Class MessageOptions

java.lang.Object
com.github.copilot.sdk.json.MessageOptions

public class MessageOptions extends Object
Options for sending a message to a Copilot session.

This class specifies the message content and optional attachments to send to the assistant. All setter methods return this for method chaining.

Example Usage


 var options = new MessageOptions().setPrompt("Explain this code")
 		.setAttachments(List.of(new Attachment("file", "/path/to/file.java", null)));

 session.send(options).get();
 
Since:
1.0.0
See Also:
  • Constructor Details

    • MessageOptions

      public MessageOptions()
  • Method Details

    • getPrompt

      public String getPrompt()
      Gets the message prompt.
      Returns:
      the prompt text
    • setPrompt

      public MessageOptions setPrompt(String prompt)
      Sets the message prompt to send to the assistant.
      Parameters:
      prompt - the message text
      Returns:
      this options instance for method chaining
    • getAttachments

      public List<Attachment> getAttachments()
      Gets the file attachments.
      Returns:
      the list of attachments
    • setAttachments

      public MessageOptions setAttachments(List<Attachment> attachments)
      Sets file attachments to include with the message.

      Attachments provide additional context to the assistant, such as source code files, documents, or other relevant files.

      Parameters:
      attachments - the list of file attachments
      Returns:
      this options instance for method chaining
      See Also:
    • setMode

      public MessageOptions setMode(String mode)
      Sets the message delivery mode.

      Valid modes:

      • "enqueue" - Queue the message for processing (default)
      • "immediate" - Process the message immediately
      Parameters:
      mode - the delivery mode
      Returns:
      this options instance for method chaining
    • getMode

      public String getMode()
      Gets the delivery mode.
      Returns:
      the delivery mode
    • clone

      public MessageOptions clone()
      Creates a shallow clone of this MessageOptions instance.

      Mutable collection properties are copied into new collection instances so that modifications to those collections on the clone do not affect the original. Other reference-type properties (like attachment items) are not deep-cloned; the original and the clone will share those objects.

      Returns:
      a clone of this options instance