safe Api Call
Extension function to safe wrap an api call and parse possible errors codes.
Return
Returns subclass of sealed class ApiResult
ApiResult.Success
ApiResult.EmptySuccess -> Returns if api call was successful emitResult is set to false.
ApiResult.GenericError -> Returns if a generic error occurred during execution of the api call or parsing of the call's response.
ApiResult.NetworkError -> Returns if a network error occurred\
Parameters
Type of the object which the (successful) response should be parsed to
CoroutinesDispatcher to handle exceptions
Boolean which decides whether a successful response should contain an object as ApiResult.Success or should be returned as ApiResult.EmptySuccess
Suspend function representing an api call which should be executed in a safe wrap