Skip to content

Commit

Permalink
v1.12.3
Browse files Browse the repository at this point in the history
- Taxonomy query support
- Early Access Feature Support
  • Loading branch information
ishaileshmishra committed Dec 15, 2023
1 parent 86ab663 commit 71d0cbd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 44 deletions.
79 changes: 38 additions & 41 deletions src/main/java/com/contentstack/sdk/Config.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.contentstack.sdk;

import lombok.Getter;
import lombok.Setter;
import okhttp3.ConnectionPool;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
Expand All @@ -23,23 +21,37 @@ public class Config {
protected String version = "v3";
protected String scheme = "https://";
protected String endpoint;
protected String[] earlyAccess;
protected boolean enableLivePreview = false;
protected String livePreviewHost;
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<ContentstackPlugin> plugins = null;


/**
* Get early access
* @return array of String
*/
public String[] getEarlyAccess() {
return this.earlyAccess;
}

/**
* The configuration for the contentstack that contains support for
* Get early access
* @param earlyAccess type of String[]
* @return instance of {@link Config}
*/
public Config setEarlyAccess(String[] earlyAccess) {
this.earlyAccess = earlyAccess;
return this;
}

public String getBranch() {
return branch;
}
Expand All @@ -51,20 +63,20 @@ public void setBranch(String branch) {
/**
* Proxy can be set like below.
*
* @param proxy
* Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
* <br>
* <br>
* <b>Example:</b><br>
* <br>
* <code>
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config
* config = new Config(); config.setProxy(proxy);
* </code>
* @param proxy Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
* <br>
* <br>
* <b>Example:</b><br>
* <br>
* <code>
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config
* config = new Config(); config.setProxy(proxy);
* </code>
*/
@Getter
protected String[] earlyAccess;
public void setProxy(Proxy proxy) {
this.proxy = proxy;
}

/**
* Returns the Proxy instance
Expand Down Expand Up @@ -122,8 +134,13 @@ public void setPlugins(List<ContentstackPlugin> plugins) {
this.plugins = plugins;
}

public void setPlugins(List<ContentstackPlugin> plugins) {
this.plugins = plugins;
/**
* Gets host.
*
* @return the host
*/
public String getHost() {
return host;
}

/**
Expand Down Expand Up @@ -191,24 +208,4 @@ 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);
* <p>
* }
* @return Config
*/
public Config earlyAccess(@NotNull String[] earlyAccessFeatures) {
this.earlyAccess = earlyAccessFeatures;
return this;
}

}
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/Contentstack.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static Stack stack(String stackApiKey, String deliveryToken, String envir
* @return the stack
* @throws IllegalAccessException the illegal access exception <b>Example</b>
* <p>
* { @Code Stack stack =
* { @Code stack =
* contentstack.Stack("apiKey", "deliveryToken",
* "environment"); }
*/
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/contentstack/sdk/TestContentstack.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void initStackWithConfigs() throws IllegalAccessException {
void testConfigEarlyAccessSingleFeature() throws IllegalAccessException {
Config config = new Config();
String[] earlyAccess = {"Taxonomy"};
config.earlyAccess(earlyAccess);
config.setEarlyAccess(earlyAccess);
Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
Assertions.assertEquals(earlyAccess[0], config.earlyAccess[0]);
Assertions.assertNotNull(stack.headers.containsKey("x-header-ea"));
Expand All @@ -123,7 +123,7 @@ void testConfigEarlyAccessSingleFeature() throws IllegalAccessException {
void testConfigEarlyAccessMultipleFeature() throws IllegalAccessException {
Config config = new Config();
String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
config.earlyAccess(earlyAccess);
config.setEarlyAccess(earlyAccess);
Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
Assertions.assertEquals(4, stack.headers.keySet().size());
Assertions.assertEquals(earlyAccess[1], config.earlyAccess[1]);
Expand Down

0 comments on commit 71d0cbd

Please sign in to comment.