This repository was archived by the owner on Mar 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathPermissionRequestResult.java
More file actions
96 lines (85 loc) · 2.65 KB
/
PermissionRequestResult.java
File metadata and controls
96 lines (85 loc) · 2.65 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Result of a permission request decision.
* <p>
* This object indicates whether a permission request was approved or denied,
* and may include additional rules for future similar requests.
*
* <h2>Common Result Kinds</h2>
* <ul>
* <li>{@link PermissionRequestResultKind#APPROVED} — approved</li>
* <li>{@link PermissionRequestResultKind#DENIED_BY_RULES} — denied by
* rules</li>
* <li>{@link PermissionRequestResultKind#DENIED_COULD_NOT_REQUEST_FROM_USER} —
* no handler and couldn't ask user</li>
* <li>{@link PermissionRequestResultKind#DENIED_INTERACTIVELY_BY_USER} — denied
* by the user interactively</li>
* </ul>
*
* @see PermissionHandler
* @see PermissionRequestResultKind
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class PermissionRequestResult {
@JsonProperty("kind")
private String kind;
@JsonProperty("rules")
private List<Object> rules;
/**
* Gets the result kind as a string.
*
* @return the result kind indicating approval or denial
*/
public String getKind() {
return kind;
}
/**
* Sets the result kind using a {@link PermissionRequestResultKind} value.
*
* @param kind
* the result kind
* @return this result for method chaining
* @since 1.1.0
*/
public PermissionRequestResult setKind(PermissionRequestResultKind kind) {
this.kind = kind != null ? kind.getValue() : null;
return this;
}
/**
* Sets the result kind using a raw string value.
*
* @param kind
* the result kind string
* @return this result for method chaining
*/
public PermissionRequestResult setKind(String kind) {
this.kind = kind;
return this;
}
/**
* Gets the approval rules.
*
* @return the list of rules for future similar requests
*/
public List<Object> getRules() {
return rules;
}
/**
* Sets approval rules for future similar requests.
*
* @param rules
* the list of rules
* @return this result for method chaining
*/
public PermissionRequestResult setRules(List<Object> rules) {
this.rules = rules;
return this;
}
}