Skip to content

Commit

Permalink
Merge pull request #53 from kintone/feat-support-new-properties-of-ap…
Browse files Browse the repository at this point in the history
…p-settings-apis

feat: Support new properties of app settings apis
  • Loading branch information
0gr committed Apr 30, 2024
2 parents 0425f42 + 97ac26d commit a4ad651
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 11 deletions.
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:2.1.0'
implementation 'com.kintone:kintone-java-client:2.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>2.1.0</version>
<version>2.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.github.hierynomus.license' version '0.16.1'
}

version = '2.1.0'
version = '2.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:2.1.0'
implementation 'com.kintone:kintone-java-client:2.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>2.1.0</version>
<version>2.2.0</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.kintone.client.api.KintoneResponseBody;
import com.kintone.client.model.app.AppIcon;
import com.kintone.client.model.app.NumberPrecision;
import com.kintone.client.model.app.TitleFiled;
import lombok.Value;

/** A response object for Get App Settings Preview API. */
Expand All @@ -20,6 +22,27 @@ public class GetAppSettingsPreviewResponseBody implements KintoneResponseBody {
/** The color theme. */
private final String theme;

/** An object containing settings of record title. */
private final TitleFiled titleField;

/** An object containing the precision settings of numbers and calculations. */
private final NumberPrecision numberPrecision;

/** The settings of first month of fiscal year */
private final int firstMonthOfFiscalYear;

/** Thumbnails of image files attached to the File fields are enabled. */
private final boolean enableThumbnails;

/** The bulk deletion of records is enabled. */
private final boolean enableBulkDeletion;

/** The record comments feature is enabled. */
private final boolean enableComments;

/** The "duplicate record" feature is enabled. */
private final boolean enableDuplicateRecord;

/** The revision number of the App settings. */
private final long revision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.kintone.client.api.KintoneResponseBody;
import com.kintone.client.model.app.AppIcon;
import com.kintone.client.model.app.NumberPrecision;
import com.kintone.client.model.app.TitleFiled;
import lombok.Value;

/** A response object for Get App Settings API. */
Expand All @@ -20,6 +22,27 @@ public class GetAppSettingsResponseBody implements KintoneResponseBody {
/** The color theme. */
private final String theme;

/** An object containing settings of record title. */
private final TitleFiled titleField;

/** An object containing the precision settings of numbers and calculations. */
private final NumberPrecision numberPrecision;

/** The settings of first month of fiscal year */
private final int firstMonthOfFiscalYear;

/** Thumbnails of image files attached to the File fields are enabled. */
private final boolean enableThumbnails;

/** The bulk deletion of records is enabled. */
private final boolean enableBulkDeletion;

/** The record comments feature is enabled. */
private final boolean enableComments;

/** The "duplicate record" feature is enabled. */
private final boolean enableDuplicateRecord;

/** The revision number of the App settings. */
private final long revision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.kintone.client.api.KintoneRequest;
import com.kintone.client.model.app.AppIcon;
import com.kintone.client.model.app.NumberPrecision;
import com.kintone.client.model.app.TitleFiled;
import lombok.Data;

/** A request object for Update App Settings API. */
Expand All @@ -26,6 +28,48 @@ public class UpdateAppSettingsRequest implements KintoneRequest {
/** The color theme (optional). If set to null, leaves this setting unchanged. */
private String theme;

/**
* An object containing settings of record title (optional). If set to null, leaves this setting
* unchanged.
*/
private TitleFiled titleField;

/**
* An object containing the precision settings of numbers and calculations (optional). If set to
* null, leaves this setting unchanged.
*/
private NumberPrecision numberPrecision;

/**
* The settings of first month of fiscal year (optional). If set to null, leaves this setting
* unchanged.
*/
private Integer firstMonthOfFiscalYear;

/**
* The on/off settings to show thumbnails of image files attached to the File fields (optional).
* If set to null, leaves this setting unchanged.
*/
private Boolean enableThumbnails;

/**
* The on/off settings of bulk deletion of records (optional). If set to null, leaves this setting
* unchanged.
*/
private Boolean enableBulkDeletion;

/**
* The on/off settings of record comments feature (optional). If set to null, leaves this setting
* unchanged.
*/
private Boolean enableComments;

/**
* The on/off settings to use the feature to "duplicate record" (optional). If set to null, leaves
* this setting unchanged.
*/
private Boolean enableDuplicateRecord;

/**
* 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
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/kintone/client/model/app/NumberPrecision.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.kintone.client.model.app;

import lombok.Data;

/** An object containing the precision settings of numbers and calculations */
@Data
public class NumberPrecision {

/** The total number of digits. */
private Integer digits;

/** The number of decimal places to round. */
private Integer decimalPlaces;

/** The rounding mode of the Number and Calculated fields. */
private RoundingMode roundingMode;
}
14 changes: 14 additions & 0 deletions src/main/java/com/kintone/client/model/app/RoundingMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.kintone.client.model.app;

/** The rounding mode of numbers. */
public enum RoundingMode {

/** Round to nearest even number. */
HALF_EVEN,

/** Round up. */
UP,

/** Round down. */
DOWN
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.kintone.client.model.app;

/** The selection mode of the title field. */
public enum TitleFieldSelectionMode {
/** Automatically set the title field. */
AUTO,

/** Manually set a field as the record title. */
MANUAL;
}
14 changes: 14 additions & 0 deletions src/main/java/com/kintone/client/model/app/TitleFiled.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.kintone.client.model.app;

import lombok.Data;

/** An object containing settings of record title. */
@Data
public class TitleFiled {

/** The selection mode of the title field. */
private TitleFieldSelectionMode selectionMode;

/** The field to be used as the record title when the "selectionMode" is set to "MANUAL". */
private String code;
}
88 changes: 82 additions & 6 deletions src/test/java/com/kintone/client/AppClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@
import com.kintone.client.model.app.FieldAccessibility;
import com.kintone.client.model.app.FieldRight;
import com.kintone.client.model.app.FieldRightEntity;
import com.kintone.client.model.app.NumberPrecision;
import com.kintone.client.model.app.RecordRight;
import com.kintone.client.model.app.RecordRightEntity;
import com.kintone.client.model.app.TitleFieldSelectionMode;
import com.kintone.client.model.app.TitleFiled;
import com.kintone.client.model.app.View;
import com.kintone.client.model.app.ViewId;
import com.kintone.client.model.app.ViewType;
Expand Down Expand Up @@ -685,7 +688,19 @@ public void getAppsByIds_List() {
@Test
public void getAppSettings_long() {
GetAppSettingsResponseBody resp =
new GetAppSettingsResponseBody("name", "desc", null, null, 10L);
new GetAppSettingsResponseBody(
"name",
"desc",
null,
null,
new TitleFiled().setSelectionMode(TitleFieldSelectionMode.AUTO),
new NumberPrecision().setDigits(40).setDecimalPlaces(10),
4,
true,
true,
true,
true,
10L);
mockClient.setResponseBody(resp);

assertThat(sut.getAppSettings(10L)).isEqualTo(resp);
Expand All @@ -697,7 +712,19 @@ public void getAppSettings_long() {
@Test
public void getAppSettings_long_String() {
GetAppSettingsResponseBody resp =
new GetAppSettingsResponseBody("name", "desc", null, null, 10L);
new GetAppSettingsResponseBody(
"name",
"desc",
null,
null,
new TitleFiled().setSelectionMode(TitleFieldSelectionMode.AUTO),
new NumberPrecision().setDigits(40).setDecimalPlaces(10),
4,
true,
true,
true,
true,
10L);
mockClient.setResponseBody(resp);

assertThat(sut.getAppSettings(10L, "ja")).isEqualTo(resp);
Expand All @@ -709,7 +736,20 @@ public void getAppSettings_long_String() {
@Test
public void getAppSettings_GetAppSettingsRequest() {
GetAppSettingsRequest req = new GetAppSettingsRequest();
GetAppSettingsResponseBody resp = new GetAppSettingsResponseBody("", "", null, "", 1);
GetAppSettingsResponseBody resp =
new GetAppSettingsResponseBody(
"",
"",
null,
"",
new TitleFiled().setSelectionMode(TitleFieldSelectionMode.AUTO),
new NumberPrecision().setDigits(40).setDecimalPlaces(10),
4,
true,
true,
true,
true,
1);
mockClient.setResponseBody(resp);

assertThat(sut.getAppSettings(req)).isEqualTo(resp);
Expand All @@ -720,7 +760,19 @@ public void getAppSettings_GetAppSettingsRequest() {
@Test
public void getAppSettingsPreview_long() {
GetAppSettingsPreviewResponseBody resp =
new GetAppSettingsPreviewResponseBody("name", "desc", null, null, 10L);
new GetAppSettingsPreviewResponseBody(
"name",
"desc",
null,
null,
new TitleFiled().setSelectionMode(TitleFieldSelectionMode.AUTO),
new NumberPrecision().setDigits(40).setDecimalPlaces(10),
4,
true,
true,
true,
true,
10L);
mockClient.setResponseBody(resp);

assertThat(sut.getAppSettingsPreview(10L)).isEqualTo(resp);
Expand All @@ -732,7 +784,19 @@ public void getAppSettingsPreview_long() {
@Test
public void getAppSettingsPreview_long_String() {
GetAppSettingsPreviewResponseBody resp =
new GetAppSettingsPreviewResponseBody("name", "desc", null, null, 10L);
new GetAppSettingsPreviewResponseBody(
"name",
"desc",
null,
null,
new TitleFiled().setSelectionMode(TitleFieldSelectionMode.AUTO),
new NumberPrecision().setDigits(40).setDecimalPlaces(10),
4,
true,
true,
true,
true,
10L);
mockClient.setResponseBody(resp);

assertThat(sut.getAppSettingsPreview(10L, "ja")).isEqualTo(resp);
Expand All @@ -745,7 +809,19 @@ public void getAppSettingsPreview_long_String() {
public void getAppSettingsPreview_GetAppSettingsPreviewRequest() {
GetAppSettingsPreviewRequest req = new GetAppSettingsPreviewRequest();
GetAppSettingsPreviewResponseBody resp =
new GetAppSettingsPreviewResponseBody("", "", null, "", 1);
new GetAppSettingsPreviewResponseBody(
"",
"",
null,
"",
new TitleFiled().setSelectionMode(TitleFieldSelectionMode.AUTO),
new NumberPrecision().setDigits(40).setDecimalPlaces(10),
4,
true,
true,
true,
true,
1);
mockClient.setResponseBody(resp);

assertThat(sut.getAppSettingsPreview(req)).isEqualTo(resp);
Expand Down

0 comments on commit a4ad651

Please sign in to comment.