getPreferences returns an object, with a single property preferences which is a reference to app.bsky.actor.defs#preferences
The definition of app.bsky.actor.defs#preferences is an array type with items of union type.
However, this is the generated response object:
@Serializable
public data class GetPreferencesResponse(
public val preferences: PreferencesUnion,
)
As you can see, the preferences field is not an array of PreferencesUnion, but a single union instead. Trying to call getPreferences from the generated XrpcBlueskyApi naturally results in an exception:
io.ktor.serialization.JsonConvertException: Illegal input: Expected class kotlinx.serialization.json.JsonObject as the serialized body of app.bsky.actor.PreferencesUnion, but had class kotlinx.serialization.json.JsonArray
getPreferences
returns an object, with a single propertypreferences
which is a reference toapp.bsky.actor.defs#preferences
The definition ofapp.bsky.actor.defs#preferences
is an array type with items of union type. However, this is the generated response object:As you can see, the preferences field is not an array of
PreferencesUnion
, but a single union instead. Trying to callgetPreferences
from the generated XrpcBlueskyApi naturally results in an exception: