首页 > 解决方案 > Java GraphQL dgs 客户端

问题描述

我使用 graphql dgs 客户端使用以下查询。我已经使用 com.netflix.graphql.dgs.client.codegen.GraphQLQueryRequest 实现了第一个查询,其中我创建了一个下面给出的根对象和一个 tocResourceGraphQLQuery 要在我的 GraphQLQueryRequest graphQLQueryRequest = new GraphQLQueryRequest(tocResourceGraphQLQuery, root); 但我不知道如何使用 dgs 客户端在查询中实现查询。

TocResourceProjectionRoot root = new TocResourceProjectionRoot().data().title().id()
        .identifier().getParent().items().data().id().identifier().getParent().type().displayId()
        .orderNo().title().availabilityTypes().getRoot();

    query {
tocResource(
    context: {
        identifier:"urn:sbnet:book:tca1e_sbtest-1", type:"book" }, 
    identifier:{
        identifier:"urn:sbnet:book:tca1e_sbtest-1:chapter:2:section:1",
         type:"section" })
         {
        data {
            title
            id {
                identifier
                }
    items(**query**: {
        filter: {isAccessible: true,availabilityTypes: [StudyPlan]},
        paginationAndSorting: {offset: 0, limit:10}
    }) {           
        data {
            title
            id {
                 identifier
             }
        type
        displayId
        orderNo
        availabilityTypes
            }
    }
}
}

}

标签: javaspringgraphqlgraphql-javanetflix-dgs

解决方案


推荐阅读