getContact method

  1. @override
Future<DOOContact> getContact()
override

Gets contact of current DOO client instance

Implementation

@override
Future<DOOContact> getContact() async {
  try {
    final createResponse = await _dio.get(
        "/public/api/v1/inboxes/${DOOClientApiInterceptor.INTERCEPTOR_INBOX_IDENTIFIER_PLACEHOLDER}/contacts/${DOOClientApiInterceptor.INTERCEPTOR_CONTACT_IDENTIFIER_PLACEHOLDER}");
    if ((createResponse.statusCode ?? 0).isBetween(199, 300)) {
      return DOOContact.fromJson(createResponse.data);
    } else {
      throw DOOClientException(
          createResponse.statusMessage ?? "unknown error",
          DOOClientExceptionType.GET_CONTACT_FAILED);
    }
  } on DioException catch (e) {
    throw DOOClientException(
        e.message!, DOOClientExceptionType.GET_CONTACT_FAILED);
  }
}