Skip to content

Commit 4188e3f

Browse files
feat: Support external user deletion API
1 parent 114e778 commit 4188e3f

File tree

11 files changed

+574
-1
lines changed

11 files changed

+574
-1
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "51be103", "specHash": "99e14a6", "version": "0.1.0" }
1+
{ "engineHash": "54ce521", "specHash": "623b811", "version": "0.1.0" }

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ the SDK are available by topic:
2323
* [Downloads](downloads.md)
2424
* [Emailaliases](emailaliases.md)
2525
* [Events](events.md)
26+
* [Externalusers](externalusers.md)
2627
* [Fileclassifications](fileclassifications.md)
2728
* [Filemetadata](filemetadata.md)
2829
* [Filerequests](filerequests.md)

docs/externalusers.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ExternalUsersManager
2+
3+
4+
- [Submit job to delete external users](#submit-job-to-delete-external-users)
5+
6+
## Submit job to delete external users
7+
8+
Delete external users from current user enterprise. This will remove each
9+
external user from all invited collaborations within the current enterprise.
10+
11+
This operation is performed by calling function `createExternalUserSubmitDeleteJobV2025R0`.
12+
13+
See the endpoint docs at
14+
[API Reference](https://developer.box.com/reference/v2025.0/post-external-users-submit-delete-job/).
15+
16+
*Currently we don't have an example for calling `createExternalUserSubmitDeleteJobV2025R0` in integration tests*
17+
18+
### Arguments
19+
20+
- requestBody `ExternalUsersSubmitDeleteJobRequestV2025R0`
21+
- Request body of createExternalUserSubmitDeleteJobV2025R0 method
22+
- headers `CreateExternalUserSubmitDeleteJobV2025R0Headers`
23+
- Headers of createExternalUserSubmitDeleteJobV2025R0 method
24+
25+
26+
### Returns
27+
28+
This function returns a value of type `ExternalUsersSubmitDeleteJobResponseV2025R0`.
29+
30+
31+
32+

src/main/java/com/box/sdkgen/client/BoxClient.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.box.sdkgen.managers.downloads.DownloadsManager;
2222
import com.box.sdkgen.managers.emailaliases.EmailAliasesManager;
2323
import com.box.sdkgen.managers.events.EventsManager;
24+
import com.box.sdkgen.managers.externalusers.ExternalUsersManager;
2425
import com.box.sdkgen.managers.fileclassifications.FileClassificationsManager;
2526
import com.box.sdkgen.managers.filemetadata.FileMetadataManager;
2627
import com.box.sdkgen.managers.filerequests.FileRequestsManager;
@@ -256,6 +257,8 @@ public class BoxClient {
256257

257258
public final ArchivesManager archives;
258259

260+
public final ExternalUsersManager externalUsers;
261+
259262
public BoxClient(Authentication auth) {
260263
this.auth = auth;
261264
this.networkSession = new NetworkSession.Builder().baseUrls(new BaseUrls()).build();
@@ -584,6 +587,11 @@ public BoxClient(Authentication auth) {
584587
.build();
585588
this.archives =
586589
new ArchivesManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
590+
this.externalUsers =
591+
new ExternalUsersManager.Builder()
592+
.auth(this.auth)
593+
.networkSession(this.networkSession)
594+
.build();
587595
}
588596

589597
protected BoxClient(Builder builder) {
@@ -914,6 +922,11 @@ protected BoxClient(Builder builder) {
914922
.build();
915923
this.archives =
916924
new ArchivesManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
925+
this.externalUsers =
926+
new ExternalUsersManager.Builder()
927+
.auth(this.auth)
928+
.networkSession(this.networkSession)
929+
.build();
917930
}
918931

919932
public FetchResponse makeRequest(FetchOptions fetchOptions) {
@@ -1299,6 +1312,10 @@ public ArchivesManager getArchives() {
12991312
return archives;
13001313
}
13011314

1315+
public ExternalUsersManager getExternalUsers() {
1316+
return externalUsers;
1317+
}
1318+
13021319
public static class Builder {
13031320

13041321
protected final Authentication auth;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.box.sdkgen.managers.externalusers;
2+
3+
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
4+
5+
import com.box.sdkgen.parameters.v2025r0.boxversionheaderv2025r0.BoxVersionHeaderV2025R0;
6+
import com.box.sdkgen.serialization.json.EnumWrapper;
7+
import java.util.Map;
8+
9+
public class CreateExternalUserSubmitDeleteJobV2025R0Headers {
10+
11+
public EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;
12+
13+
public Map<String, String> extraHeaders;
14+
15+
public CreateExternalUserSubmitDeleteJobV2025R0Headers() {
16+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
17+
this.extraHeaders = mapOf();
18+
}
19+
20+
protected CreateExternalUserSubmitDeleteJobV2025R0Headers(Builder builder) {
21+
this.boxVersion = builder.boxVersion;
22+
this.extraHeaders = builder.extraHeaders;
23+
}
24+
25+
public EnumWrapper<BoxVersionHeaderV2025R0> getBoxVersion() {
26+
return boxVersion;
27+
}
28+
29+
public Map<String, String> getExtraHeaders() {
30+
return extraHeaders;
31+
}
32+
33+
public static class Builder {
34+
35+
protected EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;
36+
37+
protected Map<String, String> extraHeaders;
38+
39+
public Builder() {
40+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
41+
this.extraHeaders = mapOf();
42+
}
43+
44+
public Builder boxVersion(BoxVersionHeaderV2025R0 boxVersion) {
45+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(boxVersion);
46+
return this;
47+
}
48+
49+
public Builder boxVersion(EnumWrapper<BoxVersionHeaderV2025R0> boxVersion) {
50+
this.boxVersion = boxVersion;
51+
return this;
52+
}
53+
54+
public Builder extraHeaders(Map<String, String> extraHeaders) {
55+
this.extraHeaders = extraHeaders;
56+
return this;
57+
}
58+
59+
public CreateExternalUserSubmitDeleteJobV2025R0Headers build() {
60+
return new CreateExternalUserSubmitDeleteJobV2025R0Headers(this);
61+
}
62+
}
63+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package com.box.sdkgen.managers.externalusers;
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.v2025r0.externaluserssubmitdeletejobrequestv2025r0.ExternalUsersSubmitDeleteJobRequestV2025R0;
15+
import com.box.sdkgen.schemas.v2025r0.externaluserssubmitdeletejobresponsev2025r0.ExternalUsersSubmitDeleteJobResponseV2025R0;
16+
import com.box.sdkgen.serialization.json.JsonManager;
17+
import java.util.Map;
18+
19+
public class ExternalUsersManager {
20+
21+
public Authentication auth;
22+
23+
public NetworkSession networkSession;
24+
25+
public ExternalUsersManager() {
26+
this.networkSession = new NetworkSession();
27+
}
28+
29+
protected ExternalUsersManager(Builder builder) {
30+
this.auth = builder.auth;
31+
this.networkSession = builder.networkSession;
32+
}
33+
34+
public ExternalUsersSubmitDeleteJobResponseV2025R0 createExternalUserSubmitDeleteJobV2025R0(
35+
ExternalUsersSubmitDeleteJobRequestV2025R0 requestBody) {
36+
return createExternalUserSubmitDeleteJobV2025R0(
37+
requestBody, new CreateExternalUserSubmitDeleteJobV2025R0Headers());
38+
}
39+
40+
public ExternalUsersSubmitDeleteJobResponseV2025R0 createExternalUserSubmitDeleteJobV2025R0(
41+
ExternalUsersSubmitDeleteJobRequestV2025R0 requestBody,
42+
CreateExternalUserSubmitDeleteJobV2025R0Headers headers) {
43+
Map<String, String> headersMap =
44+
prepareParams(
45+
mergeMaps(
46+
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
47+
headers.getExtraHeaders()));
48+
FetchResponse response =
49+
this.networkSession
50+
.getNetworkClient()
51+
.fetch(
52+
new FetchOptions.Builder(
53+
String.join(
54+
"",
55+
this.networkSession.getBaseUrls().getBaseUrl(),
56+
"/2.0/external_users/submit_delete_job"),
57+
"POST")
58+
.headers(headersMap)
59+
.data(JsonManager.serialize(requestBody))
60+
.contentType("application/json")
61+
.responseFormat(ResponseFormat.JSON)
62+
.auth(this.auth)
63+
.networkSession(this.networkSession)
64+
.build());
65+
return JsonManager.deserialize(
66+
response.getData(), ExternalUsersSubmitDeleteJobResponseV2025R0.class);
67+
}
68+
69+
public Authentication getAuth() {
70+
return auth;
71+
}
72+
73+
public NetworkSession getNetworkSession() {
74+
return networkSession;
75+
}
76+
77+
public static class Builder {
78+
79+
protected Authentication auth;
80+
81+
protected NetworkSession networkSession;
82+
83+
public Builder() {
84+
this.networkSession = new NetworkSession();
85+
}
86+
87+
public Builder auth(Authentication auth) {
88+
this.auth = auth;
89+
return this;
90+
}
91+
92+
public Builder networkSession(NetworkSession networkSession) {
93+
this.networkSession = networkSession;
94+
return this;
95+
}
96+
97+
public ExternalUsersManager build() {
98+
return new ExternalUsersManager(this);
99+
}
100+
}
101+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package com.box.sdkgen.schemas.v2025r0.externaluserdeletionresultv2025r0;
2+
3+
import com.box.sdkgen.internal.NullableFieldTracker;
4+
import com.box.sdkgen.internal.SerializableObject;
5+
import com.fasterxml.jackson.annotation.JsonFilter;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
import java.util.Objects;
8+
9+
@JsonFilter("nullablePropertyFilter")
10+
public class ExternalUserDeletionResultV2025R0 extends SerializableObject {
11+
12+
@JsonProperty("user_id")
13+
protected final String userId;
14+
15+
protected final long status;
16+
17+
protected String detail;
18+
19+
public ExternalUserDeletionResultV2025R0(
20+
@JsonProperty("user_id") String userId, @JsonProperty("status") long status) {
21+
super();
22+
this.userId = userId;
23+
this.status = status;
24+
}
25+
26+
protected ExternalUserDeletionResultV2025R0(Builder builder) {
27+
super();
28+
this.userId = builder.userId;
29+
this.status = builder.status;
30+
this.detail = builder.detail;
31+
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
32+
}
33+
34+
public String getUserId() {
35+
return userId;
36+
}
37+
38+
public long getStatus() {
39+
return status;
40+
}
41+
42+
public String getDetail() {
43+
return detail;
44+
}
45+
46+
@Override
47+
public boolean equals(Object o) {
48+
if (this == o) {
49+
return true;
50+
}
51+
if (o == null || getClass() != o.getClass()) {
52+
return false;
53+
}
54+
ExternalUserDeletionResultV2025R0 casted = (ExternalUserDeletionResultV2025R0) o;
55+
return Objects.equals(userId, casted.userId)
56+
&& Objects.equals(status, casted.status)
57+
&& Objects.equals(detail, casted.detail);
58+
}
59+
60+
@Override
61+
public int hashCode() {
62+
return Objects.hash(userId, status, detail);
63+
}
64+
65+
@Override
66+
public String toString() {
67+
return "ExternalUserDeletionResultV2025R0{"
68+
+ "userId='"
69+
+ userId
70+
+ '\''
71+
+ ", "
72+
+ "status='"
73+
+ status
74+
+ '\''
75+
+ ", "
76+
+ "detail='"
77+
+ detail
78+
+ '\''
79+
+ "}";
80+
}
81+
82+
public static class Builder extends NullableFieldTracker {
83+
84+
protected final String userId;
85+
86+
protected final long status;
87+
88+
protected String detail;
89+
90+
public Builder(String userId, long status) {
91+
super();
92+
this.userId = userId;
93+
this.status = status;
94+
}
95+
96+
public Builder detail(String detail) {
97+
this.detail = detail;
98+
return this;
99+
}
100+
101+
public ExternalUserDeletionResultV2025R0 build() {
102+
return new ExternalUserDeletionResultV2025R0(this);
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)