• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #6242

10 Feb 2026 05:27PM UTC coverage: 35.714% (+11.4%) from 24.324%
#6242

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2146 existing lines in 544 files now uncovered.

7382 of 20670 relevant lines covered (35.71%)

0.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/box/sdkgen/managers/invites/InvitesManager.java
1
package com.box.sdkgen.managers.invites;
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.invite.Invite;
15
import com.box.sdkgen.serialization.json.JsonManager;
16
import java.util.Map;
17

18
public class InvitesManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

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

28
  protected InvitesManager(Builder builder) {
×
29
    this.auth = builder.auth;
×
30
    this.networkSession = builder.networkSession;
×
31
  }
×
32

33
  /**
34
   * Invites an existing external user to join an enterprise.
35
   *
36
   * <p>The existing user can not be part of another enterprise and must already have a Box account.
37
   * Once invited, the user will receive an email and are prompted to accept the invitation within
38
   * the Box web application.
39
   *
40
   * <p>This method requires the "Manage An Enterprise" scope enabled for the application, which can
41
   * be enabled within the developer console.
42
   *
43
   * @param requestBody Request body of createInvite method
44
   */
45
  public Invite createInvite(CreateInviteRequestBody requestBody) {
46
    return createInvite(requestBody, new CreateInviteQueryParams(), new CreateInviteHeaders());
×
47
  }
48

49
  /**
50
   * Invites an existing external user to join an enterprise.
51
   *
52
   * <p>The existing user can not be part of another enterprise and must already have a Box account.
53
   * Once invited, the user will receive an email and are prompted to accept the invitation within
54
   * the Box web application.
55
   *
56
   * <p>This method requires the "Manage An Enterprise" scope enabled for the application, which can
57
   * be enabled within the developer console.
58
   *
59
   * @param requestBody Request body of createInvite method
60
   * @param queryParams Query parameters of createInvite method
61
   */
62
  public Invite createInvite(
63
      CreateInviteRequestBody requestBody, CreateInviteQueryParams queryParams) {
64
    return createInvite(requestBody, queryParams, new CreateInviteHeaders());
×
65
  }
66

67
  /**
68
   * Invites an existing external user to join an enterprise.
69
   *
70
   * <p>The existing user can not be part of another enterprise and must already have a Box account.
71
   * Once invited, the user will receive an email and are prompted to accept the invitation within
72
   * the Box web application.
73
   *
74
   * <p>This method requires the "Manage An Enterprise" scope enabled for the application, which can
75
   * be enabled within the developer console.
76
   *
77
   * @param requestBody Request body of createInvite method
78
   * @param headers Headers of createInvite method
79
   */
80
  public Invite createInvite(CreateInviteRequestBody requestBody, CreateInviteHeaders headers) {
81
    return createInvite(requestBody, new CreateInviteQueryParams(), headers);
×
82
  }
83

84
  /**
85
   * Invites an existing external user to join an enterprise.
86
   *
87
   * <p>The existing user can not be part of another enterprise and must already have a Box account.
88
   * Once invited, the user will receive an email and are prompted to accept the invitation within
89
   * the Box web application.
90
   *
91
   * <p>This method requires the "Manage An Enterprise" scope enabled for the application, which can
92
   * be enabled within the developer console.
93
   *
94
   * @param requestBody Request body of createInvite method
95
   * @param queryParams Query parameters of createInvite method
96
   * @param headers Headers of createInvite method
97
   */
98
  public Invite createInvite(
99
      CreateInviteRequestBody requestBody,
100
      CreateInviteQueryParams queryParams,
101
      CreateInviteHeaders headers) {
102
    Map<String, String> queryParamsMap =
×
103
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
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
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/invites"),
×
112
                        "POST")
113
                    .params(queryParamsMap)
×
114
                    .headers(headersMap)
×
115
                    .data(JsonManager.serialize(requestBody))
×
116
                    .contentType("application/json")
×
117
                    .responseFormat(ResponseFormat.JSON)
×
118
                    .auth(this.auth)
×
119
                    .networkSession(this.networkSession)
×
120
                    .build());
×
121
    return JsonManager.deserialize(response.getData(), Invite.class);
×
122
  }
123

124
  /**
125
   * Returns the status of a user invite.
126
   *
127
   * @param inviteId The ID of an invite. Example: "213723"
128
   */
129
  public Invite getInviteById(String inviteId) {
130
    return getInviteById(inviteId, new GetInviteByIdQueryParams(), new GetInviteByIdHeaders());
×
131
  }
132

133
  /**
134
   * Returns the status of a user invite.
135
   *
136
   * @param inviteId The ID of an invite. Example: "213723"
137
   * @param queryParams Query parameters of getInviteById method
138
   */
139
  public Invite getInviteById(String inviteId, GetInviteByIdQueryParams queryParams) {
140
    return getInviteById(inviteId, queryParams, new GetInviteByIdHeaders());
×
141
  }
142

143
  /**
144
   * Returns the status of a user invite.
145
   *
146
   * @param inviteId The ID of an invite. Example: "213723"
147
   * @param headers Headers of getInviteById method
148
   */
149
  public Invite getInviteById(String inviteId, GetInviteByIdHeaders headers) {
150
    return getInviteById(inviteId, new GetInviteByIdQueryParams(), headers);
×
151
  }
152

153
  /**
154
   * Returns the status of a user invite.
155
   *
156
   * @param inviteId The ID of an invite. Example: "213723"
157
   * @param queryParams Query parameters of getInviteById method
158
   * @param headers Headers of getInviteById method
159
   */
160
  public Invite getInviteById(
161
      String inviteId, GetInviteByIdQueryParams queryParams, GetInviteByIdHeaders headers) {
162
    Map<String, String> queryParamsMap =
×
163
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
164
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
165
    FetchResponse response =
×
166
        this.networkSession
167
            .getNetworkClient()
×
168
            .fetch(
×
169
                new FetchOptions.Builder(
170
                        String.join(
×
171
                            "",
172
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
173
                            "/2.0/invites/",
174
                            convertToString(inviteId)),
×
175
                        "GET")
176
                    .params(queryParamsMap)
×
177
                    .headers(headersMap)
×
178
                    .responseFormat(ResponseFormat.JSON)
×
179
                    .auth(this.auth)
×
180
                    .networkSession(this.networkSession)
×
181
                    .build());
×
182
    return JsonManager.deserialize(response.getData(), Invite.class);
×
183
  }
184

185
  public Authentication getAuth() {
186
    return auth;
×
187
  }
188

189
  public NetworkSession getNetworkSession() {
190
    return networkSession;
×
191
  }
192

193
  public static class Builder {
194

195
    protected Authentication auth;
196

197
    protected NetworkSession networkSession;
198

NEW
199
    public Builder() {}
×
200

201
    public Builder auth(Authentication auth) {
UNCOV
202
      this.auth = auth;
×
UNCOV
203
      return this;
×
204
    }
205

206
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
207
      this.networkSession = networkSession;
×
UNCOV
208
      return this;
×
209
    }
210

211
    public InvitesManager build() {
NEW
212
      if (this.networkSession == null) {
×
NEW
213
        this.networkSession = new NetworkSession();
×
214
      }
215
      return new InvitesManager(this);
×
216
    }
217
  }
218
}
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