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

Note

Creating a Space can only be done when authenticated as a user, it cannot be done when authenticated as an application.

The "createSpace" mutation creates a new Space.The new space requires at least a title.

The org.opencode4workspace.builders.SpaceCreateGraphQLMutation has simple static helper methods to create a space with just a title, buildCreateSpaceMutationWithSpaceTitle(String), or with a title and members, buildCreateSpaceMutationWithSpaceTitleAndMembers(String, List<String>). Similar methods are also available from WWClient and WWGraphQLEndpoint. These will just return a Space object with the space id as their result.

For greater control, create the InputDataSenderBuilder and ObjectDataSenderBuilder manually. Create an InputDataSenderBuilder for the Space.CREATE_SPACE_MUTATION_NAME object, adding the Space title and the members you wish to assign access for the Space. A CreateSpaceFields enum is available to avoid typos. Create an ObjectDataSenderBuilder for the Space.ONE_SPACE_QUERY_OBJECT_NAME object, passing in Space fields and children. Instantiate a new SpaceCreateGraphQLMutation passing in the InputDataSenderBuilder and ObjectDataSenderBuilder as parameters. Then pass this to WWClient.createSpaceWithQuery().

Examples

Basic createSpace
Space space = client.createSpace("Hello World");
assert null != space.getId();
basic createSpace with members
ArrayList<String> members = new ArrayList<String>();
members.add("7bf6c84f-861c-43df-816a-85748766912e");
members.add("1d1bf268-c263-4eea-aaec-e2dbeaa2fb71");
Space space = client.createSpace("Hello World", members);
assert null != space.getId();
createSpaceWithQuery
ArrayList<String> members = new ArrayList<String>();
members.add("7bf6c84f-861c-43df-816a-85748766912e");
members.add("1d1bf268-c263-4eea-aaec-e2dbeaa2fb71");
InputDataSenderBuilder spaceInput = new InputDataSenderBuilder(Space.CREATE_SPACE_MUTATION_NAME);
spaceInput.addField(CreateSpaceFields.TITLE, title);
spaceInput.addField(CreateSpaceFields.MEMBERS, members);
ObjectDataSenderBuilder returnObject = new ObjectDataSenderBuilder(Space.ONE_SPACE_QUERY_OBJECT_NAME);
returnObject.addField(SpaceFields.ID);
returnObject.addField(SpaceFields.TITLE);
SpaceCreateGraphQLMutation mutationObject = new SpaceCreateGraphQLMutation(spaceInput, returnObject);

Space spaceResult = client.createSpaceWithQuery(mutationObject);
assert null != space.getTitle();

2 Comments

  1. Anonymous

    An inquiry is a one-page letter introducing yourself and your novel. Before long, I'd swear off pressing an unreasonable measure of information into your inquiry letter, so single-isolating to make it fit on one page shouldn't be basic. The assignment service provider is good enough to provide data which can be transmitted into the real world.

  2. Anonymous

    I just love to visit this website and I got informative stuff from this website. Keep it up.

    William Riley, Assistant writer at Elite Assignment

Write a comment…