forked from github/copilot-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSessionEndHookInput.java
More file actions
141 lines (123 loc) · 3.36 KB
/
SessionEndHookInput.java
File metadata and controls
141 lines (123 loc) · 3.36 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Input for a session-end hook.
* <p>
* This hook is invoked when a session ends, allowing you to perform cleanup or
* logging.
*
* @since 1.0.7
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SessionEndHookInput {
@JsonProperty("timestamp")
private long timestamp;
@JsonProperty("cwd")
private String cwd;
@JsonProperty("reason")
private String reason;
@JsonProperty("finalMessage")
private String finalMessage;
@JsonProperty("error")
private String error;
/**
* Gets the timestamp when the session ended.
*
* @return the timestamp in milliseconds since epoch
*/
public long getTimestamp() {
return timestamp;
}
/**
* Sets the timestamp when the session ended.
*
* @param timestamp
* the timestamp in milliseconds since epoch
* @return this instance for method chaining
*/
public SessionEndHookInput setTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
/**
* Gets the current working directory.
*
* @return the current working directory
*/
public String getCwd() {
return cwd;
}
/**
* Sets the current working directory.
*
* @param cwd
* the current working directory
* @return this instance for method chaining
*/
public SessionEndHookInput setCwd(String cwd) {
this.cwd = cwd;
return this;
}
/**
* Gets the reason for session end.
*
* @return the reason: "complete", "error", "abort", "timeout", or "user_exit"
*/
public String getReason() {
return reason;
}
/**
* Sets the reason for session end.
*
* @param reason
* the reason: "complete", "error", "abort", "timeout", or
* "user_exit"
* @return this instance for method chaining
*/
public SessionEndHookInput setReason(String reason) {
this.reason = reason;
return this;
}
/**
* Gets the final message, if any.
*
* @return the final message, or {@code null}
*/
public String getFinalMessage() {
return finalMessage;
}
/**
* Sets the final message.
*
* @param finalMessage
* the final message
* @return this instance for method chaining
*/
public SessionEndHookInput setFinalMessage(String finalMessage) {
this.finalMessage = finalMessage;
return this;
}
/**
* Gets the error message, if the session ended due to an error.
*
* @return the error message, or {@code null}
*/
public String getError() {
return error;
}
/**
* Sets the error message.
*
* @param error
* the error message
* @return this instance for method chaining
*/
public SessionEndHookInput setError(String error) {
this.error = error;
return this;
}
}