Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/main/java/com/kintone/client/AppClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/kintone/client/api/app/MoveAppRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
11 changes: 11 additions & 0 deletions src/test/java/com/kintone/client/AppClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading