createMessage method
Sends message to DOO inbox
Implementation
@override
Future<DOOMessage> createMessage(DOONewMessageRequest request) async {
try {
final createResponse = await _dio.post(
"/public/api/v1/inboxes/${DOOClientApiInterceptor.INTERCEPTOR_INBOX_IDENTIFIER_PLACEHOLDER}/contacts/${DOOClientApiInterceptor.INTERCEPTOR_CONTACT_IDENTIFIER_PLACEHOLDER}/conversations/${DOOClientApiInterceptor.INTERCEPTOR_CONVERSATION_IDENTIFIER_PLACEHOLDER}/messages",
data: request.toJson());
if ((createResponse.statusCode ?? 0).isBetween(199, 300)) {
return DOOMessage.fromJson(createResponse.data);
} else {
throw DOOClientException(
createResponse.statusMessage ?? "unknown error",
DOOClientExceptionType.SEND_MESSAGE_FAILED);
}
} on DioException catch (e) {
throw DOOClientException(
e.message!, DOOClientExceptionType.SEND_MESSAGE_FAILED);
}
}