-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSessionMetadata.java
More file actions
176 lines (155 loc) · 4.57 KB
/
SessionMetadata.java
File metadata and controls
176 lines (155 loc) · 4.57 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Metadata about an existing Copilot session.
* <p>
* This class represents session information returned when listing available
* sessions via {@link com.github.copilot.sdk.CopilotClient#listSessions()} or
* looking up a specific session via
* {@link com.github.copilot.sdk.CopilotClient#getSessionMetadata(String)}. It
* includes timing information, a summary of the conversation, and whether the
* session is stored remotely.
*
* <h2>Example Usage</h2>
*
* <pre>{@code
* var sessions = client.listSessions().get();
* for (var meta : sessions) {
* System.out.println("Session: " + meta.getSessionId());
* System.out.println(" Started: " + meta.getStartTime());
* System.out.println(" Summary: " + meta.getSummary());
* }
* }</pre>
*
* @see com.github.copilot.sdk.CopilotClient#listSessions()
* @see com.github.copilot.sdk.CopilotClient#resumeSession(String,
* ResumeSessionConfig)
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SessionMetadata {
@JsonProperty("sessionId")
private String sessionId;
@JsonProperty("startTime")
private String startTime;
@JsonProperty("modifiedTime")
private String modifiedTime;
@JsonProperty("summary")
private String summary;
@JsonProperty("isRemote")
private boolean isRemote;
@JsonProperty("context")
private SessionContext context;
/**
* Gets the unique identifier for this session.
*
* @return the session ID
*/
public String getSessionId() {
return sessionId;
}
/**
* Sets the session identifier.
*
* @param sessionId
* the session ID
*/
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
/**
* Gets the timestamp when the session was created.
*
* @return the start time as an ISO 8601 formatted string
*/
public String getStartTime() {
return startTime;
}
/**
* Sets the session start time.
*
* @param startTime
* the start time as an ISO 8601 formatted string
*/
public void setStartTime(String startTime) {
this.startTime = startTime;
}
/**
* Gets the timestamp when the session was last modified.
*
* @return the modified time as an ISO 8601 formatted string
*/
public String getModifiedTime() {
return modifiedTime;
}
/**
* Sets the session modified time.
*
* @param modifiedTime
* the modified time as an ISO 8601 formatted string
*/
public void setModifiedTime(String modifiedTime) {
this.modifiedTime = modifiedTime;
}
/**
* Gets a brief summary of the session's conversation.
* <p>
* This is typically an AI-generated summary of the session content.
*
* @return the session summary, or {@code null} if not available
*/
public String getSummary() {
return summary;
}
/**
* Sets the session summary.
*
* @param summary
* the session summary
*/
public void setSummary(String summary) {
this.summary = summary;
}
/**
* Returns whether this session is stored remotely.
*
* @return {@code true} if the session is stored on the server, {@code false} if
* it's stored locally
*/
public boolean isRemote() {
return isRemote;
}
/**
* Sets whether this session is stored remotely.
*
* @param remote
* {@code true} if stored remotely
*/
public void setRemote(boolean remote) {
isRemote = remote;
}
/**
* Gets the working directory context from session creation.
* <p>
* Contains information about the working directory, git repository, and branch
* where the session was created.
*
* @return the session context, or {@code null} if not available
*/
public SessionContext getContext() {
return context;
}
/**
* Sets the working directory context.
*
* @param context
* the session context
*/
public void setContext(SessionContext context) {
this.context = context;
}
}