ChannelMessagesGetRequest(- {required ChannelType channelType,
- required String channelUrl,
- required Map<String, dynamic> params,
- int timestamp = 0,
- int messageId = 0,
- int parentMessageId = 0}
)
Implementation
ChannelMessagesGetRequest({
required this.channelType,
required String channelUrl,
required Map<String, dynamic> params,
int timestamp = 0,
int messageId = 0,
int parentMessageId = 0,
}) : super() {
if (messageId <= 0 && timestamp <= 0) {
throw InvalidParameterError();
}
url = '${channelType.urlString}/$channelUrl/messages';
queryParams = params;
queryParams['is_sdk'] = true;
if (messageId > 0) {
queryParams['message_id'] = messageId;
} else {
queryParams['message_ts'] = timestamp;
}
if (parentMessageId > 0) {
queryParams['root_message_id'] = parentMessageId;
}
}