package com.doverfuelingsolutions.issp.api

import com.doverfuelingsolutions.issp.api.dto.DFSResult
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.ResponseBody
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine

class ApiUtil {

    companion object {

        private val coroutineScope = CoroutineScope(Dispatchers.IO)

        suspend fun parseResponse(responseBody: ResponseBody) = suspendCoroutine<String> {
            coroutineScope.launch(Dispatchers.IO) {
                it.resume(responseBody.string())
            }
        }
    }
}