@@ -127,7 +127,7 @@ var session = client.createSession(
127127). get();
128128
129129// Access the workspace where session state is persisted
130- String workspace = session. getWorkspacePath();
130+ var workspace = session. getWorkspacePath();
131131```
132132
133133### Compaction Events
@@ -247,7 +247,7 @@ var session = client.createSession(
247247 if (request. getChoices() != null && ! request. getChoices(). isEmpty()) {
248248 System . out. println(" Options: " + request. getChoices());
249249 // Return one of the provided choices
250- String selectedChoice = request. getChoices(). get(0 );
250+ var selectedChoice = request. getChoices(). get(0 );
251251 return CompletableFuture . completedFuture(
252252 new UserInputResponse ()
253253 .setAnswer(selectedChoice)
@@ -256,7 +256,7 @@ var session = client.createSession(
256256 }
257257
258258 // Freeform input
259- String userAnswer = getUserInput(); // your input method
259+ var userAnswer = getUserInput(); // your input method
260260 return CompletableFuture . completedFuture(
261261 new UserInputResponse ()
262262 .setAnswer(userAnswer)
@@ -345,7 +345,7 @@ Subscribe to lifecycle events to be notified when sessions are created, deleted,
345345### Subscribing to All Lifecycle Events
346346
347347``` java
348- AutoCloseable subscription = client. onLifecycle(event - > {
348+ var subscription = client. onLifecycle(event - > {
349349 System . out. println(" Session " + event. getSessionId() + " : " + event. getType());
350350
351351 if (event. getMetadata() != null ) {
@@ -363,7 +363,7 @@ subscription.close();
363363import com.github.copilot.sdk.json.SessionLifecycleEventTypes ;
364364
365365// Listen only for session creation
366- AutoCloseable subscription = client. onLifecycle(
366+ var subscription = client. onLifecycle(
367367 SessionLifecycleEventTypes . CREATED ,
368368 event - > System . out. println(" New session: " + event. getSessionId())
369369);
@@ -385,7 +385,7 @@ When connecting to a server running in TUI+server mode (`--ui-server`), you can
385385### Getting the Foreground Session
386386
387387``` java
388- String sessionId = client. getForegroundSessionId(). get();
388+ var sessionId = client. getForegroundSessionId(). get();
389389if (sessionId != null ) {
390390 System . out. println(" TUI is displaying session: " + sessionId);
391391}
0 commit comments