• 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/filerequests/FileRequestsManager.java
1
package com.box.sdkgen.managers.filerequests;
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.filerequest.FileRequest;
15
import com.box.sdkgen.schemas.filerequestcopyrequest.FileRequestCopyRequest;
16
import com.box.sdkgen.schemas.filerequestupdaterequest.FileRequestUpdateRequest;
17
import com.box.sdkgen.serialization.json.JsonManager;
18
import java.util.Map;
19

20
public class FileRequestsManager {
21

22
  public Authentication auth;
23

24
  public NetworkSession networkSession;
25

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

30
  protected FileRequestsManager(Builder builder) {
×
31
    this.auth = builder.auth;
×
32
    this.networkSession = builder.networkSession;
×
33
  }
×
34

35
  /**
36
   * Retrieves the information about a file request.
37
   *
38
   * @param fileRequestId The unique identifier that represent a file request.
39
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
40
   *     web application and copying the ID from the URL. For example, for the URL
41
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
42
   */
43
  public FileRequest getFileRequestById(String fileRequestId) {
44
    return getFileRequestById(fileRequestId, new GetFileRequestByIdHeaders());
×
45
  }
46

47
  /**
48
   * Retrieves the information about a file request.
49
   *
50
   * @param fileRequestId The unique identifier that represent a file request.
51
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
52
   *     web application and copying the ID from the URL. For example, for the URL
53
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
54
   * @param headers Headers of getFileRequestById method
55
   */
56
  public FileRequest getFileRequestById(String fileRequestId, GetFileRequestByIdHeaders headers) {
57
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
58
    FetchResponse response =
×
59
        this.networkSession
60
            .getNetworkClient()
×
61
            .fetch(
×
62
                new FetchOptions.Builder(
63
                        String.join(
×
64
                            "",
65
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
66
                            "/2.0/file_requests/",
67
                            convertToString(fileRequestId)),
×
68
                        "GET")
69
                    .headers(headersMap)
×
70
                    .responseFormat(ResponseFormat.JSON)
×
71
                    .auth(this.auth)
×
72
                    .networkSession(this.networkSession)
×
73
                    .build());
×
74
    return JsonManager.deserialize(response.getData(), FileRequest.class);
×
75
  }
76

77
  /**
78
   * Updates a file request. This can be used to activate or deactivate a file request.
79
   *
80
   * @param fileRequestId The unique identifier that represent a file request.
81
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
82
   *     web application and copying the ID from the URL. For example, for the URL
83
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
84
   * @param requestBody Request body of updateFileRequestById method
85
   */
86
  public FileRequest updateFileRequestById(
87
      String fileRequestId, FileRequestUpdateRequest requestBody) {
88
    return updateFileRequestById(fileRequestId, requestBody, new UpdateFileRequestByIdHeaders());
×
89
  }
90

91
  /**
92
   * Updates a file request. This can be used to activate or deactivate a file request.
93
   *
94
   * @param fileRequestId The unique identifier that represent a file request.
95
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
96
   *     web application and copying the ID from the URL. For example, for the URL
97
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
98
   * @param requestBody Request body of updateFileRequestById method
99
   * @param headers Headers of updateFileRequestById method
100
   */
101
  public FileRequest updateFileRequestById(
102
      String fileRequestId,
103
      FileRequestUpdateRequest requestBody,
104
      UpdateFileRequestByIdHeaders headers) {
105
    Map<String, String> headersMap =
×
106
        prepareParams(
×
107
            mergeMaps(
×
108
                mapOf(entryOf("if-match", convertToString(headers.getIfMatch()))),
×
109
                headers.getExtraHeaders()));
×
110
    FetchResponse response =
×
111
        this.networkSession
112
            .getNetworkClient()
×
113
            .fetch(
×
114
                new FetchOptions.Builder(
115
                        String.join(
×
116
                            "",
117
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
118
                            "/2.0/file_requests/",
119
                            convertToString(fileRequestId)),
×
120
                        "PUT")
121
                    .headers(headersMap)
×
122
                    .data(JsonManager.serialize(requestBody))
×
123
                    .contentType("application/json")
×
124
                    .responseFormat(ResponseFormat.JSON)
×
125
                    .auth(this.auth)
×
126
                    .networkSession(this.networkSession)
×
127
                    .build());
×
128
    return JsonManager.deserialize(response.getData(), FileRequest.class);
×
129
  }
130

131
  /**
132
   * Deletes a file request permanently.
133
   *
134
   * @param fileRequestId The unique identifier that represent a file request.
135
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
136
   *     web application and copying the ID from the URL. For example, for the URL
137
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
138
   */
139
  public void deleteFileRequestById(String fileRequestId) {
140
    deleteFileRequestById(fileRequestId, new DeleteFileRequestByIdHeaders());
×
141
  }
×
142

143
  /**
144
   * Deletes a file request permanently.
145
   *
146
   * @param fileRequestId The unique identifier that represent a file request.
147
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
148
   *     web application and copying the ID from the URL. For example, for the URL
149
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
150
   * @param headers Headers of deleteFileRequestById method
151
   */
152
  public void deleteFileRequestById(String fileRequestId, DeleteFileRequestByIdHeaders headers) {
153
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
154
    FetchResponse response =
×
155
        this.networkSession
156
            .getNetworkClient()
×
157
            .fetch(
×
158
                new FetchOptions.Builder(
159
                        String.join(
×
160
                            "",
161
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
162
                            "/2.0/file_requests/",
163
                            convertToString(fileRequestId)),
×
164
                        "DELETE")
165
                    .headers(headersMap)
×
166
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
167
                    .auth(this.auth)
×
168
                    .networkSession(this.networkSession)
×
169
                    .build());
×
170
  }
×
171

172
  /**
173
   * Copies an existing file request that is already present on one folder, and applies it to
174
   * another folder.
175
   *
176
   * @param fileRequestId The unique identifier that represent a file request.
177
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
178
   *     web application and copying the ID from the URL. For example, for the URL
179
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
180
   * @param requestBody Request body of createFileRequestCopy method
181
   */
182
  public FileRequest createFileRequestCopy(
183
      String fileRequestId, FileRequestCopyRequest requestBody) {
184
    return createFileRequestCopy(fileRequestId, requestBody, new CreateFileRequestCopyHeaders());
×
185
  }
186

187
  /**
188
   * Copies an existing file request that is already present on one folder, and applies it to
189
   * another folder.
190
   *
191
   * @param fileRequestId The unique identifier that represent a file request.
192
   *     <p>The ID for any file request can be determined by visiting a file request builder in the
193
   *     web application and copying the ID from the URL. For example, for the URL
194
   *     `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123"
195
   * @param requestBody Request body of createFileRequestCopy method
196
   * @param headers Headers of createFileRequestCopy method
197
   */
198
  public FileRequest createFileRequestCopy(
199
      String fileRequestId,
200
      FileRequestCopyRequest requestBody,
201
      CreateFileRequestCopyHeaders headers) {
202
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), 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/file_requests/",
212
                            convertToString(fileRequestId),
×
213
                            "/copy"),
214
                        "POST")
215
                    .headers(headersMap)
×
216
                    .data(JsonManager.serialize(requestBody))
×
217
                    .contentType("application/json")
×
218
                    .responseFormat(ResponseFormat.JSON)
×
219
                    .auth(this.auth)
×
220
                    .networkSession(this.networkSession)
×
221
                    .build());
×
222
    return JsonManager.deserialize(response.getData(), FileRequest.class);
×
223
  }
224

225
  public Authentication getAuth() {
226
    return auth;
×
227
  }
228

229
  public NetworkSession getNetworkSession() {
230
    return networkSession;
×
231
  }
232

233
  public static class Builder {
234

235
    protected Authentication auth;
236

237
    protected NetworkSession networkSession;
238

NEW
239
    public Builder() {}
×
240

241
    public Builder auth(Authentication auth) {
UNCOV
242
      this.auth = auth;
×
UNCOV
243
      return this;
×
244
    }
245

246
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
247
      this.networkSession = networkSession;
×
UNCOV
248
      return this;
×
249
    }
250

251
    public FileRequestsManager build() {
NEW
252
      if (this.networkSession == null) {
×
NEW
253
        this.networkSession = new NetworkSession();
×
254
      }
255
      return new FileRequestsManager(this);
×
256
    }
257
  }
258
}
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