Class BlobAttachment

java.lang.Object
com.github.copilot.sdk.json.BlobAttachment
All Implemented Interfaces:
MessageAttachment

public final class BlobAttachment extends Object implements MessageAttachment
Represents an inline base64-encoded binary attachment (blob) for messages.

Use this attachment type to pass image data or other binary content directly to the assistant, without requiring a file on disk.

Example Usage


 var attachment = new BlobAttachment().setData("iVBORw0KGgoAAAANSUhEUg...") // base64-encoded content
 		.setMimeType("image/png").setDisplayName("screenshot.png");

 var options = new MessageOptions().setPrompt("Describe this image").setAttachments(List.of(attachment));
 
Since:
1.2.0
See Also:
  • Constructor Details

    • BlobAttachment

      public BlobAttachment()
  • Method Details

    • getType

      public String getType()
      Returns the attachment type, always "blob".
      Specified by:
      getType in interface MessageAttachment
      Returns:
      "blob"
    • getData

      public String getData()
      Gets the base64-encoded binary content.
      Returns:
      the base64 data string
    • setData

      public BlobAttachment setData(String data)
      Sets the base64-encoded binary content.
      Parameters:
      data - the base64-encoded content
      Returns:
      this attachment for method chaining
    • getMimeType

      public String getMimeType()
      Gets the MIME type of the binary content.
      Returns:
      the MIME type (e.g., "image/png")
    • setMimeType

      public BlobAttachment setMimeType(String mimeType)
      Sets the MIME type of the binary content.
      Parameters:
      mimeType - the MIME type (e.g., "image/png", "image/jpeg")
      Returns:
      this attachment for method chaining
    • getDisplayName

      public String getDisplayName()
      Gets the human-readable display name for the attachment.
      Returns:
      the display name, or null
    • setDisplayName

      public BlobAttachment setDisplayName(String displayName)
      Sets the human-readable display name for the attachment.
      Parameters:
      displayName - a user-visible name (e.g., "screenshot.png")
      Returns:
      this attachment for method chaining