diff --git a/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/Cloudant.java b/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/Cloudant.java index b142b6d0f..4448fa702 100644 --- a/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/Cloudant.java +++ b/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/Cloudant.java @@ -406,12 +406,18 @@ public ServiceCall getDbUpdates(GetDbUpdatesOptions getDbUpdatesOptio builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); + if (getDbUpdatesOptions.descending() != null) { + builder.query("descending", String.valueOf(getDbUpdatesOptions.descending())); + } if (getDbUpdatesOptions.feed() != null) { builder.query("feed", String.valueOf(getDbUpdatesOptions.feed())); } if (getDbUpdatesOptions.heartbeat() != null) { builder.query("heartbeat", String.valueOf(getDbUpdatesOptions.heartbeat())); } + if (getDbUpdatesOptions.limit() != null) { + builder.query("limit", String.valueOf(getDbUpdatesOptions.limit())); + } if (getDbUpdatesOptions.timeout() != null) { builder.query("timeout", String.valueOf(getDbUpdatesOptions.timeout())); } diff --git a/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptions.java b/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptions.java index ccdfee825..0cb92a7b0 100644 --- a/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptions.java +++ b/modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptions.java @@ -33,8 +33,10 @@ public interface Feed { String NORMAL = "normal"; } + protected Boolean descending; protected String feed; protected Long heartbeat; + protected Long limit; protected Long timeout; protected String since; @@ -42,8 +44,10 @@ public interface Feed { * Builder. */ public static class Builder { + private Boolean descending; private String feed; private Long heartbeat; + private Long limit; private Long timeout; private String since; @@ -53,8 +57,10 @@ public static class Builder { * @param getDbUpdatesOptions the instance to initialize the Builder with */ private Builder(GetDbUpdatesOptions getDbUpdatesOptions) { + this.descending = getDbUpdatesOptions.descending; this.feed = getDbUpdatesOptions.feed; this.heartbeat = getDbUpdatesOptions.heartbeat; + this.limit = getDbUpdatesOptions.limit; this.timeout = getDbUpdatesOptions.timeout; this.since = getDbUpdatesOptions.since; } @@ -74,6 +80,17 @@ public GetDbUpdatesOptions build() { return new GetDbUpdatesOptions(this); } + /** + * Set the descending. + * + * @param descending the descending + * @return the GetDbUpdatesOptions builder + */ + public Builder descending(Boolean descending) { + this.descending = descending; + return this; + } + /** * Set the feed. * @@ -96,6 +113,17 @@ public Builder heartbeat(long heartbeat) { return this; } + /** + * Set the limit. + * + * @param limit the limit + * @return the GetDbUpdatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + /** * Set the timeout. * @@ -122,8 +150,10 @@ public Builder since(String since) { protected GetDbUpdatesOptions() { } protected GetDbUpdatesOptions(Builder builder) { + descending = builder.descending; feed = builder.feed; heartbeat = builder.heartbeat; + limit = builder.limit; timeout = builder.timeout; since = builder.since; } @@ -137,6 +167,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the descending. + * + * Query parameter to specify whether to return the documents in descending by key order. + * + * @return the descending + */ + public Boolean descending() { + return descending; + } + /** * Gets the feed. * @@ -170,6 +211,17 @@ public Long heartbeat() { return heartbeat; } + /** + * Gets the limit. + * + * Query parameter to specify the number of returned documents to limit the result to. + * + * @return the limit + */ + public Long limit() { + return limit; + } + /** * Gets the timeout. * diff --git a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantIT.java b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantIT.java index 7854ffb7b..f2458e8a6 100644 --- a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantIT.java +++ b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantIT.java @@ -351,8 +351,10 @@ public void testPutCapacityThroughputConfiguration() throws Exception { public void testGetDbUpdates() throws Exception { try { GetDbUpdatesOptions getDbUpdatesOptions = new GetDbUpdatesOptions.Builder() + .descending(false) .feed("normal") .heartbeat(Long.valueOf("0")) + .limit(Long.valueOf("0")) .timeout(Long.valueOf("60000")) .since("0") .build(); diff --git a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantTest.java b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantTest.java index e324eed7a..9cf9ad99b 100644 --- a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantTest.java +++ b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/CloudantTest.java @@ -462,8 +462,10 @@ public void testGetDbUpdatesWOptions() throws Throwable { // Construct an instance of the GetDbUpdatesOptions model GetDbUpdatesOptions getDbUpdatesOptionsModel = new GetDbUpdatesOptions.Builder() + .descending(false) .feed("normal") .heartbeat(Long.valueOf("0")) + .limit(Long.valueOf("0")) .timeout(Long.valueOf("60000")) .since("0") .build(); @@ -484,8 +486,10 @@ public void testGetDbUpdatesWOptions() throws Throwable { // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); + assertEquals(Boolean.valueOf(query.get("descending")), Boolean.valueOf(false)); assertEquals(query.get("feed"), "normal"); assertEquals(Long.valueOf(query.get("heartbeat")), Long.valueOf("0")); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("0")); assertEquals(Long.valueOf(query.get("timeout")), Long.valueOf("60000")); assertEquals(query.get("since"), "0"); } diff --git a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptionsTest.java b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptionsTest.java index 849bf348a..c07fa4980 100644 --- a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptionsTest.java +++ b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetDbUpdatesOptionsTest.java @@ -32,13 +32,17 @@ public class GetDbUpdatesOptionsTest { @Test public void testGetDbUpdatesOptions() throws Throwable { GetDbUpdatesOptions getDbUpdatesOptionsModel = new GetDbUpdatesOptions.Builder() + .descending(false) .feed("normal") .heartbeat(Long.valueOf("0")) + .limit(Long.valueOf("0")) .timeout(Long.valueOf("60000")) .since("0") .build(); + assertEquals(getDbUpdatesOptionsModel.descending(), Boolean.valueOf(false)); assertEquals(getDbUpdatesOptionsModel.feed(), "normal"); assertEquals(getDbUpdatesOptionsModel.heartbeat(), Long.valueOf("0")); + assertEquals(getDbUpdatesOptionsModel.limit(), Long.valueOf("0")); assertEquals(getDbUpdatesOptionsModel.timeout(), Long.valueOf("60000")); assertEquals(getDbUpdatesOptionsModel.since(), "0"); }