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

box / box-java-sdk / #5076

07 Oct 2025 12:35PM UTC coverage: 37.132% (+0.007%) from 37.125%
#5076

push

github

web-flow
test: Change `Event.additionalDetails` field assertion in events test (box/box-codegen#858) (#1491)

18454 of 49699 relevant lines covered (37.13%)

0.37 hits per line

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

10.26
/src/main/java/com/box/sdkgen/managers/hubcollaborations/HubCollaborationsManager.java
1
package com.box.sdkgen.managers.hubcollaborations;
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.v2025r0.hubcollaborationcreaterequestv2025r0.HubCollaborationCreateRequestV2025R0;
15
import com.box.sdkgen.schemas.v2025r0.hubcollaborationsv2025r0.HubCollaborationsV2025R0;
16
import com.box.sdkgen.schemas.v2025r0.hubcollaborationupdaterequestv2025r0.HubCollaborationUpdateRequestV2025R0;
17
import com.box.sdkgen.schemas.v2025r0.hubcollaborationv2025r0.HubCollaborationV2025R0;
18
import com.box.sdkgen.serialization.json.JsonManager;
19
import java.util.Map;
20

21
public class HubCollaborationsManager {
22

23
  public Authentication auth;
24

25
  public NetworkSession networkSession;
26

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

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

36
  /**
37
   * Retrieves all collaborations for a Box Hub.
38
   *
39
   * @param queryParams Query parameters of getHubCollaborationsV2025R0 method
40
   */
41
  public HubCollaborationsV2025R0 getHubCollaborationsV2025R0(
42
      GetHubCollaborationsV2025R0QueryParams queryParams) {
43
    return getHubCollaborationsV2025R0(queryParams, new GetHubCollaborationsV2025R0Headers());
×
44
  }
45

46
  /**
47
   * Retrieves all collaborations for a Box Hub.
48
   *
49
   * @param queryParams Query parameters of getHubCollaborationsV2025R0 method
50
   * @param headers Headers of getHubCollaborationsV2025R0 method
51
   */
52
  public HubCollaborationsV2025R0 getHubCollaborationsV2025R0(
53
      GetHubCollaborationsV2025R0QueryParams queryParams,
54
      GetHubCollaborationsV2025R0Headers headers) {
55
    Map<String, String> queryParamsMap =
×
56
        prepareParams(
×
57
            mapOf(
×
58
                entryOf("hub_id", convertToString(queryParams.getHubId())),
×
59
                entryOf("marker", convertToString(queryParams.getMarker())),
×
60
                entryOf("limit", convertToString(queryParams.getLimit()))));
×
61
    Map<String, String> headersMap =
×
62
        prepareParams(
×
63
            mergeMaps(
×
64
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
65
                headers.getExtraHeaders()));
×
66
    FetchResponse response =
×
67
        this.networkSession
68
            .getNetworkClient()
×
69
            .fetch(
×
70
                new FetchOptions.Builder(
71
                        String.join(
×
72
                            "",
73
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
74
                            "/2.0/hub_collaborations"),
75
                        "GET")
76
                    .params(queryParamsMap)
×
77
                    .headers(headersMap)
×
78
                    .responseFormat(ResponseFormat.JSON)
×
79
                    .auth(this.auth)
×
80
                    .networkSession(this.networkSession)
×
81
                    .build());
×
82
    return JsonManager.deserialize(response.getData(), HubCollaborationsV2025R0.class);
×
83
  }
84

85
  /**
86
   * Adds a collaboration for a single user or a single group to a Box Hub.
87
   *
88
   * <p>Collaborations can be created using email address, user IDs, or group IDs.
89
   *
90
   * @param requestBody Request body of createHubCollaborationV2025R0 method
91
   */
92
  public HubCollaborationV2025R0 createHubCollaborationV2025R0(
93
      HubCollaborationCreateRequestV2025R0 requestBody) {
94
    return createHubCollaborationV2025R0(requestBody, new CreateHubCollaborationV2025R0Headers());
×
95
  }
96

97
  /**
98
   * Adds a collaboration for a single user or a single group to a Box Hub.
99
   *
100
   * <p>Collaborations can be created using email address, user IDs, or group IDs.
101
   *
102
   * @param requestBody Request body of createHubCollaborationV2025R0 method
103
   * @param headers Headers of createHubCollaborationV2025R0 method
104
   */
105
  public HubCollaborationV2025R0 createHubCollaborationV2025R0(
106
      HubCollaborationCreateRequestV2025R0 requestBody,
107
      CreateHubCollaborationV2025R0Headers headers) {
108
    Map<String, String> headersMap =
×
109
        prepareParams(
×
110
            mergeMaps(
×
111
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
112
                headers.getExtraHeaders()));
×
113
    FetchResponse response =
×
114
        this.networkSession
115
            .getNetworkClient()
×
116
            .fetch(
×
117
                new FetchOptions.Builder(
118
                        String.join(
×
119
                            "",
120
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
121
                            "/2.0/hub_collaborations"),
122
                        "POST")
123
                    .headers(headersMap)
×
124
                    .data(JsonManager.serialize(requestBody))
×
125
                    .contentType("application/json")
×
126
                    .responseFormat(ResponseFormat.JSON)
×
127
                    .auth(this.auth)
×
128
                    .networkSession(this.networkSession)
×
129
                    .build());
×
130
    return JsonManager.deserialize(response.getData(), HubCollaborationV2025R0.class);
×
131
  }
132

133
  /**
134
   * Retrieves details for a Box Hub collaboration by collaboration ID.
135
   *
136
   * @param hubCollaborationId The ID of the hub collaboration. Example: "1234"
137
   */
138
  public HubCollaborationV2025R0 getHubCollaborationByIdV2025R0(String hubCollaborationId) {
139
    return getHubCollaborationByIdV2025R0(
×
140
        hubCollaborationId, new GetHubCollaborationByIdV2025R0Headers());
141
  }
142

143
  /**
144
   * Retrieves details for a Box Hub collaboration by collaboration ID.
145
   *
146
   * @param hubCollaborationId The ID of the hub collaboration. Example: "1234"
147
   * @param headers Headers of getHubCollaborationByIdV2025R0 method
148
   */
149
  public HubCollaborationV2025R0 getHubCollaborationByIdV2025R0(
150
      String hubCollaborationId, GetHubCollaborationByIdV2025R0Headers headers) {
151
    Map<String, String> headersMap =
×
152
        prepareParams(
×
153
            mergeMaps(
×
154
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
155
                headers.getExtraHeaders()));
×
156
    FetchResponse response =
×
157
        this.networkSession
158
            .getNetworkClient()
×
159
            .fetch(
×
160
                new FetchOptions.Builder(
161
                        String.join(
×
162
                            "",
163
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
164
                            "/2.0/hub_collaborations/",
165
                            convertToString(hubCollaborationId)),
×
166
                        "GET")
167
                    .headers(headersMap)
×
168
                    .responseFormat(ResponseFormat.JSON)
×
169
                    .auth(this.auth)
×
170
                    .networkSession(this.networkSession)
×
171
                    .build());
×
172
    return JsonManager.deserialize(response.getData(), HubCollaborationV2025R0.class);
×
173
  }
174

175
  /**
176
   * Updates a Box Hub collaboration. Can be used to change the Box Hub role.
177
   *
178
   * @param hubCollaborationId The ID of the hub collaboration. Example: "1234"
179
   * @param requestBody Request body of updateHubCollaborationByIdV2025R0 method
180
   */
181
  public HubCollaborationV2025R0 updateHubCollaborationByIdV2025R0(
182
      String hubCollaborationId, HubCollaborationUpdateRequestV2025R0 requestBody) {
183
    return updateHubCollaborationByIdV2025R0(
×
184
        hubCollaborationId, requestBody, new UpdateHubCollaborationByIdV2025R0Headers());
185
  }
186

187
  /**
188
   * Updates a Box Hub collaboration. Can be used to change the Box Hub role.
189
   *
190
   * @param hubCollaborationId The ID of the hub collaboration. Example: "1234"
191
   * @param requestBody Request body of updateHubCollaborationByIdV2025R0 method
192
   * @param headers Headers of updateHubCollaborationByIdV2025R0 method
193
   */
194
  public HubCollaborationV2025R0 updateHubCollaborationByIdV2025R0(
195
      String hubCollaborationId,
196
      HubCollaborationUpdateRequestV2025R0 requestBody,
197
      UpdateHubCollaborationByIdV2025R0Headers headers) {
198
    Map<String, String> headersMap =
×
199
        prepareParams(
×
200
            mergeMaps(
×
201
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
202
                headers.getExtraHeaders()));
×
203
    FetchResponse response =
×
204
        this.networkSession
205
            .getNetworkClient()
×
206
            .fetch(
×
207
                new FetchOptions.Builder(
208
                        String.join(
×
209
                            "",
210
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
211
                            "/2.0/hub_collaborations/",
212
                            convertToString(hubCollaborationId)),
×
213
                        "PUT")
214
                    .headers(headersMap)
×
215
                    .data(JsonManager.serialize(requestBody))
×
216
                    .contentType("application/json")
×
217
                    .responseFormat(ResponseFormat.JSON)
×
218
                    .auth(this.auth)
×
219
                    .networkSession(this.networkSession)
×
220
                    .build());
×
221
    return JsonManager.deserialize(response.getData(), HubCollaborationV2025R0.class);
×
222
  }
223

224
  /**
225
   * Deletes a single Box Hub collaboration.
226
   *
227
   * @param hubCollaborationId The ID of the hub collaboration. Example: "1234"
228
   */
229
  public void deleteHubCollaborationByIdV2025R0(String hubCollaborationId) {
230
    deleteHubCollaborationByIdV2025R0(
×
231
        hubCollaborationId, new DeleteHubCollaborationByIdV2025R0Headers());
232
  }
×
233

234
  /**
235
   * Deletes a single Box Hub collaboration.
236
   *
237
   * @param hubCollaborationId The ID of the hub collaboration. Example: "1234"
238
   * @param headers Headers of deleteHubCollaborationByIdV2025R0 method
239
   */
240
  public void deleteHubCollaborationByIdV2025R0(
241
      String hubCollaborationId, DeleteHubCollaborationByIdV2025R0Headers headers) {
242
    Map<String, String> headersMap =
×
243
        prepareParams(
×
244
            mergeMaps(
×
245
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
246
                headers.getExtraHeaders()));
×
247
    FetchResponse response =
×
248
        this.networkSession
249
            .getNetworkClient()
×
250
            .fetch(
×
251
                new FetchOptions.Builder(
252
                        String.join(
×
253
                            "",
254
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
255
                            "/2.0/hub_collaborations/",
256
                            convertToString(hubCollaborationId)),
×
257
                        "DELETE")
258
                    .headers(headersMap)
×
259
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
260
                    .auth(this.auth)
×
261
                    .networkSession(this.networkSession)
×
262
                    .build());
×
263
  }
×
264

265
  public Authentication getAuth() {
266
    return auth;
×
267
  }
268

269
  public NetworkSession getNetworkSession() {
270
    return networkSession;
×
271
  }
272

273
  public static class Builder {
274

275
    protected Authentication auth;
276

277
    protected NetworkSession networkSession;
278

279
    public Builder() {
1✔
280
      this.networkSession = new NetworkSession();
1✔
281
    }
1✔
282

283
    public Builder auth(Authentication auth) {
284
      this.auth = auth;
1✔
285
      return this;
1✔
286
    }
287

288
    public Builder networkSession(NetworkSession networkSession) {
289
      this.networkSession = networkSession;
1✔
290
      return this;
1✔
291
    }
292

293
    public HubCollaborationsManager build() {
294
      return new HubCollaborationsManager(this);
1✔
295
    }
296
  }
297
}
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