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

commonMain.com.lt.lazy_people_http.call.adapter.SuspendHook.kt Maven / Gradle / Ivy

package com.lt.lazy_people_http.call.adapter

import com.lt.lazy_people_http.call.Call
import com.lt.lazy_people_http.config.LazyPeopleHttpConfig
import com.lt.lazy_people_http.request.RequestInfo

/**
 * creator: lt  2023/6/28  [email protected]
 * effect : 用于hook suspend过程
 * warning:
 * [T]接口声明的返回值类型
 */
interface SuspendHook {
    /**
     * 是否hook
     */
    fun whetherToHook(
        config: LazyPeopleHttpConfig,
        info: RequestInfo
    ): Boolean

    /**
     * hook suspend过程
     */
    suspend fun hook(
        config: LazyPeopleHttpConfig,
        info: RequestInfo,
        call: Call,
        callFunction: suspend (LazyPeopleHttpConfig, RequestInfo) -> T,
    ): T
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy