• 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

93.9
/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) {
1✔
31
    this.auth = builder.auth;
1✔
32
    this.networkSession = builder.networkSession;
1✔
33
  }
1✔
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());
1✔
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()));
1✔
58
    FetchResponse response =
1✔
59
        this.networkSession
60
            .getNetworkClient()
1✔
61
            .fetch(
1✔
62
                new FetchOptions.Builder(
63
                        String.join(
1✔
64
                            "",
65
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
66
                            "/2.0/file_requests/",
67
                            convertToString(fileRequestId)),
1✔
68
                        "GET")
69
                    .headers(headersMap)
1✔
70
                    .responseFormat(ResponseFormat.JSON)
1✔
71
                    .auth(this.auth)
1✔
72
                    .networkSession(this.networkSession)
1✔
73
                    .build());
1✔
74
    return JsonManager.deserialize(response.getData(), FileRequest.class);
1✔
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());
1✔
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 =
1✔
106
        prepareParams(
1✔
107
            mergeMaps(
1✔
108
                mapOf(entryOf("if-match", convertToString(headers.getIfMatch()))),
1✔
109
                headers.getExtraHeaders()));
1✔
110
    FetchResponse response =
1✔
111
        this.networkSession
112
            .getNetworkClient()
1✔
113
            .fetch(
1✔
114
                new FetchOptions.Builder(
115
                        String.join(
1✔
116
                            "",
117
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
118
                            "/2.0/file_requests/",
119
                            convertToString(fileRequestId)),
1✔
120
                        "PUT")
121
                    .headers(headersMap)
1✔
122
                    .data(JsonManager.serialize(requestBody))
1✔
123
                    .contentType("application/json")
1✔
124
                    .responseFormat(ResponseFormat.JSON)
1✔
125
                    .auth(this.auth)
1✔
126
                    .networkSession(this.networkSession)
1✔
127
                    .build());
1✔
128
    return JsonManager.deserialize(response.getData(), FileRequest.class);
1✔
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());
1✔
141
  }
1✔
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()));
1✔
154
    FetchResponse response =
1✔
155
        this.networkSession
156
            .getNetworkClient()
1✔
157
            .fetch(
1✔
158
                new FetchOptions.Builder(
159
                        String.join(
1✔
160
                            "",
161
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
162
                            "/2.0/file_requests/",
163
                            convertToString(fileRequestId)),
1✔
164
                        "DELETE")
165
                    .headers(headersMap)
1✔
166
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
167
                    .auth(this.auth)
1✔
168
                    .networkSession(this.networkSession)
1✔
169
                    .build());
1✔
170
  }
1✔
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());
1✔
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()));
1✔
203
    FetchResponse response =
1✔
204
        this.networkSession
205
            .getNetworkClient()
1✔
206
            .fetch(
1✔
207
                new FetchOptions.Builder(
208
                        String.join(
1✔
209
                            "",
210
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
211
                            "/2.0/file_requests/",
212
                            convertToString(fileRequestId),
1✔
213
                            "/copy"),
214
                        "POST")
215
                    .headers(headersMap)
1✔
216
                    .data(JsonManager.serialize(requestBody))
1✔
217
                    .contentType("application/json")
1✔
218
                    .responseFormat(ResponseFormat.JSON)
1✔
219
                    .auth(this.auth)
1✔
220
                    .networkSession(this.networkSession)
1✔
221
                    .build());
1✔
222
    return JsonManager.deserialize(response.getData(), FileRequest.class);
1✔
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

239
    public Builder() {
1✔
240
      this.networkSession = new NetworkSession();
1✔
241
    }
1✔
242

243
    public Builder auth(Authentication auth) {
244
      this.auth = auth;
1✔
245
      return this;
1✔
246
    }
247

248
    public Builder networkSession(NetworkSession networkSession) {
249
      this.networkSession = networkSession;
1✔
250
      return this;
1✔
251
    }
252

253
    public FileRequestsManager build() {
254
      return new FileRequestsManager(this);
1✔
255
    }
256
  }
257
}
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