Skip to content

Commit 60fde01

Browse files
v1.12.3
- Taxonomy query support - Early Access Feature Support
1 parent fdd4c58 commit 60fde01

File tree

3 files changed

+41
-44
lines changed

3 files changed

+41
-44
lines changed

src/main/java/com/contentstack/sdk/Config.java

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.contentstack.sdk;
22

3-
import lombok.Getter;
4-
import lombok.Setter;
53
import okhttp3.ConnectionPool;
64
import org.jetbrains.annotations.NotNull;
75
import org.json.JSONObject;
@@ -23,23 +21,37 @@ public class Config {
2321
protected String version = "v3";
2422
protected String scheme = "https://";
2523
protected String endpoint;
24+
protected String[] earlyAccess;
2625
protected boolean enableLivePreview = false;
2726
protected String livePreviewHost;
2827
protected JSONObject livePreviewEntry = null;
2928
protected ContentstackRegion region = ContentstackRegion.US;
3029
protected String managementToken;
31-
@Setter
32-
@Getter
3330
protected String branch;
34-
@Setter
3531
protected Proxy proxy = null;
3632
protected ConnectionPool connectionPool = new ConnectionPool();
3733

3834
protected List<ContentstackPlugin> plugins = null;
3935

36+
37+
/**
38+
* Get early access
39+
* @return array of String
40+
*/
41+
public String[] getEarlyAccess() {
42+
return this.earlyAccess;
43+
}
44+
4045
/**
41-
* The configuration for the contentstack that contains support for
46+
* Get early access
47+
* @param earlyAccess type of String[]
48+
* @return instance of {@link Config}
4249
*/
50+
public Config setEarlyAccess(String[] earlyAccess) {
51+
this.earlyAccess = earlyAccess;
52+
return this;
53+
}
54+
4355
public String getBranch() {
4456
return branch;
4557
}
@@ -51,20 +63,20 @@ public void setBranch(String branch) {
5163
/**
5264
* Proxy can be set like below.
5365
*
54-
* @param proxy
55-
* Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
56-
* <br>
57-
* <br>
58-
* <b>Example:</b><br>
59-
* <br>
60-
* <code>
61-
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
62-
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config
63-
* config = new Config(); config.setProxy(proxy);
64-
* </code>
66+
* @param proxy Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
67+
* <br>
68+
* <br>
69+
* <b>Example:</b><br>
70+
* <br>
71+
* <code>
72+
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
73+
* java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config
74+
* config = new Config(); config.setProxy(proxy);
75+
* </code>
6576
*/
66-
@Getter
67-
protected String[] earlyAccess;
77+
public void setProxy(Proxy proxy) {
78+
this.proxy = proxy;
79+
}
6880

6981
/**
7082
* Returns the Proxy instance
@@ -122,8 +134,13 @@ public void setPlugins(List<ContentstackPlugin> plugins) {
122134
this.plugins = plugins;
123135
}
124136

125-
public void setPlugins(List<ContentstackPlugin> plugins) {
126-
this.plugins = plugins;
137+
/**
138+
* Gets host.
139+
*
140+
* @return the host
141+
*/
142+
public String getHost() {
143+
return host;
127144
}
128145

129146
/**
@@ -191,24 +208,4 @@ public enum ContentstackRegion {
191208
US, EU, AZURE_NA, AZURE_EU
192209
}
193210

194-
195-
/**
196-
* To initialize the SDK with the latest features offered in the early access phase,
197-
* include the early access parameter as shown in the following code:
198-
*
199-
* @param earlyAccessFeatures The list of Early Access Features
200-
* {@code
201-
* Config config = new Config();
202-
* String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
203-
* config.earlyAccess(earlyAccess);
204-
* Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
205-
* <p>
206-
* }
207-
* @return Config
208-
*/
209-
public Config earlyAccess(@NotNull String[] earlyAccessFeatures) {
210-
this.earlyAccess = earlyAccessFeatures;
211-
return this;
212-
}
213-
214211
}

src/main/java/com/contentstack/sdk/Contentstack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static Stack stack(String stackApiKey, String deliveryToken, String envir
6969
* @return the stack
7070
* @throws IllegalAccessException the illegal access exception <b>Example</b>
7171
* <p>
72-
* { @Code Stack stack =
72+
* { @Code stack =
7373
* contentstack.Stack("apiKey", "deliveryToken",
7474
* "environment"); }
7575
*/

src/test/java/com/contentstack/sdk/TestContentstack.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void initStackWithConfigs() throws IllegalAccessException {
111111
void testConfigEarlyAccessSingleFeature() throws IllegalAccessException {
112112
Config config = new Config();
113113
String[] earlyAccess = {"Taxonomy"};
114-
config.earlyAccess(earlyAccess);
114+
config.setEarlyAccess(earlyAccess);
115115
Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
116116
Assertions.assertEquals(earlyAccess[0], config.earlyAccess[0]);
117117
Assertions.assertNotNull(stack.headers.containsKey("x-header-ea"));
@@ -123,7 +123,7 @@ void testConfigEarlyAccessSingleFeature() throws IllegalAccessException {
123123
void testConfigEarlyAccessMultipleFeature() throws IllegalAccessException {
124124
Config config = new Config();
125125
String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
126-
config.earlyAccess(earlyAccess);
126+
config.setEarlyAccess(earlyAccess);
127127
Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
128128
Assertions.assertEquals(4, stack.headers.keySet().size());
129129
Assertions.assertEquals(earlyAccess[1], config.earlyAccess[1]);

0 commit comments

Comments
 (0)