Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For greater control, create an ObjectDataSenderBuilder for the Space.SPACES_QUERY_OBJECT_NAME object, adding attributes, passing in Space fields and children. Instantiate a new SpacesGraphQLQuery passing in the ObjectDataSenderBuilder as the parameter. Then pass this to WWClient.getSpacesWithQuery() or . Sonce 0.8.0 you can also pass this to WWClient.getSpacesContainerWithQuery(). The first one just returns the List of Space objects, the second one gives access to the SpacesContainer, which gives access to the PageInfo object and the List of Space objects.

...

Code Block
languagejava
titlegetSpacesContainerWithQuery - since 0.8.0
collapsetrue
    ObjectDataSenderBuilder spaces = new ObjectDataSenderBuilder(Space.SPACES_QUERY_OBJECT_NAME, true);
    spaces.addAttribute(BasicPaginationEnum.FIRST, 10);
    spaces.addPageInfo();
    spaces.addField(SpaceFields.ID);
    spaces.addField(SpaceFields.TITLE);
    spaces.addField(SpaceFields.DESCRIPTION);
    spaces.addField(SpaceFields.UPDATED);
    spaces.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(SpaceChildren.UPDATED_BY));
    spaces.addField(SpaceFields.CREATED);
    spaces.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(SpaceChildren.CREATED_BY));
    ObjectDataSenderBuilder members = new ObjectDataSenderBuilder(SpaceChildren.MEMBERS.getLabel(), true);
    members.addAttribute(BasicPaginationEnum.FIRST, 10);
    members.addField(PersonFields.ID);
    members.addField(PersonFields.PHOTO_URL);
    members.addField(PersonFields.EMAIL);
    members.addField(PersonFields.DISPLAY_NAME);
    spaces.addChild(members);
    SpacesContainer spacesResult = client.getSpacesContainerWithQuery(new SpacesGraphQLQuery(spaces));
    assert spacesResult.getPageInfo().isHasNextPage();
    assert (spacesResult.getItems().size() > 0);