Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement Action Settings APIs #25

Merged
merged 2 commits into from
Apr 16, 2021
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ API client library for Kintone REST APIs on Java.
Add dependency declaration in `build.gradle` of your project.
```
dependencies {
implementation 'com.kintone:kintone-java-client:1.1.0'
implementation 'com.kintone:kintone-java-client:1.2.0'
}
```
- For projects using Maven
Expand All @@ -17,7 +17,7 @@ API client library for Kintone REST APIs on Java.
<dependency>
<groupId>com.kintone</groupId>
<artifactId>kintone-java-client</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'com.diffplug.gradle.spotless' version '3.25.0'
}

version = '1.1.0'
version = '1.2.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ client.close();
Add dependency declaration in `build.gradle` of your project.
```groovy
dependencies {
implementation 'com.kintone:kintone-java-client:1.1.0'
implementation 'com.kintone:kintone-java-client:1.2.0'
}
```

Expand All @@ -39,7 +39,7 @@ Add dependency declaration in `pom.xml` of your project.
<dependency>
<groupId>com.kintone</groupId>
<artifactId>kintone-java-client</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```

Expand Down
128 changes: 128 additions & 0 deletions src/main/java/com/kintone/client/AppClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import com.kintone.client.api.app.GetAppAclPreviewResponseBody;
import com.kintone.client.api.app.GetAppAclRequest;
import com.kintone.client.api.app.GetAppAclResponseBody;
import com.kintone.client.api.app.GetAppActionsPreviewRequest;
import com.kintone.client.api.app.GetAppActionsPreviewResponseBody;
import com.kintone.client.api.app.GetAppActionsRequest;
import com.kintone.client.api.app.GetAppActionsResponseBody;
import com.kintone.client.api.app.GetAppCustomizePreviewRequest;
import com.kintone.client.api.app.GetAppCustomizePreviewResponseBody;
import com.kintone.client.api.app.GetAppCustomizeRequest;
Expand Down Expand Up @@ -70,6 +74,8 @@
import com.kintone.client.api.app.GetViewsResponseBody;
import com.kintone.client.api.app.UpdateAppAclRequest;
import com.kintone.client.api.app.UpdateAppAclResponseBody;
import com.kintone.client.api.app.UpdateAppActionsRequest;
import com.kintone.client.api.app.UpdateAppActionsResponseBody;
import com.kintone.client.api.app.UpdateAppCustomizeRequest;
import com.kintone.client.api.app.UpdateAppCustomizeResponseBody;
import com.kintone.client.api.app.UpdateAppSettingsRequest;
Expand All @@ -94,7 +100,9 @@
import com.kintone.client.api.app.UpdateReportsResponseBody;
import com.kintone.client.api.app.UpdateViewsRequest;
import com.kintone.client.api.app.UpdateViewsResponseBody;
import com.kintone.client.model.app.ActionId;
import com.kintone.client.model.app.App;
import com.kintone.client.model.app.AppAction;
import com.kintone.client.model.app.AppRightEntity;
import com.kintone.client.model.app.DeployApp;
import com.kintone.client.model.app.DeployStatus;
Expand Down Expand Up @@ -435,6 +443,82 @@ public GetAppAclPreviewResponseBody getAppAclPreview(GetAppAclPreviewRequest req
return client.call(KintoneApi.GET_APP_ACL_PREVIEW, request, handlers);
}

/**
* Gets the Action settings of the App.
*
* @param app the app ID
* @return an object that maps the Action name to the Action settings
*/
public Map<String, AppAction> getAppActions(long app) {
GetAppActionsRequest req = new GetAppActionsRequest();
req.setApp(app);
return getAppActions(req).getActions();
}

/**
* Gets the Action settings of the App.
*
* @param app the app ID
* @param lang the localization language setting
* @return an object that maps the Action name to the Action settings
*/
public Map<String, AppAction> getAppActions(long app, String lang) {
GetAppActionsRequest req = new GetAppActionsRequest();
req.setApp(app);
req.setLang(lang);
return getAppActions(req).getActions();
}

/**
* Gets the Action settings of the App.
*
* @param request the request parameters. See {@link GetAppActionsRequest}
* @return the response data. See {@link GetAppActionsResponseBody}
*/
public GetAppActionsResponseBody getAppActions(GetAppActionsRequest request) {
return client.call(KintoneApi.GET_APP_ACTIONS, request, handlers);
}

/**
* Gets the Action settings of the App. This API retrieves the pre-live settings that have not yet
* been deployed to the live App.
*
* @param app the app ID
* @return an object that maps the Action name to the Action settings
*/
public Map<String, AppAction> getAppActionsPreview(long app) {
GetAppActionsPreviewRequest req = new GetAppActionsPreviewRequest();
req.setApp(app);
return getAppActionsPreview(req).getActions();
}

/**
* Gets the Action settings of the App. This API retrieves the pre-live settings that have not yet
* been deployed to the live App.
*
* @param app the app ID
* @param lang the localization language setting
* @return an object that maps the Action name to the Action settings
*/
public Map<String, AppAction> getAppActionsPreview(long app, String lang) {
GetAppActionsPreviewRequest req = new GetAppActionsPreviewRequest();
req.setApp(app);
req.setLang(lang);
return getAppActionsPreview(req).getActions();
}

/**
* Gets the Action settings of the App. This API retrieves the pre-live settings that have not yet
* been deployed to the live App.
*
* @param request the request parameters. See {@link GetAppActionsPreviewRequest}
* @return the response data. See {@link GetAppActionsPreviewResponseBody}
*/
public GetAppActionsPreviewResponseBody getAppActionsPreview(
GetAppActionsPreviewRequest request) {
return client.call(KintoneApi.GET_APP_ACTIONS_PREVIEW, request, handlers);
}

/**
* Gets the JavaScript and CSS customization settings of an App.
*
Expand Down Expand Up @@ -1331,6 +1415,50 @@ public UpdateAppAclResponseBody updateAppAcl(UpdateAppAclRequest request) {
return client.call(KintoneApi.UPDATE_APP_ACL, request, handlers);
}

/**
* Updates the Action settings of the App. This API updates the pre-live settings. After using
* this API, use the Deploy App Settings API to deploy the settings to the live App.
*
* @param app the App ID
* @param actions the object that maps the Action name to the Action settings
* @return an object containing data of the Action IDs
*/
public Map<String, ActionId> updateAppActions(long app, Map<String, AppAction> actions) {
UpdateAppActionsRequest req = new UpdateAppActionsRequest();
req.setApp(app);
req.setActions(actions);
return updateAppActions(req).getActions();
}

/**
* Updates the Action settings of the App. This API updates the pre-live settings. After using
* this API, use the Deploy App Settings API to deploy the settings to the live App.
*
* @param app the App ID
* @param actions the object that maps the Action name to the Action settings
* @param revision The expected revision number of the App settings
* @return an object containing data of the Action IDs
*/
public Map<String, ActionId> updateAppActions(
long app, Map<String, AppAction> actions, Long revision) {
UpdateAppActionsRequest req = new UpdateAppActionsRequest();
req.setApp(app);
req.setActions(actions);
req.setRevision(revision);
return updateAppActions(req).getActions();
}

/**
* Updates the Action settings of the App. This API updates the pre-live settings. After using
* this API, use the Deploy App Settings API to deploy the settings to the live App.
*
* @param request the request parameters. See {@link UpdateAppActionsRequest}
* @return the response data. See {@link UpdateAppActionsResponseBody}
*/
public UpdateAppActionsResponseBody updateAppActions(UpdateAppActionsRequest request) {
return client.call(KintoneApi.UPDATE_APP_ACTIONS, request, handlers);
}

/**
* Updates the JavaScript and CSS customization settings of an App. This API updates the pre-live
* settings. After using this API, use the Deploy App Settings API to deploy the settings to the
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/kintone/client/KintoneApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.kintone.client.api.app.EvaluateRecordAclResponseBody;
import com.kintone.client.api.app.GetAppAclPreviewResponseBody;
import com.kintone.client.api.app.GetAppAclResponseBody;
import com.kintone.client.api.app.GetAppActionsPreviewResponseBody;
import com.kintone.client.api.app.GetAppActionsResponseBody;
import com.kintone.client.api.app.GetAppCustomizePreviewResponseBody;
import com.kintone.client.api.app.GetAppCustomizeResponseBody;
import com.kintone.client.api.app.GetAppResponseBody;
Expand Down Expand Up @@ -38,6 +40,7 @@
import com.kintone.client.api.app.GetViewsPreviewResponseBody;
import com.kintone.client.api.app.GetViewsResponseBody;
import com.kintone.client.api.app.UpdateAppAclResponseBody;
import com.kintone.client.api.app.UpdateAppActionsResponseBody;
import com.kintone.client.api.app.UpdateAppCustomizeResponseBody;
import com.kintone.client.api.app.UpdateAppSettingsResponseBody;
import com.kintone.client.api.app.UpdateFieldAclResponseBody;
Expand Down Expand Up @@ -150,6 +153,9 @@ public enum KintoneApi {
GET_PROCESS_MANAGEMENT_PREVIEW(
GET, "preview/app/status", GetProcessManagementPreviewResponseBody.class),
UPDATE_PROCESS_MANAGEMENT(PUT, "preview/app/status", UpdateProcessManagementResponseBody.class),
GET_APP_ACTIONS(GET, "app/actions", GetAppActionsResponseBody.class),
GET_APP_ACTIONS_PREVIEW(GET, "preview/app/actions", GetAppActionsPreviewResponseBody.class),
UPDATE_APP_ACTIONS(PUT, "preview/app/actions", UpdateAppActionsResponseBody.class),
GET_APP_CUSTOMIZE(GET, "app/customize", GetAppCustomizeResponseBody.class),
GET_APP_CUSTOMIZE_PREVIEW(GET, "preview/app/customize", GetAppCustomizePreviewResponseBody.class),
UPDATE_APP_CUSTOMIZE(PUT, "preview/app/customize", UpdateAppCustomizeResponseBody.class),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.kintone.client.api.app;

import com.kintone.client.api.KintoneRequest;
import lombok.Data;

/** A request object for Get App Action Settings Preview API. */
@Data
public class GetAppActionsPreviewRequest implements KintoneRequest {

/** The App ID (required). */
private Long app;

/**
* The localization language setting (optional). If set to null, the default names will be
* retrieved.
*/
private String lang;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.kintone.client.api.app;

import com.kintone.client.api.KintoneResponseBody;
import com.kintone.client.model.app.AppAction;
import java.util.Map;
import lombok.Value;

/** A response object for Get App Action Settings Preview API. */
@Value
public class GetAppActionsPreviewResponseBody implements KintoneResponseBody {

/**
* An object of Action settings. The object's key is the Action's unique identifier, which is set
* as the Action's name in its default language settings (this is regardless of the lang request
* parameter's value). The values of the key are the various Action settings associated with that
* Action.
*/
private Map<String, AppAction> actions;

/** The revision number of the app settings. */
private final long revision;
}
18 changes: 18 additions & 0 deletions src/main/java/com/kintone/client/api/app/GetAppActionsRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.kintone.client.api.app;

import com.kintone.client.api.KintoneRequest;
import lombok.Data;

/** A request object for Get App Action Settings API. */
@Data
public class GetAppActionsRequest implements KintoneRequest {

/** The App ID (required). */
private Long app;

/**
* The localization language setting (optional). If set to null, the default names will be
* retrieved.
*/
private String lang;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.kintone.client.api.app;

import com.kintone.client.api.KintoneResponseBody;
import com.kintone.client.model.app.AppAction;
import java.util.Map;
import lombok.Value;

/** A response object for Get App Action Settings API. */
@Value
public class GetAppActionsResponseBody implements KintoneResponseBody {

/**
* An object of Action settings. The object's key is the Action's unique identifier, which is set
* as the Action's name in its default language settings (this is regardless of the lang request
* parameter's value). The values of the key are the various Action settings associated with that
* Action.
*/
private Map<String, AppAction> actions;

/** The revision number of the app settings. */
private final long revision;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.kintone.client.api.app;

import com.kintone.client.api.KintoneRequest;
import com.kintone.client.model.app.AppAction;
import java.util.Map;
import lombok.Data;

/** A request object for Update App Actions Settings API. */
@Data
public class UpdateAppActionsRequest implements KintoneRequest {

/** The App ID (required). */
private Long app;

/**
* An object listing Action settings. The object's key is the Action's unique identifier, which is
* equal to the Action's name in its default language settings. The values of the key are the
* various Action settings associated with that Action.
*/
private Map<String, AppAction> actions;

/**
* The expected revision number of the App settings (optional). The request will fail if the
* revision number is not the latest revision. The revision will not be checked if this parameter
* is null, or -1 is specified.
*/
private Long revision;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.kintone.client.api.app;

import com.kintone.client.api.KintoneResponseBody;
import com.kintone.client.model.app.ActionId;
import java.util.Map;
import lombok.Value;

/** A response object for Update App Actions Settings API. */
@Value
public class UpdateAppActionsResponseBody implements KintoneResponseBody {

/** An object containing data of the Action settings. */
private Map<String, ActionId> actions;

/** The revision number of the App settings. */
private final long revision;
}
11 changes: 11 additions & 0 deletions src/main/java/com/kintone/client/model/app/ActionId.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.kintone.client.model.app;

import lombok.Value;

/** Created or updated Action ID returned by Update App Action Settings API. */
@Value
public class ActionId {

/** The ID of the Action. */
private final long id;
}
Loading