From a9acff7a95ffc3678d0c2edc2bdaa40b9079e84f Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Wed, 5 Oct 2022 19:12:04 +0200 Subject: [PATCH] feat: update example projects --- ktorfit-lib/api/android/ktorfit-lib.api | 93 +++++-------------------- ktorfit-lib/api/jvm/ktorfit-lib.api | 93 +++++-------------------- 2 files changed, 32 insertions(+), 154 deletions(-) diff --git a/ktorfit-lib/api/android/ktorfit-lib.api b/ktorfit-lib/api/android/ktorfit-lib.api index 38937b6f4..1c2231fe6 100644 --- a/ktorfit-lib/api/android/ktorfit-lib.api +++ b/ktorfit-lib/api/android/ktorfit-lib.api @@ -15,12 +15,11 @@ public abstract interface class de/jensklingenberg/ktorfit/Callback { } public final class de/jensklingenberg/ktorfit/Ktorfit { - public fun (Ljava/lang/String;Lio/ktor/client/HttpClient;)V - public synthetic fun (Ljava/lang/String;Lio/ktor/client/HttpClient;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Lio/ktor/client/HttpClient;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Lio/ktor/client/HttpClient;Ljava/util/Set;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getBaseUrl ()Ljava/lang/String; public final fun getHttpClient ()Lio/ktor/client/HttpClient; public final fun getRequestConverters ()Ljava/util/Set; + public final fun getSuspendResponseConverters ()Ljava/util/Set; } public final class de/jensklingenberg/ktorfit/Ktorfit$Builder { @@ -34,7 +33,7 @@ public final class de/jensklingenberg/ktorfit/Ktorfit$Builder { public final fun httpClient (Lio/ktor/client/engine/HttpClientEngineFactory;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; public final fun httpClient (Lio/ktor/client/engine/HttpClientEngineFactory;Lkotlin/jvm/functions/Function1;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; public final fun httpClient (Lkotlin/jvm/functions/Function1;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; - public final fun requestConverter ([Lde/jensklingenberg/ktorfit/converter/RequestConverter;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; + public final fun responseConverter ([Lde/jensklingenberg/ktorfit/converter/request/CoreResponseConverter;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; } public final class de/jensklingenberg/ktorfit/KtorfitKt { @@ -46,85 +45,29 @@ public final class de/jensklingenberg/ktorfit/TypeInfoExtKt { public static final fun upperBoundType (Lio/ktor/util/reflect/TypeInfo;)Lio/ktor/util/reflect/TypeInfo; } -public abstract interface class de/jensklingenberg/ktorfit/converter/CoreResponseConverter { - public abstract fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;)Z +public abstract interface class de/jensklingenberg/ktorfit/converter/SuspendResponseConverter : de/jensklingenberg/ktorfit/converter/request/CoreResponseConverter { + public abstract fun wrapSuspendResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public abstract class de/jensklingenberg/ktorfit/converter/KtorfitPlugin : io/ktor/client/plugins/HttpClientPlugin { +public final class de/jensklingenberg/ktorfit/converter/builtin/CallResponseConverter : de/jensklingenberg/ktorfit/converter/SuspendResponseConverter, de/jensklingenberg/ktorfit/converter/request/ResponseConverter { public fun ()V - public abstract fun convert (Lio/ktor/util/reflect/TypeInfo;Ljava/lang/Object;Lio/ktor/client/statement/HttpResponse;)Lkotlin/Pair; - public abstract fun getClass ()Lkotlin/reflect/KClass; - public fun getKey ()Lio/ktor/util/AttributeKey; - public abstract fun getKey ()Ljava/lang/String; - public fun install (Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler;Lio/ktor/client/HttpClient;)V - public synthetic fun install (Ljava/lang/Object;Lio/ktor/client/HttpClient;)V - public fun prepare (Lkotlin/jvm/functions/Function1;)Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler; - public synthetic fun prepare (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public fun returnWhenException (Ljava/lang/Exception;)Ljava/lang/Object; -} - -public final class de/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler { - public fun (Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;)V - public synthetic fun (Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Lkotlin/jvm/functions/Function1; - public final fun component2 ()Lkotlin/reflect/KClass; - public final fun copy (Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;)Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler; - public static synthetic fun copy$default (Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler;Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;ILjava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler; - public fun equals (Ljava/lang/Object;)Z - public final fun getClazz ()Lkotlin/reflect/KClass; - public final fun getOnError ()Lkotlin/jvm/functions/Function1; - public fun hashCode ()I - public final fun setOnError (Lkotlin/jvm/functions/Function1;)V - public fun toString ()Ljava/lang/String; -} - -public abstract interface class de/jensklingenberg/ktorfit/converter/RequestConverter : de/jensklingenberg/ktorfit/converter/CoreResponseConverter { - public abstract fun convertRequest (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/CallPlugin : de/jensklingenberg/ktorfit/converter/KtorfitPlugin { - public fun ()V - public fun convert (Lio/ktor/util/reflect/TypeInfo;Ljava/lang/Object;Lio/ktor/client/statement/HttpResponse;)Lkotlin/Pair; - public fun getClass ()Lkotlin/reflect/KClass; - public fun getKey ()Ljava/lang/String; - public fun returnWhenException (Ljava/lang/Exception;)Ljava/lang/Object; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/FlowRequestConverter : de/jensklingenberg/ktorfit/converter/RequestConverter { - public fun ()V - public fun convertRequest (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; - public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;)Z + public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;Z)Z + public fun wrapResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; + public fun wrapSuspendResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public final class de/jensklingenberg/ktorfit/converter/builtin/KtorfitCallRequestConverter : de/jensklingenberg/ktorfit/converter/RequestConverter { +public final class de/jensklingenberg/ktorfit/converter/builtin/FlowResponseConverter : de/jensklingenberg/ktorfit/converter/request/ResponseConverter { public fun ()V - public fun convertRequest (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; - public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;)Z + public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;Z)Z + public fun wrapResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; } -public abstract class de/jensklingenberg/ktorfit/converter/builtin/Response { - public static final field Companion Lde/jensklingenberg/ktorfit/converter/builtin/Response$Companion; +public abstract interface class de/jensklingenberg/ktorfit/converter/request/CoreResponseConverter { + public abstract fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;Z)Z } -public final class de/jensklingenberg/ktorfit/converter/builtin/Response$Companion { - public final fun error (Ljava/lang/Throwable;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Error; - public final fun success (Ljava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/Response$Error : de/jensklingenberg/ktorfit/converter/builtin/Response { - public fun (Ljava/lang/Throwable;)V - public final fun getEx ()Ljava/lang/Throwable; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/Response$Success : de/jensklingenberg/ktorfit/converter/builtin/Response { - public fun (Ljava/lang/Object;)V - public final fun component1 ()Ljava/lang/Object; - public final fun copy (Ljava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success; - public static synthetic fun copy$default (Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success;Ljava/lang/Object;ILjava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success; - public fun equals (Ljava/lang/Object;)Z - public final fun getData ()Ljava/lang/Object; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; +public abstract interface class de/jensklingenberg/ktorfit/converter/request/ResponseConverter : de/jensklingenberg/ktorfit/converter/request/CoreResponseConverter { + public abstract fun wrapResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; } public final class de/jensklingenberg/ktorfit/internal/FieldData { @@ -166,10 +109,6 @@ public final class de/jensklingenberg/ktorfit/internal/KtorfitClient { public final fun requestBuilder (Lio/ktor/client/request/HttpRequestBuilder;Lde/jensklingenberg/ktorfit/internal/RequestData;)V } -public final class de/jensklingenberg/ktorfit/internal/KtorfitClientKt { - public static final fun getKtorfitErrorHandlers (Lio/ktor/client/HttpClient;)Ljava/util/List; -} - public final class de/jensklingenberg/ktorfit/internal/PathData { public fun (Ljava/lang/String;Ljava/lang/String;Z)V public final fun component1 ()Ljava/lang/String; diff --git a/ktorfit-lib/api/jvm/ktorfit-lib.api b/ktorfit-lib/api/jvm/ktorfit-lib.api index f13bbc34e..0797bad6e 100644 --- a/ktorfit-lib/api/jvm/ktorfit-lib.api +++ b/ktorfit-lib/api/jvm/ktorfit-lib.api @@ -8,12 +8,11 @@ public abstract interface class de/jensklingenberg/ktorfit/Callback { } public final class de/jensklingenberg/ktorfit/Ktorfit { - public fun (Ljava/lang/String;Lio/ktor/client/HttpClient;)V - public synthetic fun (Ljava/lang/String;Lio/ktor/client/HttpClient;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Lio/ktor/client/HttpClient;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Lio/ktor/client/HttpClient;Ljava/util/Set;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getBaseUrl ()Ljava/lang/String; public final fun getHttpClient ()Lio/ktor/client/HttpClient; public final fun getRequestConverters ()Ljava/util/Set; + public final fun getSuspendResponseConverters ()Ljava/util/Set; } public final class de/jensklingenberg/ktorfit/Ktorfit$Builder { @@ -27,7 +26,7 @@ public final class de/jensklingenberg/ktorfit/Ktorfit$Builder { public final fun httpClient (Lio/ktor/client/engine/HttpClientEngineFactory;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; public final fun httpClient (Lio/ktor/client/engine/HttpClientEngineFactory;Lkotlin/jvm/functions/Function1;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; public final fun httpClient (Lkotlin/jvm/functions/Function1;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; - public final fun requestConverter ([Lde/jensklingenberg/ktorfit/converter/RequestConverter;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; + public final fun responseConverter ([Lde/jensklingenberg/ktorfit/converter/request/CoreResponseConverter;)Lde/jensklingenberg/ktorfit/Ktorfit$Builder; } public final class de/jensklingenberg/ktorfit/KtorfitKt { @@ -39,85 +38,29 @@ public final class de/jensklingenberg/ktorfit/TypeInfoExtKt { public static final fun upperBoundType (Lio/ktor/util/reflect/TypeInfo;)Lio/ktor/util/reflect/TypeInfo; } -public abstract interface class de/jensklingenberg/ktorfit/converter/CoreResponseConverter { - public abstract fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;)Z +public abstract interface class de/jensklingenberg/ktorfit/converter/SuspendResponseConverter : de/jensklingenberg/ktorfit/converter/request/CoreResponseConverter { + public abstract fun wrapSuspendResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public abstract class de/jensklingenberg/ktorfit/converter/KtorfitPlugin : io/ktor/client/plugins/HttpClientPlugin { +public final class de/jensklingenberg/ktorfit/converter/builtin/CallResponseConverter : de/jensklingenberg/ktorfit/converter/SuspendResponseConverter, de/jensklingenberg/ktorfit/converter/request/ResponseConverter { public fun ()V - public abstract fun convert (Lio/ktor/util/reflect/TypeInfo;Ljava/lang/Object;Lio/ktor/client/statement/HttpResponse;)Lkotlin/Pair; - public abstract fun getClass ()Lkotlin/reflect/KClass; - public fun getKey ()Lio/ktor/util/AttributeKey; - public abstract fun getKey ()Ljava/lang/String; - public fun install (Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler;Lio/ktor/client/HttpClient;)V - public synthetic fun install (Ljava/lang/Object;Lio/ktor/client/HttpClient;)V - public fun prepare (Lkotlin/jvm/functions/Function1;)Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler; - public synthetic fun prepare (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public fun returnWhenException (Ljava/lang/Exception;)Ljava/lang/Object; -} - -public final class de/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler { - public fun (Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;)V - public synthetic fun (Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Lkotlin/jvm/functions/Function1; - public final fun component2 ()Lkotlin/reflect/KClass; - public final fun copy (Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;)Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler; - public static synthetic fun copy$default (Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler;Lkotlin/jvm/functions/Function1;Lkotlin/reflect/KClass;ILjava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/KtorfitPluginErrorHandler; - public fun equals (Ljava/lang/Object;)Z - public final fun getClazz ()Lkotlin/reflect/KClass; - public final fun getOnError ()Lkotlin/jvm/functions/Function1; - public fun hashCode ()I - public final fun setOnError (Lkotlin/jvm/functions/Function1;)V - public fun toString ()Ljava/lang/String; -} - -public abstract interface class de/jensklingenberg/ktorfit/converter/RequestConverter : de/jensklingenberg/ktorfit/converter/CoreResponseConverter { - public abstract fun convertRequest (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/CallPlugin : de/jensklingenberg/ktorfit/converter/KtorfitPlugin { - public fun ()V - public fun convert (Lio/ktor/util/reflect/TypeInfo;Ljava/lang/Object;Lio/ktor/client/statement/HttpResponse;)Lkotlin/Pair; - public fun getClass ()Lkotlin/reflect/KClass; - public fun getKey ()Ljava/lang/String; - public fun returnWhenException (Ljava/lang/Exception;)Ljava/lang/Object; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/FlowRequestConverter : de/jensklingenberg/ktorfit/converter/RequestConverter { - public fun ()V - public fun convertRequest (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; - public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;)Z + public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;Z)Z + public fun wrapResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; + public fun wrapSuspendResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public final class de/jensklingenberg/ktorfit/converter/builtin/KtorfitCallRequestConverter : de/jensklingenberg/ktorfit/converter/RequestConverter { +public final class de/jensklingenberg/ktorfit/converter/builtin/FlowResponseConverter : de/jensklingenberg/ktorfit/converter/request/ResponseConverter { public fun ()V - public fun convertRequest (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; - public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;)Z + public fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;Z)Z + public fun wrapResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; } -public abstract class de/jensklingenberg/ktorfit/converter/builtin/Response { - public static final field Companion Lde/jensklingenberg/ktorfit/converter/builtin/Response$Companion; +public abstract interface class de/jensklingenberg/ktorfit/converter/request/CoreResponseConverter { + public abstract fun supportedType (Lde/jensklingenberg/ktorfit/internal/TypeData;Z)Z } -public final class de/jensklingenberg/ktorfit/converter/builtin/Response$Companion { - public final fun error (Ljava/lang/Throwable;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Error; - public final fun success (Ljava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/Response$Error : de/jensklingenberg/ktorfit/converter/builtin/Response { - public fun (Ljava/lang/Throwable;)V - public final fun getEx ()Ljava/lang/Throwable; -} - -public final class de/jensklingenberg/ktorfit/converter/builtin/Response$Success : de/jensklingenberg/ktorfit/converter/builtin/Response { - public fun (Ljava/lang/Object;)V - public final fun component1 ()Ljava/lang/Object; - public final fun copy (Ljava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success; - public static synthetic fun copy$default (Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success;Ljava/lang/Object;ILjava/lang/Object;)Lde/jensklingenberg/ktorfit/converter/builtin/Response$Success; - public fun equals (Ljava/lang/Object;)Z - public final fun getData ()Ljava/lang/Object; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; +public abstract interface class de/jensklingenberg/ktorfit/converter/request/ResponseConverter : de/jensklingenberg/ktorfit/converter/request/CoreResponseConverter { + public abstract fun wrapResponse (Lde/jensklingenberg/ktorfit/internal/TypeData;Lkotlin/jvm/functions/Function1;Lde/jensklingenberg/ktorfit/Ktorfit;)Ljava/lang/Object; } public final class de/jensklingenberg/ktorfit/internal/FieldData { @@ -159,10 +102,6 @@ public final class de/jensklingenberg/ktorfit/internal/KtorfitClient { public final fun requestBuilder (Lio/ktor/client/request/HttpRequestBuilder;Lde/jensklingenberg/ktorfit/internal/RequestData;)V } -public final class de/jensklingenberg/ktorfit/internal/KtorfitClientKt { - public static final fun getKtorfitErrorHandlers (Lio/ktor/client/HttpClient;)Ljava/util/List; -} - public final class de/jensklingenberg/ktorfit/internal/PathData { public fun (Ljava/lang/String;Ljava/lang/String;Z)V public final fun component1 ()Ljava/lang/String;