updateMessage method

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

Update message with id messageIdentifier with contents of update

Implementation

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