Package com.github.copilot.sdk.json
Class BlobAttachment
java.lang.Object
com.github.copilot.sdk.json.BlobAttachment
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetData()Gets the base64-encoded binary content.Gets the human-readable display name for the attachment.Gets the MIME type of the binary content.getType()Returns the attachment type, always"blob".Sets the base64-encoded binary content.setDisplayName(String displayName) Sets the human-readable display name for the attachment.setMimeType(String mimeType) Sets the MIME type of the binary content.
-
Constructor Details
-
BlobAttachment
public BlobAttachment()
-
-
Method Details
-
getType
Returns the attachment type, always"blob".- Specified by:
getTypein interfaceMessageAttachment- Returns:
"blob"
-
getData
Gets the base64-encoded binary content.- Returns:
- the base64 data string
-
setData
Sets the base64-encoded binary content.- Parameters:
data- the base64-encoded content- Returns:
- this attachment for method chaining
-
getMimeType
Gets the MIME type of the binary content.- Returns:
- the MIME type (e.g.,
"image/png")
-
setMimeType
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
Gets the human-readable display name for the attachment.- Returns:
- the display name, or
null
-
setDisplayName
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
-