Update @OptIn annotations (#368)

This commit is contained in:
Niels van Velzen 2022-04-08 19:28:35 +02:00 committed by GitHub
parent a56bdbf340
commit 18c9883818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -20,7 +20,6 @@ import org.jellyfin.sdk.model.socket.IncomingSocketMessage
import org.jellyfin.sdk.model.socket.OutgoingSocketMessage
import org.jellyfin.sdk.model.socket.RawIncomingSocketMessage
@OptIn(InternalSerializationApi::class)
public object ApiSerializer {
private const val SOCKET_MESSAGE_DATA = "Data"
private const val SOCKET_MESSAGE_MESSAGE_ID = "MessageId"
@ -37,6 +36,7 @@ public object ApiSerializer {
encodeDefaults = true
}
@OptIn(InternalSerializationApi::class)
public fun encodeRequestBody(requestBody: Any? = null): String? {
if (requestBody == null) return null
@ -49,7 +49,7 @@ public object ApiSerializer {
else -> json.decodeFromString(responseBody.readRemaining().readText())
}
@OptIn(ExperimentalSerializationApi::class)
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
public fun encodeSocketMessage(message: OutgoingSocketMessage): String {
// Serialize with default serializer
val serializer = message::class.serializer() as KSerializer<Any>

View File

@ -12,7 +12,6 @@ import org.jellyfin.openapi.hooks.TypePath
* In the 10.7 API specification the value of the map is incorrectly labelled as not-null.
* This hook changes the type to the exact type emitted from the 10.8 alpha API specification.
*/
@OptIn(ExperimentalStdlibApi::class)
class DisplayPreferencesDtoNullabilityFixHook : TypeBuilderHook {
override fun onBuildType(path: TypePath, schema: Schema<*>, typeBuilder: OpenApiTypeBuilder) = when (path) {
ModelTypePath("DisplayPreferencesDto", "customPrefs") -> typeNameOf<Map<String, String?>>()