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

box / box-java-sdk-gen / #236

23 Jun 2025 12:23PM UTC coverage: 35.733% (+0.01%) from 35.722%
#236

Pull #343

github

web-flow
Merge ee8babc34 into 8c4ecda2f
Pull Request #343: test: Hubs API integration tests (box/box-codegen#727)

446 of 1240 new or added lines in 43 files covered. (35.97%)

8 existing lines in 1 file now uncovered.

16618 of 46506 relevant lines covered (35.73%)

0.36 hits per line

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

74.77
/src/main/java/com/box/sdkgen/managers/hubs/HubsManager.java
1
package com.box.sdkgen.managers.hubs;
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.hubsv2025r0.HubsV2025R0;
15
import com.box.sdkgen.schemas.v2025r0.hubv2025r0.HubV2025R0;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class HubsManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

NEW
25
  public HubsManager() {
×
NEW
26
    this.networkSession = new NetworkSession();
×
NEW
27
  }
×
28

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

34
  public HubsV2025R0 getHubsV2025R0() {
NEW
35
    return getHubsV2025R0(new GetHubsV2025R0QueryParams(), new GetHubsV2025R0Headers());
×
36
  }
37

38
  public HubsV2025R0 getHubsV2025R0(GetHubsV2025R0QueryParams queryParams) {
39
    return getHubsV2025R0(queryParams, new GetHubsV2025R0Headers());
1✔
40
  }
41

42
  public HubsV2025R0 getHubsV2025R0(GetHubsV2025R0Headers headers) {
NEW
43
    return getHubsV2025R0(new GetHubsV2025R0QueryParams(), headers);
×
44
  }
45

46
  public HubsV2025R0 getHubsV2025R0(
47
      GetHubsV2025R0QueryParams queryParams, GetHubsV2025R0Headers headers) {
48
    Map<String, String> queryParamsMap =
1✔
49
        prepareParams(
1✔
50
            mapOf(
1✔
51
                entryOf("query", convertToString(queryParams.getQuery())),
1✔
52
                entryOf("scope", convertToString(queryParams.getScope())),
1✔
53
                entryOf("sort", convertToString(queryParams.getSort())),
1✔
54
                entryOf("direction", convertToString(queryParams.getDirection())),
1✔
55
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
56
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
57
    Map<String, String> headersMap =
1✔
58
        prepareParams(
1✔
59
            mergeMaps(
1✔
60
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
61
                headers.getExtraHeaders()));
1✔
62
    FetchResponse response =
1✔
63
        this.networkSession
64
            .getNetworkClient()
1✔
65
            .fetch(
1✔
66
                new FetchOptions.Builder(
67
                        String.join(
1✔
68
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/hubs"),
1✔
69
                        "GET")
70
                    .params(queryParamsMap)
1✔
71
                    .headers(headersMap)
1✔
72
                    .responseFormat(ResponseFormat.JSON)
1✔
73
                    .auth(this.auth)
1✔
74
                    .networkSession(this.networkSession)
1✔
75
                    .build());
1✔
76
    return JsonManager.deserialize(response.getData(), HubsV2025R0.class);
1✔
77
  }
78

79
  public HubsV2025R0 getEnterpriseHubsV2025R0() {
NEW
80
    return getEnterpriseHubsV2025R0(
×
81
        new GetEnterpriseHubsV2025R0QueryParams(), new GetEnterpriseHubsV2025R0Headers());
82
  }
83

84
  public HubsV2025R0 getEnterpriseHubsV2025R0(GetEnterpriseHubsV2025R0QueryParams queryParams) {
85
    return getEnterpriseHubsV2025R0(queryParams, new GetEnterpriseHubsV2025R0Headers());
1✔
86
  }
87

88
  public HubsV2025R0 getEnterpriseHubsV2025R0(GetEnterpriseHubsV2025R0Headers headers) {
NEW
89
    return getEnterpriseHubsV2025R0(new GetEnterpriseHubsV2025R0QueryParams(), headers);
×
90
  }
91

92
  public HubsV2025R0 getEnterpriseHubsV2025R0(
93
      GetEnterpriseHubsV2025R0QueryParams queryParams, GetEnterpriseHubsV2025R0Headers headers) {
94
    Map<String, String> queryParamsMap =
1✔
95
        prepareParams(
1✔
96
            mapOf(
1✔
97
                entryOf("query", convertToString(queryParams.getQuery())),
1✔
98
                entryOf("sort", convertToString(queryParams.getSort())),
1✔
99
                entryOf("direction", convertToString(queryParams.getDirection())),
1✔
100
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
101
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
102
    Map<String, String> headersMap =
1✔
103
        prepareParams(
1✔
104
            mergeMaps(
1✔
105
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
106
                headers.getExtraHeaders()));
1✔
107
    FetchResponse response =
1✔
108
        this.networkSession
109
            .getNetworkClient()
1✔
110
            .fetch(
1✔
111
                new FetchOptions.Builder(
112
                        String.join(
1✔
113
                            "",
114
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
115
                            "/2.0/enterprise_hubs"),
116
                        "GET")
117
                    .params(queryParamsMap)
1✔
118
                    .headers(headersMap)
1✔
119
                    .responseFormat(ResponseFormat.JSON)
1✔
120
                    .auth(this.auth)
1✔
121
                    .networkSession(this.networkSession)
1✔
122
                    .build());
1✔
123
    return JsonManager.deserialize(response.getData(), HubsV2025R0.class);
1✔
124
  }
125

126
  public HubV2025R0 getHubByIdV2025R0(String hubId) {
127
    return getHubByIdV2025R0(hubId, new GetHubByIdV2025R0Headers());
1✔
128
  }
129

130
  public HubV2025R0 getHubByIdV2025R0(String hubId, GetHubByIdV2025R0Headers headers) {
131
    Map<String, String> headersMap =
1✔
132
        prepareParams(
1✔
133
            mergeMaps(
1✔
134
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
135
                headers.getExtraHeaders()));
1✔
136
    FetchResponse response =
1✔
137
        this.networkSession
138
            .getNetworkClient()
1✔
139
            .fetch(
1✔
140
                new FetchOptions.Builder(
141
                        String.join(
1✔
142
                            "",
143
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
144
                            "/2.0/hubs/",
145
                            convertToString(hubId)),
1✔
146
                        "GET")
147
                    .headers(headersMap)
1✔
148
                    .responseFormat(ResponseFormat.JSON)
1✔
149
                    .auth(this.auth)
1✔
150
                    .networkSession(this.networkSession)
1✔
151
                    .build());
1✔
152
    return JsonManager.deserialize(response.getData(), HubV2025R0.class);
1✔
153
  }
154

155
  public void deleteHubByIdV2025R0(String hubId) {
NEW
156
    deleteHubByIdV2025R0(hubId, new DeleteHubByIdV2025R0Headers());
×
NEW
157
  }
×
158

159
  public void deleteHubByIdV2025R0(String hubId, DeleteHubByIdV2025R0Headers headers) {
NEW
160
    Map<String, String> headersMap =
×
NEW
161
        prepareParams(
×
NEW
162
            mergeMaps(
×
NEW
163
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
NEW
164
                headers.getExtraHeaders()));
×
NEW
165
    FetchResponse response =
×
166
        this.networkSession
NEW
167
            .getNetworkClient()
×
NEW
168
            .fetch(
×
169
                new FetchOptions.Builder(
NEW
170
                        String.join(
×
171
                            "",
NEW
172
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
173
                            "/2.0/hubs/",
NEW
174
                            convertToString(hubId)),
×
175
                        "DELETE")
NEW
176
                    .headers(headersMap)
×
NEW
177
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
NEW
178
                    .auth(this.auth)
×
NEW
179
                    .networkSession(this.networkSession)
×
NEW
180
                    .build());
×
NEW
181
  }
×
182

183
  public Authentication getAuth() {
NEW
184
    return auth;
×
185
  }
186

187
  public NetworkSession getNetworkSession() {
NEW
188
    return networkSession;
×
189
  }
190

191
  public static class Builder {
192

193
    protected Authentication auth;
194

195
    protected NetworkSession networkSession;
196

197
    public Builder() {
1✔
198
      this.networkSession = new NetworkSession();
1✔
199
    }
1✔
200

201
    public Builder auth(Authentication auth) {
202
      this.auth = auth;
1✔
203
      return this;
1✔
204
    }
205

206
    public Builder networkSession(NetworkSession networkSession) {
207
      this.networkSession = networkSession;
1✔
208
      return this;
1✔
209
    }
210

211
    public HubsManager build() {
212
      return new HubsManager(this);
1✔
213
    }
214
  }
215
}
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