• 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

81.16
/src/main/java/com/box/sdkgen/managers/devicepinners/DevicePinnersManager.java
1
package com.box.sdkgen.managers.devicepinners;
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.devicepinner.DevicePinner;
15
import com.box.sdkgen.schemas.devicepinners.DevicePinners;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class DevicePinnersManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

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

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

34
  /**
35
   * Retrieves information about an individual device pin.
36
   *
37
   * @param devicePinnerId The ID of the device pin. Example: "2324234"
38
   */
39
  public DevicePinner getDevicePinnerById(String devicePinnerId) {
40
    return getDevicePinnerById(devicePinnerId, new GetDevicePinnerByIdHeaders());
×
41
  }
42

43
  /**
44
   * Retrieves information about an individual device pin.
45
   *
46
   * @param devicePinnerId The ID of the device pin. Example: "2324234"
47
   * @param headers Headers of getDevicePinnerById method
48
   */
49
  public DevicePinner getDevicePinnerById(
50
      String devicePinnerId, GetDevicePinnerByIdHeaders headers) {
51
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
52
    FetchResponse response =
1✔
53
        this.networkSession
54
            .getNetworkClient()
1✔
55
            .fetch(
×
56
                new FetchOptions.Builder(
57
                        String.join(
1✔
58
                            "",
59
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
60
                            "/2.0/device_pinners/",
61
                            convertToString(devicePinnerId)),
1✔
62
                        "GET")
63
                    .headers(headersMap)
1✔
64
                    .responseFormat(ResponseFormat.JSON)
1✔
65
                    .auth(this.auth)
1✔
66
                    .networkSession(this.networkSession)
1✔
67
                    .build());
1✔
68
    return JsonManager.deserialize(response.getData(), DevicePinner.class);
×
69
  }
70

71
  /**
72
   * Deletes an individual device pin.
73
   *
74
   * @param devicePinnerId The ID of the device pin. Example: "2324234"
75
   */
76
  public void deleteDevicePinnerById(String devicePinnerId) {
77
    deleteDevicePinnerById(devicePinnerId, new DeleteDevicePinnerByIdHeaders());
×
78
  }
×
79

80
  /**
81
   * Deletes an individual device pin.
82
   *
83
   * @param devicePinnerId The ID of the device pin. Example: "2324234"
84
   * @param headers Headers of deleteDevicePinnerById method
85
   */
86
  public void deleteDevicePinnerById(String devicePinnerId, DeleteDevicePinnerByIdHeaders headers) {
87
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
88
    FetchResponse response =
1✔
89
        this.networkSession
90
            .getNetworkClient()
1✔
91
            .fetch(
×
92
                new FetchOptions.Builder(
93
                        String.join(
1✔
94
                            "",
95
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
96
                            "/2.0/device_pinners/",
97
                            convertToString(devicePinnerId)),
1✔
98
                        "DELETE")
99
                    .headers(headersMap)
1✔
100
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
101
                    .auth(this.auth)
1✔
102
                    .networkSession(this.networkSession)
1✔
103
                    .build());
1✔
104
  }
×
105

106
  /**
107
   * Retrieves all the device pins within an enterprise.
108
   *
109
   * <p>The user must have admin privileges, and the application needs the "manage enterprise" scope
110
   * to make this call.
111
   *
112
   * @param enterpriseId The ID of the enterprise. Example: "3442311"
113
   */
114
  public DevicePinners getEnterpriseDevicePinners(String enterpriseId) {
115
    return getEnterpriseDevicePinners(
1✔
116
        enterpriseId,
117
        new GetEnterpriseDevicePinnersQueryParams(),
118
        new GetEnterpriseDevicePinnersHeaders());
119
  }
120

121
  /**
122
   * Retrieves all the device pins within an enterprise.
123
   *
124
   * <p>The user must have admin privileges, and the application needs the "manage enterprise" scope
125
   * to make this call.
126
   *
127
   * @param enterpriseId The ID of the enterprise. Example: "3442311"
128
   * @param queryParams Query parameters of getEnterpriseDevicePinners method
129
   */
130
  public DevicePinners getEnterpriseDevicePinners(
131
      String enterpriseId, GetEnterpriseDevicePinnersQueryParams queryParams) {
132
    return getEnterpriseDevicePinners(
1✔
133
        enterpriseId, queryParams, new GetEnterpriseDevicePinnersHeaders());
134
  }
135

136
  /**
137
   * Retrieves all the device pins within an enterprise.
138
   *
139
   * <p>The user must have admin privileges, and the application needs the "manage enterprise" scope
140
   * to make this call.
141
   *
142
   * @param enterpriseId The ID of the enterprise. Example: "3442311"
143
   * @param headers Headers of getEnterpriseDevicePinners method
144
   */
145
  public DevicePinners getEnterpriseDevicePinners(
146
      String enterpriseId, GetEnterpriseDevicePinnersHeaders headers) {
147
    return getEnterpriseDevicePinners(
×
148
        enterpriseId, new GetEnterpriseDevicePinnersQueryParams(), headers);
149
  }
150

151
  /**
152
   * Retrieves all the device pins within an enterprise.
153
   *
154
   * <p>The user must have admin privileges, and the application needs the "manage enterprise" scope
155
   * to make this call.
156
   *
157
   * @param enterpriseId The ID of the enterprise. Example: "3442311"
158
   * @param queryParams Query parameters of getEnterpriseDevicePinners method
159
   * @param headers Headers of getEnterpriseDevicePinners method
160
   */
161
  public DevicePinners getEnterpriseDevicePinners(
162
      String enterpriseId,
163
      GetEnterpriseDevicePinnersQueryParams queryParams,
164
      GetEnterpriseDevicePinnersHeaders headers) {
165
    Map<String, String> queryParamsMap =
1✔
166
        prepareParams(
1✔
167
            mapOf(
1✔
168
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
169
                entryOf("limit", convertToString(queryParams.getLimit())),
1✔
170
                entryOf("direction", convertToString(queryParams.getDirection()))));
1✔
171
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
172
    FetchResponse response =
1✔
173
        this.networkSession
174
            .getNetworkClient()
1✔
175
            .fetch(
1✔
176
                new FetchOptions.Builder(
177
                        String.join(
1✔
178
                            "",
179
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
180
                            "/2.0/enterprises/",
181
                            convertToString(enterpriseId),
1✔
182
                            "/device_pinners"),
183
                        "GET")
184
                    .params(queryParamsMap)
1✔
185
                    .headers(headersMap)
1✔
186
                    .responseFormat(ResponseFormat.JSON)
1✔
187
                    .auth(this.auth)
1✔
188
                    .networkSession(this.networkSession)
1✔
189
                    .build());
1✔
190
    return JsonManager.deserialize(response.getData(), DevicePinners.class);
1✔
191
  }
192

193
  public Authentication getAuth() {
194
    return auth;
×
195
  }
196

197
  public NetworkSession getNetworkSession() {
198
    return networkSession;
×
199
  }
200

201
  public static class Builder {
202

203
    protected Authentication auth;
204

205
    protected NetworkSession networkSession;
206

207
    public Builder() {
1✔
208
      this.networkSession = new NetworkSession();
1✔
209
    }
1✔
210

211
    public Builder auth(Authentication auth) {
212
      this.auth = auth;
1✔
213
      return this;
1✔
214
    }
215

216
    public Builder networkSession(NetworkSession networkSession) {
217
      this.networkSession = networkSession;
1✔
218
      return this;
1✔
219
    }
220

221
    public DevicePinnersManager build() {
222
      return new DevicePinnersManager(this);
1✔
223
    }
224
  }
225
}
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