├── .gitignore ├── .pubignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── catalog-info.yaml ├── example └── lib │ └── main.dart ├── ios └── Resources │ └── PrivacyInfo.xcprivacy ├── lib ├── sendbird_chat_sdk.dart └── src │ ├── internal │ ├── db │ │ ├── db.dart │ │ └── schema │ │ │ ├── channel │ │ │ ├── c_base_channel.dart │ │ │ ├── c_feed_channel.dart │ │ │ ├── c_feed_channel.g.dart │ │ │ ├── c_group_channel.dart │ │ │ ├── c_group_channel.g.dart │ │ │ └── meta │ │ │ │ ├── c_channel_info.dart │ │ │ │ ├── c_channel_info.g.dart │ │ │ │ └── channel_info.dart │ │ │ ├── chunk │ │ │ ├── base_chunk.dart │ │ │ ├── c_base_chunk.dart │ │ │ ├── c_base_chunk.g.dart │ │ │ ├── c_channel_chunk.dart │ │ │ ├── c_channel_chunk.g.dart │ │ │ ├── c_message_chunk.dart │ │ │ ├── c_message_chunk.g.dart │ │ │ ├── channel_chunk.dart │ │ │ ├── chunk.dart │ │ │ └── message_chunk.dart │ │ │ ├── login │ │ │ ├── c_login.dart │ │ │ ├── c_login.g.dart │ │ │ └── login.dart │ │ │ ├── message │ │ │ ├── c_admin_message.dart │ │ │ ├── c_admin_message.g.dart │ │ │ ├── c_base_message.dart │ │ │ ├── c_base_message.g.dart │ │ │ ├── c_file_message.dart │ │ │ ├── c_file_message.g.dart │ │ │ ├── c_notification_message.dart │ │ │ ├── c_notification_message.g.dart │ │ │ ├── c_root_message.dart │ │ │ ├── c_root_message.g.dart │ │ │ ├── c_user_message.dart │ │ │ ├── c_user_message.g.dart │ │ │ └── meta │ │ │ │ ├── c_channel_access.dart │ │ │ │ ├── c_channel_access.g.dart │ │ │ │ ├── c_channel_message.dart │ │ │ │ ├── c_channel_message.g.dart │ │ │ │ ├── c_message_changelog_info.dart │ │ │ │ ├── c_message_changelog_info.g.dart │ │ │ │ ├── channel_access.dart │ │ │ │ ├── channel_message.dart │ │ │ │ └── message_changelog_info.dart │ │ │ └── user │ │ │ ├── c_member.dart │ │ │ ├── c_member.g.dart │ │ │ ├── c_sender.dart │ │ │ ├── c_sender.g.dart │ │ │ ├── c_user.dart │ │ │ └── c_user.g.dart │ ├── main │ │ ├── chat │ │ │ ├── chat.dart │ │ │ ├── chat_auth.dart │ │ │ ├── chat_caching.dart │ │ │ ├── chat_channel.dart │ │ │ ├── chat_connection.dart │ │ │ ├── chat_emoji.dart │ │ │ ├── chat_event_handler.dart │ │ │ ├── chat_notifications.dart │ │ │ ├── chat_push.dart │ │ │ └── chat_user.dart │ │ ├── chat_cache │ │ │ ├── cache_service.dart │ │ │ ├── channel │ │ │ │ ├── channel_cache.dart │ │ │ │ ├── channel_cache_extensions.dart │ │ │ │ ├── channel_cache_unit.dart │ │ │ │ └── meta_data_cache.dart │ │ │ └── policy.dart │ │ ├── chat_context │ │ │ └── chat_context.dart │ │ ├── chat_manager │ │ │ ├── collection_manager │ │ │ │ ├── auto_resend_manager.dart │ │ │ │ ├── collection_manager.dart │ │ │ │ ├── group_channel_collection_manager.dart │ │ │ │ ├── message_collection_manager.dart │ │ │ │ └── message_retention_manager.dart │ │ │ ├── command_manager.dart │ │ │ ├── connection_manager.dart │ │ │ ├── db_manager.dart │ │ │ ├── device_token_manager.dart │ │ │ ├── event_dispatcher.dart │ │ │ ├── event_manager.dart │ │ │ └── session_manager.dart │ │ ├── connection_state │ │ │ ├── base_connection_state.dart │ │ │ ├── connected_state.dart │ │ │ ├── connecting_state.dart │ │ │ ├── disconnected_state.dart │ │ │ └── reconnecting_state.dart │ │ ├── extensions │ │ │ ├── base_message_extensions.dart │ │ │ ├── extensions.dart │ │ │ └── group_channel_extensions.dart │ │ ├── logger │ │ │ ├── logger_stack_trace.dart │ │ │ └── sendbird_logger.dart │ │ ├── model │ │ │ ├── application_settings.dart │ │ │ ├── application_settings.g.dart │ │ │ ├── delivery_status.dart │ │ │ ├── delivery_status.g.dart │ │ │ ├── group_channel_filter.dart │ │ │ ├── group_channel_filter.g.dart │ │ │ ├── read_status.dart │ │ │ ├── read_status.g.dart │ │ │ ├── reconnect_configuration.dart │ │ │ ├── reconnect_configuration.g.dart │ │ │ ├── reconnect_task.dart │ │ │ ├── typing_status.dart │ │ │ ├── unread_message_count_info.dart │ │ │ └── unread_message_count_info.g.dart │ │ ├── stats │ │ │ ├── daily_record_stat_prefs.dart │ │ │ ├── default_stat_prefs.dart │ │ │ ├── model │ │ │ │ ├── base_stat.dart │ │ │ │ ├── daily_record │ │ │ │ │ ├── daily_record_stat.dart │ │ │ │ │ └── local_cache_stat.dart │ │ │ │ └── default │ │ │ │ │ ├── api_result_stat.dart │ │ │ │ │ ├── default_stat.dart │ │ │ │ │ ├── local_cache_event_stat.dart │ │ │ │ │ ├── notification_stat.dart │ │ │ │ │ ├── ws_connect_stat.dart │ │ │ │ │ └── ws_disconnect_stat.dart │ │ │ ├── sendbird_statistics.dart │ │ │ ├── stat_manager.dart │ │ │ ├── stat_state.dart │ │ │ ├── stat_type.dart │ │ │ └── stat_utils.dart │ │ └── utils │ │ │ ├── async │ │ │ ├── async_queue.dart │ │ │ └── async_task.dart │ │ │ ├── enum_utils.dart │ │ │ ├── json_converter.dart │ │ │ ├── string_utils.dart │ │ │ └── type_checker.dart │ └── network │ │ ├── http │ │ ├── api_client.dart │ │ └── http_client │ │ │ ├── http_client.dart │ │ │ ├── request │ │ │ ├── api_request.dart │ │ │ ├── channel │ │ │ │ ├── channel_meta_counter │ │ │ │ │ ├── channel_meta_counter_create_request.dart │ │ │ │ │ ├── channel_meta_counter_delete_request.dart │ │ │ │ │ ├── channel_meta_counter_get_request.dart │ │ │ │ │ └── channel_meta_counter_update_request.dart │ │ │ │ ├── channel_meta_data │ │ │ │ │ ├── channel_meta_data_create_request.dart │ │ │ │ │ ├── channel_meta_data_delete_request.dart │ │ │ │ │ ├── channel_meta_data_get_request.dart │ │ │ │ │ └── channel_meta_data_update_request.dart │ │ │ │ ├── feed_channel │ │ │ │ │ ├── feed_channel_change_logs_request.dart │ │ │ │ │ ├── feed_channel_list_request.dart │ │ │ │ │ ├── feed_channel_mark_as_read_request.dart │ │ │ │ │ └── feed_channel_refresh_request.dart │ │ │ │ ├── group_channel │ │ │ │ │ ├── group_channel_change_logs_request.dart │ │ │ │ │ ├── group_channel_create_request.dart │ │ │ │ │ ├── group_channel_delete_request.dart │ │ │ │ │ ├── group_channel_list_request.dart │ │ │ │ │ ├── group_channel_mark_as_delivered_request.dart │ │ │ │ │ ├── group_channel_mark_as_read_all_request.dart │ │ │ │ │ ├── group_channel_message_deletion_timestamp_get_request.dart │ │ │ │ │ ├── group_channel_refresh_request.dart │ │ │ │ │ ├── group_channel_update_request.dart │ │ │ │ │ ├── moderation │ │ │ │ │ │ ├── channel_my_mute_info_get_request.dart │ │ │ │ │ │ ├── channel_user_ban_request.dart │ │ │ │ │ │ ├── channel_user_mute_request.dart │ │ │ │ │ │ ├── channel_user_unban_request.dart │ │ │ │ │ │ └── channel_user_unmute_request.dart │ │ │ │ │ ├── operation │ │ │ │ │ │ ├── group_channel_accept_request.dart │ │ │ │ │ │ ├── group_channel_decline_request.dart │ │ │ │ │ │ ├── group_channel_invite_request.dart │ │ │ │ │ │ ├── group_channel_join_request.dart │ │ │ │ │ │ ├── group_channel_leave_request.dart │ │ │ │ │ │ └── group_channel_reset_history_request.dart │ │ │ │ │ ├── pinned_message │ │ │ │ │ │ ├── group_channel_pin_create_request.dart │ │ │ │ │ │ └── group_channel_pin_delete_request.dart │ │ │ │ │ ├── preference │ │ │ │ │ │ ├── group_channel_count_preference_request.dart │ │ │ │ │ │ ├── group_channel_freeze_request.dart │ │ │ │ │ │ ├── group_channel_hide_request.dart │ │ │ │ │ │ ├── group_channel_push_trigger_option_request.dart │ │ │ │ │ │ └── group_channel_screen_shot_request.dart │ │ │ │ │ ├── public │ │ │ │ │ │ └── public_group_channel_list_request.dart │ │ │ │ │ └── scheduled_message │ │ │ │ │ │ ├── group_channel_scheduled_file_message_send_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_file_message_update_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_file_upload_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_message_cancel_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_message_get_list_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_message_get_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_message_send_now_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_message_total_count_request.dart │ │ │ │ │ │ ├── group_channel_scheduled_user_message_send_request.dart │ │ │ │ │ │ └── group_channel_scheduled_user_message_update_request.dart │ │ │ │ ├── invitation │ │ │ │ │ └── channel_invitation_preference_request.dart │ │ │ │ ├── message │ │ │ │ │ ├── channel_file_message_send_request.dart │ │ │ │ │ ├── channel_file_upload_request.dart │ │ │ │ │ ├── channel_message_change_log_get_request.dart │ │ │ │ │ ├── channel_message_delete_request.dart │ │ │ │ │ ├── channel_message_get_request.dart │ │ │ │ │ ├── channel_message_translate_request.dart │ │ │ │ │ ├── channel_messages_gap_request.dart │ │ │ │ │ ├── channel_messages_get_request.dart │ │ │ │ │ ├── channel_user_message_send_request.dart │ │ │ │ │ └── channel_user_message_update_request.dart │ │ │ │ ├── open_channel │ │ │ │ │ ├── open_channel_create_request.dart │ │ │ │ │ ├── open_channel_delete_request.dart │ │ │ │ │ ├── open_channel_list_request.dart │ │ │ │ │ ├── open_channel_refresh_request.dart │ │ │ │ │ └── open_channel_update_request.dart │ │ │ │ ├── operator │ │ │ │ │ ├── channel_operator_add_request.dart │ │ │ │ │ └── channel_operator_remove_request.dart │ │ │ │ ├── reaction │ │ │ │ │ ├── channel_reaction_add_request.dart │ │ │ │ │ └── channel_reaction_remove_request.dart │ │ │ │ └── report │ │ │ │ │ ├── channel_report_request.dart │ │ │ │ │ ├── message_report_request.dart │ │ │ │ │ └── user_report_request.dart │ │ │ ├── main │ │ │ │ ├── app_session_key_update_request.dart │ │ │ │ ├── application_settings_get_request.dart │ │ │ │ ├── emoji │ │ │ │ │ ├── emoji_category_request.dart │ │ │ │ │ ├── emoji_container_request.dart │ │ │ │ │ └── emoji_request.dart │ │ │ │ ├── message_search_request.dart │ │ │ │ ├── notifications │ │ │ │ │ ├── global_notification_channel_setting_get_request.dart │ │ │ │ │ ├── notification_template_get_request.dart │ │ │ │ │ └── notification_template_list_get_request.dart │ │ │ │ ├── poll │ │ │ │ │ ├── poll_changelogs_get_request.dart │ │ │ │ │ ├── poll_close_request.dart │ │ │ │ │ ├── poll_create_request.dart │ │ │ │ │ ├── poll_delete_request.dart │ │ │ │ │ ├── poll_get_request.dart │ │ │ │ │ ├── poll_list_get_request.dart │ │ │ │ │ ├── poll_option_add_request.dart │ │ │ │ │ ├── poll_option_delete_request.dart │ │ │ │ │ ├── poll_option_get_list_voters_request.dart │ │ │ │ │ ├── poll_option_get_request.dart │ │ │ │ │ ├── poll_option_update_request.dart │ │ │ │ │ ├── poll_update_request.dart │ │ │ │ │ └── poll_vote_request.dart │ │ │ │ ├── upload_notification_stat_request.dart │ │ │ │ └── upload_stat_request.dart │ │ │ ├── multipart_request.dart │ │ │ └── user │ │ │ │ ├── auth │ │ │ │ └── authenticate_feed_request.dart │ │ │ │ ├── block │ │ │ │ ├── user_block_request.dart │ │ │ │ └── user_unblock_request.dart │ │ │ │ ├── count │ │ │ │ ├── user_group_channel_count_request.dart │ │ │ │ ├── user_unread_channel_count_request.dart │ │ │ │ ├── user_unread_item_count_request.dart │ │ │ │ └── user_unread_message_count_request.dart │ │ │ │ ├── info │ │ │ │ └── user_info_update_request.dart │ │ │ │ ├── list │ │ │ │ ├── application_user_list_request.dart │ │ │ │ ├── banned_user_list_request.dart │ │ │ │ ├── blocked_user_list_request.dart │ │ │ │ ├── group_channel_member_list_request.dart │ │ │ │ ├── muted_user_list_request.dart │ │ │ │ ├── open_channel_participant_list_request.dart │ │ │ │ ├── operator_list_request.dart │ │ │ │ └── user_list_request.dart │ │ │ │ ├── preference │ │ │ │ ├── user_do_not_disturb_request.dart │ │ │ │ ├── user_push_sound_request.dart │ │ │ │ ├── user_push_template_request.dart │ │ │ │ ├── user_push_trigger_option_request.dart │ │ │ │ └── user_snooze_request.dart │ │ │ │ ├── push │ │ │ │ ├── user_push_register_request.dart │ │ │ │ └── user_push_unregister_request.dart │ │ │ │ └── user_meta_data │ │ │ │ ├── user_meta_data_create_request.dart │ │ │ │ ├── user_meta_data_delete_request.dart │ │ │ │ └── user_meta_data_update_request.dart │ │ │ └── response │ │ │ ├── responses.dart │ │ │ └── responses.g.dart │ │ └── websocket │ │ ├── command │ │ ├── command.dart │ │ ├── command.g.dart │ │ └── command_type.dart │ │ ├── event │ │ ├── base_event.dart │ │ ├── channel_event.dart │ │ ├── channel_event.g.dart │ │ ├── login_event.dart │ │ ├── login_event.g.dart │ │ ├── mcnt_event.dart │ │ ├── mcnt_event.g.dart │ │ ├── message_event.dart │ │ ├── message_event.g.dart │ │ ├── session_event.dart │ │ ├── session_event.g.dart │ │ ├── user_event.dart │ │ └── user_event.g.dart │ │ └── websocket_client.dart │ └── public │ ├── core │ ├── channel │ │ ├── base_channel │ │ │ ├── base_channel.dart │ │ │ ├── base_channel_message.dart │ │ │ ├── base_channel_message_meta_array.dart │ │ │ ├── base_channel_meta_counters.dart │ │ │ ├── base_channel_meta_data.dart │ │ │ ├── base_channel_moderation.dart │ │ │ ├── base_channel_operator.dart │ │ │ └── base_channel_reaction.dart │ │ ├── feed_channel │ │ │ └── feed_channel.dart │ │ ├── group_channel │ │ │ ├── group_channel.dart │ │ │ ├── group_channel.g.dart │ │ │ ├── group_channel_configuration.dart │ │ │ ├── group_channel_operation.dart │ │ │ ├── group_channel_pinned_message.dart │ │ │ ├── group_channel_poll.dart │ │ │ ├── group_channel_read.dart │ │ │ ├── group_channel_scheduled_message.dart │ │ │ └── group_channel_typing.dart │ │ └── open_channel │ │ │ ├── open_channel.dart │ │ │ ├── open_channel.g.dart │ │ │ └── open_channel_operation.dart │ ├── message │ │ ├── admin_message.dart │ │ ├── admin_message.g.dart │ │ ├── base_message.dart │ │ ├── file_message.dart │ │ ├── file_message.g.dart │ │ ├── notification_message.dart │ │ ├── notification_message.g.dart │ │ ├── root_message.dart │ │ ├── user_message.dart │ │ └── user_message.g.dart │ └── user │ │ ├── member.dart │ │ ├── member.g.dart │ │ ├── restricted_user.dart │ │ ├── restricted_user.g.dart │ │ ├── sender.dart │ │ ├── sender.g.dart │ │ ├── user.dart │ │ └── user.g.dart │ └── main │ ├── chat │ ├── sendbird_chat.dart │ └── sendbird_chat_options.dart │ ├── collection │ ├── collection_event_source.dart │ ├── group_channel_collection │ │ ├── base_channel_context.dart │ │ ├── feed_channel_context.dart │ │ ├── group_channel_collection.dart │ │ ├── group_channel_collection_handler.dart │ │ └── group_channel_context.dart │ └── group_channel_message_collection │ │ ├── base_message_collection.dart │ │ ├── base_message_collection_handler.dart │ │ ├── base_message_context.dart │ │ ├── message_collection.dart │ │ ├── message_collection_handler.dart │ │ ├── message_context.dart │ │ ├── notification_collection.dart │ │ ├── notification_collection_handler.dart │ │ └── notification_context.dart │ ├── define │ ├── enums.dart │ ├── exceptions.dart │ └── sendbird_error.dart │ ├── handler │ ├── channel_handler.dart │ ├── connection_handler.dart │ ├── session_handler.dart │ └── user_event_handler.dart │ ├── model │ ├── channel │ │ ├── feed_channel_change_logs.dart │ │ ├── feed_channel_change_logs.g.dart │ │ ├── group_channel_change_logs.dart │ │ ├── group_channel_change_logs.g.dart │ │ ├── group_channel_unread_item_count.dart │ │ ├── group_channel_unread_item_count.g.dart │ │ └── notification_category.dart │ ├── chat │ │ ├── do_not_disturb.dart │ │ ├── do_not_disturb.g.dart │ │ ├── emoji.dart │ │ ├── emoji.g.dart │ │ ├── global_notification_channel_setting.dart │ │ ├── notification_template.dart │ │ ├── notification_template_list.dart │ │ ├── snooze_period.dart │ │ └── snooze_period.g.dart │ ├── info │ │ ├── app_info.dart │ │ ├── app_info.g.dart │ │ ├── file_info.dart │ │ ├── file_info.g.dart │ │ ├── mute_info.dart │ │ ├── mute_info.g.dart │ │ ├── notification_info.dart │ │ ├── notification_info.g.dart │ │ ├── scheduled_info.dart │ │ └── scheduled_info.g.dart │ ├── message │ │ ├── apple_critical_alert_options.dart │ │ ├── apple_critical_alert_options.g.dart │ │ ├── message_change_logs.dart │ │ ├── message_change_logs.g.dart │ │ ├── message_meta_array.dart │ │ ├── message_meta_array.g.dart │ │ ├── notification_data.dart │ │ └── unread_message_count.dart │ ├── og │ │ ├── og_image.dart │ │ ├── og_image.g.dart │ │ ├── og_meta_data.dart │ │ └── og_meta_data.g.dart │ ├── poll │ │ ├── poll.dart │ │ ├── poll.g.dart │ │ ├── poll_change_logs.dart │ │ ├── poll_change_logs.g.dart │ │ ├── poll_data.dart │ │ ├── poll_data.g.dart │ │ ├── poll_option.dart │ │ ├── poll_option.g.dart │ │ ├── poll_update_event.dart │ │ └── poll_vote_event.dart │ ├── reaction │ │ ├── reaction.dart │ │ ├── reaction.g.dart │ │ ├── reaction_event.dart │ │ └── reaction_event.g.dart │ └── thread │ │ ├── thread_info.dart │ │ ├── thread_info.g.dart │ │ ├── thread_info_updated_event.dart │ │ ├── thread_info_updated_event.g.dart │ │ └── threaded_messages.dart │ ├── params │ ├── channel │ │ ├── feed_channel_change_logs_params.dart │ │ ├── group_channel_change_logs_params.dart │ │ ├── group_channel_create_params.dart │ │ ├── group_channel_create_params.g.dart │ │ ├── group_channel_total_unread_channel_count_params.dart │ │ ├── group_channel_total_unread_message_count_params.dart │ │ ├── group_channel_update_params.dart │ │ ├── group_channel_update_params.g.dart │ │ ├── open_channel_create_params.dart │ │ ├── open_channel_create_params.g.dart │ │ ├── open_channel_update_params.dart │ │ └── open_channel_update_params.g.dart │ ├── message │ │ ├── base_message_create_params.dart │ │ ├── base_message_fetch_params.dart │ │ ├── base_message_fetch_params.g.dart │ │ ├── base_message_update_params.dart │ │ ├── file_message_create_params.dart │ │ ├── file_message_update_params.dart │ │ ├── message_change_logs_params.dart │ │ ├── message_change_logs_params.g.dart │ │ ├── message_list_params.dart │ │ ├── message_list_params.g.dart │ │ ├── message_retrieval_params.dart │ │ ├── message_retrieval_params.g.dart │ │ ├── scheduled_file_message_create_params.dart │ │ ├── scheduled_file_message_update_params.dart │ │ ├── scheduled_file_message_update_params.g.dart │ │ ├── scheduled_message_list_query_params.dart │ │ ├── scheduled_message_retrieval_params.dart │ │ ├── scheduled_user_message_create_params.dart │ │ ├── scheduled_user_message_update_params.dart │ │ ├── scheduled_user_message_update_params.g.dart │ │ ├── threaded_message_list_params.dart │ │ ├── threaded_message_list_params.g.dart │ │ ├── total_scheduled_message_count_params.dart │ │ ├── user_message_create_params.dart │ │ └── user_message_update_params.dart │ ├── notifications │ │ └── notification_template_list_params.dart │ └── poll │ │ ├── poll_create_params.dart │ │ ├── poll_create_params.g.dart │ │ ├── poll_list_query_params.dart │ │ ├── poll_option_retrieval_params.dart │ │ ├── poll_retrieval_params.dart │ │ ├── poll_update_params.dart │ │ ├── poll_update_params.g.dart │ │ └── poll_voter_list_query_params.dart │ └── query │ ├── base_query.dart │ ├── channel │ ├── feed_channel_list_query.dart │ ├── group_channel_list_query.dart │ ├── open_channel_list_query.dart │ └── public_group_channel_list_query.dart │ ├── message │ ├── message_search_query.dart │ ├── previous_message_list_query.dart │ └── scheduled_message_list_query.dart │ ├── poll │ ├── poll_list_query.dart │ └── poll_voter_list_query.dart │ └── user │ ├── application_user_list_query.dart │ ├── banned_user_list_query.dart │ ├── blocked_user_list_query.dart │ ├── member_list_query.dart │ ├── muted_user_list_query.dart │ ├── operator_list_query.dart │ └── participant_list_query.dart └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | 32 | # Added 33 | .flutter-plugins 34 | .flutter-plugins-dependencies 35 | .vscode/ 36 | .credentials 37 | doc/ 38 | coverage/ 39 | *.info 40 | -------------------------------------------------------------------------------- /.pubignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sendbird/sendbird-chat-sdk-flutter/964a30891d3abab21c0a7a2719d0a470c163f13d/.pubignore -------------------------------------------------------------------------------- /catalog-info.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: backstage.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: sendbird-chat-sdk-flutter 5 | description: Flutter Chat SDK (for release) 6 | annotations: 7 | github.com/project-slug: sendbird/sendbird-chat-sdk-flutter 8 | spec: 9 | type: library 10 | lifecycle: production 11 | owner: dep-client-platform 12 | system: sendbird-chat 13 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:sendbird_chat_sdk/sendbird_chat_sdk.dart'; 4 | 5 | void main() async { 6 | runZonedGuarded(() async { 7 | // Initialize the SendbirdChat SDK with your Application ID. 8 | await SendbirdChat.init(appId: 'APP-ID'); 9 | 10 | // Connect to the Sendbird server with a User ID. 11 | await SendbirdChat.connect('USER-ID'); 12 | 13 | // Create a new open channel. 14 | final openChannel = 15 | await OpenChannel.createChannel(OpenChannelCreateParams()); 16 | 17 | // Enter the channel. 18 | await openChannel.enter(); 19 | 20 | // Send a message to the channel. 21 | openChannel.sendUserMessage(UserMessageCreateParams(message: 'MESSAGE')); 22 | }, (e, s) { 23 | // Handle error. 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/channel/meta/channel_info.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | class ChannelInfo { 4 | String? lastChannelToken; 5 | bool isChannelBackSyncCompleted; 6 | 7 | ChannelInfo({ 8 | this.lastChannelToken, 9 | this.isChannelBackSyncCompleted = false, 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/chunk/base_chunk.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/db/schema/chunk/chunk.dart'; 4 | 5 | class BaseChunk { 6 | List chunks; 7 | 8 | BaseChunk({ 9 | List? chunks, 10 | }) : chunks = chunks ?? []; 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/chunk/channel_chunk.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/db/schema/chunk/base_chunk.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/db/schema/chunk/c_channel_chunk.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/db/schema/chunk/chunk.dart'; 6 | 7 | class ChannelChunk extends BaseChunk { 8 | final ChannelChunkType channelChunkType; 9 | 10 | ChannelChunk({ 11 | required this.channelChunkType, 12 | List? chunks, 13 | }) { 14 | super.chunks = chunks ?? []; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/chunk/chunk.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | class Chunk { 4 | int oldestTs; 5 | int latestTs; 6 | 7 | Chunk({ 8 | required this.oldestTs, 9 | required this.latestTs, 10 | }); 11 | 12 | @override 13 | bool operator ==(other) { 14 | if (identical(other, this)) return true; 15 | 16 | return other is Chunk && 17 | other.oldestTs == oldestTs && 18 | other.latestTs == latestTs; 19 | } 20 | 21 | @override 22 | int get hashCode => Object.hash( 23 | super.hashCode, 24 | oldestTs, 25 | latestTs, 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/login/login.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat_context/chat_context.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/model/reconnect_configuration.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/model/info/app_info.dart'; 8 | 9 | class Login { 10 | final String userId; 11 | final List services; 12 | AppInfo? appInfo; 13 | final int uploadSizeLimit; 14 | int? maxUnreadCountOnSuperGroup; 15 | int? lastConnectedAt; 16 | ReconnectConfiguration? reconnectConfig; 17 | 18 | final Chat chat; 19 | 20 | Login({ 21 | required this.userId, 22 | List? services, 23 | this.appInfo, 24 | int? uploadSizeLimit, 25 | this.maxUnreadCountOnSuperGroup, 26 | this.lastConnectedAt, 27 | this.reconnectConfig, 28 | Chat? chat, 29 | }) : services = services ?? [], 30 | uploadSizeLimit = uploadSizeLimit ?? 0, 31 | chat = chat ?? SendbirdChat().chat; 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/message/meta/channel_access.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | class ChannelAccess { 4 | final String channelUrl; 5 | final int lastAccessedAt; 6 | 7 | ChannelAccess({ 8 | required this.channelUrl, 9 | required this.lastAccessedAt, 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/message/meta/channel_message.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/core/message/root_message.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 5 | 6 | class ChannelMessage { 7 | final String rootId; 8 | final MessageType messageType; 9 | final String channelUrl; 10 | final ChannelType channelType; 11 | final int createdAt; 12 | final SendingStatus sendingStatus; // sendingStatus for filtering 13 | final String? customType; // customType for filtering 14 | final String? senderId; // senderId for filtering 15 | final RootMessage message; 16 | 17 | ChannelMessage({ 18 | required this.rootId, 19 | required this.messageType, 20 | required this.channelUrl, 21 | required this.channelType, 22 | required this.createdAt, 23 | required this.sendingStatus, 24 | required this.customType, 25 | required this.senderId, 26 | required this.message, 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/message/meta/message_changelog_info.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | class MessageChangeLogInfo { 4 | final String channelUrl; 5 | String? lastMessageToken; 6 | String? lastPollToken; 7 | 8 | MessageChangeLogInfo({ 9 | required this.channelUrl, 10 | this.lastMessageToken, 11 | this.lastPollToken, 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/internal/db/schema/user/c_sender.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:isar/isar.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/db/schema/user/c_user.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/core/user/sender.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | part 'c_sender.g.dart'; 10 | 11 | @embedded 12 | class CSender { 13 | late String userId; // CUser 14 | 15 | late bool isBlockedByMe; 16 | 17 | @enumerated 18 | late Role role; 19 | 20 | CSender(); 21 | 22 | factory CSender.fromSender(Sender sender) { 23 | return CSender() 24 | // User 25 | ..userId = sender.userId 26 | // Sender 27 | ..isBlockedByMe = sender.isBlockedByMe 28 | ..role = sender.role; 29 | } 30 | 31 | Future toSender(Chat chat, Isar isar) async { 32 | final cUser = await CUser.getCUser(chat, isar, userId); 33 | if (cUser == null) return null; 34 | 35 | final sender = Sender( 36 | // User 37 | userId: cUser.userId, 38 | nickname: cUser.nickname, 39 | ) 40 | ..set(chat) 41 | // Sender 42 | ..isBlockedByMe = isBlockedByMe 43 | ..role = role; 44 | return CUser.setCUser(sender, cUser) as Sender; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/src/internal/main/chat/chat_caching.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | part of 'chat.dart'; 4 | 5 | extension ChatCaching on Chat { 6 | Future getCachedDataSize() async { 7 | return await dbManager.getDBFileSize(); 8 | } 9 | 10 | Future clearCachedData() async { 11 | await dbManager.clear(); 12 | } 13 | 14 | Future clearCachedMessages(String channelUrl) async { 15 | await dbManager.clearMessagesInChannel(channelUrl); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/internal/main/chat/chat_emoji.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | part of 'chat.dart'; 4 | 5 | extension ChatEmoji on Chat { 6 | Future getAllEmoji() async { 7 | sbLog.i(StackTrace.current); 8 | return await apiClient.send(EmojiContainerGetRequest(this)); 9 | } 10 | 11 | Future getEmoji(String key) async { 12 | sbLog.i(StackTrace.current); 13 | 14 | if (key.isEmpty) throw InvalidParameterException(); 15 | return await apiClient.send(EmojiGetRequest(this, key)); 16 | } 17 | 18 | Future getEmojiCategory(int categoryId) async { 19 | sbLog.i(StackTrace.current); 20 | 21 | if (categoryId <= 0) throw InvalidParameterException(); 22 | return await apiClient 23 | .send(EmojiCategoryGetRequest(this, categoryId)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/internal/main/chat/chat_notifications.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | part of 'chat.dart'; 4 | 5 | extension ChatNotifications on Chat { 6 | Future 7 | getGlobalNotificationChannelSetting() async { 8 | sbLog.i(StackTrace.current); 9 | return await apiClient.send( 10 | GlobalNotificationChannelSettingGetRequest(this)); 11 | } 12 | 13 | Future getNotificationTemplateListByToken( 14 | NotificationTemplateListParams params, { 15 | String? token, 16 | }) async { 17 | sbLog.i(StackTrace.current); 18 | return await apiClient 19 | .send(NotificationTemplateListGetRequest( 20 | this, 21 | params, 22 | token: token, 23 | )); 24 | } 25 | 26 | Future getNotificationTemplate({ 27 | required String key, 28 | }) async { 29 | sbLog.i(StackTrace.current); 30 | return await apiClient 31 | .send(NotificationTemplateGetRequest( 32 | this, 33 | key: key, 34 | )); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/internal/main/chat_cache/policy.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'dart:async'; 4 | 5 | abstract class EvictionPolicy {} 6 | 7 | abstract class Evictable { 8 | late EvictionPolicy policy; 9 | void evict(); 10 | } 11 | 12 | class LRUEviction implements EvictionPolicy {} 13 | 14 | class PeriodEviction implements EvictionPolicy { 15 | final int periodInSeconds; 16 | final Function evict; 17 | Timer? timer; 18 | 19 | PeriodEviction({ 20 | required this.periodInSeconds, 21 | required this.evict, 22 | }); 23 | 24 | void start() { 25 | timer?.cancel(); 26 | timer = Timer(Duration(seconds: periodInSeconds), () { 27 | evict(); 28 | }); 29 | } 30 | 31 | void stop() { 32 | timer?.cancel(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/internal/main/connection_state/base_connection_state.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/core/user/user.dart'; 5 | 6 | abstract class BaseConnectionState { 7 | final Chat chat; 8 | 9 | BaseConnectionState({required this.chat}); 10 | 11 | Future connect( 12 | String userId, { 13 | String? nickname, 14 | String? accessToken, 15 | String? apiHost, 16 | String? wsHost, 17 | }); 18 | Future disconnect({required bool logout}); 19 | Future reconnect({required bool reset}); 20 | 21 | Future enterBackground(); 22 | Future enterForeground(); 23 | 24 | @override 25 | bool operator ==(covariant BaseConnectionState other) { 26 | if (runtimeType.toString() == other.runtimeType.toString()) { 27 | return true; 28 | } 29 | return false; 30 | } 31 | 32 | @override 33 | int get hashCode => Object.hash( 34 | runtimeType.toString(), 35 | runtimeType.toString(), 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/main/extensions/base_message_extensions.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | part of 'package:sendbird_chat_sdk/src/public/core/message/base_message.dart'; 4 | 5 | extension BaseMessageExtensions on BaseMessage { 6 | bool hasUpdatedLaterThan(int timestamp) { 7 | return createdAt > timestamp && updatedAt > timestamp; 8 | } 9 | 10 | bool mentioned({User? user, User? byOtherUser}) { 11 | if (user == null || byOtherUser == null) { 12 | return false; 13 | } 14 | 15 | if (mentionType == MentionType.users) { 16 | return _containsMentionedUser(user) && byOtherUser.userId != user.userId; 17 | } else if (mentionType == MentionType.channel) { 18 | return byOtherUser.userId != user.userId; 19 | } 20 | return false; 21 | } 22 | 23 | bool _containsMentionedUser(User? user) { 24 | if (user == null || mentionedUsers.isEmpty) { 25 | return false; 26 | } 27 | 28 | return mentionedUsers 29 | .where((element) => element.userId == user.userId) 30 | .toList() 31 | .isNotEmpty; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/application_settings.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'application_settings.g.dart'; 6 | 7 | @JsonSerializable(createToJson: false) 8 | class ApplicationSettings { 9 | Map configs; 10 | bool hasMore; 11 | String? next; 12 | int? ts; 13 | 14 | ApplicationSettings({ 15 | required this.configs, 16 | required this.hasMore, 17 | this.next, 18 | this.ts, 19 | }); 20 | 21 | static ApplicationSettings fromJson(Map json) => 22 | _$ApplicationSettingsFromJson(json); 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/application_settings.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'application_settings.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ApplicationSettings _$ApplicationSettingsFromJson(Map json) => 10 | ApplicationSettings( 11 | configs: json['configs'] as Map, 12 | hasMore: json['has_more'] as bool, 13 | next: json['next'] as String?, 14 | ts: (json['ts'] as num?)?.toInt(), 15 | ); 16 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/delivery_status.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat_cache/cache_service.dart'; 5 | 6 | part 'delivery_status.g.dart'; 7 | 8 | @JsonSerializable(createToJson: false) 9 | class DeliveryStatus implements Cacheable { 10 | final String channelUrl; 11 | 12 | @JsonKey(name: 'updated') 13 | Map updatedDeliveryStatus; 14 | 15 | @JsonKey(includeFromJson: false, includeToJson: false) 16 | @override 17 | bool dirty = false; 18 | 19 | DeliveryStatus({ 20 | required this.channelUrl, 21 | this.updatedDeliveryStatus = const {}, 22 | }); 23 | 24 | factory DeliveryStatus.fromJson(Map json) => 25 | _$DeliveryStatusFromJson(json); 26 | 27 | @override 28 | String get key => 'delivery/$channelUrl'; 29 | 30 | @override 31 | String get primaryKey => channelUrl; 32 | 33 | @override 34 | void copyWith(dynamic other) { 35 | if (other is DeliveryStatus) { 36 | updatedDeliveryStatus.addAll(other.updatedDeliveryStatus); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/delivery_status.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'delivery_status.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DeliveryStatus _$DeliveryStatusFromJson(Map json) => 10 | DeliveryStatus( 11 | channelUrl: json['channel_url'] as String, 12 | updatedDeliveryStatus: (json['updated'] as Map?)?.map( 13 | (k, e) => MapEntry(k, (e as num).toInt()), 14 | ) ?? 15 | const {}, 16 | ); 17 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/read_status.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'read_status.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ReadStatus _$ReadStatusFromJson(Map json) => ReadStatus( 10 | userId: userToUserId(json['user'] as Map?), 11 | timestamp: (json['ts'] as num?)?.toInt() ?? 0, 12 | channelUrl: json['channel_url'] as String, 13 | channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), 14 | ); 15 | 16 | const _$ChannelTypeEnumMap = { 17 | ChannelType.group: 'group', 18 | ChannelType.open: 'open', 19 | ChannelType.feed: 'feed', 20 | }; 21 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/reconnect_configuration.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'reconnect_configuration.g.dart'; 6 | 7 | @JsonSerializable() 8 | class ReconnectConfiguration { 9 | @JsonKey(name: 'interval') 10 | double interval; 11 | 12 | @JsonKey(name: 'max_interval') 13 | double maxInterval; 14 | 15 | @JsonKey(name: 'mul') 16 | int multiplier; 17 | 18 | @JsonKey(name: 'retry_cnt') 19 | int maximumRetryCount; 20 | 21 | bool get enabledInfinitelyRetry => maximumRetryCount < 0; 22 | 23 | ReconnectConfiguration({ 24 | required this.interval, 25 | required this.maxInterval, 26 | required this.multiplier, 27 | required this.maximumRetryCount, 28 | }); 29 | 30 | factory ReconnectConfiguration.fromJson(Map json) => 31 | _$ReconnectConfigurationFromJson(json); 32 | Map toJson() => _$ReconnectConfigurationToJson(this); 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/reconnect_configuration.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'reconnect_configuration.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ReconnectConfiguration _$ReconnectConfigurationFromJson( 10 | Map json) => 11 | ReconnectConfiguration( 12 | interval: (json['interval'] as num).toDouble(), 13 | maxInterval: (json['max_interval'] as num).toDouble(), 14 | multiplier: (json['mul'] as num).toInt(), 15 | maximumRetryCount: (json['retry_cnt'] as num).toInt(), 16 | ); 17 | 18 | Map _$ReconnectConfigurationToJson( 19 | ReconnectConfiguration instance) => 20 | { 21 | 'interval': instance.interval, 22 | 'max_interval': instance.maxInterval, 23 | 'mul': instance.multiplier, 24 | 'retry_cnt': instance.maximumRetryCount, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/reconnect_task.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'dart:math'; 4 | 5 | import 'package:sendbird_chat_sdk/src/internal/main/model/reconnect_configuration.dart'; 6 | 7 | class ReconnectTask { 8 | int _backOffPeriod = 0; 9 | int _retryCount = 1; 10 | ReconnectConfiguration config; 11 | 12 | ReconnectTask(this.config); 13 | 14 | int get backOffPeriod => _backOffPeriod; 15 | int get retryCount => _retryCount; 16 | 17 | bool get exceedRetryCount { 18 | if (config.enabledInfinitelyRetry) return false; 19 | return _retryCount >= config.maximumRetryCount; 20 | } 21 | 22 | bool get hasRetriedLastChance { 23 | if (config.enabledInfinitelyRetry) return false; 24 | if (config.maximumRetryCount == 0 && _retryCount == 0) return false; 25 | return _retryCount == config.maximumRetryCount; 26 | } 27 | 28 | void increaseRetryCount() { 29 | if (_backOffPeriod < config.maxInterval) { 30 | final newBackOff = 31 | config.interval * pow(config.multiplier, (_retryCount - 1)); 32 | _backOffPeriod = min(newBackOff.toInt(), config.maxInterval.toInt()); 33 | } 34 | _retryCount++; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/unread_message_count_info.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'unread_message_count_info.g.dart'; 6 | 7 | @JsonSerializable(createToJson: false) 8 | class UnreadMessageCountInfo { 9 | int all; 10 | int feed; 11 | Map customTypes; 12 | int ts; 13 | 14 | UnreadMessageCountInfo({ 15 | this.all = 0, 16 | this.feed = 0, 17 | this.customTypes = const {}, 18 | this.ts = 0, 19 | }); 20 | 21 | bool copyWith(UnreadMessageCountInfo others) { 22 | var didChange = false; 23 | 24 | if (all != others.all) { 25 | didChange = true; 26 | all = others.all; 27 | } 28 | 29 | if (feed != others.feed) { 30 | didChange = true; 31 | feed = others.feed; 32 | } 33 | 34 | others.customTypes.forEach((key, value) { 35 | final currValue = customTypes[key]; 36 | if (currValue != value) { 37 | didChange = true; 38 | customTypes[key] = value; 39 | } 40 | }); 41 | 42 | ts = others.ts; 43 | return didChange; 44 | } 45 | 46 | static UnreadMessageCountInfo fromJson(Map json) => 47 | _$UnreadMessageCountInfoFromJson(json); 48 | } 49 | -------------------------------------------------------------------------------- /lib/src/internal/main/model/unread_message_count_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'unread_message_count_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | UnreadMessageCountInfo _$UnreadMessageCountInfoFromJson( 10 | Map json) => 11 | UnreadMessageCountInfo( 12 | all: (json['all'] as num?)?.toInt() ?? 0, 13 | feed: (json['feed'] as num?)?.toInt() ?? 0, 14 | customTypes: (json['custom_types'] as Map?)?.map( 15 | (k, e) => MapEntry(k, (e as num).toInt()), 16 | ) ?? 17 | const {}, 18 | ts: (json['ts'] as num?)?.toInt() ?? 0, 19 | ); 20 | -------------------------------------------------------------------------------- /lib/src/internal/main/stats/model/base_stat.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_type.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_utils.dart'; 5 | 6 | class BaseStat { 7 | final StatType type; 8 | final int ts; 9 | 10 | BaseStat(this.type, this.ts); 11 | 12 | Map toJson() { 13 | final result = { 14 | 'stat_type': StatUtils.getStatTypeString(type), 15 | 'ts': ts, 16 | }; 17 | return result; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/internal/main/stats/model/daily_record/daily_record_stat.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/stats/model/base_stat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_type.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_utils.dart'; 6 | 7 | abstract class DailyRecordStat extends BaseStat { 8 | DailyRecordStat(StatType type, int ts) : super(type, ts); 9 | 10 | void update(DailyRecordStat stat); 11 | 12 | static const keyPrefix = 'daily_record'; 13 | 14 | String get key => 15 | '${keyPrefix}_${getDateString(ts)}_${StatUtils.getStatTypeString(type)}'; 16 | 17 | static String getDateString(int ts) { 18 | String dateString; 19 | try { 20 | final date = DateTime.fromMillisecondsSinceEpoch(ts); 21 | String year = date.year.toString(); 22 | String month = date.month.toString(); 23 | String day = date.day.toString(); 24 | 25 | if (month.length == 1) month = '0$month'; 26 | if (day.length == 1) day = '0$day'; 27 | 28 | dateString = '$year$month$day'; 29 | } catch (_) { 30 | dateString = ''; 31 | } 32 | return dateString; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/internal/main/stats/model/default/default_stat.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/stats/model/base_stat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_type.dart'; 5 | 6 | class DefaultStat extends BaseStat { 7 | DefaultStat(StatType type, int ts) : super(type, ts); 8 | } 9 | -------------------------------------------------------------------------------- /lib/src/internal/main/stats/sendbird_statistics.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/logger/sendbird_logger.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 6 | 7 | // For internal use only. 8 | class SendbirdStatistics { 9 | static const String apiResultType = 'api:result'; 10 | static const String wsConnectType = 'ws:connect'; 11 | static const String wsDisconnectType = 'ws:disconnect'; 12 | static const String featureLocalCacheType = 'feature:local_cache'; 13 | static const String featureLocalCacheEventType = 'feature:local_cache_event'; 14 | static const String notiStatsType = 'noti:stats'; 15 | 16 | static Future appendStat({ 17 | required String type, 18 | required Map data, 19 | Chat? chat, 20 | }) async { 21 | sbLog.i(StackTrace.current, 'type: $type'); 22 | return await (chat ?? SendbirdChat().chat) 23 | .statManager 24 | .appendStat(type: type, data: data); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/main/stats/stat_state.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | enum StatState { 4 | pending, // StatCollector's state isn't determined because it haven't received LOGI command. 5 | enabled, // StatCollector is able to collect and upload stats. 6 | collectOnly, // StatCollector is able to collect but is not able to upload stats. 7 | disabled, // StatCollector is not able to collect and upload stats. 8 | } 9 | -------------------------------------------------------------------------------- /lib/src/internal/main/stats/stat_type.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | enum StatType { 4 | apiResult, 5 | wsConnect, 6 | wsDisconnect, 7 | featureLocalCache, 8 | featureLocalCacheEvent, 9 | notificationStats, 10 | } 11 | -------------------------------------------------------------------------------- /lib/src/internal/main/utils/async/async_task.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | abstract class Operation { 4 | Function()? onCancel; 5 | } 6 | 7 | class AsyncSimpleTask implements Operation { 8 | @override 9 | Function()? onCancel; 10 | Future Function() func; 11 | 12 | AsyncSimpleTask(this.func, {this.onCancel}); 13 | } 14 | 15 | class AsyncTask implements Operation { 16 | @override 17 | Function()? onCancel; 18 | Future Function(T) func; 19 | T arg; 20 | 21 | AsyncTask({ 22 | required this.func, 23 | required this.arg, 24 | this.onCancel, 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/main/utils/string_utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'dart:math'; 4 | 5 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 6 | 7 | const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890'; 8 | final _random = Random(); 9 | 10 | String getRandomString(int length) { 11 | return String.fromCharCodes(Iterable.generate( 12 | length, (_) => _chars.codeUnitAt(_random.nextInt(_chars.length)))); 13 | } 14 | 15 | String getFileExtension(String fileName) { 16 | return ".${fileName.split('.').last}"; 17 | } 18 | 19 | String getUrlEncodedUserId(Chat chat, String? userId) { 20 | return Uri.encodeComponent(userId ?? chat.chatContext.currentUserId ?? ''); 21 | } 22 | 23 | List getUrlEncodedUserIds(Chat chat, List userIds) { 24 | return userIds.map((userId) => Uri.encodeComponent(userId)).toList(); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/internal/main/utils/type_checker.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | class TypeChecker { 4 | static String? fromJsonToNullableString(dynamic json) { 5 | return json is String ? json : null; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/api_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'dart:async'; 4 | 5 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/core/channel/base_channel/base_channel.dart'; 8 | 9 | abstract class ApiRequest { 10 | final String version = 'v3'; 11 | 12 | // requires 13 | HttpMethod method = HttpMethod.get; 14 | String url = ''; 15 | 16 | // optional 17 | Map queryParams = {}; 18 | Map body = {}; 19 | Map headers = {}; 20 | ProgressHandler? progressHandler; 21 | bool isMultipart = false; 22 | bool isAuthenticateFeed = false; 23 | 24 | final Chat chat; 25 | String? userId; 26 | String? apiToken; 27 | 28 | ApiRequest({ 29 | required this.chat, 30 | this.userId, 31 | this.apiToken, 32 | }) { 33 | userId ??= chat.chatContext.currentUserId; 34 | } 35 | 36 | Future response(Map res) async {} 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_counter/channel_meta_counter_create_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelMetaCounterCreateRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | ChannelMetaCounterCreateRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required Map metaCounter, 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/metacounter'; 20 | body = {'metacounter': metaCounter}; 21 | } 22 | 23 | @override 24 | Future> response(Map res) async { 25 | return Map.from(res); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_counter/channel_meta_counter_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelMetaCounterDeleteRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.delete; 12 | 13 | ChannelMetaCounterDeleteRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required String key, 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/metacounter/$key'; 20 | } 21 | } 22 | 23 | class ChannelMetaCounterDeleteAllRequest extends ApiRequest { 24 | @override 25 | HttpMethod get method => HttpMethod.delete; 26 | 27 | ChannelMetaCounterDeleteAllRequest( 28 | Chat chat, { 29 | required ChannelType channelType, 30 | required String channelUrl, 31 | }) : super(chat: chat) { 32 | url = '${channelType.urlString}/$channelUrl/metacounter'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_counter/channel_meta_counter_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelMetaCounterGetRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.get; 12 | 13 | ChannelMetaCounterGetRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | List keys = const [], 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/metacounter'; 20 | queryParams = {'include_ts': true}; 21 | if (keys.isNotEmpty) { 22 | queryParams['keys'] = keys; 23 | } 24 | } 25 | 26 | @override 27 | Future> response(Map res) async { 28 | return Map.from(res); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_counter/channel_meta_counter_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/core/channel/base_channel/base_channel.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 9 | 10 | class ChannelMetaCounterUpdateRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.put; 13 | 14 | ChannelMetaCounterUpdateRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required Map metaCounter, 19 | required UpdateMetaCounterMode mode, 20 | bool upsert = true, 21 | }) : super(chat: chat) { 22 | url = '${channelType.urlString}/$channelUrl/metacounter'; 23 | body = { 24 | 'metacounter': metaCounter, 25 | 'upsert': upsert, 26 | 'mode': mode.asString() 27 | }; 28 | } 29 | 30 | @override 31 | Future> response(Map res) async { 32 | return Map.from(res); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_data/channel_meta_data_create_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 9 | 10 | class ChannelMetaDataCreateRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.post; 13 | 14 | ChannelMetaDataCreateRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required Map metaData, 19 | String? userId, 20 | }) : super(chat: chat, userId: userId) { 21 | url = '${channelType.urlString}/$channelUrl/metadata'; 22 | body = {'metadata': metaData, 'upsert': true}; 23 | queryParams = {'include_ts': true}; 24 | } 25 | 26 | @override 27 | Future response(Map res) async { 28 | return MetaDataResponse.fromJson(res); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_data/channel_meta_data_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 9 | 10 | class ChannelMetaDataGetRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | ChannelMetaDataGetRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | List keys = const [], 19 | }) : super(chat: chat) { 20 | url = '${channelType.urlString}/$channelUrl/metadata'; 21 | queryParams = {'include_ts': true}; 22 | if (keys.isNotEmpty) { 23 | queryParams['keys'] = keys; 24 | } 25 | } 26 | 27 | @override 28 | Future response(Map res) async { 29 | return MetaDataResponse.fromJson(res); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/channel_meta_data/channel_meta_data_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 9 | 10 | class ChannelMetaDataUpdateRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.put; 13 | 14 | ChannelMetaDataUpdateRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required Map metaData, 19 | bool upsert = true, 20 | }) : super(chat: chat) { 21 | url = '${channelType.urlString}/$channelUrl/metadata'; 22 | body = {'metadata': metaData, 'upsert': upsert}; 23 | queryParams = {'include_ts': true}; 24 | } 25 | 26 | @override 27 | Future response(Map res) async { 28 | return MetaDataResponse.fromJson(res); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/feed_channel/feed_channel_mark_as_read_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class FeedChannelMarkAsReadRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | FeedChannelMarkAsReadRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | int? timestamp, 15 | List? messageIds, 16 | String? userId, 17 | }) : super(chat: chat, userId: userId) { 18 | url = 'group_channels/$channelUrl/messages/mark_as_read'; 19 | body = { 20 | 'channel_url': channelUrl, 21 | }; 22 | 23 | if (timestamp != null) { 24 | body['timestamp'] = timestamp; 25 | } 26 | 27 | if (messageIds != null && messageIds.isNotEmpty) { 28 | body['message_ids'] = messageIds; 29 | } 30 | } 31 | 32 | @override 33 | Future> response(Map res) async { 34 | return res; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/feed_channel/feed_channel_refresh_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat_cache/cache_service.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/core/channel/feed_channel/feed_channel.dart'; 9 | 10 | class FeedChannelRefreshRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | FeedChannelRefreshRequest( 15 | Chat chat, 16 | String channelUrl, { 17 | List options = const [], 18 | bool passive = false, 19 | }) : super(chat: chat) { 20 | url = '${passive ? 'sdk/' : ''}group_channels/$channelUrl'; 21 | queryParams = options.toJson(); 22 | queryParams['is_feed_channel'] = true; 23 | } 24 | 25 | @override 26 | Future response(Map res) async { 27 | final channel = FeedChannel.fromJsonWithChat(chat, res)..set(chat); 28 | channel.saveToCache( 29 | chat, 30 | channel: channel, 31 | res: res, 32 | ); 33 | return channel; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/group_channel_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelDeleteRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.delete; 10 | 11 | GroupChannelDeleteRequest( 12 | Chat chat, 13 | String channelUrl, 14 | ) : super(chat: chat) { 15 | url = 'group_channels/$channelUrl'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/group_channel_mark_as_delivered_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelMarkAsDeliveredRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelMarkAsDeliveredRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | required String userId, 15 | required int timestamp, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'group_channels/$channelUrl/messages/mark_as_delivered'; 18 | body = {'user_id': userId, 'ts': timestamp}; 19 | } 20 | 21 | @override 22 | Future response(Map res) async { 23 | return res['ts']; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/group_channel_mark_as_read_all_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class GroupChannelMarkAsReadAllRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.put; 11 | 12 | GroupChannelMarkAsReadAllRequest( 13 | Chat chat, { 14 | List? channelUrls, 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'users/${getUrlEncodedUserId(chat, userId)}/mark_as_read_all'; 18 | body = { 19 | if (channelUrls != null && channelUrls.isNotEmpty) 20 | 'channel_urls': channelUrls, 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/group_channel_message_deletion_timestamp_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelMessageDeletionTimestampGetRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.get; 10 | 11 | GroupChannelMessageDeletionTimestampGetRequest( 12 | Chat chat, 13 | String channelUrl, 14 | ) : super(chat: chat) { 15 | url = 'group_channels/$channelUrl/message_purge_offset'; 16 | } 17 | 18 | @override 19 | Future response(Map res) async { 20 | final messagePurgeOffset = res['message_purge_offset']; 21 | if (messagePurgeOffset != null && messagePurgeOffset is int) { 22 | return messagePurgeOffset; 23 | } 24 | return null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/group_channel_refresh_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat_cache/cache_service.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart'; 9 | 10 | class GroupChannelRefreshRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | GroupChannelRefreshRequest( 15 | Chat chat, 16 | String channelUrl, { 17 | List options = const [], 18 | bool passive = false, 19 | }) : super(chat: chat) { 20 | url = '${passive ? 'sdk/' : ''}group_channels/$channelUrl'; 21 | queryParams = options.toJson(); 22 | } 23 | 24 | @override 25 | Future response(Map res) async { 26 | final channel = GroupChannel.fromJsonWithChat(chat, res); 27 | channel.saveToCache( 28 | chat, 29 | channel: channel, 30 | res: res, 31 | ); 32 | return channel; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/moderation/channel_my_mute_info_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 9 | import 'package:sendbird_chat_sdk/src/public/main/model/info/mute_info.dart'; 10 | 11 | class ChannelMyMuteInfoGetRequest extends ApiRequest { 12 | @override 13 | HttpMethod get method => HttpMethod.get; 14 | 15 | ChannelMyMuteInfoGetRequest( 16 | Chat chat, { 17 | required ChannelType channelType, 18 | required String channelUrl, 19 | String? userId, 20 | }) : super(chat: chat, userId: userId) { 21 | url = 22 | '${channelType.urlString}/$channelUrl/mute/${getUrlEncodedUserId(chat, userId)}'; 23 | } 24 | 25 | @override 26 | Future response(Map res) async { 27 | return MuteInfo.fromJson(res); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/moderation/channel_user_ban_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelUserBanRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | ChannelUserBanRequest( 14 | Chat chat, { 15 | required String targetId, 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | String? description, 19 | int seconds = -1, 20 | }) : super(chat: chat) { 21 | url = '${channelType.urlString}/$channelUrl/ban'; 22 | body = { 23 | 'user_id': targetId, 24 | 'seconds': seconds, 25 | if (description != null) 'description': description, 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/moderation/channel_user_mute_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelUserMuteRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | ChannelUserMuteRequest( 14 | Chat chat, { 15 | required String targetId, 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | String? description, 19 | int seconds = -1, 20 | }) : super(chat: chat) { 21 | url = '${channelType.urlString}/$channelUrl/mute'; 22 | body = { 23 | 'user_id': targetId, 24 | 'seconds': seconds, 25 | if (description != null) 'description': description, 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/moderation/channel_user_unban_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 9 | 10 | class ChannelUserUnbanRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.delete; 13 | 14 | ChannelUserUnbanRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required String targetId, 19 | }) : super(chat: chat) { 20 | url = 21 | '${channelType.urlString}/$channelUrl/ban/${getUrlEncodedUserId(chat, targetId)}'; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/moderation/channel_user_unmute_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 9 | 10 | class ChannelUserUnmuteRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.delete; 13 | 14 | ChannelUserUnmuteRequest( 15 | Chat chat, { 16 | required String targetId, 17 | required ChannelType channelType, 18 | required String channelUrl, 19 | }) : super(chat: chat) { 20 | url = 21 | '${channelType.urlString}/$channelUrl/mute/${getUrlEncodedUserId(chat, targetId)}'; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/operation/group_channel_accept_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelInvitationAcceptRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelInvitationAcceptRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | String? accessCode, 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'group_channels/$channelUrl/accept'; 18 | body = { 19 | if (accessCode != null) 'access_code': accessCode, 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/operation/group_channel_decline_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelInvitationDeclineRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelInvitationDeclineRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | String? userId, 15 | }) : super(chat: chat, userId: userId) { 16 | url = 'group_channels/$channelUrl/decline'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/operation/group_channel_invite_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat_cache/cache_service.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart'; 8 | 9 | class GroupChannelInviteRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | GroupChannelInviteRequest( 14 | Chat chat, { 15 | required String channelUrl, 16 | required List userIds, 17 | String? inviterId, 18 | }) : super(chat: chat) { 19 | url = 'group_channels/$channelUrl/invite'; 20 | body = { 21 | 'inviter_id': inviterId ?? chat.chatContext.currentUserId, 22 | 'user_ids': userIds, 23 | }; 24 | } 25 | 26 | @override 27 | Future response(Map res) async { 28 | final channel = GroupChannel.fromJsonWithChat(chat, res); 29 | channel.saveToCache( 30 | chat, 31 | channel: channel, 32 | res: res, 33 | ); 34 | return channel; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/operation/group_channel_join_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelJoinRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelJoinRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | String? accessCode, 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'group_channels/$channelUrl/join'; 18 | body = { 19 | if (accessCode != null) 'access_code': accessCode, 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/operation/group_channel_leave_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelLeaveRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelLeaveRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | String? userId, 15 | bool? shouldRemoveOperatorStatus, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'group_channels/$channelUrl/leave'; 18 | body = { 19 | 'should_remove_operator_status': shouldRemoveOperatorStatus ?? false 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/operation/group_channel_reset_history_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelHistoryResetRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelHistoryResetRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | String? userId, 15 | }) : super(chat: chat, userId: userId) { 16 | url = 'group_channels/$channelUrl/reset_user_history'; 17 | } 18 | 19 | @override 20 | Future response(Map res) async { 21 | return res['ts_message_offset']; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/pinned_message/group_channel_pin_create_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class PinCreateRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | PinCreateRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required int messageId, 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/messages/$messageId/pin'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/pinned_message/group_channel_pin_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class PinDeleteRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.delete; 12 | 13 | PinDeleteRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required int messageId, 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/messages/$messageId/pin'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/preference/group_channel_freeze_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelFreezeSetRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelFreezeSetRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | required bool freeze, 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'group_channels/$channelUrl/freeze'; 18 | body = {'freeze': freeze}; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/preference/group_channel_hide_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelHideRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.put; 10 | 11 | GroupChannelHideRequest( 12 | Chat chat, 13 | String channelUrl, { 14 | bool hidePreviousMessages = false, 15 | bool allowAutoUnhide = true, 16 | String? userId, 17 | }) : super(chat: chat, userId: userId) { 18 | url = 'group_channels/$channelUrl/hide'; 19 | body = { 20 | 'hide_previous_messages': hidePreviousMessages, 21 | 'allow_auto_unhide': allowAutoUnhide, 22 | }; 23 | } 24 | } 25 | 26 | class GroupChannelUnhideRequest extends ApiRequest { 27 | @override 28 | HttpMethod get method => HttpMethod.delete; 29 | 30 | GroupChannelUnhideRequest( 31 | Chat chat, { 32 | required String channelUrl, 33 | String? userId, 34 | }) : super(chat: chat, userId: userId) { 35 | url = 'group_channels/$channelUrl/hide'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/preference/group_channel_screen_shot_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelScreenshotRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.post; 10 | 11 | GroupChannelScreenshotRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | }) : super(chat: chat) { 15 | url = 'group_channels/$channelUrl/screenshot'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/scheduled_message/group_channel_scheduled_file_message_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/core/message/file_message.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/params/message/scheduled_file_message_update_params.dart'; 8 | 9 | class GroupChannelScheduledFileMessageUpdateRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.put; 12 | 13 | GroupChannelScheduledFileMessageUpdateRequest( 14 | Chat chat, { 15 | required String channelUrl, 16 | required int scheduledMessageId, 17 | required ScheduledFileMessageUpdateParams params, 18 | }) : super(chat: chat) { 19 | url = 'group_channels/$channelUrl/scheduled_messages/$scheduledMessageId'; 20 | body.addAll(params.toJson()); 21 | } 22 | 23 | @override 24 | Future response(Map res) async { 25 | return FileMessage.fromJsonWithChat(chat, res); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/scheduled_message/group_channel_scheduled_message_cancel_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class GroupChannelScheduledMessageCancelRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.delete; 10 | 11 | GroupChannelScheduledMessageCancelRequest( 12 | Chat chat, { 13 | required String channelUrl, 14 | required int scheduledMessageId, 15 | }) : super(chat: chat) { 16 | url = 'group_channels/$channelUrl/scheduled_messages/$scheduledMessageId'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/scheduled_message/group_channel_scheduled_message_send_now_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class GroupChannelScheduledMessageSendNowRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | GroupChannelScheduledMessageSendNowRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required int scheduledMessageId, 18 | }) : super(chat: chat) { 19 | url = 20 | '${channelType.urlString}/$channelUrl/scheduled_messages/$scheduledMessageId/send_now'; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/scheduled_message/group_channel_scheduled_message_total_count_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/params/message/total_scheduled_message_count_params.dart'; 7 | 8 | class GroupChannelScheduledMessageTotalCountRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | GroupChannelScheduledMessageTotalCountRequest( 13 | Chat chat, { 14 | TotalScheduledMessageCountParams? params, 15 | }) : super(chat: chat) { 16 | url = 'scheduled_messages/count'; 17 | if (params != null) { 18 | queryParams.addAll(params.toJson()); 19 | } 20 | } 21 | 22 | @override 23 | Future response(Map res) async { 24 | return res['count']; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/group_channel/scheduled_message/group_channel_scheduled_user_message_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/core/message/user_message.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/params/message/scheduled_user_message_update_params.dart'; 8 | 9 | class GroupChannelScheduledUserMessageUpdateRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.put; 12 | 13 | GroupChannelScheduledUserMessageUpdateRequest( 14 | Chat chat, { 15 | required String channelUrl, 16 | required int scheduledMessageId, 17 | required ScheduledUserMessageUpdateParams params, 18 | }) : super(chat: chat) { 19 | url = 'group_channels/$channelUrl/scheduled_messages/$scheduledMessageId'; 20 | 21 | body.addAll(params.toJson()); 22 | } 23 | 24 | @override 25 | Future response(Map res) async { 26 | return UserMessage.fromJsonWithChat(chat, res); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/message/channel_message_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelMessageDeleteRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.delete; 12 | 13 | ChannelMessageDeleteRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required int messageId, 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/messages/$messageId'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/message/channel_message_translate_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/core/message/user_message.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 9 | 10 | class ChannelMessageTranslateRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.post; 13 | 14 | ChannelMessageTranslateRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required int messageId, 19 | required List targetLanguages, 20 | }) : super(chat: chat) { 21 | url = 22 | '${channelType.urlString}/$channelUrl/messages/$messageId/translation'; 23 | body = {'target_langs': targetLanguages}; 24 | } 25 | 26 | @override 27 | Future response(Map res) async { 28 | return UserMessage.fromJsonWithChat(chat, res); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/open_channel/open_channel_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class OpenChannelDeleteRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.delete; 10 | 11 | OpenChannelDeleteRequest( 12 | Chat chat, 13 | String channelUrl, 14 | ) : super(chat: chat) { 15 | url = 'open_channels/$channelUrl'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/open_channel/open_channel_refresh_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat_cache/cache_service.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/core/channel/open_channel/open_channel.dart'; 9 | 10 | class OpenChannelRefreshRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | OpenChannelRefreshRequest( 15 | Chat chat, { 16 | required String channelUrl, 17 | List options = const [], 18 | bool passive = false, 19 | }) : super(chat: chat) { 20 | url = '${passive ? 'sdk/' : ''}open_channels/$channelUrl'; 21 | queryParams = options.toJson(); 22 | } 23 | 24 | @override 25 | Future response(Map res) async { 26 | final channel = OpenChannel.fromJsonWithChat(chat, res); 27 | channel.saveToCache( 28 | chat, 29 | channel: channel, 30 | res: res, 31 | ts: res['ts'], 32 | ); 33 | return channel; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/operator/channel_operator_add_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelOperatorsAddRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | ChannelOperatorsAddRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required List userIds, 18 | }) : super(chat: chat) { 19 | url = '${channelType.urlString}/$channelUrl/operators'; 20 | body = {'operator_ids': userIds}; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/operator/channel_operator_remove_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 9 | 10 | class ChannelOperatorsRemoveRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.delete; 13 | 14 | ChannelOperatorsRemoveRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | List userIds = const [], 19 | bool removeAll = false, 20 | }) : super(chat: chat) { 21 | url = '${channelType.urlString}/$channelUrl/operators'; 22 | body = { 23 | if (removeAll) 'delete_all': true, 24 | if (!removeAll) 'operator_ids': getUrlEncodedUserIds(chat, userIds), 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/reaction/channel_reaction_add_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/reaction/reaction_event.dart'; 9 | 10 | class ChannelReactionAddRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.post; 13 | 14 | ChannelReactionAddRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required int messageId, 19 | required String key, 20 | String? userId, 21 | }) : super(chat: chat, userId: userId) { 22 | url = '${channelType.urlString}/$channelUrl/messages/$messageId/reactions'; 23 | body = {'reaction': key, 'user_id': userId}; 24 | } 25 | 26 | @override 27 | Future response(Map res) async { 28 | return ReactionEvent.fromJson(res); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/reaction/channel_reaction_remove_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/reaction/reaction_event.dart'; 9 | 10 | class ChannelReactionDeleteRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.delete; 13 | 14 | ChannelReactionDeleteRequest( 15 | Chat chat, { 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required int messageId, 19 | required String key, 20 | String? userId, 21 | }) : super(chat: chat, userId: userId) { 22 | url = '${channelType.urlString}/$channelUrl/messages/$messageId/reactions'; 23 | body = {'reaction': key}; 24 | } 25 | 26 | @override 27 | Future response(Map res) async { 28 | return ReactionEvent.fromJson(res); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/report/channel_report_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class ChannelReportRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | ChannelReportRequest( 14 | Chat chat, { 15 | required ChannelType channelType, 16 | required String channelUrl, 17 | required ReportCategory category, 18 | String? description, 19 | }) : super(chat: chat) { 20 | url = 'report/${channelType.urlString}/$channelUrl'; 21 | body = { 22 | 'reporting_user_id': chat.chatContext.currentUserId, 23 | 'report_category': category.asString(), 24 | if (description != null) 'report_description': description 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/report/message_report_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class MessageReportRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | MessageReportRequest( 14 | Chat chat, { 15 | required int messageId, 16 | required String senderId, 17 | required ChannelType channelType, 18 | required String channelUrl, 19 | required ReportCategory category, 20 | String? description, 21 | }) : super(chat: chat) { 22 | url = 'report/${channelType.urlString}/$channelUrl/messages/$messageId'; 23 | body = { 24 | 'reporting_user_id': chat.chatContext.currentUserId, 25 | 'offending_user_id': senderId, 26 | 'report_category': category.asString(), 27 | if (description != null) 'report_description': description 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/channel/report/user_report_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | 9 | class UserReportRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | UserReportRequest( 14 | Chat chat, { 15 | required String targetId, 16 | required ChannelType channelType, 17 | required String channelUrl, 18 | required ReportCategory category, 19 | String? reporterId, 20 | String? description, 21 | }) : super(chat: chat) { 22 | url = 'report/users/$targetId'; 23 | body = { 24 | 'channel_type': channelType.urlString, 25 | 'channel_url': channelUrl, 26 | 'report_category': category.asString(), 27 | 'reporting_user_id': reporterId ?? chat.chatContext.currentUserId, 28 | if (description != null) 'report_description': description 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/application_settings_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/model/application_settings.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class ApplicationSettingsGetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | ApplicationSettingsGetRequest( 13 | Chat chat, { 14 | int? ts, 15 | String? token, 16 | int? limit, 17 | }) : super(chat: chat) { 18 | url = 'sdk/applications/settings'; 19 | 20 | if (token != null) { 21 | queryParams['token'] = token; 22 | } else if (ts != null) { 23 | queryParams['ts'] = ts; 24 | } 25 | 26 | if (limit != null) { 27 | queryParams['limit'] = limit; 28 | } 29 | } 30 | 31 | @override 32 | Future response(Map res) async { 33 | return ApplicationSettings.fromJson(res); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/emoji/emoji_category_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/chat/emoji.dart'; 7 | 8 | class EmojiCategoryGetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | EmojiCategoryGetRequest( 13 | Chat chat, 14 | int categoryId, 15 | ) : super(chat: chat) { 16 | url = 'emoji_categories/$categoryId'; 17 | } 18 | 19 | @override 20 | Future response(Map res) async { 21 | return EmojiCategory.fromJson(res); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/emoji/emoji_container_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/chat/emoji.dart'; 7 | 8 | class EmojiContainerGetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | EmojiContainerGetRequest( 13 | Chat chat, 14 | ) : super(chat: chat) { 15 | url = 'emoji_categories'; 16 | } 17 | 18 | @override 19 | Future response(Map res) async { 20 | return EmojiContainer.fromJson(res); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/emoji/emoji_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/chat/emoji.dart'; 7 | 8 | class EmojiGetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | EmojiGetRequest( 13 | Chat chat, 14 | String key, 15 | ) : super(chat: chat) { 16 | url = 'emojis/$key'; 17 | } 18 | 19 | @override 20 | Future response(Map res) async { 21 | return Emoji.fromJson(res); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/notifications/global_notification_channel_setting_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/chat/global_notification_channel_setting.dart'; 7 | 8 | class GlobalNotificationChannelSettingGetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | GlobalNotificationChannelSettingGetRequest( 13 | Chat chat, 14 | ) : super(chat: chat) { 15 | url = 'notifications/settings'; 16 | } 17 | 18 | @override 19 | Future response( 20 | Map res, 21 | ) async { 22 | return GlobalNotificationChannelSetting(setting: res); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/notifications/notification_template_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/chat/notification_template.dart'; 7 | 8 | class NotificationTemplateGetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | NotificationTemplateGetRequest( 13 | Chat chat, { 14 | required String key, 15 | }) : super(chat: chat) { 16 | url = 'notifications/templates/$key'; 17 | } 18 | 19 | @override 20 | Future response(Map res) async { 21 | return NotificationTemplate(template: res); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_changelogs_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll_change_logs.dart'; 9 | 10 | class PollChangelogsGetRequest extends ApiRequest { 11 | static const pollChangeLogsLimit = 100; // Check 12 | 13 | @override 14 | HttpMethod get method => HttpMethod.get; 15 | 16 | PollChangelogsGetRequest( 17 | Chat chat, { 18 | required ChannelType channelType, 19 | required String channelUrl, 20 | String? token, 21 | int? ts, 22 | int limit = pollChangeLogsLimit, 23 | }) : super(chat: chat) { 24 | url = "${channelType.urlString}/$channelUrl/polls/changelogs"; 25 | queryParams = { 26 | 'token': token, 27 | 'change_ts': ts, 28 | 'limit': limit, 29 | }; 30 | queryParams.removeWhere((key, value) => value == null); 31 | } 32 | 33 | @override 34 | Future response(Map res) async { 35 | return PollChangeLogs.fromJson(res); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_close_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 7 | 8 | class PollCloseRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.put; 11 | 12 | PollCloseRequest( 13 | Chat chat, { 14 | required int pollId, 15 | }) : super(chat: chat) { 16 | url = 'polls/$pollId/close'; 17 | } 18 | 19 | @override 20 | Future response(Map res) async { 21 | return Poll.fromJson(res); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_create_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/params/poll/poll_create_params.dart'; 8 | 9 | class PollCreateRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | PollCreateRequest( 14 | Chat chat, { 15 | required PollCreateParams params, 16 | }) : super(chat: chat) { 17 | url = 'polls'; 18 | 19 | body.addAll(params.toJson()); 20 | body.removeWhere((key, value) => value == null); 21 | } 22 | 23 | @override 24 | Future response(Map res) async { 25 | return Poll.fromJson(res); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class PollDeleteRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.delete; 10 | 11 | PollDeleteRequest( 12 | Chat chat, { 13 | required int pollId, 14 | }) : super(chat: chat) { 15 | url = 'polls/$pollId'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 9 | 10 | class PollGetRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | PollGetRequest( 15 | Chat chat, { 16 | required int pollId, 17 | required String channelUrl, 18 | required ChannelType channelType, 19 | }) : super(chat: chat) { 20 | url = 'polls/$pollId'; 21 | 22 | queryParams = { 23 | 'channel_url': channelUrl, 24 | 'channel_type': channelType.urlString, 25 | }; 26 | } 27 | 28 | @override 29 | Future response(Map res) async { 30 | return Poll.fromJson(res); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_list_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 9 | 10 | class PollListGetRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | PollListGetRequest( 15 | Chat chat, { 16 | required int limit, 17 | required String channelUrl, 18 | required ChannelType channelType, 19 | String? token, 20 | }) : super(chat: chat) { 21 | url = 'polls'; 22 | 23 | queryParams = { 24 | 'channel_url': channelUrl, 25 | 'token': token, 26 | 'limit': limit, 27 | 'channel_type': channelType.urlString, 28 | }; 29 | 30 | queryParams.removeWhere((key, value) => value == null); 31 | } 32 | 33 | @override 34 | Future response(Map res) async { 35 | return PollListQueryResponse.fromJson(res); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_option_add_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 9 | 10 | class PollOptionAddRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.post; 13 | 14 | PollOptionAddRequest( 15 | Chat chat, { 16 | required int pollId, 17 | required String text, 18 | required String channelUrl, 19 | required ChannelType channelType, 20 | }) : super(chat: chat) { 21 | url = 'polls/$pollId/options'; 22 | body = { 23 | 'text': text, 24 | 'channel_url': channelUrl, 25 | 'channel_type': channelType.urlString, 26 | }; 27 | } 28 | 29 | @override 30 | Future response(Map res) async { 31 | return Poll.fromJson(res); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_option_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | 7 | class PollOptionDeleteRequest extends ApiRequest { 8 | @override 9 | HttpMethod get method => HttpMethod.delete; 10 | 11 | PollOptionDeleteRequest( 12 | Chat chat, { 13 | required int pollId, 14 | required int pollOptionId, 15 | }) : super(chat: chat) { 16 | url = 'polls/$pollId/options/$pollOptionId'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_option_get_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll_option.dart'; 9 | 10 | class PollOptionGetRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | PollOptionGetRequest( 15 | Chat chat, { 16 | required int pollId, 17 | required int pollOptionId, 18 | required String channelUrl, 19 | required ChannelType channelType, 20 | }) : super(chat: chat) { 21 | url = 'polls/$pollId/options/$pollOptionId'; 22 | queryParams = { 23 | 'channel_url': channelUrl, 24 | 'channel_type': channelType.urlString, 25 | }; 26 | } 27 | 28 | @override 29 | Future response(Map res) async { 30 | return PollOption.fromJson(res); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_option_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 7 | 8 | class PollOptionUpdateRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.put; 11 | 12 | PollOptionUpdateRequest( 13 | Chat chat, { 14 | required int pollId, 15 | required int pollOptionId, 16 | required String text, 17 | }) : super(chat: chat) { 18 | url = 'polls/$pollId/options/$pollOptionId'; 19 | body = {'text': text}; 20 | } 21 | 22 | @override 23 | Future response(Map res) async { 24 | return Poll.fromJson(res); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/params/poll/poll_update_params.dart'; 8 | 9 | class PollUpdateRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.put; 12 | 13 | PollUpdateRequest( 14 | Chat chat, { 15 | required int pollId, 16 | required PollUpdateParams params, 17 | }) : super(chat: chat) { 18 | url = 'polls/$pollId'; 19 | body.addAll(params.toJson()); 20 | body.removeWhere((key, value) => value == null); 21 | } 22 | 23 | @override 24 | Future response(Map res) async { 25 | return Poll.fromJson(res); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/poll/poll_vote_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 9 | 10 | class PollVoteRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.put; 13 | 14 | PollVoteRequest( 15 | Chat chat, { 16 | required int pollId, 17 | required List pollOptionIds, 18 | required String channelUrl, 19 | required ChannelType channelType, 20 | }) : super(chat: chat) { 21 | url = 'polls/$pollId/vote'; 22 | body = { 23 | 'option_ids': pollOptionIds, 24 | 'channel_url': channelUrl, 25 | 'channel_type': channelType.urlString, 26 | }; 27 | } 28 | 29 | @override 30 | Future response(Map res) async { 31 | return Poll.fromJson(res); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/upload_notification_stat_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/stats/model/base_stat.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UploadNotificationStatRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.post; 11 | 12 | static const statUrl = 'sdk/notification_statistics'; 13 | 14 | UploadNotificationStatRequest( 15 | Chat chat, { 16 | required String deviceId, 17 | required List stats, 18 | }) : super(chat: chat) { 19 | url = statUrl; 20 | body = { 21 | 'device_id': deviceId, 22 | 'log_entries': stats.map((stat) => stat.toJson()).toList(), 23 | }; 24 | userId = null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/main/upload_stat_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/stats/model/base_stat.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UploadStatRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.post; 11 | 12 | static const statUrl = 'sdk/statistics'; 13 | 14 | UploadStatRequest( 15 | Chat chat, { 16 | required String deviceId, 17 | required List stats, 18 | }) : super(chat: chat) { 19 | url = statUrl; 20 | body = { 21 | 'device_id': deviceId, 22 | 'log_entries': stats.map((stat) => stat.toJson()).toList(), 23 | }; 24 | userId = null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/block/user_block_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/core/user/user.dart'; 8 | 9 | class UserBlockRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.post; 12 | 13 | UserBlockRequest( 14 | Chat chat, { 15 | String? userId, 16 | required String targetId, 17 | }) : super(chat: chat, userId: userId) { 18 | url = 'users/${getUrlEncodedUserId(chat, userId)}/block'; 19 | body = {'target_id': targetId}; 20 | } 21 | 22 | @override 23 | Future response(Map res) async { 24 | return User.fromJsonWithChat(chat, res); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/block/user_unblock_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UserUnblockRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.delete; 11 | 12 | UserUnblockRequest( 13 | Chat chat, { 14 | String? userId, 15 | required String targetId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 18 | 'users/${getUrlEncodedUserId(chat, userId)}/block/${getUrlEncodedUserId(chat, targetId)}'; 19 | body = {'target_id': targetId}; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/list/blocked_user_list_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 8 | 9 | class BlockedUserListRequest extends ApiRequest { 10 | @override 11 | HttpMethod get method => HttpMethod.get; 12 | 13 | BlockedUserListRequest( 14 | Chat chat, { 15 | required int limit, 16 | List userIds = const [], 17 | String? token, 18 | String? userId, 19 | }) : super(chat: chat) { 20 | url = 'users/${getUrlEncodedUserId(chat, userId)}/block'; 21 | queryParams = { 22 | 'limit': limit, 23 | if (token != null) 'token': token, 24 | if (userIds.isNotEmpty) 'user_ids': userIds, 25 | }; 26 | } 27 | 28 | @override 29 | Future response(Map res) async => 30 | UserListQueryResponse.fromJsonWithChat(chat, res); 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/list/muted_user_list_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 9 | 10 | class MutedUserListRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | MutedUserListRequest( 15 | Chat chat, { 16 | required int limit, 17 | required ChannelType channelType, 18 | required String channelUrl, 19 | String? token, 20 | }) : super(chat: chat) { 21 | url = '${channelType.urlString}/$channelUrl/mute'; 22 | queryParams = { 23 | 'limit': limit, 24 | if (token != null) 'token': token, 25 | }; 26 | } 27 | 28 | @override 29 | Future response(Map res) async { 30 | final output = {'users': res['muted_list'], 'next': res['next']}; 31 | return UserListQueryResponse.fromJsonWithChat(chat, output); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/list/open_channel_participant_list_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 7 | 8 | class OpenChannelParticipantListRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.get; 11 | 12 | OpenChannelParticipantListRequest( 13 | Chat chat, { 14 | required int limit, 15 | required String channelUrl, 16 | String? token, 17 | }) : super(chat: chat) { 18 | url = 'open_channels/$channelUrl/participants'; 19 | queryParams = { 20 | 'limit': limit, 21 | if (token != null) 'token': token, 22 | }; 23 | } 24 | 25 | @override 26 | Future response(Map res) async { 27 | final output = {'users': res['participants'], 'next': res['next']}; 28 | return UserListQueryResponse.fromJsonWithChat(chat, output); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/list/operator_list_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/extensions/extensions.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 8 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart'; 9 | 10 | class OperatorListRequest extends ApiRequest { 11 | @override 12 | HttpMethod get method => HttpMethod.get; 13 | 14 | OperatorListRequest( 15 | Chat chat, { 16 | required int limit, 17 | required ChannelType channelType, 18 | required String channelUrl, 19 | String? token, 20 | }) : super(chat: chat) { 21 | url = '${channelType.urlString}/$channelUrl/operators'; 22 | queryParams = { 23 | 'limit': limit.toString(), 24 | if (token != null) 'token': token, 25 | }; 26 | } 27 | 28 | @override 29 | Future response(Map res) async { 30 | final response = OperatorListQueryResponse.fromJson(res); 31 | for (final element in response.operators) { 32 | element.set(chat); 33 | } 34 | return response; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/preference/user_push_sound_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UserPushSoundSetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.put; 11 | 12 | UserPushSoundSetRequest( 13 | Chat chat, 14 | String sound, { 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'users/${getUrlEncodedUserId(chat, userId)}/push_preference'; 18 | body = {'push_sound': sound}; 19 | } 20 | } 21 | 22 | class UserPushSoundGetRequest extends ApiRequest { 23 | @override 24 | HttpMethod get method => HttpMethod.get; 25 | 26 | UserPushSoundGetRequest( 27 | Chat chat, { 28 | String? userId, 29 | }) : super(chat: chat, userId: userId) { 30 | url = 'users/${getUrlEncodedUserId(chat, userId)}/push_preference'; 31 | } 32 | 33 | @override 34 | Future response(Map res) async { 35 | return res['push_sound']; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/preference/user_push_template_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UserPushTemplateSetRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.put; 11 | 12 | UserPushTemplateSetRequest( 13 | Chat chat, 14 | String name, { 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'users/${getUrlEncodedUserId(chat, userId)}/push/template'; 18 | body = {'name': name}; 19 | } 20 | } 21 | 22 | class UserPushTemplateGetRequest extends ApiRequest { 23 | @override 24 | HttpMethod get method => HttpMethod.get; 25 | 26 | UserPushTemplateGetRequest( 27 | Chat chat, { 28 | String? userId, 29 | }) : super(chat: chat, userId: userId) { 30 | url = 'users/${getUrlEncodedUserId(chat, userId)}/push/template'; 31 | } 32 | 33 | @override 34 | Future response(Map res) async { 35 | return res['name']; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/user_meta_data/user_meta_data_create_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UserMetaDataCreateRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.post; 11 | 12 | UserMetaDataCreateRequest( 13 | Chat chat, 14 | Map metaData, { 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'users/${getUrlEncodedUserId(chat, userId)}/metadata'; 18 | body = {'metadata': metaData, 'upsert': true}; 19 | } 20 | 21 | @override 22 | Future response(Map res) async { 23 | return Map.from(res); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/user_meta_data/user_meta_data_delete_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UserMetaDataDeleteRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.delete; 11 | 12 | UserMetaDataDeleteRequest( 13 | Chat chat, 14 | String key, { 15 | String? userId, 16 | }) : super(chat: chat, userId: userId) { 17 | url = 'users/${getUrlEncodedUserId(chat, userId)}/metadata/$key'; 18 | } 19 | } 20 | 21 | class UserMetaDataDeleteAllRequest extends ApiRequest { 22 | @override 23 | HttpMethod get method => HttpMethod.delete; 24 | 25 | UserMetaDataDeleteAllRequest( 26 | Chat chat, { 27 | String? userId, 28 | }) : super(chat: chat, userId: userId) { 29 | url = 'users/${getUrlEncodedUserId(chat, userId)}/metadata'; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/internal/network/http/http_client/request/user/user_meta_data/user_meta_data_update_request.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/utils/string_utils.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/http_client.dart'; 6 | import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/api_request.dart'; 7 | 8 | class UserMetaDataUpdateRequest extends ApiRequest { 9 | @override 10 | HttpMethod get method => HttpMethod.put; 11 | 12 | UserMetaDataUpdateRequest( 13 | Chat chat, 14 | Map metaData, { 15 | String? userId, 16 | bool upsert = true, 17 | }) : super(chat: chat, userId: userId) { 18 | url = 'users/${getUrlEncodedUserId(chat, userId)}/metadata'; 19 | body = {'metadata': metaData, 'upsert': upsert}; 20 | } 21 | 22 | @override 23 | Future response(Map res) async { 24 | return Map.from(res); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/command/command.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'command.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Command _$CommandFromJson(Map json) => Command( 10 | cmd: json['cmd'] as String, 11 | requestId: json['req_id'] as String?, 12 | timestamp: (json['ts'] as num?)?.toInt(), 13 | requireAuth: json['require_auth'] as bool?, 14 | errorCode: (json['code'] as num?)?.toInt(), 15 | errorMessage: json['message'] as String?, 16 | replyToChannel: json['reply_to_channel'] as bool? ?? false, 17 | ); 18 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/base_event.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 5 | 6 | abstract class BaseEvent { 7 | @JsonKey(includeFromJson: false, includeToJson: false) 8 | late Chat chat; 9 | 10 | void set(Chat chat) { 11 | this.chat = chat; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/channel_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'channel_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ChannelEvent _$ChannelEventFromJson(Map json) => ChannelEvent( 10 | channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), 11 | channelUrl: json['channel_url'] as String, 12 | category: channelEventValueOf((json['cat'] as num).toInt()), 13 | data: json['data'] as Map? ?? {}, 14 | ts: (json['ts'] as num?)?.toInt(), 15 | messageOffset: (json['ts_message_offset'] as num?)?.toInt(), 16 | ); 17 | 18 | const _$ChannelTypeEnumMap = { 19 | ChannelType.group: 'group', 20 | ChannelType.open: 'open', 21 | ChannelType.feed: 'feed', 22 | }; 23 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/login_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'login_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | LoginEvent _$LoginEventFromJson(Map json) => LoginEvent( 10 | eKey: json['ekey'] as String?, 11 | newKey: json['new_key'] as String?, 12 | key: json['key'] as String?, 13 | loginTimestamp: (json['login_ts'] as num).toInt(), 14 | reconnectConfiguration: ReconnectConfiguration.fromJson( 15 | json['reconnect'] as Map), 16 | pingInterval: (json['ping_interval'] as num?)?.toInt() ?? 15, 17 | watchdogInterval: (json['pong_timeout'] as num).toInt(), 18 | maxUnreadCountOnSuperGroup: 19 | (json['max_unread_count_on_super_group'] as num?)?.toInt(), 20 | applicationAttributes: (json['application_attributes'] as List?) 21 | ?.map((e) => e as String) 22 | .toList() ?? 23 | const [], 24 | deviceTokenLastDeletedAt: 25 | (json['device_token_last_deleted_at'] as num?)?.toInt() ?? 0, 26 | configSyncNeeded: json['config_sync_needed'] as bool?, 27 | ); 28 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/mcnt_event.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 5 | import 'package:sendbird_chat_sdk/src/internal/network/websocket/event/base_event.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/core/channel/open_channel/open_channel.dart'; 8 | 9 | part 'mcnt_event.g.dart'; 10 | 11 | @JsonSerializable(createToJson: false) 12 | class MCNTEvent extends BaseEvent { 13 | @JsonKey(defaultValue: []) 14 | List groupChannels; 15 | 16 | @JsonKey(defaultValue: []) 17 | List openChannels; 18 | 19 | @JsonKey(name: 'sts') 20 | int? systemTimestamp; 21 | 22 | @JsonKey(name: 'ts') 23 | int? timestamp; 24 | 25 | MCNTEvent({ 26 | required this.groupChannels, 27 | required this.openChannels, 28 | this.systemTimestamp, 29 | this.timestamp, 30 | }); 31 | 32 | factory MCNTEvent.fromJsonWithChat(Chat chat, Map json) { 33 | final event = _$MCNTEventFromJson(json); 34 | 35 | for (final channel in event.groupChannels) { 36 | channel.set(chat); 37 | } 38 | for (final channel in event.openChannels) { 39 | channel.set(chat); 40 | } 41 | return event; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/mcnt_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'mcnt_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MCNTEvent _$MCNTEventFromJson(Map json) => MCNTEvent( 10 | groupChannels: (json['group_channels'] as List?) 11 | ?.map((e) => GroupChannel.fromJson(e as Map)) 12 | .toList() ?? 13 | [], 14 | openChannels: (json['open_channels'] as List?) 15 | ?.map((e) => OpenChannel.fromJson(e as Map)) 16 | .toList() ?? 17 | [], 18 | systemTimestamp: (json['sts'] as num?)?.toInt(), 19 | timestamp: (json['ts'] as num?)?.toInt(), 20 | ); 21 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/session_event.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/network/websocket/event/base_event.dart'; 5 | 6 | part 'session_event.g.dart'; 7 | 8 | @JsonSerializable(createToJson: false) 9 | class SessionEvent extends BaseEvent { 10 | final String? newKey; 11 | 12 | @JsonKey(name: 'ekey') 13 | final String? eKey; 14 | 15 | final String? key; 16 | 17 | String get sessionKey => key ?? newKey ?? ''; 18 | 19 | SessionEvent({this.newKey, this.eKey, this.key}); 20 | 21 | factory SessionEvent.fromJson(Map json) => 22 | _$SessionEventFromJson(json); 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/session_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'session_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SessionEvent _$SessionEventFromJson(Map json) => SessionEvent( 10 | newKey: json['new_key'] as String?, 11 | eKey: json['ekey'] as String?, 12 | key: json['key'] as String?, 13 | ); 14 | -------------------------------------------------------------------------------- /lib/src/internal/network/websocket/event/user_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'user_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | UserEvent _$UserEventFromJson(Map json) => UserEvent( 10 | category: userEventValueOf((json['cat'] as num).toInt()), 11 | data: json['data'] as Map, 12 | ts: (json['ts'] as num).toInt(), 13 | ); 14 | -------------------------------------------------------------------------------- /lib/src/public/core/channel/group_channel/group_channel_pinned_message.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | part of 'group_channel.dart'; 4 | 5 | /// GroupChannelPinnedMessage 6 | extension GroupChannelPinnedMessage on GroupChannel { 7 | /// Pins a message to the channel. 8 | /// [messageId] is id of a message to pin. 9 | Future pinMessage(int messageId) async { 10 | if (messageId <= 0) throw InvalidParameterException(); 11 | 12 | sbLog.i(StackTrace.current, 'messageId: $messageId'); 13 | 14 | await chat.apiClient.send( 15 | PinCreateRequest( 16 | chat, 17 | channelType: ChannelType.group, 18 | channelUrl: channelUrl, 19 | messageId: messageId, 20 | ), 21 | ); 22 | } 23 | 24 | /// Removes the message from the channel's pinned messages. 25 | /// [messageId] is id of a message to unpin. 26 | Future unpinMessage(int messageId) async { 27 | if (messageId <= 0) throw InvalidParameterException(); 28 | 29 | sbLog.i(StackTrace.current, 'messageId: $messageId'); 30 | 31 | await chat.apiClient.send( 32 | PinDeleteRequest( 33 | chat, 34 | channelType: ChannelType.group, 35 | channelUrl: channelUrl, 36 | messageId: messageId, 37 | ), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/src/public/core/channel/open_channel/open_channel_operation.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | part of 'open_channel.dart'; 4 | 5 | /// OpenChannelOperation 6 | extension OpenChannelOperation on OpenChannel { 7 | /// Enters this channel. 8 | /// The current `User` becomes a participant of this channel. 9 | Future enter() async { 10 | sbLog.i(StackTrace.current); 11 | 12 | final cmd = Command.buildEnterChannel(this); 13 | final result = await chat.commandManager.sendCommand(cmd); 14 | participantCount = result?.payload['participant_count']; 15 | 16 | chat.chatContext.enteredOpenChannelUrls.add(channelUrl); 17 | sbLog.i( 18 | StackTrace.current, 19 | '[add()] enteredOpenChannels: ${chat.chatContext.enteredOpenChannelUrls.length}', 20 | ); 21 | } 22 | 23 | /// Exits from this channel. 24 | /// The current `User` is no longer a participant of this channel. 25 | Future exit() async { 26 | sbLog.i(StackTrace.current); 27 | 28 | final cmd = Command.buildExitChannel(this); 29 | final result = await chat.commandManager.sendCommand(cmd); 30 | participantCount = result?.payload['participant_count'] ?? 0; 31 | 32 | removeFromCache(chat); 33 | chat.chatContext.enteredOpenChannelUrls.remove(channelUrl); 34 | sbLog.i( 35 | StackTrace.current, 36 | '[remove()] enteredOpenChannels: ${chat.chatContext.enteredOpenChannelUrls.length}', 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_collection/base_channel_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/collection/collection_event_source.dart'; 4 | 5 | /// The context of a base channel. 6 | /// @since 4.0.3 7 | class BaseChannelContext { 8 | final CollectionEventSource _collectionEventSource; 9 | 10 | /// The [CollectionEventSource] of current context. 11 | CollectionEventSource get collectionEventSource => _collectionEventSource; 12 | 13 | BaseChannelContext(CollectionEventSource collectionEventSource) 14 | : _collectionEventSource = collectionEventSource; 15 | } 16 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_collection/feed_channel_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/collection/collection_event_source.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_collection/base_channel_context.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_message_collection/notification_collection_handler.dart'; 6 | 7 | /// The context of a feed channel, used in [NotificationCollectionHandler]. 8 | /// @since 4.0.3 9 | class FeedChannelContext extends BaseChannelContext { 10 | /// Constructor 11 | /// @since 4.0.3 12 | FeedChannelContext(CollectionEventSource collectionEventSource) 13 | : super(collectionEventSource); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_collection/group_channel_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/collection/collection_event_source.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_collection/base_channel_context.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_collection/group_channel_collection_handler.dart'; 6 | 7 | /// The context of a group channel, used in [GroupChannelCollectionHandler]. 8 | class GroupChannelContext extends BaseChannelContext { 9 | GroupChannelContext(CollectionEventSource collectionEventSource) 10 | : super(collectionEventSource); 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_message_collection/base_message_collection_handler.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | /// The base message collection handler. 4 | /// @since 4.0.3 5 | abstract class BaseMessageCollectionHandler {} 6 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_message_collection/base_message_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/collection/collection_event_source.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_message_collection/message_collection_handler.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 6 | 7 | /// The context of a base message. 8 | /// @since 4.0.3 9 | class BaseMessageContext { 10 | final CollectionEventSource _collectionEventSource; 11 | final SendingStatus _sendingStatus; // TODO: Remove (?) 12 | 13 | /// The [CollectionEventSource] of current context. 14 | CollectionEventSource get collectionEventSource => _collectionEventSource; 15 | 16 | /// The [sendingStatus] of the messages that's sent out from [MessageCollectionHandler] with this context. 17 | SendingStatus get sendingStatus => _sendingStatus; 18 | 19 | BaseMessageContext( 20 | CollectionEventSource collectionEventSource, SendingStatus sendingStatus) 21 | : _collectionEventSource = collectionEventSource, 22 | _sendingStatus = sendingStatus; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_message_collection/message_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/collection/collection_event_source.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_message_collection/base_message_context.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_message_collection/message_collection_handler.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 7 | 8 | /// The context of a message, used in [MessageCollectionHandler]. 9 | class MessageContext extends BaseMessageContext { 10 | MessageContext( 11 | CollectionEventSource collectionEventSource, SendingStatus sendingStatus) 12 | : super(collectionEventSource, sendingStatus); 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/public/main/collection/group_channel_message_collection/notification_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/collection/collection_event_source.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_message_collection/base_message_context.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/collection/group_channel_message_collection/notification_collection_handler.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 7 | 8 | /// The context of a notification, used in [NotificationCollectionHandler]. 9 | /// @since 4.0.3 10 | class NotificationContext extends BaseMessageContext { 11 | /// Constructor 12 | /// @since 4.0.3 13 | NotificationContext( 14 | CollectionEventSource collectionEventSource, SendingStatus sendingStatus) 15 | : super(collectionEventSource, sendingStatus); 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/public/main/handler/connection_handler.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 4 | 5 | /// The connection handler. 6 | /// This handler provides callbacks for automatically managed reconnection events. 7 | /// SendbirdChat tries reconnection when the connection is lost. 8 | /// This handler can be used to track the reconnection state. 9 | /// To add or remove this handler, refer to [SendbirdChat.addConnectionHandler] and [SendbirdChat.removeConnectionHandler]. 10 | abstract class ConnectionHandler { 11 | /// A callback for when SendbirdChat is connected. 12 | void onConnected(String userId); 13 | 14 | /// A callback for when SendbirdChat is disconnected. 15 | void onDisconnected(String userId); 16 | 17 | /// A callback for when SendbirdChat tries to reconnect. 18 | void onReconnectStarted(); 19 | 20 | /// A callback for when connection is reestablished. 21 | void onReconnectSucceeded(); 22 | 23 | /// A callback for when reconnection is failed. 24 | void onReconnectFailed(); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/public/main/handler/user_event_handler.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/core/channel/feed_channel/feed_channel.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/core/user/user.dart'; 6 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 7 | import 'package:sendbird_chat_sdk/src/public/main/model/message/unread_message_count.dart'; 8 | 9 | /// User event handler. 10 | /// To add or remove this handler, 11 | /// refer to [SendbirdChat.addUserEventHandler] and [SendbirdChat.removeUserEventHandler]. 12 | abstract class UserEventHandler { 13 | /// The friends discovered event. 14 | void onFriendsDiscovered(List friends); 15 | 16 | /// Gets the subscribed total number of unread message of all [GroupChannel]s and [FeedChannel]s the current user has joined, 17 | /// and number of unread message of [GroupChannel] for all subscribed custom type. 18 | /// @since 4.0.3 19 | void onTotalUnreadMessageCountChanged( 20 | UnreadMessageCount unreadMessageCount, 21 | ) {} 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/public/main/model/channel/feed_channel_change_logs.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'feed_channel_change_logs.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | FeedChannelChangeLogs _$FeedChannelChangeLogsFromJson( 10 | Map json) => 11 | FeedChannelChangeLogs( 12 | updatedChannels: (json['updated'] as List?) 13 | ?.map((e) => const FeedChannelConverter().fromJson(e as Object)) 14 | .toList() ?? 15 | [], 16 | deletedChannelUrls: (json['deleted'] as List?) 17 | ?.map((e) => e as String) 18 | .toList() ?? 19 | [], 20 | hasMore: json['has_more'] as bool? ?? false, 21 | token: json['next'] as String?, 22 | ); 23 | -------------------------------------------------------------------------------- /lib/src/public/main/model/channel/group_channel_change_logs.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart'; 6 | 7 | part 'group_channel_change_logs.g.dart'; 8 | 9 | /// The GroupChannelChangeLogs class. 10 | @JsonSerializable(createToJson: false) 11 | class GroupChannelChangeLogs { 12 | /// The updated channels. 13 | @JsonKey(defaultValue: [], name: 'updated') 14 | final List updatedChannels; 15 | 16 | /// The deleted channel urls. 17 | @JsonKey(defaultValue: [], name: 'deleted') 18 | final List deletedChannelUrls; 19 | 20 | /// True if it has more changelogs. 21 | @JsonKey(defaultValue: false) 22 | final bool hasMore; 23 | 24 | /// [token] to get next changelogs. 25 | @JsonKey(name: 'next') 26 | final String? token; 27 | 28 | GroupChannelChangeLogs({ 29 | required this.updatedChannels, 30 | required this.deletedChannelUrls, 31 | required this.hasMore, 32 | this.token, 33 | }); 34 | 35 | static GroupChannelChangeLogs fromJsonWithChat( 36 | Chat chat, Map json) { 37 | final res = _$GroupChannelChangeLogsFromJson(json); 38 | 39 | for (final channel in res.updatedChannels) { 40 | channel.set(chat); 41 | } 42 | return res; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/src/public/main/model/channel/group_channel_change_logs.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'group_channel_change_logs.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | GroupChannelChangeLogs _$GroupChannelChangeLogsFromJson( 10 | Map json) => 11 | GroupChannelChangeLogs( 12 | updatedChannels: (json['updated'] as List?) 13 | ?.map((e) => GroupChannel.fromJson(e as Map)) 14 | .toList() ?? 15 | [], 16 | deletedChannelUrls: (json['deleted'] as List?) 17 | ?.map((e) => e as String) 18 | .toList() ?? 19 | [], 20 | hasMore: json['has_more'] as bool? ?? false, 21 | token: json['next'] as String?, 22 | ); 23 | -------------------------------------------------------------------------------- /lib/src/public/main/model/channel/notification_category.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | /// NotificationCategory 4 | /// @since 4.0.6 5 | class NotificationCategory { 6 | /// id 7 | /// @since 4.0.6 8 | final int id; 9 | 10 | /// customType 11 | /// @since 4.0.6 12 | final String customType; 13 | 14 | /// name 15 | /// @since 4.0.6 16 | final String name; 17 | 18 | /// isDefault 19 | /// @since 4.0.6 20 | final bool isDefault; 21 | 22 | NotificationCategory({ 23 | required this.id, 24 | required this.customType, 25 | required this.name, 26 | required this.isDefault, 27 | }); 28 | 29 | @override 30 | bool operator ==(other) { 31 | if (identical(other, this)) return true; 32 | 33 | return other is NotificationCategory && 34 | other.id == id && 35 | other.customType == customType && 36 | other.name == name && 37 | other.isDefault == isDefault; 38 | } 39 | 40 | @override 41 | int get hashCode => Object.hash( 42 | id, 43 | customType, 44 | name, 45 | isDefault, 46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/do_not_disturb.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'do_not_disturb.g.dart'; 6 | 7 | /// The DoNotDisturb class. 8 | @JsonSerializable(createToJson: false) 9 | class DoNotDisturb { 10 | /// Flag for the option is on or off. 11 | @JsonKey(name: 'do_not_disturb') 12 | final bool isDoNotDisturbOn; 13 | 14 | /// The option starting hour (0~23). 15 | final int? startHour; 16 | 17 | /// The option starting minute (0~59). 18 | final int? startMin; 19 | 20 | /// The option ending hour (0~23). 21 | final int? endHour; 22 | 23 | /// The option ending minute (0~59). 24 | final int? endMin; 25 | 26 | /// Timezone. 27 | final String? timezone; 28 | 29 | DoNotDisturb({ 30 | required this.isDoNotDisturbOn, 31 | this.startHour, 32 | this.startMin, 33 | this.endHour, 34 | this.endMin, 35 | this.timezone, 36 | }); 37 | 38 | static DoNotDisturb fromJson(Map json) => 39 | _$DoNotDisturbFromJson(json); 40 | } 41 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/do_not_disturb.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'do_not_disturb.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DoNotDisturb _$DoNotDisturbFromJson(Map json) => DoNotDisturb( 10 | isDoNotDisturbOn: json['do_not_disturb'] as bool, 11 | startHour: (json['start_hour'] as num?)?.toInt(), 12 | startMin: (json['start_min'] as num?)?.toInt(), 13 | endHour: (json['end_hour'] as num?)?.toInt(), 14 | endMin: (json['end_min'] as num?)?.toInt(), 15 | timezone: json['timezone'] as String?, 16 | ); 17 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/emoji.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'emoji.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Emoji _$EmojiFromJson(Map json) => Emoji( 10 | key: json['key'] as String, 11 | url: json['url'] as String, 12 | ); 13 | 14 | EmojiCategory _$EmojiCategoryFromJson(Map json) => 15 | EmojiCategory( 16 | id: (json['id'] as num).toInt(), 17 | name: json['name'] as String, 18 | url: json['url'] as String, 19 | emojis: (json['emojis'] as List?) 20 | ?.map((e) => Emoji.fromJson(e as Map)) 21 | .toList() ?? 22 | [], 23 | ); 24 | 25 | EmojiContainer _$EmojiContainerFromJson(Map json) => 26 | EmojiContainer( 27 | emojiHash: json['emoji_hash'] as String, 28 | emojiCategories: (json['emoji_categories'] as List?) 29 | ?.map((e) => EmojiCategory.fromJson(e as Map)) 30 | .toList() ?? 31 | [], 32 | ); 33 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/global_notification_channel_setting.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 4 | 5 | /// Class to obtain the global notification channel setting. 6 | /// @since 4.0.3 7 | class GlobalNotificationChannelSetting { 8 | /// The setting map received from the [SendbirdChat.getGlobalNotificationChannelSetting]. 9 | /// @since 4.0.3 10 | final Map setting; 11 | 12 | GlobalNotificationChannelSetting({ 13 | required this.setting, 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/notification_template.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | /// Class to obtain the Notification template. 4 | /// @since 4.0.3 5 | class NotificationTemplate { 6 | /// The notification template. 7 | /// @since 4.0.3 8 | final Map template; 9 | 10 | NotificationTemplate({ 11 | required this.template, 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/notification_template_list.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 4 | 5 | /// The notification template list received from the [SendbirdChat.getNotificationTemplateListByToken]. 6 | /// @since 4.0.3 7 | class NotificationTemplateList { 8 | /// The notification template list. 9 | /// @since 4.0.3 10 | final Map templateList; 11 | 12 | /// Returned true if it has more template list. 13 | /// @since 4.0.3 14 | final bool hasMore; 15 | 16 | /// Returned token to get next template list. 17 | /// @since 4.0.3 18 | final String? token; 19 | 20 | NotificationTemplateList({ 21 | required this.templateList, 22 | required this.hasMore, 23 | required this.token, 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/snooze_period.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'snooze_period.g.dart'; 6 | 7 | /// The SnoozePeriod class 8 | @JsonSerializable(createToJson: false) 9 | class SnoozePeriod { 10 | /// Flag for the snooze is on or off. 11 | @JsonKey(name: 'snooze_enabled') 12 | final bool isSnoozeOn; 13 | 14 | /// Start date of snooze period. 15 | @JsonKey(fromJson: _msToDateTime, name: 'snooze_start_ts') 16 | final DateTime? startDate; 17 | 18 | /// End date of snooze period. 19 | @JsonKey(fromJson: _msToDateTime, name: 'snooze_end_ts') 20 | final DateTime? endDate; 21 | 22 | SnoozePeriod({required this.isSnoozeOn, this.startDate, this.endDate}); 23 | 24 | static SnoozePeriod fromJson(Map json) => 25 | _$SnoozePeriodFromJson(json); 26 | } 27 | 28 | DateTime? _msToDateTime(dynamic ms) { 29 | if (ms is int) { 30 | return DateTime.fromMillisecondsSinceEpoch(ms); 31 | } else { 32 | return null; // Fix related to the wrong response from server 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/public/main/model/chat/snooze_period.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'snooze_period.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SnoozePeriod _$SnoozePeriodFromJson(Map json) => SnoozePeriod( 10 | isSnoozeOn: json['snooze_enabled'] as bool, 11 | startDate: _msToDateTime(json['snooze_start_ts']), 12 | endDate: _msToDateTime(json['snooze_end_ts']), 13 | ); 14 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/app_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'app_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | AppInfo _$AppInfoFromJson(Map json) => AppInfo( 10 | premiumFeatureList: (json['premium_feature_list'] as List?) 11 | ?.map((e) => e as String) 12 | .toList() ?? 13 | [], 14 | uploadSizeLimit: (json['file_upload_size_limit'] as num?)?.toInt() ?? 30, 15 | attributesInUse: (json['application_attributes'] as List?) 16 | ?.map((e) => e as String) 17 | .toList() ?? 18 | [], 19 | emojiHash: json['emoji_hash'] as String, 20 | useReaction: json['use_reaction'] as bool, 21 | notificationInfo: json['notifications'] == null 22 | ? null 23 | : NotificationInfo.fromJson( 24 | json['notifications'] as Map), 25 | allowSdkStatsUpload: json['allow_sdk_log_ingestion'] as bool? ?? true, 26 | disableSuperGroupMack: json['disable_supergroup_mack'] as bool? ?? false, 27 | unreadCntThreadingPolicy: 28 | (json['unread_cnt_threading_policy'] as num?)?.toInt() ?? 0, 29 | lastMsgThreadingPolicy: 30 | (json['last_msg_threading_policy'] as num?)?.toInt() ?? 0, 31 | ); 32 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/file_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'file_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | FileInfo _$FileInfoFromJson(Map json) => FileInfo( 10 | fileUrl: json['url'] as String?, 11 | fileName: json['name'] as String?, 12 | mimeType: json['type'] as String?, 13 | fileSize: (json['size'] as num?)?.toInt(), 14 | ); 15 | 16 | Map _$FileInfoToJson(FileInfo instance) => { 17 | 'url': instance.fileUrl, 18 | 'name': instance.fileName, 19 | 'type': instance.mimeType, 20 | 'size': instance.fileSize, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/mute_info.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'mute_info.g.dart'; 6 | 7 | /// The MuteInfo class. 8 | @JsonSerializable(createToJson: false) 9 | class MuteInfo { 10 | /// IsMuted. 11 | final bool isMuted; 12 | 13 | /// Description. 14 | final String? description; 15 | 16 | /// Timestamp when the mute started (ms). 17 | final int? startAt; 18 | 19 | /// Timestamp when the mute will end (ms). 20 | final int? endAt; 21 | 22 | /// Remaining duration (ms). 23 | final int? remainingDuration; 24 | 25 | MuteInfo({ 26 | required this.isMuted, 27 | this.description, 28 | this.startAt, 29 | this.endAt, 30 | this.remainingDuration, 31 | }); 32 | 33 | static MuteInfo fromJson(Map json) => 34 | _$MuteInfoFromJson(json); 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/mute_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'mute_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MuteInfo _$MuteInfoFromJson(Map json) => MuteInfo( 10 | isMuted: json['is_muted'] as bool, 11 | description: json['description'] as String?, 12 | startAt: (json['start_at'] as num?)?.toInt(), 13 | endAt: (json['end_at'] as num?)?.toInt(), 14 | remainingDuration: (json['remaining_duration'] as num?)?.toInt(), 15 | ); 16 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/notification_info.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 5 | 6 | part 'notification_info.g.dart'; 7 | 8 | /// Represents information about Notifications. 9 | /// @since 4.0.3 10 | @JsonSerializable(createToJson: false) 11 | class NotificationInfo { 12 | /// Whether notification is enabled 13 | /// @since 4.0.3 14 | @JsonKey(name: 'enabled') 15 | final bool isEnabled; 16 | 17 | /// List of feed channels for [SendbirdChat.currentUser], channel_key : channel_url 18 | /// @since 4.0.3 19 | final Map feedChannels; 20 | 21 | /// Updated at for the global notification settings 22 | /// @since 4.0.3 23 | final int settingsUpdatedAt; 24 | 25 | /// Token for the notification template list 26 | /// @since 4.0.3 27 | final String? templateListToken; 28 | 29 | NotificationInfo({ 30 | required this.isEnabled, 31 | required this.feedChannels, 32 | required this.settingsUpdatedAt, 33 | this.templateListToken, 34 | }); 35 | 36 | static NotificationInfo fromJson(Map json) => 37 | _$NotificationInfoFromJson(json); 38 | } 39 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/notification_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'notification_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | NotificationInfo _$NotificationInfoFromJson(Map json) => 10 | NotificationInfo( 11 | isEnabled: json['enabled'] as bool, 12 | feedChannels: Map.from(json['feed_channels'] as Map), 13 | settingsUpdatedAt: (json['settings_updated_at'] as num).toInt(), 14 | templateListToken: json['template_list_token'] as String?, 15 | ); 16 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/scheduled_info.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 5 | 6 | part 'scheduled_info.g.dart'; 7 | 8 | /// Class holding an information about the scheduled messages. 9 | @JsonSerializable(createToJson: false) 10 | class ScheduledInfo { 11 | /// The ID of the scheduled message. 12 | int scheduledMessageId; 13 | 14 | /// The scheduled time of this message. 15 | int scheduledAt; 16 | 17 | /// The scheduled message sending status. 18 | ScheduledStatus scheduledStatus; 19 | 20 | ScheduledInfo({ 21 | required this.scheduledMessageId, 22 | required this.scheduledAt, 23 | required this.scheduledStatus, 24 | }); 25 | 26 | factory ScheduledInfo.fromJson(Map json) => 27 | _$ScheduledInfoFromJson(json); 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/public/main/model/info/scheduled_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'scheduled_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ScheduledInfo _$ScheduledInfoFromJson(Map json) => 10 | ScheduledInfo( 11 | scheduledMessageId: (json['scheduled_message_id'] as num).toInt(), 12 | scheduledAt: (json['scheduled_at'] as num).toInt(), 13 | scheduledStatus: 14 | $enumDecode(_$ScheduledStatusEnumMap, json['scheduled_status']), 15 | ); 16 | 17 | const _$ScheduledStatusEnumMap = { 18 | ScheduledStatus.pending: 'pending', 19 | ScheduledStatus.inQueue: 'in_queue', 20 | ScheduledStatus.sent: 'sent', 21 | ScheduledStatus.failed: 'failed', 22 | ScheduledStatus.canceled: 'canceled', 23 | ScheduledStatus.removed: 'removed', 24 | }; 25 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/apple_critical_alert_options.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'apple_critical_alert_options.g.dart'; 6 | 7 | /// A class that can be used to send apple's critical alert. 8 | @JsonSerializable() 9 | class AppleCriticalAlertOptions { 10 | static const defaultName = 'default'; 11 | static const defaultVolume = 1.0; 12 | 13 | /// The name of the critical alert sound. 14 | final String? name; 15 | 16 | /// The volume of the critical alert sound. 17 | /// The volume ranges from 0.0 to 1.0, 18 | /// which indicates silent and full volume, respectively. 19 | final double? volume; 20 | 21 | AppleCriticalAlertOptions({ 22 | this.name = AppleCriticalAlertOptions.defaultName, 23 | this.volume = AppleCriticalAlertOptions.defaultVolume, 24 | }); 25 | 26 | Map toJson() => _$AppleCriticalAlertOptionsToJson(this); 27 | 28 | factory AppleCriticalAlertOptions.fromJson(Map json) => 29 | _$AppleCriticalAlertOptionsFromJson(json); 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/apple_critical_alert_options.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'apple_critical_alert_options.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | AppleCriticalAlertOptions _$AppleCriticalAlertOptionsFromJson( 10 | Map json) => 11 | AppleCriticalAlertOptions( 12 | name: json['name'] as String? ?? AppleCriticalAlertOptions.defaultName, 13 | volume: (json['volume'] as num?)?.toDouble() ?? 14 | AppleCriticalAlertOptions.defaultVolume, 15 | ); 16 | 17 | Map _$AppleCriticalAlertOptionsToJson( 18 | AppleCriticalAlertOptions instance) => 19 | { 20 | 'name': instance.name, 21 | 'volume': instance.volume, 22 | }; 23 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/message_change_logs.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'message_change_logs.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MessageChangeLogs _$MessageChangeLogsFromJson(Map json) => 10 | MessageChangeLogs( 11 | updatedMessages: json['updated'] == null 12 | ? [] 13 | : toRootMessageList(json['updated'] as List), 14 | deletedMessageIds: toDeletedMessageIds(json['deleted'] as List), 15 | hasMore: json['has_more'] as bool? ?? false, 16 | token: json['next'] as String?, 17 | ); 18 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/message_meta_array.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:collection/collection.dart'; 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'message_meta_array.g.dart'; 7 | 8 | /// Represents meta array of [BaseMessage]. 9 | @JsonSerializable() 10 | class MessageMetaArray { 11 | /// The meta array key. 12 | final String key; 13 | 14 | /// The meta array value. 15 | List value; 16 | 17 | MessageMetaArray({ 18 | required this.key, 19 | this.value = const [], 20 | }); 21 | 22 | factory MessageMetaArray.fromJson(Map json) => 23 | _$MessageMetaArrayFromJson(json); 24 | 25 | Map toJson() => _$MessageMetaArrayToJson(this); 26 | 27 | @override 28 | bool operator ==(other) { 29 | if (identical(other, this)) return true; 30 | 31 | final eq = const ListEquality().equals; 32 | return other is MessageMetaArray && 33 | other.key == key && 34 | eq(other.value, value); 35 | } 36 | 37 | @override 38 | int get hashCode => Object.hash( 39 | key, 40 | value, 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/message_meta_array.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'message_meta_array.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MessageMetaArray _$MessageMetaArrayFromJson(Map json) => 10 | MessageMetaArray( 11 | key: json['key'] as String, 12 | value: 13 | (json['value'] as List?)?.map((e) => e as String).toList() ?? 14 | const [], 15 | ); 16 | 17 | Map _$MessageMetaArrayToJson(MessageMetaArray instance) => 18 | { 19 | 'key': instance.key, 20 | 'value': instance.value, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/notification_data.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/core/message/base_message.dart'; 4 | 5 | /// The NotificationData class for [BaseMessage.notificationData]. 6 | /// @since 4.0.7 7 | class NotificationData { 8 | /// templateKey 9 | /// @since 4.0.7 10 | final String templateKey; 11 | 12 | /// templateVariables 13 | /// @since 4.0.8 14 | final Map templateVariables; 15 | 16 | /// label 17 | /// @since 4.0.7 18 | String? label; 19 | 20 | /// tags 21 | /// @since 4.0.8 22 | List tags; 23 | 24 | NotificationData({ 25 | required this.templateKey, 26 | required this.templateVariables, 27 | this.label, 28 | List? tags, 29 | }) : tags = tags ?? []; 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/public/main/model/message/unread_message_count.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat.dart'; 4 | 5 | /// The UnreadMessageCount class for [SendbirdChat.getTotalUnreadMessageCount]. 6 | /// @since 4.0.3 7 | class UnreadMessageCount { 8 | /// The total count of unread message count in all of group channels. 9 | final int totalCountForGroupChannels; 10 | 11 | /// The total count of unread message count in all of feed channels. 12 | final int totalCountForFeedChannels; 13 | 14 | /// Gets the number of unread message with subscribed custom type. 15 | Map totalCountByCustomType; 16 | 17 | UnreadMessageCount({ 18 | required this.totalCountForGroupChannels, 19 | required this.totalCountForFeedChannels, 20 | required this.totalCountByCustomType, 21 | }); 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/public/main/model/og/og_image.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'og_image.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | OGImage _$OGImageFromJson(Map json) => OGImage( 10 | url: json['url'] as String?, 11 | secureUrl: json['secure_url'] as String?, 12 | type: json['type'] as String?, 13 | alt: json['alt'] as String?, 14 | width: (json['width'] as num?)?.toInt() ?? 0, 15 | height: (json['height'] as num?)?.toInt() ?? 0, 16 | ); 17 | 18 | Map _$OGImageToJson(OGImage instance) => { 19 | 'url': instance.url, 20 | 'secure_url': instance.secureUrl, 21 | 'type': instance.type, 22 | 'alt': instance.alt, 23 | 'width': instance.width, 24 | 'height': instance.height, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/public/main/model/og/og_meta_data.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'og_meta_data.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | OGMetaData _$OGMetaDataFromJson(Map json) => OGMetaData( 10 | title: json['og:title'] as String?, 11 | url: json['og:url'] as String?, 12 | description: json['og:description'] as String?, 13 | ogImage: json['og:image'] == null 14 | ? null 15 | : OGImage.fromJson(json['og:image'] as Map), 16 | ); 17 | 18 | Map _$OGMetaDataToJson(OGMetaData instance) => 19 | { 20 | 'og:title': instance.title, 21 | 'og:url': instance.url, 22 | 'og:description': instance.description, 23 | 'og:image': instance.ogImage?.toJson(), 24 | }; 25 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_change_logs.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 5 | 6 | part 'poll_change_logs.g.dart'; 7 | 8 | /// The PollChangeLogs class. 9 | @JsonSerializable(createToJson: false) 10 | class PollChangeLogs { 11 | /// The updated polls. 12 | @JsonKey(defaultValue: [], name: 'updated') 13 | List? updatedPolls; 14 | 15 | /// The deleted poll IDs. 16 | @JsonKey(name: 'deleted') 17 | List? deletedPollIds; 18 | 19 | /// hasMore 20 | @JsonKey(defaultValue: false) 21 | final bool hasMore; 22 | 23 | /// [token] to get next changelogs. 24 | @JsonKey(name: 'next') 25 | String? token; 26 | 27 | static PollChangeLogs fromJson(Map json) => 28 | _$PollChangeLogsFromJson(json); 29 | 30 | PollChangeLogs({ 31 | this.updatedPolls, 32 | this.deletedPollIds, 33 | required this.hasMore, 34 | this.token, 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_change_logs.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'poll_change_logs.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | PollChangeLogs _$PollChangeLogsFromJson(Map json) => 10 | PollChangeLogs( 11 | updatedPolls: (json['updated'] as List?) 12 | ?.map((e) => Poll.fromJson(e as Map)) 13 | .toList() ?? 14 | [], 15 | deletedPollIds: (json['deleted'] as List?) 16 | ?.map((e) => (e as num).toDouble()) 17 | .toList(), 18 | hasMore: json['has_more'] as bool? ?? false, 19 | token: json['next'] as String?, 20 | ); 21 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_data.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'poll_data.g.dart'; 6 | 7 | /// Class representing data for poll. 8 | /// A poll may or may not have a data, which is an additional field used after user's vote. 9 | /// Currently this class only supports [text] data. 10 | @JsonSerializable() 11 | class PollData { 12 | /// Text data field. 13 | String text; 14 | 15 | PollData({this.text = ''}); 16 | 17 | factory PollData.fromJson(Map json) => 18 | _$PollDataFromJson(json); 19 | 20 | Map toJson() => _$PollDataToJson(this); 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_data.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'poll_data.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | PollData _$PollDataFromJson(Map json) => PollData( 10 | text: json['text'] as String? ?? '', 11 | ); 12 | 13 | Map _$PollDataToJson(PollData instance) => { 14 | 'text': instance.text, 15 | }; 16 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_option.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'poll_option.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | PollOption _$PollOptionFromJson(Map json) => PollOption( 10 | pollId: (json['poll_id'] as num).toInt(), 11 | id: (json['id'] as num).toInt(), 12 | text: json['text'] as String, 13 | createdBy: json['created_by'] as String?, 14 | createdAt: (json['created_at'] as num).toInt(), 15 | voteCount: (json['vote_count'] as num).toInt(), 16 | updatedAt: (json['updated_at'] as num).toInt(), 17 | ); 18 | 19 | Map _$PollOptionToJson(PollOption instance) => 20 | { 21 | 'poll_id': instance.pollId, 22 | 'id': instance.id, 23 | 'text': instance.text, 24 | 'created_by': instance.createdBy, 25 | 'created_at': instance.createdAt, 26 | 'vote_count': instance.voteCount, 27 | 'updated_at': instance.updatedAt, 28 | }; 29 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_update_event.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/handler/channel_handler.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 5 | 6 | /// Class representing an event that a [Poll] has been updated. 7 | /// This event will be passed to [GroupChannelHandler.onPollUpdated]. 8 | /// Once this event is received, the user must find cached messages 9 | /// that contain this poll and apply changes using [Poll.applyPollUpdateEvent]. 10 | class PollUpdateEvent { 11 | /// Id of the updated [Poll]. 12 | int pollId; 13 | 14 | /// Id of the message that contains the [Poll]. 15 | int messageId; 16 | 17 | Map json; 18 | 19 | PollUpdateEvent({ 20 | required this.pollId, 21 | required this.messageId, 22 | required this.json, 23 | }); 24 | 25 | factory PollUpdateEvent.fromJson(Map res) { 26 | return PollUpdateEvent( 27 | pollId: res['poll']['id'], 28 | messageId: res['poll']['message_id'], 29 | json: res, 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/public/main/model/poll/poll_vote_event.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/handler/channel_handler.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll.dart'; 5 | 6 | /// Class representing an event that one or more vote has been casted on a poll option. 7 | /// The affected poll may be in multiple channels. 8 | /// This event will be passed to [GroupChannelHandler.onPollVoted]. 9 | /// Once this event is received, the user must find cached messages 10 | /// that contain this poll and apply changes using [Poll.applyPollVoteEvent]. 11 | class PollVoteEvent { 12 | /// Id of the voted [Poll]. 13 | int pollId; 14 | 15 | /// Id of the message that contains the [Poll]. 16 | int messageId; 17 | 18 | Map json; 19 | 20 | PollVoteEvent({ 21 | required this.pollId, 22 | required this.messageId, 23 | required this.json, 24 | }); 25 | 26 | factory PollVoteEvent.fromJson(Map res) { 27 | return PollVoteEvent( 28 | pollId: res['poll_id'], 29 | messageId: res['message_id'], 30 | json: res, 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/public/main/model/reaction/reaction.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'reaction.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Reaction _$ReactionFromJson(Map json) => Reaction( 10 | key: json['key'] as String, 11 | userIds: (json['user_ids'] as List?) 12 | ?.map((e) => e as String) 13 | .toList() ?? 14 | [], 15 | updatedAt: (json['updated_at'] as num).toInt(), 16 | ); 17 | 18 | Map _$ReactionToJson(Reaction instance) => { 19 | 'key': instance.key, 20 | 'user_ids': instance.userIds, 21 | 'updated_at': instance.updatedAt, 22 | }; 23 | -------------------------------------------------------------------------------- /lib/src/public/main/model/reaction/reaction_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'reaction_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ReactionEvent _$ReactionEventFromJson(Map json) => 10 | ReactionEvent( 11 | channelType: $enumDecodeNullable( 12 | _$ChannelTypeEnumMap, json['channel_type'], 13 | unknownValue: ChannelType.group) ?? 14 | ChannelType.group, 15 | channelUrl: json['channel_url'] as String? ?? '', 16 | messageId: (json['msg_id'] as num?)?.toInt() ?? 0, 17 | key: json['reaction'] as String? ?? '', 18 | userId: json['user_id'] as String? ?? '', 19 | operation: $enumDecodeNullable( 20 | _$ReactionEventActionEnumMap, json['operation']) ?? 21 | ReactionEventAction.delete, 22 | updatedAt: (json['updated_at'] as num?)?.toInt() ?? 0, 23 | ); 24 | 25 | const _$ChannelTypeEnumMap = { 26 | ChannelType.group: 'group', 27 | ChannelType.open: 'open', 28 | ChannelType.feed: 'feed', 29 | }; 30 | 31 | const _$ReactionEventActionEnumMap = { 32 | ReactionEventAction.add: 'ADD', 33 | ReactionEventAction.delete: 'DELETE', 34 | }; 35 | -------------------------------------------------------------------------------- /lib/src/public/main/model/thread/thread_info.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'thread_info.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ThreadInfo _$ThreadInfoFromJson(Map json) => ThreadInfo( 10 | replyCount: (json['reply_count'] as num?)?.toInt() ?? 0, 11 | mostRepliesUsers: (json['most_replies'] as List?) 12 | ?.map((e) => User.fromJson(e as Map)) 13 | .toList() ?? 14 | const [], 15 | lastRepliedAt: (json['last_replied_at'] as num?)?.toInt() ?? 0, 16 | updatedAt: (json['updated_at'] as num?)?.toInt(), 17 | ); 18 | 19 | Map _$ThreadInfoToJson(ThreadInfo instance) => 20 | { 21 | 'reply_count': instance.replyCount, 22 | 'most_replies': instance.mostRepliesUsers.map((e) => e.toJson()).toList(), 23 | 'last_replied_at': instance.lastRepliedAt, 24 | 'updated_at': instance.updatedAt, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/public/main/model/thread/thread_info_updated_event.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/model/thread/thread_info.dart'; 6 | 7 | part 'thread_info_updated_event.g.dart'; 8 | 9 | /// Objects representing a thread info event. 10 | @JsonSerializable(createToJson: false) 11 | class ThreadInfoUpdateEvent { 12 | /// The [ThreadInfo] that has information about threaded messages. 13 | final ThreadInfo threadInfo; 14 | 15 | /// The unique ID of the message that has threaded replies and holds thread information. 16 | @JsonKey(name: 'parent_message_id') 17 | final int targetMessageId; 18 | 19 | /// The type of the channel where threaded messages belong. 20 | final ChannelType channelType; 21 | 22 | /// The unique URL of the channel where threaded messages belong. 23 | final String channelUrl; 24 | 25 | ThreadInfoUpdateEvent({ 26 | required this.threadInfo, 27 | required this.targetMessageId, 28 | required this.channelType, 29 | required this.channelUrl, 30 | }); 31 | 32 | factory ThreadInfoUpdateEvent.fromJson(Map json) => 33 | _$ThreadInfoUpdateEventFromJson(json); 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/public/main/model/thread/thread_info_updated_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'thread_info_updated_event.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ThreadInfoUpdateEvent _$ThreadInfoUpdateEventFromJson( 10 | Map json) => 11 | ThreadInfoUpdateEvent( 12 | threadInfo: 13 | ThreadInfo.fromJson(json['thread_info'] as Map), 14 | targetMessageId: (json['parent_message_id'] as num).toInt(), 15 | channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), 16 | channelUrl: json['channel_url'] as String, 17 | ); 18 | 19 | const _$ChannelTypeEnumMap = { 20 | ChannelType.group: 'group', 21 | ChannelType.open: 'open', 22 | ChannelType.feed: 'feed', 23 | }; 24 | -------------------------------------------------------------------------------- /lib/src/public/main/model/thread/threaded_messages.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/core/message/base_message.dart'; 4 | 5 | /// The ThreadedMessages class. 6 | class ThreadedMessages { 7 | /// Parent message of this thread. 8 | BaseMessage parentMessage; 9 | 10 | /// Retrieves the threaded replies in the thread 11 | List threadMessages; 12 | 13 | ThreadedMessages({ 14 | required this.parentMessage, 15 | required this.threadMessages, 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/feed_channel_change_logs_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | /// Represents a feed channel change logs params. 4 | /// @since 4.0.3 5 | class FeedChannelChangeLogsParams { 6 | /// Determines whether to include empty channels or not (channels without messages). 7 | /// Defaults to true. 8 | /// @since 4.0.3 9 | bool includeEmpty = true; 10 | 11 | Map toJson() { 12 | return { 13 | 'show_empty': includeEmpty, 14 | }; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/group_channel_change_logs_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart'; 4 | 5 | /// Represents a group channel change logs params. 6 | class GroupChannelChangeLogsParams { 7 | /// [GroupChannel] custom types filter. 8 | /// If this is null, the changelogs of all channels will be returned. 9 | List customTypes = []; 10 | 11 | /// Determines whether to include empty channels or not (channels without messages). 12 | /// Defaults to true. 13 | bool includeEmpty = true; 14 | 15 | /// Determines whether to include frozen channels or not. 16 | /// Defaults to true. 17 | bool includeFrozen = true; 18 | 19 | /// Whether to include chat notification channels in changelogs. 20 | /// @since 4.0.3 21 | bool includeChatNotification = false; 22 | 23 | Map toJson() { 24 | return { 25 | 'custom_type': customTypes, 26 | 'show_empty': includeEmpty, 27 | 'show_frozen': includeFrozen, 28 | 'include_chat_notification': includeChatNotification, 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/group_channel_total_unread_channel_count_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | 5 | /// Represents a group channel total unread channel count params. 6 | class GroupChannelTotalUnreadChannelCountParams { 7 | /// The channel custom types. 8 | List channelCustomTypes = []; 9 | 10 | /// The super channel filter. 11 | SuperChannelFilter superChannelFilter = SuperChannelFilter.all; 12 | } 13 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/group_channel_total_unread_message_count_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | 5 | /// Represents a group channel total unread message count params. 6 | class GroupChannelTotalUnreadMessageCountParams { 7 | /// The channel custom types. 8 | List channelCustomTypes = []; 9 | 10 | /// The super channel filter. 11 | SuperChannelFilter superChannelFilter = SuperChannelFilter.all; 12 | } 13 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/group_channel_update_params.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'group_channel_update_params.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | GroupChannelUpdateParams _$GroupChannelUpdateParamsFromJson( 10 | Map json) => 11 | GroupChannelUpdateParams() 12 | ..isPublic = json['is_public'] as bool? 13 | ..isDistinct = json['is_distinct'] as bool? 14 | ..isDiscoverable = json['is_discoverable'] as bool? 15 | ..accessCode = json['access_code'] as String? 16 | ..customType = json['custom_type'] as String? 17 | ..data = json['data'] as String? 18 | ..name = json['name'] as String? 19 | ..operatorUserIds = (json['operator_ids'] as List?) 20 | ?.map((e) => e as String) 21 | .toList(); 22 | 23 | Map _$GroupChannelUpdateParamsToJson( 24 | GroupChannelUpdateParams instance) => 25 | { 26 | 'is_public': instance.isPublic, 27 | 'is_distinct': instance.isDistinct, 28 | 'is_discoverable': instance.isDiscoverable, 29 | 'access_code': instance.accessCode, 30 | 'custom_type': instance.customType, 31 | 'data': instance.data, 32 | 'name': instance.name, 33 | 'operator_ids': instance.operatorUserIds, 34 | }; 35 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/open_channel_create_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/model/info/file_info.dart'; 5 | 6 | part 'open_channel_create_params.g.dart'; 7 | 8 | /// Represents a open channel params. 9 | @JsonSerializable() 10 | class OpenChannelCreateParams { 11 | /// The channel url of the channel. 12 | String? channelUrl; 13 | 14 | /// The name of the channel. 15 | String? name; 16 | 17 | /// The custom type of the channel. 18 | String? customType; 19 | 20 | /// The data of the channel. 21 | String? data; 22 | 23 | /// The cover image file info. 24 | @JsonKey(includeFromJson: false, includeToJson: false) 25 | FileInfo? coverImage; 26 | 27 | /// The operator user ids of the channel. Defaults to null. 28 | @JsonKey(name: 'operator_ids') 29 | List? operatorUserIds; 30 | 31 | static OpenChannelCreateParams fromJson(Map json) { 32 | return _$OpenChannelCreateParamsFromJson(json); 33 | } 34 | 35 | Map toJson() { 36 | final json = _$OpenChannelCreateParamsToJson(this); 37 | if (coverImage != null && coverImage!.hasBinary) { 38 | json['cover_file'] = coverImage; 39 | } else { 40 | json['cover_url'] = coverImage?.fileUrl; 41 | } 42 | 43 | json.removeWhere((key, value) => value == null); 44 | return json; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/open_channel_create_params.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'open_channel_create_params.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | OpenChannelCreateParams _$OpenChannelCreateParamsFromJson( 10 | Map json) => 11 | OpenChannelCreateParams() 12 | ..channelUrl = json['channel_url'] as String? 13 | ..name = json['name'] as String? 14 | ..customType = json['custom_type'] as String? 15 | ..data = json['data'] as String? 16 | ..operatorUserIds = (json['operator_ids'] as List?) 17 | ?.map((e) => e as String) 18 | .toList(); 19 | 20 | Map _$OpenChannelCreateParamsToJson( 21 | OpenChannelCreateParams instance) => 22 | { 23 | 'channel_url': instance.channelUrl, 24 | 'name': instance.name, 25 | 'custom_type': instance.customType, 26 | 'data': instance.data, 27 | 'operator_ids': instance.operatorUserIds, 28 | }; 29 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/open_channel_update_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/model/info/file_info.dart'; 5 | 6 | part 'open_channel_update_params.g.dart'; 7 | 8 | /// Represents a open channel update params. 9 | @JsonSerializable() 10 | class OpenChannelUpdateParams { 11 | /// The name of the channel. 12 | String? name; 13 | 14 | /// The custom type of the channel. 15 | String? customType; 16 | 17 | /// The data of the channel. 18 | String? data; 19 | 20 | /// The cover image file info. 21 | @JsonKey(includeFromJson: false, includeToJson: false) 22 | FileInfo? coverImage; 23 | 24 | /// The operator user ids of the channel. Defaults to null. 25 | @JsonKey(name: 'operator_ids') 26 | List? operatorUserIds; 27 | 28 | static OpenChannelUpdateParams fromJson(Map json) { 29 | return _$OpenChannelUpdateParamsFromJson(json); 30 | } 31 | 32 | Map toJson() { 33 | final json = _$OpenChannelUpdateParamsToJson(this); 34 | if (coverImage != null && coverImage!.hasBinary) { 35 | json['cover_file'] = coverImage; 36 | } else { 37 | json['cover_url'] = coverImage?.fileUrl; 38 | } 39 | 40 | json.removeWhere((key, value) => value == null); 41 | return json; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/src/public/main/params/channel/open_channel_update_params.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'open_channel_update_params.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | OpenChannelUpdateParams _$OpenChannelUpdateParamsFromJson( 10 | Map json) => 11 | OpenChannelUpdateParams() 12 | ..name = json['name'] as String? 13 | ..customType = json['custom_type'] as String? 14 | ..data = json['data'] as String? 15 | ..operatorUserIds = (json['operator_ids'] as List?) 16 | ?.map((e) => e as String) 17 | .toList(); 18 | 19 | Map _$OpenChannelUpdateParamsToJson( 20 | OpenChannelUpdateParams instance) => 21 | { 22 | 'name': instance.name, 23 | 'custom_type': instance.customType, 24 | 'data': instance.data, 25 | 'operator_ids': instance.operatorUserIds, 26 | }; 27 | -------------------------------------------------------------------------------- /lib/src/public/main/params/message/file_message_update_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/sendbird_chat_sdk.dart'; 4 | 5 | /// Represents a file message params. 6 | class FileMessageUpdateParams extends BaseMessageUpdateParams { 7 | FileMessageUpdateParams({ 8 | String? data, 9 | String? customType, 10 | MentionType? mentionType, 11 | List? mentionedUserIds, 12 | }) : super( 13 | data: data, 14 | customType: customType, 15 | mentionType: mentionType, 16 | mentionedUserIds: mentionedUserIds, 17 | ); 18 | 19 | // withMessage 20 | FileMessageUpdateParams.withMessage(FileMessage fileMessage) 21 | : super.withMessage(fileMessage); 22 | 23 | @override 24 | Map toJson() { 25 | final ret = super.toJson(); 26 | 27 | ret.removeWhere((key, value) => value == null); 28 | return ret; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/public/main/params/message/message_change_logs_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/params/message/base_message_fetch_params.dart'; 6 | 7 | part 'message_change_logs_params.g.dart'; 8 | 9 | /// An object consists a set of parameters to retrieve message's change log 10 | @JsonSerializable() 11 | class MessageChangeLogParams extends BaseMessageFetchParams { 12 | static MessageChangeLogParams fromJson(Map json) { 13 | return _$MessageChangeLogParamsFromJson(json); 14 | } 15 | 16 | @override 17 | Map toJson() => _$MessageChangeLogParamsToJson(this); 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/public/main/params/message/message_retrieval_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 5 | import 'package:sendbird_chat_sdk/src/public/main/params/message/base_message_fetch_params.dart'; 6 | 7 | part 'message_retrieval_params.g.dart'; 8 | 9 | /// An object consists a set of parameters to retrieve information from a message. 10 | @JsonSerializable() 11 | class MessageRetrievalParams extends BaseMessageFetchParams { 12 | /// The [ChannelType]. 13 | ChannelType channelType; 14 | 15 | /// The channel url. 16 | String channelUrl; 17 | 18 | /// The message ID. 19 | int messageId; 20 | 21 | MessageRetrievalParams({ 22 | required this.channelType, 23 | required this.channelUrl, 24 | required this.messageId, 25 | }); 26 | 27 | static MessageRetrievalParams fromJson(Map json) { 28 | return _$MessageRetrievalParamsFromJson(json); 29 | } 30 | 31 | @override 32 | Map toJson() { 33 | final json = super.toJson(); 34 | json.addAll(_$MessageRetrievalParamsToJson(this)); 35 | json.removeWhere((key, value) => value == null); 36 | return json; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/src/public/main/params/message/scheduled_message_list_query_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | 5 | /// Params for creating a [ScheduledMessageListQuery] object. 6 | class ScheduledMessageListQueryParams { 7 | /// The scheduled messages in specified channel will be retrieved. Defaults to null. 8 | String? channelUrl; 9 | 10 | /// Determines whether to list the retrieved messages in reverse order. Defaults to false. 11 | bool? reverse = false; 12 | 13 | /// The target scheduled status of the scheduled messages to be retrieved. Defaults to null. 14 | List? scheduledStatus; 15 | 16 | /// Message type filter of scheduled messages. Defaults to [MessageTypeFilter.all]. 17 | MessageTypeFilter? messageTypeFilter = MessageTypeFilter.all; 18 | 19 | /// The result order of scheduled messages. Defaults to [ScheduledMessageListQueryOrder.createdAt]. 20 | ScheduledMessageListQueryOrder? order = 21 | ScheduledMessageListQueryOrder.createdAt; 22 | 23 | /// The maximum number of items per queried page. 24 | int? limit; 25 | 26 | ScheduledMessageListQueryParams({ 27 | this.channelUrl, 28 | this.reverse, 29 | this.scheduledStatus, 30 | this.messageTypeFilter, 31 | this.order, 32 | this.limit, 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/public/main/params/message/scheduled_message_retrieval_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | /// Represents a params for retrieving a single scheduled message. 4 | class ScheduledMessageRetrievalParams { 5 | /// The channel url. 6 | final String channelUrl; 7 | 8 | /// The scheduled message ID. 9 | final int scheduledMessageId; 10 | 11 | ScheduledMessageRetrievalParams({ 12 | required this.channelUrl, 13 | required this.scheduledMessageId, 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /lib/src/public/main/params/message/total_scheduled_message_count_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | 5 | /// Represents a params for retrieving total scheduled message. 6 | class TotalScheduledMessageCountParams { 7 | /// The channel url. 8 | String? channelUrl; 9 | 10 | /// The scheduled status. Refer to [ScheduledStatus] 11 | List? scheduledStatus; 12 | 13 | /// The message type. Refer to [MessageTypeFilter] 14 | MessageTypeFilter? messageTypeFilter; 15 | 16 | TotalScheduledMessageCountParams({ 17 | this.channelUrl, 18 | this.scheduledStatus, 19 | this.messageTypeFilter, 20 | }); 21 | 22 | Map toJson() { 23 | var statusList = []; 24 | if (scheduledStatus != null) { 25 | for (final val in scheduledStatus!) { 26 | statusList.add(val.toString().split('.').last); 27 | } 28 | } 29 | 30 | final ret = { 31 | 'channel_url': channelUrl, 32 | 'status': statusList.isEmpty ? null : statusList, 33 | 'message_type': messageTypeFilter?.toString().split('.').last, 34 | }; 35 | 36 | ret.removeWhere((key, value) => value == null); 37 | return ret; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/src/public/main/params/notifications/notification_template_list_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/query/base_query.dart'; 4 | 5 | /// Params for retrieving Notification template list. 6 | /// @since 4.0.3 7 | class NotificationTemplateListParams { 8 | /// The key filter to retrieve only selected templates with given keys. Defaults to null. 9 | /// @since 4.0.3 10 | final List? keys; 11 | 12 | /// Whether the result is set to be reversed or not. Defaults to false. 13 | /// @since 4.0.3 14 | final bool reverse; 15 | 16 | /// The maximum number of items per queried page. 17 | /// @since 4.0.3 18 | final int limit; 19 | 20 | NotificationTemplateListParams({ 21 | this.keys, 22 | this.reverse = false, 23 | this.limit = BaseQuery.defaultQueryLimit, 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_create_params.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'poll_create_params.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | PollCreateParams _$PollCreateParamsFromJson(Map json) => 10 | PollCreateParams( 11 | title: json['title'] as String, 12 | optionTexts: 13 | (json['options'] as List).map((e) => e as String).toList(), 14 | data: json['data'] == null 15 | ? null 16 | : PollData.fromJson(json['data'] as Map), 17 | allowUserSuggestion: json['allow_user_suggestion'] as bool?, 18 | allowMultipleVotes: json['allow_multiple_votes'] as bool?, 19 | closeAt: (json['close_at'] as num?)?.toInt() ?? -1, 20 | ); 21 | 22 | Map _$PollCreateParamsToJson(PollCreateParams instance) => 23 | { 24 | 'title': instance.title, 25 | 'options': instance.optionTexts, 26 | 'data': instance.data?.toJson(), 27 | 'allow_user_suggestion': instance.allowUserSuggestion, 28 | 'allow_multiple_votes': instance.allowMultipleVotes, 29 | 'close_at': instance.closeAt, 30 | }; 31 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_list_query_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/query/poll/poll_list_query.dart'; 5 | 6 | /// Params for creating a [PollListQuery] object. 7 | class PollListQueryParams { 8 | /// The [ChannelType] of the channel you want to get polls from. 9 | ChannelType channelType; 10 | 11 | /// The channel url of the channel you want to get polls from. 12 | String channelUrl; 13 | 14 | /// The maximum number of items per queried page. 15 | /// The default value for the [limit] parameter is `10`. 16 | int? limit; 17 | 18 | PollListQueryParams({ 19 | required this.channelType, 20 | required this.channelUrl, 21 | this.limit, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_option_retrieval_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | 5 | /// Parameters for retrieving poll option. 6 | /// A poll option should be 7 | /// specified by the [pollId] of the poll that the option belongs to and [pollOptionId] of the 8 | /// option, and the [channelUrl] of the channel that the poll specified by [pollId] belongs 9 | /// to. 10 | class PollOptionRetrievalParams { 11 | /// The ID of the poll of this option. 12 | int pollId; 13 | 14 | /// The ID of the pollOption to get. 15 | int pollOptionId; 16 | 17 | /// The channel type of the channel this poll belongs to. 18 | ChannelType channelType; 19 | 20 | /// The url of the channel this poll belongs to. 21 | String channelUrl; 22 | 23 | PollOptionRetrievalParams({ 24 | required this.pollId, 25 | required this.pollOptionId, 26 | required this.channelType, 27 | required this.channelUrl, 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_retrieval_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | 5 | /// Parameters for retrieving poll operations. 6 | /// For poll retrieval, [pollId], [channelType] and [channelUrl] 7 | /// are required and all other members are optional. 8 | class PollRetrievalParams { 9 | /// The ID of the poll retrieved from server. 10 | int pollId; 11 | 12 | /// The channel type of the channel containing the poll. 13 | ChannelType channelType; 14 | 15 | /// The url of the channel containing the poll. 16 | String channelUrl; 17 | 18 | PollRetrievalParams({ 19 | required this.pollId, 20 | required this.channelType, 21 | required this.channelUrl, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_update_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/model/poll/poll_data.dart'; 5 | 6 | part 'poll_update_params.g.dart'; 7 | 8 | /// Parameters for updating poll operations. All members are optional. 9 | @JsonSerializable() 10 | class PollUpdateParams { 11 | /// Title of the poll. 12 | String? title; 13 | 14 | /// An additional json data to accompany the poll. 15 | PollData? data; 16 | 17 | /// Whether to allow user-suggested options 18 | bool? allowUserSuggestion; 19 | 20 | /// Whether to allow multiple vote casting 21 | bool? allowMultipleVotes; 22 | 23 | /// Unix timestamp at which the poll has closed or will close (second) 24 | int closeAt = -1; 25 | 26 | PollUpdateParams({ 27 | this.title, 28 | this.data, 29 | this.allowUserSuggestion, 30 | this.allowMultipleVotes, 31 | this.closeAt = -1, 32 | }); 33 | 34 | static PollUpdateParams fromJson(Map json) { 35 | return _$PollUpdateParamsFromJson(json); 36 | } 37 | 38 | Map toJson() { 39 | return _$PollUpdateParamsToJson(this); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_update_params.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'poll_update_params.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | PollUpdateParams _$PollUpdateParamsFromJson(Map json) => 10 | PollUpdateParams( 11 | title: json['title'] as String?, 12 | data: json['data'] == null 13 | ? null 14 | : PollData.fromJson(json['data'] as Map), 15 | allowUserSuggestion: json['allow_user_suggestion'] as bool?, 16 | allowMultipleVotes: json['allow_multiple_votes'] as bool?, 17 | closeAt: (json['close_at'] as num?)?.toInt() ?? -1, 18 | ); 19 | 20 | Map _$PollUpdateParamsToJson(PollUpdateParams instance) => 21 | { 22 | 'title': instance.title, 23 | 'data': instance.data?.toJson(), 24 | 'allow_user_suggestion': instance.allowUserSuggestion, 25 | 'allow_multiple_votes': instance.allowMultipleVotes, 26 | 'close_at': instance.closeAt, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/src/public/main/params/poll/poll_voter_list_query_params.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart'; 4 | import 'package:sendbird_chat_sdk/src/public/main/query/poll/poll_voter_list_query.dart'; 5 | 6 | /// Params for creating a [PollVoterListQuery] object. 7 | class PollVoterListQueryParams { 8 | /// A unique identifier for the poll which contains this poll option. 9 | int pollId; 10 | 11 | /// A unique identifier for this poll option. 12 | int pollOptionId; 13 | 14 | /// The type of the channel that this poll belongs to. 15 | ChannelType channelType; 16 | 17 | /// The url of the channel that this poll belongs to. 18 | String channelUrl; 19 | 20 | /// The maximum number of items per queried page. 21 | /// The default value for [limit] is 20. 22 | int? limit; 23 | 24 | PollVoterListQueryParams({ 25 | required this.pollId, 26 | required this.pollOptionId, 27 | required this.channelType, 28 | required this.channelUrl, 29 | this.limit, 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/public/main/query/base_query.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Sendbird, Inc. All rights reserved. 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:sendbird_chat_sdk/src/internal/main/chat/chat.dart'; 5 | 6 | /// Abstract class for query 7 | abstract class BaseQuery { 8 | static const defaultQueryLimit = 20; 9 | // Default value is different from other queries because this query's limit max is 20 10 | static const defaultPollListQueryLimit = 10; 11 | 12 | /// Whether the current query is in communication progress with server. 13 | @JsonKey(includeFromJson: false, includeToJson: false) 14 | bool isLoading = false; 15 | 16 | /// Whether there is a next page. 17 | bool hasNext = true; 18 | 19 | /// The maximum number of items per queried page. 20 | int limit = defaultQueryLimit; 21 | 22 | String? token; 23 | 24 | @JsonKey(includeFromJson: false, includeToJson: false) 25 | final Chat chat; 26 | 27 | BaseQuery({required this.chat}); 28 | 29 | /// Gets the list of next items. 30 | Future next(); 31 | } 32 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sendbird_chat_sdk 2 | description: With Sendbird Chat for Flutter, you can easily build an in-app chat with all the essential messaging features. 3 | version: 4.3.2 4 | homepage: https://sendbird.com 5 | repository: https://github.com/sendbird/sendbird-chat-sdk-flutter 6 | documentation: https://sendbird.com/docs/chat/sdk/v4/flutter/getting-started/send-first-message 7 | 8 | environment: 9 | sdk: '>=2.19.0 <4.0.0' 10 | flutter: '>=3.7.0' 11 | 12 | platforms: 13 | android: 14 | ios: 15 | web: 16 | 17 | dependencies: 18 | flutter: 19 | sdk: flutter 20 | collection: ^1.17.0 21 | uuid: '>=3.0.7 <5.0.0' 22 | json_annotation: ^4.8.1 23 | encrypt: ^5.0.1 24 | shared_preferences: ^2.2.2 25 | http: '>=0.13.6 <2.0.0' 26 | logger: '>=1.4.0 <3.0.0' 27 | mime: '>=1.0.4 <3.0.0' 28 | connectivity_plus: '>=5.0.1 <7.0.0' 29 | http_parser: ^4.0.2 30 | web_socket_channel: '>=2.4.0 <4.0.0' 31 | universal_io: ^2.2.0 32 | async: ^2.10.0 33 | isar: ^3.1.0+1 34 | isar_flutter_libs: ^3.1.0+1 35 | path_provider: ^2.1.1 36 | path: ^1.8.2 37 | 38 | dev_dependencies: 39 | flutter_test: 40 | sdk: flutter 41 | flutter_lints: '>=2.0.1 <6.0.0' 42 | test: ^1.22.0 43 | stack_trace: ^1.11.0 44 | json_serializable: ^6.6.2 45 | build_runner: ^2.3.3 46 | isar_generator: ^3.1.0+1 47 | --------------------------------------------------------------------------------