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

box / box-java-sdk / #6242

10 Feb 2026 05:27PM UTC coverage: 35.714% (+11.4%) from 24.324%
#6242

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2146 existing lines in 544 files now uncovered.

7382 of 20670 relevant lines covered (35.71%)

0.4 hits per line

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

0.0
/src/main/java/com/box/sdkgen/managers/weblinks/WebLinksManager.java
1
package com.box.sdkgen.managers.weblinks;
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.weblink.WebLink;
15
import com.box.sdkgen.serialization.json.JsonManager;
16
import java.util.Map;
17

18
public class WebLinksManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

24
  public WebLinksManager() {
×
25
    this.networkSession = new NetworkSession();
×
26
  }
×
27

28
  protected WebLinksManager(Builder builder) {
×
29
    this.auth = builder.auth;
×
30
    this.networkSession = builder.networkSession;
×
31
  }
×
32

33
  /**
34
   * Creates a web link object within a folder.
35
   *
36
   * @param requestBody Request body of createWebLink method
37
   */
38
  public WebLink createWebLink(CreateWebLinkRequestBody requestBody) {
39
    return createWebLink(requestBody, new CreateWebLinkHeaders());
×
40
  }
41

42
  /**
43
   * Creates a web link object within a folder.
44
   *
45
   * @param requestBody Request body of createWebLink method
46
   * @param headers Headers of createWebLink method
47
   */
48
  public WebLink createWebLink(CreateWebLinkRequestBody requestBody, CreateWebLinkHeaders headers) {
49
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
50
    FetchResponse response =
×
51
        this.networkSession
52
            .getNetworkClient()
×
53
            .fetch(
×
54
                new FetchOptions.Builder(
55
                        String.join(
×
56
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/web_links"),
×
57
                        "POST")
58
                    .headers(headersMap)
×
59
                    .data(JsonManager.serialize(requestBody))
×
60
                    .contentType("application/json")
×
61
                    .responseFormat(ResponseFormat.JSON)
×
62
                    .auth(this.auth)
×
63
                    .networkSession(this.networkSession)
×
64
                    .build());
×
65
    return JsonManager.deserialize(response.getData(), WebLink.class);
×
66
  }
67

68
  /**
69
   * Retrieve information about a web link.
70
   *
71
   * @param webLinkId The ID of the web link. Example: "12345"
72
   */
73
  public WebLink getWebLinkById(String webLinkId) {
74
    return getWebLinkById(webLinkId, new GetWebLinkByIdHeaders());
×
75
  }
76

77
  /**
78
   * Retrieve information about a web link.
79
   *
80
   * @param webLinkId The ID of the web link. Example: "12345"
81
   * @param headers Headers of getWebLinkById method
82
   */
83
  public WebLink getWebLinkById(String webLinkId, GetWebLinkByIdHeaders headers) {
84
    Map<String, String> headersMap =
×
85
        prepareParams(
×
86
            mergeMaps(
×
87
                mapOf(entryOf("boxapi", convertToString(headers.getBoxapi()))),
×
88
                headers.getExtraHeaders()));
×
89
    FetchResponse response =
×
90
        this.networkSession
91
            .getNetworkClient()
×
92
            .fetch(
×
93
                new FetchOptions.Builder(
94
                        String.join(
×
95
                            "",
96
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
97
                            "/2.0/web_links/",
98
                            convertToString(webLinkId)),
×
99
                        "GET")
100
                    .headers(headersMap)
×
101
                    .responseFormat(ResponseFormat.JSON)
×
102
                    .auth(this.auth)
×
103
                    .networkSession(this.networkSession)
×
104
                    .build());
×
105
    return JsonManager.deserialize(response.getData(), WebLink.class);
×
106
  }
107

108
  /**
109
   * Updates a web link object.
110
   *
111
   * @param webLinkId The ID of the web link. Example: "12345"
112
   */
113
  public WebLink updateWebLinkById(String webLinkId) {
114
    return updateWebLinkById(
×
115
        webLinkId, new UpdateWebLinkByIdRequestBody(), new UpdateWebLinkByIdHeaders());
116
  }
117

118
  /**
119
   * Updates a web link object.
120
   *
121
   * @param webLinkId The ID of the web link. Example: "12345"
122
   * @param requestBody Request body of updateWebLinkById method
123
   */
124
  public WebLink updateWebLinkById(String webLinkId, UpdateWebLinkByIdRequestBody requestBody) {
125
    return updateWebLinkById(webLinkId, requestBody, new UpdateWebLinkByIdHeaders());
×
126
  }
127

128
  /**
129
   * Updates a web link object.
130
   *
131
   * @param webLinkId The ID of the web link. Example: "12345"
132
   * @param headers Headers of updateWebLinkById method
133
   */
134
  public WebLink updateWebLinkById(String webLinkId, UpdateWebLinkByIdHeaders headers) {
135
    return updateWebLinkById(webLinkId, new UpdateWebLinkByIdRequestBody(), headers);
×
136
  }
137

138
  /**
139
   * Updates a web link object.
140
   *
141
   * @param webLinkId The ID of the web link. Example: "12345"
142
   * @param requestBody Request body of updateWebLinkById method
143
   * @param headers Headers of updateWebLinkById method
144
   */
145
  public WebLink updateWebLinkById(
146
      String webLinkId,
147
      UpdateWebLinkByIdRequestBody requestBody,
148
      UpdateWebLinkByIdHeaders headers) {
149
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
150
    FetchResponse response =
×
151
        this.networkSession
152
            .getNetworkClient()
×
153
            .fetch(
×
154
                new FetchOptions.Builder(
155
                        String.join(
×
156
                            "",
157
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
158
                            "/2.0/web_links/",
159
                            convertToString(webLinkId)),
×
160
                        "PUT")
161
                    .headers(headersMap)
×
162
                    .data(JsonManager.serialize(requestBody))
×
163
                    .contentType("application/json")
×
164
                    .responseFormat(ResponseFormat.JSON)
×
165
                    .auth(this.auth)
×
166
                    .networkSession(this.networkSession)
×
167
                    .build());
×
168
    return JsonManager.deserialize(response.getData(), WebLink.class);
×
169
  }
170

171
  /**
172
   * Deletes a web link.
173
   *
174
   * @param webLinkId The ID of the web link. Example: "12345"
175
   */
176
  public void deleteWebLinkById(String webLinkId) {
177
    deleteWebLinkById(webLinkId, new DeleteWebLinkByIdHeaders());
×
178
  }
×
179

180
  /**
181
   * Deletes a web link.
182
   *
183
   * @param webLinkId The ID of the web link. Example: "12345"
184
   * @param headers Headers of deleteWebLinkById method
185
   */
186
  public void deleteWebLinkById(String webLinkId, DeleteWebLinkByIdHeaders headers) {
187
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
188
    FetchResponse response =
×
189
        this.networkSession
190
            .getNetworkClient()
×
191
            .fetch(
×
192
                new FetchOptions.Builder(
193
                        String.join(
×
194
                            "",
195
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
196
                            "/2.0/web_links/",
197
                            convertToString(webLinkId)),
×
198
                        "DELETE")
199
                    .headers(headersMap)
×
200
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
201
                    .auth(this.auth)
×
202
                    .networkSession(this.networkSession)
×
203
                    .build());
×
204
  }
×
205

206
  public Authentication getAuth() {
207
    return auth;
×
208
  }
209

210
  public NetworkSession getNetworkSession() {
211
    return networkSession;
×
212
  }
213

214
  public static class Builder {
215

216
    protected Authentication auth;
217

218
    protected NetworkSession networkSession;
219

NEW
220
    public Builder() {}
×
221

222
    public Builder auth(Authentication auth) {
UNCOV
223
      this.auth = auth;
×
UNCOV
224
      return this;
×
225
    }
226

227
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
228
      this.networkSession = networkSession;
×
UNCOV
229
      return this;
×
230
    }
231

232
    public WebLinksManager build() {
NEW
233
      if (this.networkSession == null) {
×
NEW
234
        this.networkSession = new NetworkSession();
×
235
      }
236
      return new WebLinksManager(this);
×
237
    }
238
  }
239
}
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