From cbdc3f803d4d8f29866ec450601819e8e73614b3 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Tue, 19 Apr 2022 13:54:27 +0200 Subject: [PATCH] Add extension function for authenticateWithQuickConnect that takes the secret directly (#382) --- jellyfin-api/api/jellyfin-api.api | 1 + .../sdk/api/client/extensions/UserApiExtensions.kt | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/jellyfin-api/api/jellyfin-api.api b/jellyfin-api/api/jellyfin-api.api index a5e4322d2..c0087c2d7 100644 --- a/jellyfin-api/api/jellyfin-api.api +++ b/jellyfin-api/api/jellyfin-api.api @@ -203,6 +203,7 @@ public final class org/jellyfin/sdk/api/client/extensions/ApiClientExtensionsKt public final class org/jellyfin/sdk/api/client/extensions/UserApiExtensionsKt { public static final fun authenticateUserByName (Lorg/jellyfin/sdk/api/operations/UserApi;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun authenticateWithQuickConnect (Lorg/jellyfin/sdk/api/operations/UserApi;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class org/jellyfin/sdk/api/client/util/ApiSerializer { diff --git a/jellyfin-api/src/commonMain/kotlin/org/jellyfin/sdk/api/client/extensions/UserApiExtensions.kt b/jellyfin-api/src/commonMain/kotlin/org/jellyfin/sdk/api/client/extensions/UserApiExtensions.kt index ab93644db..fb29edab9 100644 --- a/jellyfin-api/src/commonMain/kotlin/org/jellyfin/sdk/api/client/extensions/UserApiExtensions.kt +++ b/jellyfin-api/src/commonMain/kotlin/org/jellyfin/sdk/api/client/extensions/UserApiExtensions.kt @@ -4,16 +4,28 @@ import org.jellyfin.sdk.api.client.Response import org.jellyfin.sdk.api.operations.UserApi import org.jellyfin.sdk.model.api.AuthenticateUserByName import org.jellyfin.sdk.model.api.AuthenticationResult +import org.jellyfin.sdk.model.api.QuickConnectDto /** * Extension function for the authenticateUserByName operation that accepts the username and password directly */ public suspend inline fun UserApi.authenticateUserByName( username: String, - password: String + password: String, ): Response = authenticateUserByName( data = AuthenticateUserByName( username = username, pw = password ) ) + +/** + * Extension function for the authenticateWithQuickConnect operation that accepts the secret directly + */ +public suspend inline fun UserApi.authenticateWithQuickConnect( + secret: String, +): Response = authenticateWithQuickConnect( + data = QuickConnectDto( + secret = secret + ) +)