001package com.box.sdkgen.managers.externalusers; 002 003import static com.box.sdkgen.internal.utils.UtilsManager.convertToString; 004import static com.box.sdkgen.internal.utils.UtilsManager.entryOf; 005import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; 006import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps; 007import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams; 008 009import com.box.sdkgen.networking.auth.Authentication; 010import com.box.sdkgen.networking.fetchoptions.FetchOptions; 011import com.box.sdkgen.networking.fetchoptions.ResponseFormat; 012import com.box.sdkgen.networking.fetchresponse.FetchResponse; 013import com.box.sdkgen.networking.network.NetworkSession; 014import com.box.sdkgen.schemas.v2025r0.externaluserssubmitdeletejobrequestv2025r0.ExternalUsersSubmitDeleteJobRequestV2025R0; 015import com.box.sdkgen.schemas.v2025r0.externaluserssubmitdeletejobresponsev2025r0.ExternalUsersSubmitDeleteJobResponseV2025R0; 016import com.box.sdkgen.serialization.json.JsonManager; 017import java.util.Map; 018 019public class ExternalUsersManager { 020 021 public Authentication auth; 022 023 public NetworkSession networkSession; 024 025 public ExternalUsersManager() { 026 this.networkSession = new NetworkSession(); 027 } 028 029 protected ExternalUsersManager(Builder builder) { 030 this.auth = builder.auth; 031 this.networkSession = builder.networkSession; 032 } 033 034 /** 035 * Delete external users from current user enterprise. This will remove each external user from 036 * all invited collaborations within the current enterprise. 037 * 038 * @param requestBody Request body of submitJobToDeleteExternalUsersV2025R0 method 039 */ 040 public ExternalUsersSubmitDeleteJobResponseV2025R0 submitJobToDeleteExternalUsersV2025R0( 041 ExternalUsersSubmitDeleteJobRequestV2025R0 requestBody) { 042 return submitJobToDeleteExternalUsersV2025R0( 043 requestBody, new SubmitJobToDeleteExternalUsersV2025R0Headers()); 044 } 045 046 /** 047 * Delete external users from current user enterprise. This will remove each external user from 048 * all invited collaborations within the current enterprise. 049 * 050 * @param requestBody Request body of submitJobToDeleteExternalUsersV2025R0 method 051 * @param headers Headers of submitJobToDeleteExternalUsersV2025R0 method 052 */ 053 public ExternalUsersSubmitDeleteJobResponseV2025R0 submitJobToDeleteExternalUsersV2025R0( 054 ExternalUsersSubmitDeleteJobRequestV2025R0 requestBody, 055 SubmitJobToDeleteExternalUsersV2025R0Headers headers) { 056 Map<String, String> headersMap = 057 prepareParams( 058 mergeMaps( 059 mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))), 060 headers.getExtraHeaders())); 061 FetchResponse response = 062 this.networkSession 063 .getNetworkClient() 064 .fetch( 065 new FetchOptions.Builder( 066 String.join( 067 "", 068 this.networkSession.getBaseUrls().getBaseUrl(), 069 "/2.0/external_users/submit_delete_job"), 070 "POST") 071 .headers(headersMap) 072 .data(JsonManager.serialize(requestBody)) 073 .contentType("application/json") 074 .responseFormat(ResponseFormat.JSON) 075 .auth(this.auth) 076 .networkSession(this.networkSession) 077 .build()); 078 return JsonManager.deserialize( 079 response.getData(), ExternalUsersSubmitDeleteJobResponseV2025R0.class); 080 } 081 082 public Authentication getAuth() { 083 return auth; 084 } 085 086 public NetworkSession getNetworkSession() { 087 return networkSession; 088 } 089 090 public static class Builder { 091 092 protected Authentication auth; 093 094 protected NetworkSession networkSession; 095 096 public Builder() {} 097 098 public Builder auth(Authentication auth) { 099 this.auth = auth; 100 return this; 101 } 102 103 public Builder networkSession(NetworkSession networkSession) { 104 this.networkSession = networkSession; 105 return this; 106 } 107 108 public ExternalUsersManager build() { 109 if (this.networkSession == null) { 110 this.networkSession = new NetworkSession(); 111 } 112 return new ExternalUsersManager(this); 113 } 114 } 115}