我的架构中有一个自定义查询,并设置了自己的管道解析器:
type Query {
getMomentAppendView(mid: ID!): Moment
}
我不确定 codegen 在 Amplify 框架中将其标记为什么。在教程中,我只看到如何获取模型的预制查询。例如,在一个简单的@model
(如Moment
上面的)上。
Amplify.API.query(
// Return a single item
ModelQuery.get(Moment::class.java, mid),
{ resp ->
val response = Response<Moment>()
response.data = resp.data as Moment
response.isSuccessful = true
cont.resume(response)
},
{ error ->
val response = Response<Moment>()
response.throwable = error
response.isSuccessful = false
cont.resume(response)
}
)
如何执行我的自定义 GraphQL 查询?