diff --git a/CHANGELOG.md b/CHANGELOG.md
index 137dc5f2..6f202ece 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,15 @@
# CHANGELOG
-## v1.12.3
+
+## v1.13.0
+
+### Date: 18-Dec-2023
+
+- Taxonomy Query Support
+- Updated Latest version of Utils SDK to 1.2.6
+- Snyk Issues fixed
+- Updated dependencies
+- Added support for early access feature
### Date: 28-SEP-2023
diff --git a/pom.xml b/pom.xml
index d326775a..0a0afd80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0com.contentstack.sdkjava
- 1.12.3
+ 1.13.0jarcontentstack-javaJava SDK for Contentstack Content Delivery API
@@ -25,7 +25,7 @@
5.0.0-alpha.110.8.51.18.30
- 5.10.0
+ 5.10.15.8.0-M12.8.81.1.1
@@ -33,10 +33,10 @@
1.53.8.11.6.13
- 20230618
+ 202310130.8.72.5.3
- 1.2.4
+ 1.2.6
diff --git a/src/main/java/com/contentstack/sdk/APIService.java b/src/main/java/com/contentstack/sdk/APIService.java
index a537f0d8..5bf3462b 100644
--- a/src/main/java/com/contentstack/sdk/APIService.java
+++ b/src/main/java/com/contentstack/sdk/APIService.java
@@ -4,9 +4,11 @@
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.HeaderMap;
+import retrofit2.http.Query;
import retrofit2.http.Url;
import java.util.LinkedHashMap;
+import java.util.Map;
/**
* @author Shailesh Mishra
@@ -15,5 +17,11 @@
*/
public interface APIService {
@GET
- Call getRequest(@Url String url, @HeaderMap LinkedHashMap headers);
+ Call getRequest(
+ @Url String url, @HeaderMap LinkedHashMap headers);
+
+ @GET("v3/taxonomies/entries")
+ Call getTaxonomy(
+ @HeaderMap Map headers,
+ @Query("query") String query);
}
diff --git a/src/main/java/com/contentstack/sdk/CSHttpConnection.java b/src/main/java/com/contentstack/sdk/CSHttpConnection.java
index 38792649..9eda41c0 100644
--- a/src/main/java/com/contentstack/sdk/CSHttpConnection.java
+++ b/src/main/java/com/contentstack/sdk/CSHttpConnection.java
@@ -186,7 +186,8 @@ public void send() {
}
private void getService(String requestUrl) throws IOException {
- this.headers.put(X_USER_AGENT_KEY, "contentstack-java/" + SDK_VERSION);
+
+ this.headers.put(X_USER_AGENT_KEY, "contentstack-delivery-java/" + SDK_VERSION);
this.headers.put(USER_AGENT_KEY, USER_AGENT);
this.headers.put(CONTENT_TYPE, APPLICATION_JSON);
@@ -260,7 +261,6 @@ void handleJSONObject(JSONArray arrayEntry, JSONObject jsonObj, int idx) {
}
void setError(String errResp) {
- logger.info(errResp);
responseJSON = new JSONObject(errResp); // Parse error string to JSONObject
responseJSON.put(ERROR_MESSAGE, responseJSON.optString(ERROR_MESSAGE));
responseJSON.put(ERROR_CODE, responseJSON.optString(ERROR_CODE));
diff --git a/src/main/java/com/contentstack/sdk/Config.java b/src/main/java/com/contentstack/sdk/Config.java
index fd736a6d..5d436901 100644
--- a/src/main/java/com/contentstack/sdk/Config.java
+++ b/src/main/java/com/contentstack/sdk/Config.java
@@ -1,5 +1,7 @@
package com.contentstack.sdk;
+import lombok.Getter;
+import lombok.Setter;
import okhttp3.ConnectionPool;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@@ -26,12 +28,19 @@ public class Config {
protected JSONObject livePreviewEntry = null;
protected ContentstackRegion region = ContentstackRegion.US;
protected String managementToken;
+ @Setter
+ @Getter
protected String branch;
+ @Setter
protected Proxy proxy = null;
protected ConnectionPool connectionPool = new ConnectionPool();
protected List plugins = null;
+
+ /**
+ * -- GETTER --
+ * The configuration for the contentstack that contains support for
public String getBranch() {
return branch;
}
@@ -55,9 +64,8 @@ public void setBranch(String branch) {
* config = new Config(); config.setProxy(proxy);
*
*/
- public void setProxy(Proxy proxy) {
- this.proxy = proxy;
- }
+ @Getter
+ protected String[] earlyAccess;
/**
* Returns the Proxy instance
@@ -73,12 +81,9 @@ public Proxy getProxy() {
* {@link okhttp3.Address} may share a {@link okhttp3.Connection}. This class implements the policy * of which
* connections to keep open for future use.
*
- * @param maxIdleConnections
- * the maxIdleConnections default value is 5
- * @param keepAliveDuration
- * the keepAliveDuration default value is 5
- * @param timeUnit
- * the timeUnit default value is TimeUnit. MINUTES
+ * @param maxIdleConnections the maxIdleConnections default value is 5
+ * @param keepAliveDuration the keepAliveDuration default value is 5
+ * @param timeUnit the timeUnit default value is TimeUnit. MINUTES
* @return ConnectionPool
*/
public ConnectionPool connectionPool(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit) {
@@ -98,8 +103,7 @@ public ContentstackRegion getRegion() {
/**
* Sets region.
*
- * @param region
- * the region
+ * @param region the region
* @return the region
*/
public ContentstackRegion setRegion(ContentstackRegion region) {
@@ -119,20 +123,10 @@ public void setPlugins(List plugins) {
this.plugins = plugins;
}
- /**
- * Gets host.
- *
- * @return the host
- */
- public String getHost() {
- return host;
- }
-
/**
* Sets host.
*
- * @param hostName
- * the host name
+ * @param hostName the host name
*/
public void setHost(String hostName) {
if (hostName != null && !hostName.isEmpty()) {
@@ -152,8 +146,7 @@ public String getVersion() {
/**
* Enable live preview config.
*
- * @param enableLivePreview
- * to enable live preview
+ * @param enableLivePreview to enable live preview
* @return the config
*/
public Config enableLivePreview(boolean enableLivePreview) {
@@ -164,8 +157,7 @@ public Config enableLivePreview(boolean enableLivePreview) {
/**
* Sets live preview host.
*
- * @param livePreviewHost
- * the live preview host
+ * @param livePreviewHost the live preview host
* @return the live preview host
*/
public Config setLivePreviewHost(@NotNull String livePreviewHost) {
@@ -181,8 +173,7 @@ protected Config setLivePreviewEntry(@NotNull JSONObject livePreviewEntry) {
/**
* Sets management token.
*
- * @param managementToken
- * the management token
+ * @param managementToken the management token
* @return the management token
*/
public Config setManagementToken(@NotNull String managementToken) {
@@ -197,4 +188,24 @@ public enum ContentstackRegion {
US, EU, AZURE_NA, AZURE_EU
}
+
+ /**
+ * To initialize the SDK with the latest features offered in the early access phase,
+ * include the early access parameter as shown in the following code:
+ *
+ * @param earlyAccessFeatures The list of Early Access Features
+ * {@code
+ * Config config = new Config();
+ * String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
+ * config.earlyAccess(earlyAccess);
+ * Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
+ *
+ * }
+ * @return Config
+ */
+ public Config earlyAccess(@NotNull String[] earlyAccessFeatures) {
+ this.earlyAccess = earlyAccessFeatures;
+ return this;
+ }
+
}
diff --git a/src/main/java/com/contentstack/sdk/Constants.java b/src/main/java/com/contentstack/sdk/Constants.java
index fcb5fab9..24917225 100644
--- a/src/main/java/com/contentstack/sdk/Constants.java
+++ b/src/main/java/com/contentstack/sdk/Constants.java
@@ -21,7 +21,7 @@
public class Constants {
private static final Logger logger = Logger.getLogger(Constants.class.getSimpleName());
- protected static final String SDK_VERSION = "1.12.3";
+ protected static final String SDK_VERSION = "1.13.0";
protected static final String ENVIRONMENT = "environment";
protected static final String CONTENT_TYPE_UID = "content_type_uid";
protected static final String ENTRY_UID = "entry_uid";
diff --git a/src/main/java/com/contentstack/sdk/Contentstack.java b/src/main/java/com/contentstack/sdk/Contentstack.java
index aa7fe895..c12ebf3a 100644
--- a/src/main/java/com/contentstack/sdk/Contentstack.java
+++ b/src/main/java/com/contentstack/sdk/Contentstack.java
@@ -31,27 +31,23 @@ protected Contentstack() throws IllegalAccessException {
* key of your stack.
* Find Your Stack Credentials from Contentstack .
*
- * @param stackApiKey
- * The API Key is a unique key assigned to each stack.
- * @param deliveryToken
- * The Delivery Token is a read-only credential that you
+ * @param stackApiKey The API Key is a unique key assigned to each stack.
+ * @param deliveryToken The Delivery Token is a read-only credential that you
* can create for different environments of your
* stack
- * @param environment
- * the environment for the stack
+ * @param environment the environment for the stack
* @return the stack
- * @throws IllegalAccessException
- * the illegal access exception
+ * @throws IllegalAccessException the illegal access exception
*
*/
public Query setHeader(@NotNull String key, @NotNull String value) {
if (!key.isEmpty() && !value.isEmpty()) {
@@ -95,6 +95,7 @@ public Query setHeader(@NotNull String key, @NotNull String value) {
*
* Stack stack = Contentstack..stack( "apiKey", "deliveryToken", "environment"); Query csQuery =
* stack.contentType("contentTypeUid").query(); csQuery.removeHeader("custom_key");
+
*/
public Query removeHeader(@NotNull String key) {
if (!key.isEmpty()) {
@@ -110,10 +111,8 @@ public String getContentType() {
/**
* Add a constraint to fetch all entries that contains given value against specified key
*
- * @param key
- * field uid.
- * @param value
- * field value which get 'included' from the response.
+ * @param key field uid.
+ * @param value field value which get 'included' from the response.
* @return {@link Query} object, so you can chain this call.
*
* Note : for group field provide key in a
@@ -138,10 +137,8 @@ public Query where(@NotNull String key, Object value) {
/**
* Add a custom query against specified key.
*
- * @param key
- * key.
- * @param value
- * value.
+ * @param key key.
+ * @param value value.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -164,8 +161,7 @@ public Query addQuery(@NotNull String key, String value) {
/**
* Remove provided query key from custom query if existed.
*
- * @param key
- * Query name to remove.
+ * @param key Query name to remove.
* @return {@linkplain Query} object, so you can chain this call.
*
*
@@ -186,8 +182,7 @@ public Query removeQuery(@NotNull String key) {
/**
* Combines all the queries together using AND operator
*
- * @param queryObjects
- * list of {@link Query} instances on which AND query executes.
+ * @param queryObjects list of {@link Query} instances on which AND query executes.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -221,8 +216,7 @@ public Query and(@NotNull List queryObjects) {
/**
* Add a constraint to fetch all entries which satisfy any queries.
*
- * @param queryObjects
- * list of {@link Query} instances on which OR query executes.
+ * @param queryObjects list of {@link Query} instances on which OR query executes.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -262,10 +256,8 @@ public Query or(List queryObjects) {
/**
* Add a constraint to the query that requires a particular key entry to be less than the provided value.
*
- * @param key
- * the key to be constrained.
- * @param value
- * the value that provides an upper bound.
+ * @param key the key to be constrained.
+ * @param value the value that provides an upper bound.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -280,7 +272,7 @@ public Query or(List queryObjects) {
*/
public Query lessThan(@NotNull String key, @NotNull Object value) {
if (queryValueJSON.isNull(key)) {
- if (queryValue.length() > 0) {
+ if (!queryValue.isEmpty()) {
queryValue = new JSONObject();
}
queryValue.put("$lt", value);
@@ -296,10 +288,8 @@ public Query lessThan(@NotNull String key, @NotNull Object value) {
* Add a constraint to the query that requires a particular key entry to be less than or equal to the provided
* value.
*
- * @param key
- * The key to be constrained
- * @param value
- * The value that must be equalled.
+ * @param key The key to be constrained
+ * @param value The value that must be equalled.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -314,7 +304,7 @@ public Query lessThan(@NotNull String key, @NotNull Object value) {
*/
public Query lessThanOrEqualTo(@NotNull String key, Object value) {
if (queryValueJSON.isNull(key)) {
- if (queryValue.length() > 0) {
+ if (!queryValue.isEmpty()) {
queryValue = new JSONObject();
}
queryValue.put("$lte", value);
@@ -329,10 +319,8 @@ public Query lessThanOrEqualTo(@NotNull String key, Object value) {
/**
* Add a constraint to the query that requires a particular key entry to be greater than the provided value.
*
- * @param key
- * The key to be constrained.
- * @param value
- * The value that provides a lower bound.
+ * @param key The key to be constrained.
+ * @param value The value that provides a lower bound.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -347,7 +335,7 @@ public Query lessThanOrEqualTo(@NotNull String key, Object value) {
*/
public Query greaterThan(@NotNull String key, Object value) {
if (queryValueJSON.isNull(key)) {
- if (queryValue.length() > 0) {
+ if (!queryValue.isEmpty()) {
queryValue = new JSONObject();
}
queryValue.put("$gt", value);
@@ -363,10 +351,8 @@ public Query greaterThan(@NotNull String key, Object value) {
* Add a constraint to the query that requires a particular key entry to be greater than or equal to the provided
* value.
*
- * @param key
- * The key to be constrained.
- * @param value
- * The value that provides a lower bound.
+ * @param key The key to be constrained.
+ * @param value The value that provides a lower bound.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -396,10 +382,8 @@ public Query greaterThanOrEqualTo(String key, Object value) {
/**
* Add a constraint to the query that requires a particular key's entry to be not equal to the provided value.
*
- * @param key
- * The key to be constrained.
- * @param value
- * The object that must not be equaled.
+ * @param key The key to be constrained.
+ * @param value The object that must not be equaled.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -429,10 +413,8 @@ public Query notEqualTo(@NotNull String key, Object value) {
/**
* Add a constraint to the query that requires a particular key's entry to be contained in the provided array.
*
- * @param key
- * The key to be constrained.
- * @param values
- * The possible values for the key's object.
+ * @param key The key to be constrained.
+ * @param values The possible values for the key's object.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -467,10 +449,8 @@ public Query containedIn(@NotNull String key, Object[] values) {
* Add a constraint to the query that requires a particular key entry's value not be contained in the provided
* array.
*
- * @param key
- * The key to be constrained.
- * @param values
- * The list of values the key object should not be.
+ * @param key The key to be constrained.
+ * @param values The list of values the key object should not be.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -504,8 +484,7 @@ public Query notContainedIn(@NotNull String key, Object[] values) {
/**
* Add a constraint that requires, a specified key exists in response.
*
- * @param key
- * The key to be constrained.
+ * @param key The key to be constrained.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -535,8 +514,7 @@ public Query exists(@NotNull String key) {
/**
* Add a constraint that requires, a specified key does not exist in response.
*
- * @param key
- * The key to be constrained.
+ * @param key The key to be constrained.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -568,8 +546,7 @@ public Query notExists(@NotNull String key) {
/**
* Add a constraint that requires a particular reference key details.
*
- * @param key
- * key that to be constrained.
+ * @param key key that to be constrained.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -593,8 +570,7 @@ public Query includeReference(String key) {
/**
* Include tags with which to search entries.
*
- * @param tags
- * Comma separated array of tags with which to search entries.
+ * @param tags Comma separated array of tags with which to search entries.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -617,8 +593,7 @@ public Query tags(@NotNull String[] tags) {
* Sort the results in ascending order with the given key. Sort the returned entries in ascending order of the
* provided key.
*
- * @param key
- * The key to order by.
+ * @param key The key to order by.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -641,8 +616,7 @@ public Query ascending(@NotNull String key) {
* Sort the results in descending order with the given key. Sort the returned entries in descending order of
* the provided key.
*
- * @param key
- * The key to order by.
+ * @param key The key to order by.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -663,8 +637,7 @@ public Query descending(@NotNull String key) {
/**
* Specifies list of field ids that would be 'excluded' from the response.
*
- * @param fieldUid
- * field uid which get 'excluded' from the response.
+ * @param fieldUid field uid which get 'excluded' from the response.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -695,8 +668,7 @@ public Query except(@NotNull List fieldUid) {
/**
* Specifies list of field ids that would be 'excluded' from the response.
*
- * @param fieldIds
- * field uid which get 'excluded' from the response.
+ * @param fieldIds field uid which get 'excluded' from the response.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -724,8 +696,7 @@ public Query except(@NotNull String[] fieldIds) {
/**
* Specifies an array of 'only' keys in BASE object that would be 'included' in the response.
*
- * @param fieldUid
- * Array of the 'only' reference keys to be included in response.
+ * @param fieldUid Array of the 'only' reference keys to be included in response.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -753,10 +724,8 @@ public Query only(@NotNull String[] fieldUid) {
/**
* Specifies an array of 'only' keys that would be 'included' in the response.
*
- * @param fieldUid
- * Array of the 'only' reference keys to be included in response.
- * @param referenceFieldUid
- * Key who has reference to some other class object.
+ * @param fieldUid Array of the 'only' reference keys to be included in response.
+ * @param referenceFieldUid Key who has reference to some other class object.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -792,10 +761,8 @@ public Query onlyWithReferenceUid(@NotNull List fieldUid, @NotNull Strin
/**
* Specifies an array of 'except' keys that would be 'excluded' in the response.
*
- * @param fieldUid
- * Array of the 'except' reference keys to be excluded in response.
- * @param referenceFieldUid
- * Key who has reference to some other class object.
+ * @param fieldUid Array of the 'except' reference keys to be excluded in response.
+ * @param referenceFieldUid Key who has reference to some other class object.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -897,8 +864,7 @@ public Query includeContentType() {
/**
* The number of objects to skip before returning any.
*
- * @param number
- * No of objects to skip from returned objects
+ * @param number No of objects to skip from returned objects
* @return {@link Query} object, so you can chain this call.
*
* Note: The skip parameter can be used for pagination,
@@ -922,8 +888,7 @@ public Query skip(int number) {
/**
* A limit on the number of objects to return.
*
- * @param number
- * No of objects to limit.
+ * @param number No of objects to limit.
* @return {@link Query} object, so you can chain this call.
*
* Note: The limit parameter can be used for pagination, "
@@ -948,10 +913,8 @@ public Query limit(int number) {
* Add a regular expression constraint for finding string values that match the provided regular expression. This
* may be slow for large data sets.
*
- * @param key
- * The key to be constrained.
- * @param regex
- * The regular expression pattern to match.
+ * @param key The key to be constrained.
+ * @param regex The regular expression pattern to match.
* @return {@link Query} object, so you can chain this call.
*
*
@@ -983,21 +946,18 @@ public Query regex(@NotNull String key, @NotNull String regex) {
* Add a regular expression constraint for finding string values that match the provided regular expression. This
* may be slow for large data sets.
*
- * @param key
- * The key to be constrained.
- * @param regex
- * The regular expression pattern to match
- * @param modifiers
- * Any of the following supported Regular expression modifiers.
- *
- * use i for case-insensitive matching.
- *
- *
- * use m for making dot match newlines.
- *
- *
- * use x for ignoring whitespace in regex
- *
+ * @param key The key to be constrained.
+ * @param regex The regular expression pattern to match
+ * @param modifiers Any of the following supported Regular expression modifiers.
+ *
+ * use i for case-insensitive matching.
+ *
+ *
+ * use m for making dot match newlines.
+ *
+ *
+ * use x for ignoring whitespace in regex
+ *
* @return {@link Query} object, so you can chain this call.
*
*
@@ -1038,8 +998,7 @@ public Query regex(@NotNull String key, @NotNull String regex, String modifiers)
/**
* set Language using locale code.
*
- * @param locale
- * {@link String} value
+ * @param locale {@link String} value
* @return {@link Query} object, so you can chain this call
*
*
@@ -1059,8 +1018,7 @@ public Query locale(@NotNull String locale) {
/**
* This method provides only the entries matching the specified value.
*
- * @param value
- * value used to match or compare
+ * @param value value used to match or compare
* @return {@link Query} object, so you can chain this call.
*
*
@@ -1084,8 +1042,7 @@ public Query search(@NotNull String value) {
/**
* Execute a Query and Caches its result (Optional)
*
- * @param callback
- * {@link QueryResultsCallBack} object to notify the application when the request has completed.
+ * @param callback {@link QueryResultsCallBack} object to notify the application when the request has completed.
* @return {@linkplain Query} object, so you can chain this call.
*
*
@@ -1123,8 +1080,7 @@ public Query find(QueryResultsCallBack callback) {
/**
* Execute a Query and Caches its result (Optional)
*
- * @param callBack
- * {@link QueryResultsCallBack} object to notify the application when the request has completed.
+ * @param callBack {@link QueryResultsCallBack} object to notify the application when the request has completed.
* @return {@linkplain Query} object, so you can chain this call.
*
*
@@ -1294,10 +1250,8 @@ public void getResultObject(List