Package com.github.copilot.sdk.json
Class Attachment
java.lang.Object
com.github.copilot.sdk.json.Attachment
Represents a file attachment to include with a message.
Attachments provide additional context to the AI assistant, such as source
code files, documents, or other relevant content. All setter methods return
this for method chaining.
Example Usage
var attachment = new Attachment().setType("file").setPath("/path/to/source.java").setDisplayName("Main Source File");
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the display name.getPath()Gets the file path.getType()Gets the attachment type.setDisplayName(String displayName) Sets a human-readable display name for the attachment.Sets the file path.Sets the attachment type.
-
Constructor Details
-
Attachment
public Attachment()
-
-
Method Details
-
getType
Gets the attachment type.- Returns:
- the type (e.g., "file")
-
setType
Sets the attachment type.Currently supported types:
- "file" - A file from the filesystem
- Parameters:
type- the attachment type- Returns:
- this attachment for method chaining
-
getPath
Gets the file path.- Returns:
- the absolute path to the file
-
setPath
Sets the file path.This should be an absolute path to the file on the filesystem.
- Parameters:
path- the absolute file path- Returns:
- this attachment for method chaining
-
getDisplayName
Gets the display name.- Returns:
- the display name for the attachment
-
setDisplayName
Sets a human-readable display name for the attachment.This name is shown to the assistant and may be used when referring to the file in responses.
- Parameters:
displayName- the display name- Returns:
- this attachment for method chaining
-