• 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

19.67
/src/main/java/com/box/sdkgen/managers/hubitems/HubItemsManager.java
1
package com.box.sdkgen.managers.hubitems;
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.hubitemsmanagerequestv2025r0.HubItemsManageRequestV2025R0;
15
import com.box.sdkgen.schemas.v2025r0.hubitemsmanageresponsev2025r0.HubItemsManageResponseV2025R0;
16
import com.box.sdkgen.schemas.v2025r0.hubitemsv2025r0.HubItemsV2025R0;
17
import com.box.sdkgen.serialization.json.JsonManager;
18
import java.util.Map;
19

20
public class HubItemsManager {
21

22
  public Authentication auth;
23

24
  public NetworkSession networkSession;
25

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

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

35
  /**
36
   * Retrieves all items associated with a Box Hub.
37
   *
38
   * @param queryParams Query parameters of getHubItemsV2025R0 method
39
   */
40
  public HubItemsV2025R0 getHubItemsV2025R0(GetHubItemsV2025R0QueryParams queryParams) {
41
    return getHubItemsV2025R0(queryParams, new GetHubItemsV2025R0Headers());
×
42
  }
43

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

80
  /**
81
   * Adds and/or removes Box Hub items from a Box Hub.
82
   *
83
   * @param hubId The unique identifier that represent a hub.
84
   *     <p>The ID for any hub can be determined by visiting this hub in the web application and
85
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the
86
   *     `hub_id` is `123`. Example: "12345"
87
   * @param requestBody Request body of manageHubItemsV2025R0 method
88
   */
89
  public HubItemsManageResponseV2025R0 manageHubItemsV2025R0(
90
      String hubId, HubItemsManageRequestV2025R0 requestBody) {
91
    return manageHubItemsV2025R0(hubId, requestBody, new ManageHubItemsV2025R0Headers());
×
92
  }
93

94
  /**
95
   * Adds and/or removes Box Hub items from a Box Hub.
96
   *
97
   * @param hubId The unique identifier that represent a hub.
98
   *     <p>The ID for any hub can be determined by visiting this hub in the web application and
99
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the
100
   *     `hub_id` is `123`. Example: "12345"
101
   * @param requestBody Request body of manageHubItemsV2025R0 method
102
   * @param headers Headers of manageHubItemsV2025R0 method
103
   */
104
  public HubItemsManageResponseV2025R0 manageHubItemsV2025R0(
105
      String hubId,
106
      HubItemsManageRequestV2025R0 requestBody,
107
      ManageHubItemsV2025R0Headers 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/hubs/",
122
                            convertToString(hubId),
×
123
                            "/manage_items"),
124
                        "POST")
125
                    .headers(headersMap)
×
126
                    .data(JsonManager.serialize(requestBody))
×
127
                    .contentType("application/json")
×
128
                    .responseFormat(ResponseFormat.JSON)
×
129
                    .auth(this.auth)
×
130
                    .networkSession(this.networkSession)
×
131
                    .build());
×
132
    return JsonManager.deserialize(response.getData(), HubItemsManageResponseV2025R0.class);
×
133
  }
134

135
  public Authentication getAuth() {
136
    return auth;
×
137
  }
138

139
  public NetworkSession getNetworkSession() {
140
    return networkSession;
×
141
  }
142

143
  public static class Builder {
144

145
    protected Authentication auth;
146

147
    protected NetworkSession networkSession;
148

149
    public Builder() {
1✔
150
      this.networkSession = new NetworkSession();
1✔
151
    }
1✔
152

153
    public Builder auth(Authentication auth) {
154
      this.auth = auth;
1✔
155
      return this;
1✔
156
    }
157

158
    public Builder networkSession(NetworkSession networkSession) {
159
      this.networkSession = networkSession;
1✔
160
      return this;
1✔
161
    }
162

163
    public HubItemsManager build() {
164
      return new HubItemsManager(this);
1✔
165
    }
166
  }
167
}
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