The org.opencode4workspace.endpoints.MessagePostEndpoint is used to post a message (an AppMessage object) to a Space and retrieve a MessageResponse object corresponding to a successful posting.
The MessagePostEndpoint is instantiated, like the other endpoints, by passing in the WWClient for the request. The message is posted using the postMessage(AppMessage message, String spaceId) method. Alternatively, the WWClient.postMessageToSpace(AppMessage message, String spaceId) helper method is available for easier use.
A new AppMessageBuilder object is instantiated. The setters return the current AppMessageBuilder, allowing the methods to be chained (see the example below if clarification is required). The various properties of the builder are set. The AppMessageBuilder's build() method returns a new AppMessage object ready to be passed to Watson Work Services.
If the posting is successful, a MessageResponse object is returned comprising the String id of the creator of the message, the created Date, the String version of the message and the String id of the message.