forked from github/copilot-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserMessageEvent.java
More file actions
62 lines (49 loc) · 2.17 KB
/
UserMessageEvent.java
File metadata and controls
62 lines (49 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.events;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.List;
/**
* Event: user.message
*
* @since 1.0.0
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public final class UserMessageEvent extends AbstractSessionEvent {
@JsonProperty("data")
private UserMessageData data;
@Override
public String getType() {
return "user.message";
}
public UserMessageData getData() {
return data;
}
public void setData(UserMessageData data) {
this.data = data;
}
@JsonIgnoreProperties(ignoreUnknown = true)
public record UserMessageData(@JsonProperty("content") String content,
@JsonProperty("transformedContent") String transformedContent,
@JsonProperty("attachments") List<Attachment> attachments, @JsonProperty("source") String source) {
/** Returns a defensive copy of the attachments list. */
@Override
public List<Attachment> attachments() {
return attachments == null ? null : Collections.unmodifiableList(attachments);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public record Attachment(@JsonProperty("type") String type, @JsonProperty("path") String path,
@JsonProperty("filePath") String filePath, @JsonProperty("displayName") String displayName,
@JsonProperty("text") String text, @JsonProperty("selection") Selection selection) {
@JsonIgnoreProperties(ignoreUnknown = true)
public record Selection(@JsonProperty("start") Position start, @JsonProperty("end") Position end) {
@JsonIgnoreProperties(ignoreUnknown = true)
public record Position(@JsonProperty("line") int line, @JsonProperty("character") int character) {
}
}
}
}
}