wp-graphql icon indicating copy to clipboard operation
wp-graphql copied to clipboard

Implement a GraphQL collection model that is Relay Compliant.

Open BE-Webdesign opened this issue 9 years ago • 0 comments

Eventually we will want a collection model that will be programatically created based on what types we need. This will be built out of our WordPress primitives, Post, Comment, User etc. The GraphQL post collection model should look something like this.

postConnection(first: $howManyItems, after: $offsetOfCursor) {
  totalCount
  edges {
    node {
      ...postFields
    }
    cursor
  }
  pageInfo {
    endCursor
    hasNextPage
  }
}

The connection types can use a connection interface which will feature three fields totalCount: total count of resources, edges (the list of edges in our graph), and a pageInfo object field containing the last cursor and whether there is another page of results for pagination in the collection.

For reference: https://facebook.github.io/relay/graphql/connections.htm

BE-Webdesign avatar Nov 08 '16 02:11 BE-Webdesign