Any> request( target: Target, decoder: Decoder<ResultType>, completion: (Result<ResultType, NetworkError>) -> Unit) { val url = this.platform.createURLFromString(target.baseURL + target.path) ?: return val success = { res: Data -> val obj: ResultType = decoder.decode(res) completion(Result.Success(obj)) } val err = { error: NetworkError -> completion(Result.Failure(error)) } this.platform.request(url, target.method, target.task.data, success, err) } }