diff --git a/src/main/java/com/kintone/client/AppClient.java b/src/main/java/com/kintone/client/AppClient.java index 5e3d188..038970a 100644 --- a/src/main/java/com/kintone/client/AppClient.java +++ b/src/main/java/com/kintone/client/AppClient.java @@ -1403,11 +1403,21 @@ public GetViewsPreviewResponseBody getViewsPreview(GetViewsPreviewRequest reques return client.call(KintoneApi.GET_VIEWS_PREVIEW, request, handlers); } + /** + * Removes an App from its current Space. + * + * @param app the App ID + */ + public void move(long app) { + move(app, null); + } + /** * Changes the Space to which an App belongs. * * @param app the App ID - * @param space the Space ID of where the App will be moved to. + * @param space the Space ID of where the App will be moved to. If set to null, the App will be + * removed from its current space. */ public void move(long app, Long space) { MoveAppRequest req = new MoveAppRequest(); @@ -1420,8 +1430,7 @@ public void move(long app, Long space) { * Changes the Space to which an App belongs. * * @param request the request parameters. See {@link MoveAppRequest} - * @return the response data. To remove an App from its current space, null can be specified. See - * {@link MoveAppResponseBody} + * @return the response data. See {@link MoveAppResponseBody} */ public MoveAppResponseBody move(MoveAppRequest request) { return client.call(KintoneApi.MOVE_APP_TO_SPACE, request, handlers); diff --git a/src/main/java/com/kintone/client/api/app/MoveAppRequest.java b/src/main/java/com/kintone/client/api/app/MoveAppRequest.java index d02ce2d..2e846c9 100644 --- a/src/main/java/com/kintone/client/api/app/MoveAppRequest.java +++ b/src/main/java/com/kintone/client/api/app/MoveAppRequest.java @@ -11,8 +11,8 @@ public class MoveAppRequest implements KintoneRequest { private Long app; /** - * The Space ID of where the App will be moved to (required). To remove an App from its current - * space, null can be specified. + * The Space ID of where the App will be moved to (optional). If set to null or not set, the App + * will be removed from its current space. */ private Long space; } diff --git a/src/test/java/com/kintone/client/AppClientTest.java b/src/test/java/com/kintone/client/AppClientTest.java index fb3311a..92a7678 100644 --- a/src/test/java/com/kintone/client/AppClientTest.java +++ b/src/test/java/com/kintone/client/AppClientTest.java @@ -1544,6 +1544,17 @@ public void getViewsPreview_GetViewsPreviewRequest() { assertThat(mockClient.getLastBody()).isEqualTo(req); } + @Test + public void moveToSpace_long() { + mockClient.setResponseBody(new MoveAppResponseBody()); + + sut.move(1); + assertThat(mockClient.getLastApi()).isEqualTo(KintoneApi.MOVE_APP_TO_SPACE); + assertThat(mockClient.getLastBody()) + .usingRecursiveComparison() + .isEqualTo(new MoveAppRequest().setApp(1L).setSpace(null)); + } + @Test public void moveToSpace_long_long() { mockClient.setResponseBody(new MoveAppResponseBody());