Page tree
Skip to end of metadata
Go to start of metadata

The "spaces" query returns a collection of Spaces the user or application has access to. The query can accept various attributes of pagination options from the BasicPaginationEnum.

The org.opencode4workspace.builders.SpacesGraphQLQuery class has a simple static helper method, buildStandardGetSpacesQuery(). Similar methods are also available from WWClient and WWGraphQLEndpoint.

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(). 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.

Examples

Basic getSpaces
    List<? extends Space> spaces = client.getSpaces();
getSpacesWithQuery
    ObjectDataSenderBuilder spaces = new ObjectDataSenderBuilder(Space.SPACES_QUERY_OBJECT_NAME, true);
    spaces.addAttribute(BasicPaginationEnum.FIRST, 100);
    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);
    List<? extends Space> spacesResult = client.getSpacesWithQuery(new SpacesGraphQLQuery(spaces));
    assert (spacesResult.size() > 0);
getSpacesContainerWithQuery - since 0.8.0
    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);

1 Comment

  1. Anonymous

    this is Java API and used class spacesgraphQLQuery implement on the interface of Serializable, IGraphQLQuery.
    public class SpacesGraphQLQuery
    extends BaseGraphQLQuery
    Since:
    0.5.0 Object for creating a Spaces query. The only attributes available are from BasicPaginationEnum.
    Author:
    Paul Withers.
    Also there are two classes that you cam use it,
    1- nested class:
    static class SpacesGraphQLQuery.SpacesAttributes
    2- Constructor class:
    SpacesGraphQLQuery()
    Creates a Spaces query with a blank ObjectDataSenderBuilder query object
    SpacesGraphQLQuery(ObjectDataSenderBuilder query)
    Creates a Spaces query with a pre-populated ObjectDataSenderBuilder query object

    information was given by cheap reliable essay writing service thankyou in advance. 

Write a comment…