mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
add middlewares
This commit is contained in:
parent
a7f4ab36c6
commit
b5b7482c2f
@ -312,37 +312,6 @@ public abstract interface class dev/inmo/tgbotapi/bot/ktor/KtorCallFactory {
|
||||
public abstract fun makeCall (Lio/ktor/client/HttpClient;Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlinx/serialization/json/Json;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public abstract interface class dev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder$Companion;
|
||||
public abstract fun onAfterCallFactoryMakeCall (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestException (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestResultAbsent (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestResultPresented (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestReturnResult (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder$Companion : dev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder {
|
||||
public fun onAfterCallFactoryMakeCall (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestException (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultAbsent (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultPresented (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestReturnResult (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder$DefaultImpls {
|
||||
public static fun onAfterCallFactoryMakeCall (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestException (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestResultAbsent (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestResultPresented (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestReturnResult (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutorBuilder {
|
||||
public fun <init> (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;)V
|
||||
public final fun build ()Ldev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor;
|
||||
@ -351,15 +320,16 @@ public final class dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutorBuilder {
|
||||
public final fun getExcludeDefaultFactories ()Z
|
||||
public final fun getJsonFormatter ()Lkotlinx/serialization/json/Json;
|
||||
public final fun getLogger ()Ldev/inmo/kslog/common/KSLog;
|
||||
public final fun getPipelineStepsHolder ()Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;
|
||||
public final fun getPipelineStepsHolder ()Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;
|
||||
public final fun getRequestsLimiter ()Ldev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;
|
||||
public final fun getTelegramAPIUrlsKeeper ()Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;
|
||||
public final fun includeMiddlewares (Lkotlin/jvm/functions/Function1;)V
|
||||
public final fun setCallsFactories (Ljava/util/List;)V
|
||||
public final fun setClient (Lio/ktor/client/HttpClient;)V
|
||||
public final fun setExcludeDefaultFactories (Z)V
|
||||
public final fun setJsonFormatter (Lkotlinx/serialization/json/Json;)V
|
||||
public final fun setLogger (Ldev/inmo/kslog/common/KSLog;)V
|
||||
public final fun setPipelineStepsHolder (Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;)V
|
||||
public final fun setPipelineStepsHolder (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;)V
|
||||
public final fun setRequestsLimiter (Ldev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;)V
|
||||
public final fun setTelegramAPIUrlsKeeper (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;)V
|
||||
}
|
||||
@ -374,8 +344,39 @@ public final class dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutorFactoriesKt {
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutorKt {
|
||||
public static final fun KtorRequestsExecutor (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Lio/ktor/client/HttpClient;Ljava/util/List;ZLdev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;Lkotlinx/serialization/json/Json;Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ldev/inmo/kslog/common/KSLog;)Ldev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor;
|
||||
public static synthetic fun KtorRequestsExecutor$default (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Lio/ktor/client/HttpClient;Ljava/util/List;ZLdev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;Lkotlinx/serialization/json/Json;Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;Ldev/inmo/kslog/common/KSLog;ILjava/lang/Object;)Ldev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor;
|
||||
public static final fun KtorRequestsExecutor (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Lio/ktor/client/HttpClient;Ljava/util/List;ZLdev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;Lkotlinx/serialization/json/Json;Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ldev/inmo/kslog/common/KSLog;)Ldev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor;
|
||||
public static synthetic fun KtorRequestsExecutor$default (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Lio/ktor/client/HttpClient;Ljava/util/List;ZLdev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;Lkotlinx/serialization/json/Json;Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ldev/inmo/kslog/common/KSLog;ILjava/lang/Object;)Ldev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor;
|
||||
}
|
||||
|
||||
public abstract interface class dev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler$Companion;
|
||||
public abstract fun onAfterCallFactoryMakeCall (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestException (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestResultAbsent (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestResultPresented (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun onRequestReturnResult-3t6e044 (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler$Companion : dev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler {
|
||||
public fun onAfterCallFactoryMakeCall (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestException (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultAbsent (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultPresented (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestReturnResult-3t6e044 (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler$DefaultImpls {
|
||||
public static fun onAfterCallFactoryMakeCall (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestException (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestResultAbsent (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestResultPresented (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static fun onRequestReturnResult-3t6e044 (Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public abstract class dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory : dev/inmo/tgbotapi/bot/ktor/KtorCallFactory {
|
||||
@ -414,7 +415,7 @@ public final class dev/inmo/tgbotapi/bot/ktor/base/MultipartRequestCallFactory :
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/base/MultipleClientKtorRequestsExecutor : dev/inmo/tgbotapi/bot/BaseRequestsExecutor {
|
||||
public fun <init> (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Ljava/util/List;ZLdev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;Lkotlinx/serialization/json/Json;Ldev/inmo/tgbotapi/bot/ktor/KtorPipelineStepsHolder;ILdev/inmo/kslog/common/KSLog;Lkotlin/jvm/functions/Function0;)V
|
||||
public fun <init> (Ldev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper;Ljava/util/List;ZLdev/inmo/tgbotapi/bot/settings/limiters/RequestLimiter;Lkotlinx/serialization/json/Json;Ldev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler;ILdev/inmo/kslog/common/KSLog;Lkotlin/jvm/functions/Function0;)V
|
||||
public fun close ()V
|
||||
public fun execute (Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
@ -425,6 +426,75 @@ public final class dev/inmo/tgbotapi/bot/ktor/base/SimpleRequestCallFactory : de
|
||||
public synthetic fun <init> (Ldev/inmo/kslog/common/KSLog;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware : dev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware$Companion;
|
||||
public fun <init> ()V
|
||||
public fun <init> (Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function5;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;)V
|
||||
public synthetic fun <init> (Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function5;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun onAfterCallFactoryMakeCall (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestException (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultAbsent (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultPresented (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestReturnResult-3t6e044 (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware$Companion {
|
||||
public final fun build (Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware$ResultAbsence : java/lang/Throwable {
|
||||
public static final field INSTANCE Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware$ResultAbsence;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewareBuilder {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewareBuilder$Companion;
|
||||
public fun <init> ()V
|
||||
public final fun build ()Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware;
|
||||
public final fun getOnAfterCallFactoryMakeCall ()Lkotlin/jvm/functions/Function4;
|
||||
public final fun getOnBeforeCallFactoryMakeCall ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getOnBeforeSearchCallFactory ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getOnRequestException ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getOnRequestResultAbsent ()Lkotlin/jvm/functions/Function3;
|
||||
public final fun getOnRequestResultPresented ()Lkotlin/jvm/functions/Function5;
|
||||
public final fun getOnRequestReturnResult ()Lkotlin/jvm/functions/Function4;
|
||||
public final fun setOnAfterCallFactoryMakeCall (Lkotlin/jvm/functions/Function4;)V
|
||||
public final fun setOnBeforeCallFactoryMakeCall (Lkotlin/jvm/functions/Function3;)V
|
||||
public final fun setOnBeforeSearchCallFactory (Lkotlin/jvm/functions/Function3;)V
|
||||
public final fun setOnRequestException (Lkotlin/jvm/functions/Function3;)V
|
||||
public final fun setOnRequestResultAbsent (Lkotlin/jvm/functions/Function3;)V
|
||||
public final fun setOnRequestResultPresented (Lkotlin/jvm/functions/Function5;)V
|
||||
public final fun setOnRequestReturnResult (Lkotlin/jvm/functions/Function4;)V
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewareBuilder$Companion {
|
||||
public final fun from (Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewaresPipelinesHandler : dev/inmo/tgbotapi/bot/ktor/TelegramBotPipelinesHandler {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewaresPipelinesHandler$Companion;
|
||||
public fun <init> (Ljava/util/List;)V
|
||||
public fun onAfterCallFactoryMakeCall (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeCallFactoryMakeCall (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onBeforeSearchCallFactory (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestException (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultAbsent (Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestResultPresented (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ldev/inmo/tgbotapi/bot/ktor/KtorCallFactory;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun onRequestReturnResult-3t6e044 (Ljava/lang/Object;Ldev/inmo/tgbotapi/requests/abstracts/Request;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewaresPipelinesHandler$Builder {
|
||||
public fun <init> ()V
|
||||
public final fun addMiddleware (Lkotlin/jvm/functions/Function1;)Z
|
||||
public final fun build ()Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewaresPipelinesHandler;
|
||||
public final fun getMiddlewares ()Ljava/util/List;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewaresPipelinesHandler$Companion {
|
||||
public final fun build (Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddlewaresPipelinesHandler;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/bot/multiserver/SimpleMultiServerRequestsExecutor : dev/inmo/tgbotapi/bot/RequestsExecutor {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/bot/multiserver/SimpleMultiServerRequestsExecutor$Companion;
|
||||
public fun <init> (Ljava/util/List;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function0;)V
|
||||
|
@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.bot.ktor
|
||||
import dev.inmo.kslog.common.KSLog
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.bot.ktor.base.*
|
||||
import dev.inmo.tgbotapi.bot.ktor.middlewares.TelegramBotMiddlewaresPipelinesHandler
|
||||
import dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter
|
||||
import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
@ -28,6 +29,10 @@ class KtorRequestsExecutorBuilder(
|
||||
var logger: KSLog = DefaultKTgBotAPIKSLog
|
||||
var pipelineStepsHolder: TelegramBotPipelinesHandler = TelegramBotPipelinesHandler
|
||||
|
||||
fun includeMiddlewares(block: TelegramBotMiddlewaresPipelinesHandler.Builder.() -> Unit) {
|
||||
pipelineStepsHolder = TelegramBotMiddlewaresPipelinesHandler.build(block)
|
||||
}
|
||||
|
||||
fun build() = KtorRequestsExecutor(
|
||||
telegramAPIUrlsKeeper,
|
||||
client,
|
||||
|
@ -68,7 +68,7 @@ interface TelegramBotPipelinesHandler {
|
||||
result: Result<T>,
|
||||
request: Request<T>,
|
||||
callsFactories: List<KtorCallFactory>
|
||||
): Result<T> = result.getOrThrow()
|
||||
): Result<T> = result
|
||||
|
||||
companion object : TelegramBotPipelinesHandler
|
||||
}
|
||||
|
@ -4,6 +4,22 @@ import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
||||
import dev.inmo.tgbotapi.bot.ktor.TelegramBotPipelinesHandler
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
|
||||
/**
|
||||
* @param onRequestException Will be called when some exception happen during [Request] handling. Non-null result of
|
||||
* lambda will be used as the result of request handling
|
||||
* @param onBeforeSearchCallFactory Will be called when telegram bot starts to choose which [KtorCallFactory] will handle
|
||||
* [Request]
|
||||
* @param onBeforeCallFactoryMakeCall Will be called when telegram bot trying to use [KtorCallFactory] as potential
|
||||
* handler for [Request]
|
||||
* @param onAfterCallFactoryMakeCall Will be called when [KtorCallFactory] made call. Non-null result of
|
||||
* lambda will be used as the result of request handling
|
||||
* @param onRequestResultPresented Will be called when [KtorCallFactory] **or** [TelegramBotPipelinesHandler]/[TelegramBotMiddleware]
|
||||
* returned non-null result. Non-null result of lambda will be used as the result of request handling
|
||||
* @param onRequestResultAbsent Will be called when some there is no any result of [Request] handling. Non-null result of
|
||||
* lambda will be used as the result of request handling
|
||||
* @param onRequestReturnResult Latest lambda before result returning. Will be called after all previous stages.
|
||||
* Non-null result of lambda will be used as the result of request handling
|
||||
*/
|
||||
class TelegramBotMiddleware(
|
||||
internal val onRequestException: (suspend (request: Request<*>, t: Throwable?) -> Any?)? = null,
|
||||
internal val onBeforeSearchCallFactory: (suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Unit)? = null,
|
||||
|
@ -8,15 +8,21 @@ class TelegramBotMiddlewaresPipelinesHandler(
|
||||
private val middlewares: List<TelegramBotMiddleware>
|
||||
) : TelegramBotPipelinesHandler {
|
||||
override suspend fun <T : Any> onRequestException(request: Request<T>, t: Throwable): T? {
|
||||
return super.onRequestException(request, t)
|
||||
return middlewares.firstNotNullOfOrNull {
|
||||
it.onRequestException(request, t)
|
||||
} ?: super.onRequestException(request, t)
|
||||
}
|
||||
|
||||
override suspend fun onBeforeSearchCallFactory(request: Request<*>, callsFactories: List<KtorCallFactory>) {
|
||||
super.onBeforeSearchCallFactory(request, callsFactories)
|
||||
middlewares.forEach {
|
||||
it.onBeforeSearchCallFactory(request, callsFactories)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun onBeforeCallFactoryMakeCall(request: Request<*>, potentialFactory: KtorCallFactory) {
|
||||
super.onBeforeCallFactoryMakeCall(request, potentialFactory)
|
||||
middlewares.forEach {
|
||||
it.onBeforeCallFactoryMakeCall(request, potentialFactory)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> onAfterCallFactoryMakeCall(
|
||||
@ -24,7 +30,9 @@ class TelegramBotMiddlewaresPipelinesHandler(
|
||||
request: Request<T>,
|
||||
potentialFactory: KtorCallFactory
|
||||
): T? {
|
||||
return super.onAfterCallFactoryMakeCall(result, request, potentialFactory)
|
||||
return middlewares.firstNotNullOfOrNull {
|
||||
it.onAfterCallFactoryMakeCall(result, request, potentialFactory)
|
||||
} ?: super.onAfterCallFactoryMakeCall(result, request, potentialFactory)
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> onRequestResultPresented(
|
||||
@ -33,14 +41,18 @@ class TelegramBotMiddlewaresPipelinesHandler(
|
||||
resultCallFactory: KtorCallFactory,
|
||||
callsFactories: List<KtorCallFactory>
|
||||
): T? {
|
||||
return super.onRequestResultPresented(result, request, resultCallFactory, callsFactories)
|
||||
return middlewares.firstNotNullOfOrNull {
|
||||
it.onRequestResultPresented(result, request, resultCallFactory, callsFactories)
|
||||
} ?: super.onRequestResultPresented(result, request, resultCallFactory, callsFactories)
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> onRequestResultAbsent(
|
||||
request: Request<T>,
|
||||
callsFactories: List<KtorCallFactory>
|
||||
): T? {
|
||||
return super.onRequestResultAbsent(request, callsFactories)
|
||||
return middlewares.firstNotNullOfOrNull {
|
||||
it.onRequestResultAbsent(request, callsFactories)
|
||||
} ?: super.onRequestResultAbsent(request, callsFactories)
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> onRequestReturnResult(
|
||||
@ -48,6 +60,27 @@ class TelegramBotMiddlewaresPipelinesHandler(
|
||||
request: Request<T>,
|
||||
callsFactories: List<KtorCallFactory>
|
||||
): Result<T> {
|
||||
return super.onRequestReturnResult(result, request, callsFactories)
|
||||
return middlewares.firstNotNullOfOrNull {
|
||||
it.onRequestReturnResult(result, request, callsFactories).takeIf {
|
||||
it.onFailure { return@takeIf it !is TelegramBotMiddleware.ResultAbsence }
|
||||
true
|
||||
}
|
||||
} ?: super.onRequestReturnResult(result, request, callsFactories)
|
||||
}
|
||||
|
||||
class Builder {
|
||||
val middlewares = mutableListOf<TelegramBotMiddleware>()
|
||||
|
||||
fun addMiddleware(block: TelegramBotMiddlewareBuilder.() -> Unit) = middlewares.add(
|
||||
TelegramBotMiddleware.build(block)
|
||||
)
|
||||
|
||||
fun build(): TelegramBotMiddlewaresPipelinesHandler = TelegramBotMiddlewaresPipelinesHandler(
|
||||
middlewares.toList()
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun build(block: Builder.() -> Unit) = Builder().apply(block).build()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user