GraphQl CustomType适配器-货币类型

时间:2019-03-10 13:59:06

标签: android kotlin graphql currency custom-adapter

Can't map GraphQL type: Currency to: Object.java

我已经创建了一个自定义类型适配器,但是我不完全知道如何映射标量Currency,而我目前得到的响应是creditBalance=com.apollographql.apollo.response.CustomTypeValue$GraphQLString@a9b3abb

这是我的适配器:

 object customTypeAdapteCurrency : CustomTypeAdapter<String> {

        override fun encode(value: String): CustomTypeValue<*> {
            return CustomTypeValue.GraphQLString(value)
        }

        override fun decode(value: CustomTypeValue<*>): String? {
            return try {
                java.lang.String.valueOf(value)
            } catch (e: ParseException) {
                return null
            }
        }
    }

0 个答案:

没有答案