fix(llc): use channel partial update for slowmode

This commit is contained in:
Salvatore Giordano
2021-07-30 11:48:23 +02:00
parent 28695fb9d8
commit b989fbc3ad
3 changed files with 16 additions and 16 deletions
@@ -834,7 +834,7 @@ class Channel {
} }
/// Enable slow mode /// Enable slow mode
Future<UpdateChannelResponse> enableSlowMode({ Future<PartialUpdateChannelResponse> enableSlowMode({
required int cooldownInterval, required int cooldownInterval,
}) async { }) async {
_checkInitialized(); _checkInitialized();
@@ -842,7 +842,7 @@ class Channel {
} }
/// Disable slow mode /// Disable slow mode
Future<UpdateChannelResponse> disableSlowMode() async { Future<PartialUpdateChannelResponse> disableSlowMode() async {
_checkInitialized(); _checkInitialized();
return _client.disableSlowdown(id!, type); return _client.disableSlowdown(id!, type);
} }
@@ -1248,7 +1248,7 @@ class StreamChatClient {
); );
/// Enables slow mode /// Enables slow mode
Future<UpdateChannelResponse> enableSlowdown( Future<PartialUpdateChannelResponse> enableSlowdown(
String channelId, String channelId,
String channelType, String channelType,
int cooldown, int cooldown,
@@ -1260,7 +1260,7 @@ class StreamChatClient {
); );
/// Disables slow mode /// Disables slow mode
Future<UpdateChannelResponse> disableSlowdown( Future<PartialUpdateChannelResponse> disableSlowdown(
String channelId, String channelId,
String channelType, String channelType,
) async => ) async =>
@@ -124,32 +124,32 @@ class ChannelApi {
} }
/// Enable slowdown /// Enable slowdown
Future<UpdateChannelResponse> enableSlowdown( Future<PartialUpdateChannelResponse> enableSlowdown(
String channelId, String channelId,
String channelType, String channelType,
int cooldown, int cooldown,
) async { ) async {
final response = await _client.post( final response = await updateChannelPartial(
_getChannelUrl(channelId, channelType), channelId,
data: { channelType,
set: {
'cooldown': cooldown, 'cooldown': cooldown,
}, },
); );
return UpdateChannelResponse.fromJson(response.data); return response;
} }
/// Disable slowdown /// Disable slowdown
Future<UpdateChannelResponse> disableSlowdown( Future<PartialUpdateChannelResponse> disableSlowdown(
String channelId, String channelId,
String channelType, String channelType,
) async { ) async {
final response = await _client.post( final response = await updateChannelPartial(
_getChannelUrl(channelId, channelType), channelId,
data: { channelType,
'cooldown': 0, unset: ['cooldown'],
},
); );
return UpdateChannelResponse.fromJson(response.data); return response;
} }
/// Accept invitation to the channel /// Accept invitation to the channel