Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lastmerge
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dd2dcbc439256acfb9feb2cff07c0b9c820091b8
c63feb2794786342d57936c13d28c250e723c676
21 changes: 9 additions & 12 deletions src/main/java/com/github/copilot/sdk/CopilotClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -744,18 +744,15 @@ public CompletableFuture<String> getForegroundSessionId() {
* if the operation fails
*/
public CompletableFuture<Void> setForegroundSessionId(String sessionId) {
return ensureConnected()
.thenCompose(
connection -> connection.rpc
.invoke("session.setForeground", Map.of("sessionId", sessionId),
com.github.copilot.sdk.json.SetForegroundSessionResponse.class)
.thenAccept(response -> {
if (!response.success()) {
throw new RuntimeException(response.error() != null
? response.error()
: "Failed to set foreground session");
}
}));
return ensureConnected().thenCompose(connection -> connection.rpc
.invoke("session.setForeground", new com.github.copilot.sdk.json.SetForegroundSessionRequest(sessionId),
com.github.copilot.sdk.json.SetForegroundSessionResponse.class)
.thenAccept(response -> {
if (!response.success()) {
throw new RuntimeException(
response.error() != null ? response.error() : "Failed to set foreground session");
}
}));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/

package com.github.copilot.sdk.json;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Internal request object for setting the foreground session.
*
* @param sessionId
* the ID of the session to set as the foreground session
* @see com.github.copilot.sdk.CopilotClient#setForegroundSessionId(String)
* @since 1.0.0
*/
public record SetForegroundSessionRequest(@JsonProperty("sessionId") String sessionId) {
}
Loading