All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.ktor.client.call.Compatibility.kt Maven / Gradle / Ivy

Go to download

Ktor is a framework for quickly creating web applications in Kotlin with minimal effort.

There is a newer version: 2.2.4
Show newest version
/*
 * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
 */

package io.ktor.client.call

import io.ktor.client.statement.*
import io.ktor.util.reflect.*

/**
 * Tries to receive the payload of the [response] as a specific type [T].
 *
 * @throws NoTransformationFoundException If no transformation is found for the type [T].
 * @throws DoubleReceiveException If already called [receive].
 */
@Deprecated("Use `body` method instead", replaceWith = ReplaceWith("this.body()"), level = DeprecationLevel.ERROR)
public suspend inline fun  HttpClientCall.receive(): T = error("Use `body` method instead")

/**
 * Tries to receive the payload of the [response] as a specific type [T].
 *
 * @throws NoTransformationFoundException If no transformation is found for the type [T].
 * @throws DoubleReceiveException If already called [receive].
 */
@Deprecated("Use `body` method instead", replaceWith = ReplaceWith("this.body()"), level = DeprecationLevel.ERROR)
public suspend inline fun  HttpResponse.receive(): T = error("Use `body` method instead")

/**
 * Tries to receive the payload of the [response] as a specific expected type provided in [info].
 * Returns [response] if [info] corresponds to [HttpResponse].
 *
 * @throws NoTransformationFoundException If no transformation is found for the type [info].
 * @throws DoubleReceiveException If already called [receive].
 */
@Suppress("UNUSED_PARAMETER")
@Deprecated("Use `body` method instead", replaceWith = ReplaceWith("this.body(info)"), level = DeprecationLevel.ERROR)
public suspend fun HttpClientCall.receive(info: TypeInfo): Any = error("Use `body` method instead")




© 2015 - 2024 Weber Informatics LLC | Privacy Policy