-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSessionEndHandler.java
More file actions
40 lines (36 loc) · 1.28 KB
/
SessionEndHandler.java
File metadata and controls
40 lines (36 loc) · 1.28 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import java.util.concurrent.CompletableFuture;
/**
* Handler for session-end hooks.
* <p>
* This handler is invoked when a session ends, allowing you to perform cleanup
* or logging.
*
* <h2>Example Usage</h2>
*
* <pre>{@code
* SessionEndHandler handler = (input, invocation) -> {
* System.out.println("Session ended: " + input.reason());
* return CompletableFuture.completedFuture(new SessionEndHookOutput(null, null, "Session completed successfully"));
* };
* }</pre>
*
* @since 1.0.7
*/
@FunctionalInterface
public interface SessionEndHandler {
/**
* Handles a session end event.
*
* @param input
* the hook input containing session end details
* @param invocation
* metadata about the hook invocation
* @return a future that resolves with the hook output, or {@code null} to
* proceed without modification
*/
CompletableFuture<SessionEndHookOutput> handle(SessionEndHookInput input, HookInvocation invocation);
}