• 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

77.55
/src/main/java/com/box/sdkgen/managers/signrequests/SignRequestsManager.java
1
package com.box.sdkgen.managers.signrequests;
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.signrequest.SignRequest;
15
import com.box.sdkgen.schemas.signrequestcreaterequest.SignRequestCreateRequest;
16
import com.box.sdkgen.schemas.signrequests.SignRequests;
17
import com.box.sdkgen.serialization.json.JsonManager;
18
import java.util.Map;
19

20
public class SignRequestsManager {
21

22
  public Authentication auth;
23

24
  public NetworkSession networkSession;
25

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

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

35
  /**
36
   * Cancels a sign request.
37
   *
38
   * @param signRequestId The ID of the signature request. Example: "33243242"
39
   */
40
  public SignRequest cancelSignRequest(String signRequestId) {
41
    return cancelSignRequest(signRequestId, new CancelSignRequestHeaders());
1✔
42
  }
43

44
  /**
45
   * Cancels a sign request.
46
   *
47
   * @param signRequestId The ID of the signature request. Example: "33243242"
48
   * @param headers Headers of cancelSignRequest method
49
   */
50
  public SignRequest cancelSignRequest(String signRequestId, CancelSignRequestHeaders headers) {
51
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
52
    FetchResponse response =
1✔
53
        this.networkSession
54
            .getNetworkClient()
1✔
55
            .fetch(
1✔
56
                new FetchOptions.Builder(
57
                        String.join(
1✔
58
                            "",
59
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
60
                            "/2.0/sign_requests/",
61
                            convertToString(signRequestId),
1✔
62
                            "/cancel"),
63
                        "POST")
64
                    .headers(headersMap)
1✔
65
                    .responseFormat(ResponseFormat.JSON)
1✔
66
                    .auth(this.auth)
1✔
67
                    .networkSession(this.networkSession)
1✔
68
                    .build());
1✔
69
    return JsonManager.deserialize(response.getData(), SignRequest.class);
1✔
70
  }
71

72
  /**
73
   * Resends a signature request email to all outstanding signers.
74
   *
75
   * @param signRequestId The ID of the signature request. Example: "33243242"
76
   */
77
  public void resendSignRequest(String signRequestId) {
78
    resendSignRequest(signRequestId, new ResendSignRequestHeaders());
×
79
  }
×
80

81
  /**
82
   * Resends a signature request email to all outstanding signers.
83
   *
84
   * @param signRequestId The ID of the signature request. Example: "33243242"
85
   * @param headers Headers of resendSignRequest method
86
   */
87
  public void resendSignRequest(String signRequestId, ResendSignRequestHeaders headers) {
88
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), 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/sign_requests/",
98
                            convertToString(signRequestId),
×
99
                            "/resend"),
100
                        "POST")
101
                    .headers(headersMap)
×
102
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
103
                    .auth(this.auth)
×
104
                    .networkSession(this.networkSession)
×
105
                    .build());
×
106
  }
×
107

108
  /**
109
   * Gets a sign request by ID.
110
   *
111
   * @param signRequestId The ID of the signature request. Example: "33243242"
112
   */
113
  public SignRequest getSignRequestById(String signRequestId) {
114
    return getSignRequestById(signRequestId, new GetSignRequestByIdHeaders());
1✔
115
  }
116

117
  /**
118
   * Gets a sign request by ID.
119
   *
120
   * @param signRequestId The ID of the signature request. Example: "33243242"
121
   * @param headers Headers of getSignRequestById method
122
   */
123
  public SignRequest getSignRequestById(String signRequestId, GetSignRequestByIdHeaders headers) {
124
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
125
    FetchResponse response =
1✔
126
        this.networkSession
127
            .getNetworkClient()
1✔
128
            .fetch(
1✔
129
                new FetchOptions.Builder(
130
                        String.join(
1✔
131
                            "",
132
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
133
                            "/2.0/sign_requests/",
134
                            convertToString(signRequestId)),
1✔
135
                        "GET")
136
                    .headers(headersMap)
1✔
137
                    .responseFormat(ResponseFormat.JSON)
1✔
138
                    .auth(this.auth)
1✔
139
                    .networkSession(this.networkSession)
1✔
140
                    .build());
1✔
141
    return JsonManager.deserialize(response.getData(), SignRequest.class);
1✔
142
  }
143

144
  /**
145
   * Gets signature requests created by a user. If the `sign_files` and/or `parent_folder` are
146
   * deleted, the signature request will not return in the list.
147
   */
148
  public SignRequests getSignRequests() {
149
    return getSignRequests(new GetSignRequestsQueryParams(), new GetSignRequestsHeaders());
1✔
150
  }
151

152
  /**
153
   * Gets signature requests created by a user. If the `sign_files` and/or `parent_folder` are
154
   * deleted, the signature request will not return in the list.
155
   *
156
   * @param queryParams Query parameters of getSignRequests method
157
   */
158
  public SignRequests getSignRequests(GetSignRequestsQueryParams queryParams) {
159
    return getSignRequests(queryParams, new GetSignRequestsHeaders());
×
160
  }
161

162
  /**
163
   * Gets signature requests created by a user. If the `sign_files` and/or `parent_folder` are
164
   * deleted, the signature request will not return in the list.
165
   *
166
   * @param headers Headers of getSignRequests method
167
   */
168
  public SignRequests getSignRequests(GetSignRequestsHeaders headers) {
169
    return getSignRequests(new GetSignRequestsQueryParams(), headers);
×
170
  }
171

172
  /**
173
   * Gets signature requests created by a user. If the `sign_files` and/or `parent_folder` are
174
   * deleted, the signature request will not return in the list.
175
   *
176
   * @param queryParams Query parameters of getSignRequests method
177
   * @param headers Headers of getSignRequests method
178
   */
179
  public SignRequests getSignRequests(
180
      GetSignRequestsQueryParams queryParams, GetSignRequestsHeaders headers) {
181
    Map<String, String> queryParamsMap =
1✔
182
        prepareParams(
1✔
183
            mapOf(
1✔
184
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
185
                entryOf("limit", convertToString(queryParams.getLimit())),
1✔
186
                entryOf("senders", convertToString(queryParams.getSenders())),
1✔
187
                entryOf("shared_requests", convertToString(queryParams.getSharedRequests()))));
1✔
188
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
189
    FetchResponse response =
1✔
190
        this.networkSession
191
            .getNetworkClient()
1✔
192
            .fetch(
1✔
193
                new FetchOptions.Builder(
194
                        String.join(
1✔
195
                            "",
196
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
197
                            "/2.0/sign_requests"),
198
                        "GET")
199
                    .params(queryParamsMap)
1✔
200
                    .headers(headersMap)
1✔
201
                    .responseFormat(ResponseFormat.JSON)
1✔
202
                    .auth(this.auth)
1✔
203
                    .networkSession(this.networkSession)
1✔
204
                    .build());
1✔
205
    return JsonManager.deserialize(response.getData(), SignRequests.class);
1✔
206
  }
207

208
  /**
209
   * Creates a signature request. This involves preparing a document for signing and sending the
210
   * signature request to signers.
211
   *
212
   * @param requestBody Request body of createSignRequest method
213
   */
214
  public SignRequest createSignRequest(SignRequestCreateRequest requestBody) {
215
    return createSignRequest(requestBody, new CreateSignRequestHeaders());
1✔
216
  }
217

218
  /**
219
   * Creates a signature request. This involves preparing a document for signing and sending the
220
   * signature request to signers.
221
   *
222
   * @param requestBody Request body of createSignRequest method
223
   * @param headers Headers of createSignRequest method
224
   */
225
  public SignRequest createSignRequest(
226
      SignRequestCreateRequest requestBody, CreateSignRequestHeaders headers) {
227
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
228
    FetchResponse response =
1✔
229
        this.networkSession
230
            .getNetworkClient()
1✔
231
            .fetch(
1✔
232
                new FetchOptions.Builder(
233
                        String.join(
1✔
234
                            "",
235
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
236
                            "/2.0/sign_requests"),
237
                        "POST")
238
                    .headers(headersMap)
1✔
239
                    .data(JsonManager.serialize(requestBody))
1✔
240
                    .contentType("application/json")
1✔
241
                    .responseFormat(ResponseFormat.JSON)
1✔
242
                    .auth(this.auth)
1✔
243
                    .networkSession(this.networkSession)
1✔
244
                    .build());
1✔
245
    return JsonManager.deserialize(response.getData(), SignRequest.class);
1✔
246
  }
247

248
  public Authentication getAuth() {
249
    return auth;
×
250
  }
251

252
  public NetworkSession getNetworkSession() {
253
    return networkSession;
×
254
  }
255

256
  public static class Builder {
257

258
    protected Authentication auth;
259

260
    protected NetworkSession networkSession;
261

262
    public Builder() {
1✔
263
      this.networkSession = new NetworkSession();
1✔
264
    }
1✔
265

266
    public Builder auth(Authentication auth) {
267
      this.auth = auth;
1✔
268
      return this;
1✔
269
    }
270

271
    public Builder networkSession(NetworkSession networkSession) {
272
      this.networkSession = networkSession;
1✔
273
      return this;
1✔
274
    }
275

276
    public SignRequestsManager build() {
277
      return new SignRequestsManager(this);
1✔
278
    }
279
  }
280
}
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