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

The "space" query returns a specific Space. The query requires a mandatory attribute for the id of the Space to retrieve.

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

For greater control, create an ObjectDataSenderBuilder for the Space.ONE_SPACE_QUERY_OBJECT_NAME object, adding the Space id attribute, passing in Space fields and children. Instantiate a new SpaceGraphQLQuery passing in the ObjectDataSenderBuilder as the parameter. Then pass this to WWClient.getSpaceWithQuery().

Space Members

While developing the SDK, it was expected that getting members for a Space would be a common requirement. Consequently the org.opencode4workspace.builders.SpaceMembersGraphQLQuery class has a simple static helper method, buildSpaceMembersGraphQueryWithSpaceId(String). Similar methods are also available from WWClient and WWGraphQLEndpoint.

For greater control, create an ObjectDataSenderBuilder for the Space.ONE_SPACE_QUERY_OBJECT_NAME object, adding the Space id attribute, passing in Space fields and children. Instantiate a new SpaceMembersGraphQLQuery passing in the ObjectDataSenderBuilder as the parameter. Then pass this to WWClient.getSpaceMembersWithQuery().

Examples

Basic getSpace
    Space space = client.getSpaceById(spaceId);
    assert (space.getMembers().size() > 0);
getSpaceWithQuery
    ObjectDataSenderBuilder query = new ObjectDataSenderBuilder();
    query.setObjectName(Space.ONE_SPACE_QUERY_OBJECT_NAME);
    query.addAttribute(SpaceAttributes.ID, spaceId);
    query.addField(SpaceFields.ID);
    query.addField(SpaceFields.TITLE);
    query.addField(SpaceFields.DESCRIPTION);

	Space spaceResult = client.getSpaceWithQuery(new SpaceGraphQLQuery(query));
basic getSpaceMembers
    List<Person> members = client.getSpaceMembersById(spaceId);
    assert (members.size() > 0);
getSpaceMembers
    ObjectDataSenderBuilder query = new ObjectDataSenderBuilder();
    query.setObjectName(Space.ONE_SPACE_QUERY_OBJECT_NAME);
    query.addAttribute(SpaceAttributes.ID, spaceId);
    ObjectDataSenderBuilder members = new ObjectDataSenderBuilder(SpaceChildren.MEMBERS.getLabel(), true);
    members.addField(PersonFields.ID);
    members.addField(PersonFields.PHOTO_URL);
    members.addField(PersonFields.EMAIL);
    members.addField(PersonFields.DISPLAY_NAME);
    members.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(PersonChildren.CREATED_BY));
    members.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(PersonChildren.UPDATED_BY));
    query.addChild(members);

	List<Person> members = client.getSpaceMembersWithQuery(new SpaceMembersGraphQLQuery(query));

5 Comments

  1. Anonymous

    A question is a one-page letter presenting yourself and your novel. By and by, I'd abstain from packing an excessive amount of data into your question letter, so single-separating so as to make it fit on one page shouldn't be essential. Assignment Service

  2. Anonymous

    For greater control, create an ObjectDataSenderBuilder for the Space. Btw if you are looking for best PPC Services in Australia, visit PPC Services Australia.

  3. Anonymous

    Instantiate a new SpaceGraphQLQuery passing in the ObjectDataSenderBuilder as the parameter. And if you are looking for the best web development services please visit Web Development USA

  4. Anonymous

    It was actually best website for IT learners as they can get useful information regarding SQL, database and java script. Keep sharing good content.

    Alex,

    http://www.qualityassignment.co.uk/services/assignment-writing-service/

  5. Anonymous

    Very informative blog regarding space. I’ll sure it been very helpful for all people.

    Regards,

    http://www.assignmenthelpfolks.com/nursing/

Write a comment…