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

box / box-java-sdk-gen / #541

05 Sep 2025 02:31PM UTC coverage: 7.451% (-29.2%) from 36.66%
#541

push

other

web-flow
chore: release version 0.8.1 (#437)

1 of 1 new or added line in 1 file covered. (100.0%)

14652 existing lines in 1191 files now uncovered.

3737 of 50151 relevant lines covered (7.45%)

0.07 hits per line

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

11.21
/src/main/java/com/box/sdkgen/managers/aistudio/AiStudioManager.java
1
package com.box.sdkgen.managers.aistudio;
2

3
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
4
import static com.box.sdkgen.internal.utils.UtilsManager.entryOf;
5
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
6
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
7
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;
8

9
import com.box.sdkgen.networking.auth.Authentication;
10
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
11
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
12
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
13
import com.box.sdkgen.networking.network.NetworkSession;
14
import com.box.sdkgen.schemas.aimultipleagentresponse.AiMultipleAgentResponse;
15
import com.box.sdkgen.schemas.aisingleagentresponsefull.AiSingleAgentResponseFull;
16
import com.box.sdkgen.schemas.createaiagent.CreateAiAgent;
17
import com.box.sdkgen.serialization.json.JsonManager;
18
import java.util.Map;
19

20
public class AiStudioManager {
21

22
  public Authentication auth;
23

24
  public NetworkSession networkSession;
25

26
  public AiStudioManager() {
×
27
    this.networkSession = new NetworkSession();
×
28
  }
×
29

30
  protected AiStudioManager(Builder builder) {
1✔
31
    this.auth = builder.auth;
1✔
32
    this.networkSession = builder.networkSession;
1✔
33
  }
1✔
34

35
  public AiMultipleAgentResponse getAiAgents() {
UNCOV
36
    return getAiAgents(new GetAiAgentsQueryParams(), new GetAiAgentsHeaders());
×
37
  }
38

39
  public AiMultipleAgentResponse getAiAgents(GetAiAgentsQueryParams queryParams) {
40
    return getAiAgents(queryParams, new GetAiAgentsHeaders());
×
41
  }
42

43
  public AiMultipleAgentResponse getAiAgents(GetAiAgentsHeaders headers) {
44
    return getAiAgents(new GetAiAgentsQueryParams(), headers);
×
45
  }
46

47
  public AiMultipleAgentResponse getAiAgents(
48
      GetAiAgentsQueryParams queryParams, GetAiAgentsHeaders headers) {
UNCOV
49
    Map<String, String> queryParamsMap =
×
UNCOV
50
        prepareParams(
×
UNCOV
51
            mapOf(
×
UNCOV
52
                entryOf("mode", convertToString(queryParams.getMode())),
×
UNCOV
53
                entryOf("fields", convertToString(queryParams.getFields())),
×
UNCOV
54
                entryOf("agent_state", convertToString(queryParams.getAgentState())),
×
UNCOV
55
                entryOf("include_box_default", convertToString(queryParams.getIncludeBoxDefault())),
×
UNCOV
56
                entryOf("marker", convertToString(queryParams.getMarker())),
×
UNCOV
57
                entryOf("limit", convertToString(queryParams.getLimit()))));
×
UNCOV
58
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
59
    FetchResponse response =
×
60
        this.networkSession
UNCOV
61
            .getNetworkClient()
×
UNCOV
62
            .fetch(
×
63
                new FetchOptions.Builder(
UNCOV
64
                        String.join(
×
UNCOV
65
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/ai_agents"),
×
66
                        "GET")
UNCOV
67
                    .params(queryParamsMap)
×
UNCOV
68
                    .headers(headersMap)
×
UNCOV
69
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
70
                    .auth(this.auth)
×
UNCOV
71
                    .networkSession(this.networkSession)
×
UNCOV
72
                    .build());
×
UNCOV
73
    return JsonManager.deserialize(response.getData(), AiMultipleAgentResponse.class);
×
74
  }
75

76
  public AiSingleAgentResponseFull createAiAgent(CreateAiAgent requestBody) {
UNCOV
77
    return createAiAgent(requestBody, new CreateAiAgentHeaders());
×
78
  }
79

80
  public AiSingleAgentResponseFull createAiAgent(
81
      CreateAiAgent requestBody, CreateAiAgentHeaders headers) {
UNCOV
82
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
83
    FetchResponse response =
×
84
        this.networkSession
UNCOV
85
            .getNetworkClient()
×
UNCOV
86
            .fetch(
×
87
                new FetchOptions.Builder(
UNCOV
88
                        String.join(
×
UNCOV
89
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/ai_agents"),
×
90
                        "POST")
UNCOV
91
                    .headers(headersMap)
×
UNCOV
92
                    .data(JsonManager.serialize(requestBody))
×
UNCOV
93
                    .contentType("application/json")
×
UNCOV
94
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
95
                    .auth(this.auth)
×
UNCOV
96
                    .networkSession(this.networkSession)
×
UNCOV
97
                    .build());
×
UNCOV
98
    return JsonManager.deserialize(response.getData(), AiSingleAgentResponseFull.class);
×
99
  }
100

101
  public AiSingleAgentResponseFull updateAiAgentById(String agentId, CreateAiAgent requestBody) {
UNCOV
102
    return updateAiAgentById(agentId, requestBody, new UpdateAiAgentByIdHeaders());
×
103
  }
104

105
  public AiSingleAgentResponseFull updateAiAgentById(
106
      String agentId, CreateAiAgent requestBody, UpdateAiAgentByIdHeaders headers) {
UNCOV
107
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
108
    FetchResponse response =
×
109
        this.networkSession
UNCOV
110
            .getNetworkClient()
×
UNCOV
111
            .fetch(
×
112
                new FetchOptions.Builder(
UNCOV
113
                        String.join(
×
114
                            "",
UNCOV
115
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
116
                            "/2.0/ai_agents/",
UNCOV
117
                            convertToString(agentId)),
×
118
                        "PUT")
UNCOV
119
                    .headers(headersMap)
×
UNCOV
120
                    .data(JsonManager.serialize(requestBody))
×
UNCOV
121
                    .contentType("application/json")
×
UNCOV
122
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
123
                    .auth(this.auth)
×
UNCOV
124
                    .networkSession(this.networkSession)
×
UNCOV
125
                    .build());
×
UNCOV
126
    return JsonManager.deserialize(response.getData(), AiSingleAgentResponseFull.class);
×
127
  }
128

129
  public AiSingleAgentResponseFull getAiAgentById(String agentId) {
130
    return getAiAgentById(agentId, new GetAiAgentByIdQueryParams(), new GetAiAgentByIdHeaders());
×
131
  }
132

133
  public AiSingleAgentResponseFull getAiAgentById(
134
      String agentId, GetAiAgentByIdQueryParams queryParams) {
UNCOV
135
    return getAiAgentById(agentId, queryParams, new GetAiAgentByIdHeaders());
×
136
  }
137

138
  public AiSingleAgentResponseFull getAiAgentById(String agentId, GetAiAgentByIdHeaders headers) {
139
    return getAiAgentById(agentId, new GetAiAgentByIdQueryParams(), headers);
×
140
  }
141

142
  public AiSingleAgentResponseFull getAiAgentById(
143
      String agentId, GetAiAgentByIdQueryParams queryParams, GetAiAgentByIdHeaders headers) {
UNCOV
144
    Map<String, String> queryParamsMap =
×
UNCOV
145
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
UNCOV
146
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
147
    FetchResponse response =
×
148
        this.networkSession
UNCOV
149
            .getNetworkClient()
×
UNCOV
150
            .fetch(
×
151
                new FetchOptions.Builder(
UNCOV
152
                        String.join(
×
153
                            "",
UNCOV
154
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
155
                            "/2.0/ai_agents/",
UNCOV
156
                            convertToString(agentId)),
×
157
                        "GET")
UNCOV
158
                    .params(queryParamsMap)
×
UNCOV
159
                    .headers(headersMap)
×
UNCOV
160
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
161
                    .auth(this.auth)
×
UNCOV
162
                    .networkSession(this.networkSession)
×
UNCOV
163
                    .build());
×
UNCOV
164
    return JsonManager.deserialize(response.getData(), AiSingleAgentResponseFull.class);
×
165
  }
166

167
  public void deleteAiAgentById(String agentId) {
UNCOV
168
    deleteAiAgentById(agentId, new DeleteAiAgentByIdHeaders());
×
UNCOV
169
  }
×
170

171
  public void deleteAiAgentById(String agentId, DeleteAiAgentByIdHeaders headers) {
UNCOV
172
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
173
    FetchResponse response =
×
174
        this.networkSession
UNCOV
175
            .getNetworkClient()
×
UNCOV
176
            .fetch(
×
177
                new FetchOptions.Builder(
UNCOV
178
                        String.join(
×
179
                            "",
UNCOV
180
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
181
                            "/2.0/ai_agents/",
UNCOV
182
                            convertToString(agentId)),
×
183
                        "DELETE")
UNCOV
184
                    .headers(headersMap)
×
UNCOV
185
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
UNCOV
186
                    .auth(this.auth)
×
UNCOV
187
                    .networkSession(this.networkSession)
×
UNCOV
188
                    .build());
×
UNCOV
189
  }
×
190

191
  public Authentication getAuth() {
192
    return auth;
×
193
  }
194

195
  public NetworkSession getNetworkSession() {
196
    return networkSession;
×
197
  }
198

199
  public static class Builder {
200

201
    protected Authentication auth;
202

203
    protected NetworkSession networkSession;
204

205
    public Builder() {
1✔
206
      this.networkSession = new NetworkSession();
1✔
207
    }
1✔
208

209
    public Builder auth(Authentication auth) {
210
      this.auth = auth;
1✔
211
      return this;
1✔
212
    }
213

214
    public Builder networkSession(NetworkSession networkSession) {
215
      this.networkSession = networkSession;
1✔
216
      return this;
1✔
217
    }
218

219
    public AiStudioManager build() {
220
      return new AiStudioManager(this);
1✔
221
    }
222
  }
223
}
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