• 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

55.0
/src/main/java/com/box/sdkgen/managers/termsofservices/TermsOfServicesManager.java
1
package com.box.sdkgen.managers.termsofservices;
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.termsofservice.TermsOfService;
15
import com.box.sdkgen.schemas.termsofservices.TermsOfServices;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class TermsOfServicesManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

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

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

34
  /** Returns the current terms of service text and settings for the enterprise. */
35
  public TermsOfServices getTermsOfService() {
36
    return getTermsOfService(new GetTermsOfServiceQueryParams(), new GetTermsOfServiceHeaders());
1✔
37
  }
38

39
  /**
40
   * Returns the current terms of service text and settings for the enterprise.
41
   *
42
   * @param queryParams Query parameters of getTermsOfService method
43
   */
44
  public TermsOfServices getTermsOfService(GetTermsOfServiceQueryParams queryParams) {
45
    return getTermsOfService(queryParams, new GetTermsOfServiceHeaders());
×
46
  }
47

48
  /**
49
   * Returns the current terms of service text and settings for the enterprise.
50
   *
51
   * @param headers Headers of getTermsOfService method
52
   */
53
  public TermsOfServices getTermsOfService(GetTermsOfServiceHeaders headers) {
54
    return getTermsOfService(new GetTermsOfServiceQueryParams(), headers);
×
55
  }
56

57
  /**
58
   * Returns the current terms of service text and settings for the enterprise.
59
   *
60
   * @param queryParams Query parameters of getTermsOfService method
61
   * @param headers Headers of getTermsOfService method
62
   */
63
  public TermsOfServices getTermsOfService(
64
      GetTermsOfServiceQueryParams queryParams, GetTermsOfServiceHeaders headers) {
65
    Map<String, String> queryParamsMap =
1✔
66
        prepareParams(mapOf(entryOf("tos_type", convertToString(queryParams.getTosType()))));
1✔
67
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
68
    FetchResponse response =
1✔
69
        this.networkSession
70
            .getNetworkClient()
1✔
71
            .fetch(
1✔
72
                new FetchOptions.Builder(
73
                        String.join(
1✔
74
                            "",
75
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
76
                            "/2.0/terms_of_services"),
77
                        "GET")
78
                    .params(queryParamsMap)
1✔
79
                    .headers(headersMap)
1✔
80
                    .responseFormat(ResponseFormat.JSON)
1✔
81
                    .auth(this.auth)
1✔
82
                    .networkSession(this.networkSession)
1✔
83
                    .build());
1✔
84
    return JsonManager.deserialize(response.getData(), TermsOfServices.class);
1✔
85
  }
86

87
  /**
88
   * Creates a terms of service for a given enterprise and type of user.
89
   *
90
   * @param requestBody Request body of createTermsOfService method
91
   */
92
  public TermsOfService createTermsOfService(CreateTermsOfServiceRequestBody requestBody) {
93
    return createTermsOfService(requestBody, new CreateTermsOfServiceHeaders());
×
94
  }
95

96
  /**
97
   * Creates a terms of service for a given enterprise and type of user.
98
   *
99
   * @param requestBody Request body of createTermsOfService method
100
   * @param headers Headers of createTermsOfService method
101
   */
102
  public TermsOfService createTermsOfService(
103
      CreateTermsOfServiceRequestBody requestBody, CreateTermsOfServiceHeaders headers) {
104
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
105
    FetchResponse response =
×
106
        this.networkSession
107
            .getNetworkClient()
×
108
            .fetch(
×
109
                new FetchOptions.Builder(
110
                        String.join(
×
111
                            "",
112
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
113
                            "/2.0/terms_of_services"),
114
                        "POST")
115
                    .headers(headersMap)
×
116
                    .data(JsonManager.serialize(requestBody))
×
117
                    .contentType("application/json")
×
118
                    .responseFormat(ResponseFormat.JSON)
×
119
                    .auth(this.auth)
×
120
                    .networkSession(this.networkSession)
×
121
                    .build());
×
122
    return JsonManager.deserialize(response.getData(), TermsOfService.class);
×
123
  }
124

125
  /**
126
   * Fetches a specific terms of service.
127
   *
128
   * @param termsOfServiceId The ID of the terms of service. Example: "324234"
129
   */
130
  public TermsOfService getTermsOfServiceById(String termsOfServiceId) {
131
    return getTermsOfServiceById(termsOfServiceId, new GetTermsOfServiceByIdHeaders());
×
132
  }
133

134
  /**
135
   * Fetches a specific terms of service.
136
   *
137
   * @param termsOfServiceId The ID of the terms of service. Example: "324234"
138
   * @param headers Headers of getTermsOfServiceById method
139
   */
140
  public TermsOfService getTermsOfServiceById(
141
      String termsOfServiceId, GetTermsOfServiceByIdHeaders headers) {
142
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
143
    FetchResponse response =
×
144
        this.networkSession
145
            .getNetworkClient()
×
146
            .fetch(
×
147
                new FetchOptions.Builder(
148
                        String.join(
×
149
                            "",
150
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
151
                            "/2.0/terms_of_services/",
152
                            convertToString(termsOfServiceId)),
×
153
                        "GET")
154
                    .headers(headersMap)
×
155
                    .responseFormat(ResponseFormat.JSON)
×
156
                    .auth(this.auth)
×
157
                    .networkSession(this.networkSession)
×
158
                    .build());
×
159
    return JsonManager.deserialize(response.getData(), TermsOfService.class);
×
160
  }
161

162
  /**
163
   * Updates a specific terms of service.
164
   *
165
   * @param termsOfServiceId The ID of the terms of service. Example: "324234"
166
   * @param requestBody Request body of updateTermsOfServiceById method
167
   */
168
  public TermsOfService updateTermsOfServiceById(
169
      String termsOfServiceId, UpdateTermsOfServiceByIdRequestBody requestBody) {
170
    return updateTermsOfServiceById(
1✔
171
        termsOfServiceId, requestBody, new UpdateTermsOfServiceByIdHeaders());
172
  }
173

174
  /**
175
   * Updates a specific terms of service.
176
   *
177
   * @param termsOfServiceId The ID of the terms of service. Example: "324234"
178
   * @param requestBody Request body of updateTermsOfServiceById method
179
   * @param headers Headers of updateTermsOfServiceById method
180
   */
181
  public TermsOfService updateTermsOfServiceById(
182
      String termsOfServiceId,
183
      UpdateTermsOfServiceByIdRequestBody requestBody,
184
      UpdateTermsOfServiceByIdHeaders headers) {
185
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
186
    FetchResponse response =
1✔
187
        this.networkSession
188
            .getNetworkClient()
1✔
189
            .fetch(
1✔
190
                new FetchOptions.Builder(
191
                        String.join(
1✔
192
                            "",
193
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
194
                            "/2.0/terms_of_services/",
195
                            convertToString(termsOfServiceId)),
1✔
196
                        "PUT")
197
                    .headers(headersMap)
1✔
198
                    .data(JsonManager.serialize(requestBody))
1✔
199
                    .contentType("application/json")
1✔
200
                    .responseFormat(ResponseFormat.JSON)
1✔
201
                    .auth(this.auth)
1✔
202
                    .networkSession(this.networkSession)
1✔
203
                    .build());
1✔
204
    return JsonManager.deserialize(response.getData(), TermsOfService.class);
1✔
205
  }
206

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

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

215
  public static class Builder {
216

217
    protected Authentication auth;
218

219
    protected NetworkSession networkSession;
220

221
    public Builder() {
1✔
222
      this.networkSession = new NetworkSession();
1✔
223
    }
1✔
224

225
    public Builder auth(Authentication auth) {
226
      this.auth = auth;
1✔
227
      return this;
1✔
228
    }
229

230
    public Builder networkSession(NetworkSession networkSession) {
231
      this.networkSession = networkSession;
1✔
232
      return this;
1✔
233
    }
234

235
    public TermsOfServicesManager build() {
236
      return new TermsOfServicesManager(this);
1✔
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