From e5b3e7f6f732cc05fa9e23acbc6144be3d414365 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Mon, 25 Aug 2025 05:23:55 -0700 Subject: [PATCH 1/3] test: ExternalUsers API integration tests (box/box-codegen#799) --- .codegen.json | 2 +- .github/workflows/build.yml | 1 + README.md | 2 +- docs/externalusers.md | 5 +- .../externalusers/ExternalUsersITest.java | 53 +++++++++++++++++++ 5 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 src/test/java/com/box/sdkgen/test/externalusers/ExternalUsersITest.java diff --git a/.codegen.json b/.codegen.json index 4ba6aa255..b30bfd099 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "3ba449c", "specHash": "ec8720b", "version": "0.1.0" } +{ "engineHash": "b0bc740", "specHash": "ec8720b", "version": "0.1.0" } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cfcb2ba9..478ff07d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: ENTERPRISE_ID: ${{ secrets.ENTERPRISE_ID }} BOX_FILE_REQUEST_ID: ${{ secrets.BOX_FILE_REQUEST_ID }} BOX_EXTERNAL_USER_EMAIL: ${{ secrets.BOX_EXTERNAL_USER_EMAIL }} + BOX_EXTERNAL_USER_ID: ${{ secrets.BOX_EXTERNAL_USER_ID }} APP_ITEM_ASSOCIATION_FILE_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FILE_ID }} APP_ITEM_ASSOCIATION_FOLDER_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FOLDER_ID }} WORKFLOW_FOLDER_ID: ${{ secrets.WORKFLOW_FOLDER_ID }} diff --git a/README.md b/README.md index 11a8f1524..af8e807a2 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Now select `Authorization` and submit application to be reviewed by account admi download your app configuration settings as JSON. 2. Encode configuration file to Base64, e.g. using command: `base64 -i path_to_json_file` 3. Set environment variable: `JWT_CONFIG_BASE_64` with base64 encoded jwt configuration file -4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account, `BOX_EXTERNAL_USER_EMAIL` with email of free external user which not belongs to any enterprise. +4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account, `BOX_EXTERNAL_USER_EMAIL` with email of free external user which not belongs to any enterprise and `BOX_EXTERNAL_USER_ID` with its ID. 5. Set environment variable: `WORKFLOW_FOLDER_ID` with the ID of the Relay workflow that deletes the file that triggered the workflow. The workflow should have a manual start to be able to start it from the API. 6. Set environment variable: `APP_ITEM_ASSOCIATION_FILE_ID` to the ID of the file with associated app item and `APP_ITEM_ASSOCIATION_FOLDER_ID` to the ID of the folder with associated app item. 7. Set environment variable: `APP_ITEM_SHARED_LINK` to the shared link associated with app item. diff --git a/docs/externalusers.md b/docs/externalusers.md index 5223d80d0..295e94197 100644 --- a/docs/externalusers.md +++ b/docs/externalusers.md @@ -13,7 +13,10 @@ This operation is performed by calling function `submitJobToDeleteExternalUsersV See the endpoint docs at [API Reference](https://developer.box.com/reference/v2025.0/post-external-users-submit-delete-job/). -*Currently we don't have an example for calling `submitJobToDeleteExternalUsersV2025R0` in integration tests* + +``` +client.getExternalUsers().submitJobToDeleteExternalUsersV2025R0(new ExternalUsersSubmitDeleteJobRequestV2025R0(Arrays.asList(new UserReferenceV2025R0(getEnvVar("BOX_EXTERNAL_USER_ID"))))) +``` ### Arguments diff --git a/src/test/java/com/box/sdkgen/test/externalusers/ExternalUsersITest.java b/src/test/java/com/box/sdkgen/test/externalusers/ExternalUsersITest.java new file mode 100644 index 000000000..52f46cb8b --- /dev/null +++ b/src/test/java/com/box/sdkgen/test/externalusers/ExternalUsersITest.java @@ -0,0 +1,53 @@ +package com.box.sdkgen.test.externalusers; + +import static com.box.sdkgen.internal.utils.UtilsManager.getEnvVar; +import static com.box.sdkgen.test.commons.CommonsManager.getDefaultClientWithUserSubject; +import static com.box.sdkgen.test.commons.CommonsManager.uploadNewFile; + +import com.box.sdkgen.client.BoxClient; +import com.box.sdkgen.managers.usercollaborations.CreateCollaborationRequestBody; +import com.box.sdkgen.managers.usercollaborations.CreateCollaborationRequestBodyAccessibleByField; +import com.box.sdkgen.managers.usercollaborations.CreateCollaborationRequestBodyAccessibleByTypeField; +import com.box.sdkgen.managers.usercollaborations.CreateCollaborationRequestBodyItemField; +import com.box.sdkgen.managers.usercollaborations.CreateCollaborationRequestBodyItemTypeField; +import com.box.sdkgen.managers.usercollaborations.CreateCollaborationRequestBodyRoleField; +import com.box.sdkgen.schemas.collaboration.Collaboration; +import com.box.sdkgen.schemas.filefull.FileFull; +import com.box.sdkgen.schemas.v2025r0.externaluserssubmitdeletejobrequestv2025r0.ExternalUsersSubmitDeleteJobRequestV2025R0; +import com.box.sdkgen.schemas.v2025r0.externaluserssubmitdeletejobresponsev2025r0.ExternalUsersSubmitDeleteJobResponseV2025R0; +import com.box.sdkgen.schemas.v2025r0.userreferencev2025r0.UserReferenceV2025R0; +import java.util.Arrays; +import org.junit.jupiter.api.Test; + +public class ExternalUsersITest { + + private static final BoxClient client = getDefaultClientWithUserSubject(getEnvVar("USER_ID")); + + @Test + public void testSubmitJobToDeleteExternalUsers() { + FileFull file = uploadNewFile(); + Collaboration fileCollaboration = + client + .getUserCollaborations() + .createCollaboration( + new CreateCollaborationRequestBody( + new CreateCollaborationRequestBodyItemField.Builder() + .type(CreateCollaborationRequestBodyItemTypeField.FILE) + .id(file.getId()) + .build(), + new CreateCollaborationRequestBodyAccessibleByField.Builder( + CreateCollaborationRequestBodyAccessibleByTypeField.USER) + .id(getEnvVar("BOX_EXTERNAL_USER_ID")) + .build(), + CreateCollaborationRequestBodyRoleField.EDITOR)); + ExternalUsersSubmitDeleteJobResponseV2025R0 externalUsersJobDeleteResponse = + client + .getExternalUsers() + .submitJobToDeleteExternalUsersV2025R0( + new ExternalUsersSubmitDeleteJobRequestV2025R0( + Arrays.asList(new UserReferenceV2025R0(getEnvVar("BOX_EXTERNAL_USER_ID"))))); + assert externalUsersJobDeleteResponse.getEntries().size() == 1; + assert externalUsersJobDeleteResponse.getEntries().get(0).getStatus() == 202; + client.getFiles().deleteFileById(file.getId()); + } +} From 7bbfeaab99ed3df70276f9391ff8c04dd11fe322 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Mon, 25 Aug 2025 07:53:50 -0700 Subject: [PATCH 2/3] chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index b30bfd099..cdff96eba 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "b0bc740", "specHash": "ec8720b", "version": "0.1.0" } +{ "engineHash": "ec59ea3", "specHash": "ec8720b", "version": "0.1.0" } From 13eee2fa246058f25fe245062d907b8749a37328 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 26 Aug 2025 04:23:49 -0700 Subject: [PATCH 3/3] chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index cdff96eba..7cc37c9bf 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "ec59ea3", "specHash": "ec8720b", "version": "0.1.0" } +{ "engineHash": "4673277", "specHash": "ec8720b", "version": "0.1.0" }