• 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

91.94
/src/main/java/com/box/sdkgen/managers/folderwatermarks/FolderWatermarksManager.java
1
package com.box.sdkgen.managers.folderwatermarks;
2

3
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
4
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
5
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
6
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;
7

8
import com.box.sdkgen.networking.auth.Authentication;
9
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
10
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
11
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
12
import com.box.sdkgen.networking.network.NetworkSession;
13
import com.box.sdkgen.schemas.watermark.Watermark;
14
import com.box.sdkgen.serialization.json.JsonManager;
15
import java.util.Map;
16

17
public class FolderWatermarksManager {
18

19
  public Authentication auth;
20

21
  public NetworkSession networkSession;
22

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

27
  protected FolderWatermarksManager(Builder builder) {
1✔
28
    this.auth = builder.auth;
1✔
29
    this.networkSession = builder.networkSession;
1✔
30
  }
1✔
31

32
  /**
33
   * Retrieve the watermark for a folder.
34
   *
35
   * @param folderId The unique identifier that represent a folder.
36
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
37
   *     and copying the ID from the URL. For example, for the URL
38
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
39
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
40
   */
41
  public Watermark getFolderWatermark(String folderId) {
42
    return getFolderWatermark(folderId, new GetFolderWatermarkHeaders());
1✔
43
  }
44

45
  /**
46
   * Retrieve the watermark for a folder.
47
   *
48
   * @param folderId The unique identifier that represent a folder.
49
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
50
   *     and copying the ID from the URL. For example, for the URL
51
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
52
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
53
   * @param headers Headers of getFolderWatermark method
54
   */
55
  public Watermark getFolderWatermark(String folderId, GetFolderWatermarkHeaders headers) {
56
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
57
    FetchResponse response =
1✔
58
        this.networkSession
59
            .getNetworkClient()
1✔
60
            .fetch(
1✔
61
                new FetchOptions.Builder(
62
                        String.join(
1✔
63
                            "",
64
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
65
                            "/2.0/folders/",
66
                            convertToString(folderId),
1✔
67
                            "/watermark"),
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(), Watermark.class);
1✔
75
  }
76

77
  /**
78
   * Applies or update a watermark on a folder.
79
   *
80
   * @param folderId The unique identifier that represent a folder.
81
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
82
   *     and copying the ID from the URL. For example, for the URL
83
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
84
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
85
   * @param requestBody Request body of updateFolderWatermark method
86
   */
87
  public Watermark updateFolderWatermark(
88
      String folderId, UpdateFolderWatermarkRequestBody requestBody) {
89
    return updateFolderWatermark(folderId, requestBody, new UpdateFolderWatermarkHeaders());
1✔
90
  }
91

92
  /**
93
   * Applies or update a watermark on a folder.
94
   *
95
   * @param folderId The unique identifier that represent a folder.
96
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
97
   *     and copying the ID from the URL. For example, for the URL
98
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
99
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
100
   * @param requestBody Request body of updateFolderWatermark method
101
   * @param headers Headers of updateFolderWatermark method
102
   */
103
  public Watermark updateFolderWatermark(
104
      String folderId,
105
      UpdateFolderWatermarkRequestBody requestBody,
106
      UpdateFolderWatermarkHeaders headers) {
107
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
108
    FetchResponse response =
1✔
109
        this.networkSession
110
            .getNetworkClient()
1✔
111
            .fetch(
1✔
112
                new FetchOptions.Builder(
113
                        String.join(
1✔
114
                            "",
115
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
116
                            "/2.0/folders/",
117
                            convertToString(folderId),
1✔
118
                            "/watermark"),
119
                        "PUT")
120
                    .headers(headersMap)
1✔
121
                    .data(JsonManager.serialize(requestBody))
1✔
122
                    .contentType("application/json")
1✔
123
                    .responseFormat(ResponseFormat.JSON)
1✔
124
                    .auth(this.auth)
1✔
125
                    .networkSession(this.networkSession)
1✔
126
                    .build());
1✔
127
    return JsonManager.deserialize(response.getData(), Watermark.class);
1✔
128
  }
129

130
  /**
131
   * Removes the watermark from a folder.
132
   *
133
   * @param folderId The unique identifier that represent a folder.
134
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
135
   *     and copying the ID from the URL. For example, for the URL
136
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
137
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
138
   */
139
  public void deleteFolderWatermark(String folderId) {
140
    deleteFolderWatermark(folderId, new DeleteFolderWatermarkHeaders());
1✔
141
  }
1✔
142

143
  /**
144
   * Removes the watermark from a folder.
145
   *
146
   * @param folderId The unique identifier that represent a folder.
147
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
148
   *     and copying the ID from the URL. For example, for the URL
149
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
150
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
151
   * @param headers Headers of deleteFolderWatermark method
152
   */
153
  public void deleteFolderWatermark(String folderId, DeleteFolderWatermarkHeaders headers) {
154
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
155
    FetchResponse response =
1✔
156
        this.networkSession
157
            .getNetworkClient()
1✔
158
            .fetch(
1✔
159
                new FetchOptions.Builder(
160
                        String.join(
1✔
161
                            "",
162
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
163
                            "/2.0/folders/",
164
                            convertToString(folderId),
1✔
165
                            "/watermark"),
166
                        "DELETE")
167
                    .headers(headersMap)
1✔
168
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
169
                    .auth(this.auth)
1✔
170
                    .networkSession(this.networkSession)
1✔
171
                    .build());
1✔
172
  }
1✔
173

174
  public Authentication getAuth() {
175
    return auth;
×
176
  }
177

178
  public NetworkSession getNetworkSession() {
179
    return networkSession;
×
180
  }
181

182
  public static class Builder {
183

184
    protected Authentication auth;
185

186
    protected NetworkSession networkSession;
187

188
    public Builder() {
1✔
189
      this.networkSession = new NetworkSession();
1✔
190
    }
1✔
191

192
    public Builder auth(Authentication auth) {
193
      this.auth = auth;
1✔
194
      return this;
1✔
195
    }
196

197
    public Builder networkSession(NetworkSession networkSession) {
198
      this.networkSession = networkSession;
1✔
199
      return this;
1✔
200
    }
201

202
    public FolderWatermarksManager build() {
203
      return new FolderWatermarksManager(this);
1✔
204
    }
205
  }
206
}
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