updateMessage method

  1. @override
Future<RuutMessage> updateMessage(
  1. String messageIdentifier,
  2. dynamic update
)
override

Update message with id messageIdentifier with contents of update

Implementation

@override
Future<RuutMessage> updateMessage(
    String messageIdentifier, update) async {
  try {
    final updateResponse = await _dio.patch(
        "/public/api/v1/inboxes/${RuutChatClientApiInterceptor.INTERCEPTOR_INBOX_IDENTIFIER_PLACEHOLDER}/contacts/${RuutChatClientApiInterceptor.INTERCEPTOR_CONTACT_IDENTIFIER_PLACEHOLDER}/conversations/${RuutChatClientApiInterceptor.INTERCEPTOR_CONVERSATION_IDENTIFIER_PLACEHOLDER}/messages/$messageIdentifier",
        data: update);
    if ((updateResponse.statusCode ?? 0).isBetween(199, 300)) {
      return RuutMessage.fromJson(updateResponse.data);
    } else {
      throw RuutClientException(
          updateResponse.statusMessage ?? "unknown error",
          RuutClientExceptionType.UPDATE_MESSAGE_FAILED);
    }
  } on DioException catch (e) {
    throw RuutClientException(
        e.message ?? '', RuutClientExceptionType.UPDATE_MESSAGE_FAILED);
  }
}