• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #3992

06 Sep 2024 01:11PM UTC coverage: 71.703% (-0.7%) from 72.441%
#3992

push

github

web-flow
feat: Support AI Agent (#1265)

248 of 452 new or added lines in 14 files covered. (54.87%)

3 existing lines in 3 files now uncovered.

7921 of 11047 relevant lines covered (71.7%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.81
/src/main/java/com/box/sdk/BoxAIAgentAsk.java
1
package com.box.sdk;
2

3
import com.box.sdk.internal.utils.JsonUtils;
4
import com.eclipsesource.json.JsonObject;
5
import com.eclipsesource.json.JsonValue;
6

7
/**
8
 * Represents an AI Agent used to handle queries.
9
 */
10
@BoxResourceType("ai_agent_ask")
11
public class BoxAIAgentAsk extends BoxAIAgent {
12

13
    /**
14
     * The type of the AI Ask agent.
15
     */
16
    public static final String TYPE = "ai_agent_ask";
17

18
    /**
19
     * AI agent tool used to handle basic text.
20
     */
21
    private BoxAIAgentAskBasicText basicText;
22
    /**
23
     * AI agent tool used to handle basic text.
24
     */
25
    private BoxAIAgentAskBasicText basicTextMulti;
26
    /**
27
     * AI agent tool used to handle longer text.
28
     */
29
    private BoxAIAgentAskLongText longText;
30
    /**
31
     * AI agent tool used to handle longer text.
32
     */
33
    private BoxAIAgentAskLongText longTextMulti;
34

35
    /**
36
     * Constructs an AI agent with default settings.
37
     * @param basicText AI agent tool used to handle basic text.
38
     * @param basicTextMulti AI agent tool used to handle basic text.
39
     * @param longText AI agent tool used to handle longer text.
40
     * @param longTextMulti AI agent tool used to handle longer text.
41
     */
42
    public BoxAIAgentAsk(BoxAIAgentAskBasicText basicText, BoxAIAgentAskBasicText basicTextMulti,
43
                         BoxAIAgentAskLongText longText, BoxAIAgentAskLongText longTextMulti) {
NEW
44
        super(TYPE);
×
NEW
45
        this.basicText = basicText;
×
NEW
46
        this.basicTextMulti = basicTextMulti;
×
NEW
47
        this.longText = longText;
×
NEW
48
        this.longTextMulti = longTextMulti;
×
NEW
49
    }
×
50

51
    /**
52
     * Constructs an AI agent with default settings.
53
     * @param jsonObject JSON object representing the AI agent.
54
     */
55
    public BoxAIAgentAsk(JsonObject jsonObject) {
56
        super(jsonObject);
1✔
57
    }
1✔
58

59
    /**
60
     * Gets the AI agent tool used to handle basic text.
61
     * @return The AI agent tool used to handle basic text.
62
     */
63
    public BoxAIAgentAskBasicText getBasicText() {
64
        return basicText;
1✔
65
    }
66

67
    /**
68
     * Sets the AI agent tool used to handle basic text.
69
     * @param basicText The AI agent tool used to handle basic text.
70
     */
71
    public void setBasicText(BoxAIAgentAskBasicText basicText) {
NEW
72
        this.basicText = basicText;
×
NEW
73
    }
×
74

75
    /**
76
     * Gets the AI agent tool used to handle basic text.
77
     * @return The AI agent tool used to handle basic text.
78
     */
79
    public BoxAIAgentAskBasicText getBasicTextMulti() {
NEW
80
        return basicTextMulti;
×
81
    }
82

83
    /**
84
     * Sets the AI agent tool used to handle basic text.
85
     * @param basicTextMulti The AI agent tool used to handle basic text.
86
     */
87
    public void setBasicTextMulti(BoxAIAgentAskBasicText basicTextMulti) {
NEW
88
        this.basicTextMulti = basicTextMulti;
×
NEW
89
    }
×
90

91
    /**
92
     * Gets the AI agent tool used to handle longer text.
93
     * @return The AI agent tool used to handle longer text.
94
     */
95
    public BoxAIAgentAskLongText getLongText() {
NEW
96
        return longText;
×
97
    }
98

99
    /**
100
     * Sets the AI agent tool used to handle longer text.
101
     * @param longText The AI agent tool used to handle longer text.
102
     */
103
    public void setLongText(BoxAIAgentAskLongText longText) {
NEW
104
        this.longText = longText;
×
NEW
105
    }
×
106

107
    /**
108
     * Gets the AI agent tool used to handle longer text.
109
     * @return The AI agent tool used to handle longer text.
110
     */
111
    public BoxAIAgentAskLongText getLongTextMulti() {
NEW
112
        return longTextMulti;
×
113
    }
114

115
    /**
116
     * Sets the AI agent tool used to handle longer text.
117
     * @param longTextMulti The AI agent tool used to handle longer text.
118
     */
119
    public void setLongTextMulti(BoxAIAgentAskLongText longTextMulti) {
NEW
120
        this.longTextMulti = longTextMulti;
×
NEW
121
    }
×
122

123
    @Override
124
    void parseJSONMember(JsonObject.Member member) {
125
        super.parseJSONMember(member);
1✔
126
        String memberName = member.getName();
1✔
127
        JsonValue memberValue = member.getValue();
1✔
128
        try {
129
            switch (memberName) {
1✔
130
                case "basic_text":
131
                    this.basicText = new BoxAIAgentAskBasicText(memberValue.asObject());
1✔
132
                    break;
1✔
133
                case "basic_text_multi":
134
                    this.basicTextMulti = new BoxAIAgentAskBasicText(memberValue.asObject());
1✔
135
                    break;
1✔
136
                case "long_text":
137
                    this.longText = new BoxAIAgentAskLongText(memberValue.asObject());
1✔
138
                    break;
1✔
139
                case "long_text_multi":
140
                    this.longTextMulti = new BoxAIAgentAskLongText(memberValue.asObject());
1✔
141
                    break;
1✔
142
                default:
143
                    break;
144
            }
NEW
145
        } catch (Exception e) {
×
NEW
146
            throw new BoxAPIException("Could not parse JSON response.", e);
×
147
        }
1✔
148
    }
1✔
149

150
    @Override
151
    public JsonObject getJSONObject() {
152
        JsonObject jsonObject = new JsonObject();
1✔
153
        JsonUtils.addIfNotNull(jsonObject, "type", this.getType());
1✔
154
        JsonUtils.addIfNotNull(jsonObject, "basic_text", this.basicText.getJSONObject());
1✔
155
        JsonUtils.addIfNotNull(jsonObject, "basic_text_multi", this.basicTextMulti.getJSONObject());
1✔
156
        JsonUtils.addIfNotNull(jsonObject, "long_text", this.longText.getJSONObject());
1✔
157
        JsonUtils.addIfNotNull(jsonObject, "long_text_multi", this.longTextMulti.getJSONObject());
1✔
158
        return jsonObject;
1✔
159
    }
160
}
161

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc