feat(llc): add additional parameters to channel.truncate

This commit is contained in:
Salvatore Giordano
2022-04-12 11:29:40 +02:00
parent 432579e04b
commit 58536e56c0
4 changed files with 48 additions and 11 deletions
@@ -265,10 +265,18 @@ class ChannelApi {
/// Removes all messages from the channel
Future<EmptyResponse> truncateChannel(
String channelId,
String channelType,
) async {
String channelType, {
Message? message,
bool? skipPush,
DateTime? truncatedAt,
}) async {
final response = await _client.post(
'${_getChannelUrl(channelId, channelType)}/truncate',
data: {
if (message != null) 'message': message,
if (skipPush != null) 'skip_push': skipPush,
if (truncatedAt != null) 'truncated_at': truncatedAt,
},
);
return EmptyResponse.fromJson(response.data);
}