GraphQLResponseConverter

class GraphQLResponseConverter<T : Any>(type: Type, codec: GraphQLTransportCodec) : Converter<ResponseBody, T> (source)

Backend-neutral GraphQL response body converter.

GraphQLResponseConverter is the neutral counterpart of the legacy GraphResponseConverter. It delegates deserialization entirely to a GraphQLTransportCodec and never references a JSON backend.

Type and body forwarding

The raw response body string and the complete Java Type of the response as declared by the Retrofit method (for example GraphQLResponse<GetCurrentUserData>) are forwarded to GraphQLTransportCodec.decodeResponse so the codec can resolve the parameterized data serializer.

Failure behavior

Parameters

type

The complete Java reflection Type of the response, including generic arguments, as provided by Retrofit.

codec

The explicit GraphQLTransportCodec used to deserialize bodies.

Type Parameters

T

The decoded response type, typically co.anitrend.retrofit.graphql.model.GraphQLResponse of a data type.

See also

GraphQLConverterFactory

Constructors

Link copied to clipboard
constructor(type: Type, codec: GraphQLTransportCodec)

Functions

Link copied to clipboard
open override fun convert(responseBody: ResponseBody): T

Converts a raw ResponseBody into a decoded GraphQL response.