*/
public static Stack stack(String stackApiKey, String deliveryToken, String environment)
throws IllegalAccessException {
@@ -66,21 +60,16 @@ public static Stack stack(String stackApiKey, String deliveryToken, String envir
* create content structures, content entries, users, etc. related to the
* project.
*
- * @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 config
- * the config
+ * @param environment the environment for the stack
+ * @param config the config
* @return the stack
- * @throws IllegalAccessException
- * the illegal access exception Example
+ * @throws IllegalAccessException the illegal access exception Example
*
- * { @Code Stack stack =
+ * { @Code stack =
* contentstack.Stack("apiKey", "deliveryToken",
* "environment"); }
*/
@@ -115,6 +104,10 @@ private static Stack initializeStack(String stackApiKey, String deliveryToken, S
if (config.getBranch() != null && !config.getBranch().isEmpty()) {
stack.setHeader("branch", config.getBranch());
}
+ if (config.getEarlyAccess() != null && config.getEarlyAccess().length > 0) {
+ String eaValues = String.join(",", config.earlyAccess).replace("\"", "");
+ stack.setHeader("x-header-ea", eaValues);
+ }
stack.setConfig(config);
return stack;
}
diff --git a/src/main/java/com/contentstack/sdk/Query.java b/src/main/java/com/contentstack/sdk/Query.java
index ce2c63ea..9522b626 100644
--- a/src/main/java/com/contentstack/sdk/Query.java
+++ b/src/main/java/com/contentstack/sdk/Query.java
@@ -63,21 +63,21 @@ protected void setContentTypeInstance(ContentType contentTypeInstance) {
/**
* To set headers for Built.io Contentstack rest calls. Scope is limited to this object and followed classes.
*
- * @param key
- * header name.
- * @param value
- * header value against given header name.
- *
- *
- *
- * Example :
- *
+ * 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 +109,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 +135,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 +159,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 +180,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 +214,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 +254,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 +270,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 +286,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 +302,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 +317,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 +333,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 +349,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 +380,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 +411,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 +447,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 +482,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 +512,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 +544,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 +568,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 +591,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 +614,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 +635,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 +666,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 +694,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 +722,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 +759,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 +862,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 +886,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 +911,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 +944,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 +996,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 +1016,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 +1040,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 +1078,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 +1248,8 @@ public void getResultObject(List