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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

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

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

For greater control, create an ObjectDataSenderBuilder for the Conversation.CONVERSATION_QUERY_OBJECT_NAME object, adding the Conversation id attribute, passing in Conversation fields and children. Instantiate a new ConversationGraphQLQuery passing in the ObjectDataSenderBuilder as the parameter. Then pass this to WWClient.getConversationWithQuery().

Examples

Basic getConversationById
    Conversation conversation = client.getConversationById(conversationId);
    assert (conversation.getMessages().size() > 0);
getConversation
    ObjectDataSenderBuilder query = new ObjectDataSenderBuilder();
    query.setObjectName(Conversation.CONVERSATION_QUERY_OBJECT_NAME);
    query.addAttribute(ConversationAttributes.ID, conversationId);
    ObjectDataSenderBuilder messages = new ObjectDataSenderBuilder(ConversationChildren.MESSAGES.getLabel(), true);
    messages.addAttribute(BasicPaginationEnum.FIRST, 10);
    messages.addPageInfo();
    messages.addField(MessageFields.CONTENT_TYPE);
    messages.addField(MessageFields.ANNOTATIONS);
    messages.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(MessageChildren.CREATED_BY));
    messages.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(MessageChildren.UPDATED_BY));
    query.addChild(messages);

	Conversation conversation = client.getConversationWithQuery(new ConversationGraphQLQuery(query));
  • No labels