• 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

85.71
/src/main/java/com/box/sdkgen/managers/appitemassociations/AppItemAssociationsManager.java
1
package com.box.sdkgen.managers.appitemassociations;
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.appitemassociations.AppItemAssociations;
15
import com.box.sdkgen.serialization.json.JsonManager;
16
import java.util.Map;
17

18
public class AppItemAssociationsManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

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

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

33
  /**
34
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
35
   * items the file is associated with. This includes app items associated with ancestors of the
36
   * file. Assuming the context user has access to the file, the type/ids are revealed even if the
37
   * context user does not have **View** permission on the app item.
38
   *
39
   * @param fileId The unique identifier that represents a file.
40
   *     <p>The ID for any file can be determined by visiting a file in the web application and
41
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
42
   *     `file_id` is `123`. Example: "12345"
43
   */
44
  public AppItemAssociations getFileAppItemAssociations(String fileId) {
45
    return getFileAppItemAssociations(
1✔
46
        fileId,
47
        new GetFileAppItemAssociationsQueryParams(),
48
        new GetFileAppItemAssociationsHeaders());
49
  }
50

51
  /**
52
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
53
   * items the file is associated with. This includes app items associated with ancestors of the
54
   * file. Assuming the context user has access to the file, the type/ids are revealed even if the
55
   * context user does not have **View** permission on the app item.
56
   *
57
   * @param fileId The unique identifier that represents a file.
58
   *     <p>The ID for any file can be determined by visiting a file in the web application and
59
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
60
   *     `file_id` is `123`. Example: "12345"
61
   * @param queryParams Query parameters of getFileAppItemAssociations method
62
   */
63
  public AppItemAssociations getFileAppItemAssociations(
64
      String fileId, GetFileAppItemAssociationsQueryParams queryParams) {
65
    return getFileAppItemAssociations(fileId, queryParams, new GetFileAppItemAssociationsHeaders());
×
66
  }
67

68
  /**
69
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
70
   * items the file is associated with. This includes app items associated with ancestors of the
71
   * file. Assuming the context user has access to the file, the type/ids are revealed even if the
72
   * context user does not have **View** permission on the app item.
73
   *
74
   * @param fileId The unique identifier that represents a file.
75
   *     <p>The ID for any file can be determined by visiting a file in the web application and
76
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
77
   *     `file_id` is `123`. Example: "12345"
78
   * @param headers Headers of getFileAppItemAssociations method
79
   */
80
  public AppItemAssociations getFileAppItemAssociations(
81
      String fileId, GetFileAppItemAssociationsHeaders headers) {
82
    return getFileAppItemAssociations(fileId, new GetFileAppItemAssociationsQueryParams(), headers);
×
83
  }
84

85
  /**
86
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
87
   * items the file is associated with. This includes app items associated with ancestors of the
88
   * file. Assuming the context user has access to the file, the type/ids are revealed even if the
89
   * context user does not have **View** permission on the app item.
90
   *
91
   * @param fileId The unique identifier that represents a file.
92
   *     <p>The ID for any file can be determined by visiting a file in the web application and
93
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
94
   *     `file_id` is `123`. Example: "12345"
95
   * @param queryParams Query parameters of getFileAppItemAssociations method
96
   * @param headers Headers of getFileAppItemAssociations method
97
   */
98
  public AppItemAssociations getFileAppItemAssociations(
99
      String fileId,
100
      GetFileAppItemAssociationsQueryParams queryParams,
101
      GetFileAppItemAssociationsHeaders headers) {
102
    Map<String, String> queryParamsMap =
1✔
103
        prepareParams(
1✔
104
            mapOf(
1✔
105
                entryOf("limit", convertToString(queryParams.getLimit())),
1✔
106
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
107
                entryOf("application_type", convertToString(queryParams.getApplicationType()))));
1✔
108
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
109
    FetchResponse response =
1✔
110
        this.networkSession
111
            .getNetworkClient()
1✔
112
            .fetch(
1✔
113
                new FetchOptions.Builder(
114
                        String.join(
1✔
115
                            "",
116
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
117
                            "/2.0/files/",
118
                            convertToString(fileId),
1✔
119
                            "/app_item_associations"),
120
                        "GET")
121
                    .params(queryParamsMap)
1✔
122
                    .headers(headersMap)
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(), AppItemAssociations.class);
1✔
128
  }
129

130
  /**
131
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
132
   * items the folder is associated with. This includes app items associated with ancestors of the
133
   * folder. Assuming the context user has access to the folder, the type/ids are revealed even if
134
   * the context user does not have **View** permission on the app item.
135
   *
136
   * @param folderId The unique identifier that represent a folder.
137
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
138
   *     and copying the ID from the URL. For example, for the URL
139
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
140
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
141
   */
142
  public AppItemAssociations getFolderAppItemAssociations(String folderId) {
143
    return getFolderAppItemAssociations(
1✔
144
        folderId,
145
        new GetFolderAppItemAssociationsQueryParams(),
146
        new GetFolderAppItemAssociationsHeaders());
147
  }
148

149
  /**
150
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
151
   * items the folder is associated with. This includes app items associated with ancestors of the
152
   * folder. Assuming the context user has access to the folder, the type/ids are revealed even if
153
   * the context user does not have **View** permission on the app item.
154
   *
155
   * @param folderId The unique identifier that represent a folder.
156
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
157
   *     and copying the ID from the URL. For example, for the URL
158
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
159
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
160
   * @param queryParams Query parameters of getFolderAppItemAssociations method
161
   */
162
  public AppItemAssociations getFolderAppItemAssociations(
163
      String folderId, GetFolderAppItemAssociationsQueryParams queryParams) {
164
    return getFolderAppItemAssociations(
×
165
        folderId, queryParams, new GetFolderAppItemAssociationsHeaders());
166
  }
167

168
  /**
169
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
170
   * items the folder is associated with. This includes app items associated with ancestors of the
171
   * folder. Assuming the context user has access to the folder, the type/ids are revealed even if
172
   * the context user does not have **View** permission on the app item.
173
   *
174
   * @param folderId The unique identifier that represent a folder.
175
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
176
   *     and copying the ID from the URL. For example, for the URL
177
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
178
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
179
   * @param headers Headers of getFolderAppItemAssociations method
180
   */
181
  public AppItemAssociations getFolderAppItemAssociations(
182
      String folderId, GetFolderAppItemAssociationsHeaders headers) {
183
    return getFolderAppItemAssociations(
×
184
        folderId, new GetFolderAppItemAssociationsQueryParams(), headers);
185
  }
186

187
  /**
188
   * **This is a beta feature, which means that its availability might be limited.** Returns all app
189
   * items the folder is associated with. This includes app items associated with ancestors of the
190
   * folder. Assuming the context user has access to the folder, the type/ids are revealed even if
191
   * the context user does not have **View** permission on the app item.
192
   *
193
   * @param folderId The unique identifier that represent a folder.
194
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
195
   *     and copying the ID from the URL. For example, for the URL
196
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
197
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
198
   * @param queryParams Query parameters of getFolderAppItemAssociations method
199
   * @param headers Headers of getFolderAppItemAssociations method
200
   */
201
  public AppItemAssociations getFolderAppItemAssociations(
202
      String folderId,
203
      GetFolderAppItemAssociationsQueryParams queryParams,
204
      GetFolderAppItemAssociationsHeaders headers) {
205
    Map<String, String> queryParamsMap =
1✔
206
        prepareParams(
1✔
207
            mapOf(
1✔
208
                entryOf("limit", convertToString(queryParams.getLimit())),
1✔
209
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
210
                entryOf("application_type", convertToString(queryParams.getApplicationType()))));
1✔
211
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
212
    FetchResponse response =
1✔
213
        this.networkSession
214
            .getNetworkClient()
1✔
215
            .fetch(
1✔
216
                new FetchOptions.Builder(
217
                        String.join(
1✔
218
                            "",
219
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
220
                            "/2.0/folders/",
221
                            convertToString(folderId),
1✔
222
                            "/app_item_associations"),
223
                        "GET")
224
                    .params(queryParamsMap)
1✔
225
                    .headers(headersMap)
1✔
226
                    .responseFormat(ResponseFormat.JSON)
1✔
227
                    .auth(this.auth)
1✔
228
                    .networkSession(this.networkSession)
1✔
229
                    .build());
1✔
230
    return JsonManager.deserialize(response.getData(), AppItemAssociations.class);
1✔
231
  }
232

233
  public Authentication getAuth() {
234
    return auth;
×
235
  }
236

237
  public NetworkSession getNetworkSession() {
238
    return networkSession;
×
239
  }
240

241
  public static class Builder {
242

243
    protected Authentication auth;
244

245
    protected NetworkSession networkSession;
246

247
    public Builder() {
1✔
248
      this.networkSession = new NetworkSession();
1✔
249
    }
1✔
250

251
    public Builder auth(Authentication auth) {
252
      this.auth = auth;
1✔
253
      return this;
1✔
254
    }
255

256
    public Builder networkSession(NetworkSession networkSession) {
257
      this.networkSession = networkSession;
1✔
258
      return this;
1✔
259
    }
260

261
    public AppItemAssociationsManager build() {
262
      return new AppItemAssociationsManager(this);
1✔
263
    }
264
  }
265
}
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