Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit a5082ae

Browse files
Adds simple interfaces for ETClient and ETRestConnection.
Only method exposed on ETClient at the moment is getRestConnection, making it clear that this is the only use of the client for non-SOAP endpoints.
1 parent a838a62 commit a5082ae

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@
249249
</dependency>
250250
</dependencies>
251251
</plugin>
252+
<plugin>
253+
<groupId>org.apache.maven.plugins</groupId>
254+
<artifactId>maven-compiler-plugin</artifactId>
255+
<configuration>
256+
<source>1.6</source>
257+
<target>1.6</target>
258+
</configuration>
259+
</plugin>
252260
</plugins>
253261
<pluginManagement>
254262
<plugins>

src/main/java/com/exacttarget/fuelsdk/ETClient.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
* client library.
5656
*/
5757

58-
public class ETClient {
58+
public class ETClient implements IETClient {
5959
private static Logger logger = Logger.getLogger(ETClient.class);
6060

6161
private static final String DEFAULT_PROPERTIES_FILE_NAME =
@@ -76,13 +76,6 @@ public class ETClient {
7676
private String clientId = null;
7777
private String clientSecret = null;
7878

79-
private String username = null;
80-
private String password = null;
81-
82-
private String endpoint = null;
83-
private String authEndpoint = null;
84-
private String soapEndpoint = null;
85-
8679
private Boolean autoHydrateObjects = true;
8780

8881
private Gson gson = null;
@@ -129,18 +122,18 @@ public ETClient(ETConfiguration configuration)
129122
clientId = configuration.get("clientId");
130123
clientSecret = configuration.get("clientSecret");
131124

132-
username = configuration.get("username");
133-
password = configuration.get("password");
125+
String username = configuration.get("username");
126+
String password = configuration.get("password");
134127

135-
endpoint = configuration.get("endpoint");
128+
String endpoint = configuration.get("endpoint");
136129
if (endpoint == null) {
137130
endpoint = DEFAULT_ENDPOINT;
138131
}
139-
authEndpoint = configuration.get("authEndpoint");
132+
String authEndpoint = configuration.get("authEndpoint");
140133
if (authEndpoint == null) {
141134
authEndpoint = DEFAULT_AUTH_ENDPOINT;
142135
}
143-
soapEndpoint = configuration.get("soapEndpoint");
136+
String soapEndpoint = configuration.get("soapEndpoint");
144137

145138
GsonBuilder gsonBuilder = new GsonBuilder()
146139
.excludeFieldsWithoutExposeAnnotation()
@@ -250,6 +243,7 @@ public Gson getGson() {
250243
*
251244
* @return The ETRestConnection
252245
*/
246+
@Override
253247
public ETRestConnection getRestConnection() {
254248
return restConnection;
255249
}

src/main/java/com/exacttarget/fuelsdk/ETRestConnection.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* connection to the Salesforce Marketing Cloud REST API.
5959
*/
6060

61-
public class ETRestConnection {
61+
public class ETRestConnection implements IETRestConnection {
6262
private static Logger logger = Logger.getLogger(ETRestConnection.class);
6363

6464
private ETClient client = null;
@@ -100,6 +100,7 @@ public ETRestConnection(ETClient client, String endpoint, boolean isAuthConnecti
100100
* @param path The path to GET the response
101101
* @return The Response object
102102
*/
103+
@Override
103104
public Response get(String path)
104105
throws ETSdkException
105106
{
@@ -126,6 +127,7 @@ public Response get(String path)
126127
* @param path The path to POST or create
127128
* @return The Response object
128129
*/
130+
@Override
129131
public Response post(String path, String payload)
130132
throws ETSdkException
131133
{
@@ -152,6 +154,7 @@ public Response post(String path, String payload)
152154
* @param path The path to PATCH or update
153155
* @return The Response object
154156
*/
157+
@Override
155158
public Response patch(String path, String payload)
156159
throws ETSdkException
157160
{
@@ -178,6 +181,7 @@ public Response patch(String path, String payload)
178181
* @param path The path to DELETE
179182
* @return The Response object
180183
*/
184+
@Override
181185
public Response delete(String path)
182186
throws ETSdkException
183187
{
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.exacttarget.fuelsdk;
2+
3+
public interface IETClient {
4+
IETRestConnection getRestConnection();
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.exacttarget.fuelsdk;
2+
3+
import com.exacttarget.fuelsdk.ETRestConnection.Response;
4+
5+
public interface IETRestConnection {
6+
Response get(String path) throws ETSdkException;
7+
Response post(String path, String payload) throws ETSdkException;
8+
Response patch(String path, String payload) throws ETSdkException;
9+
Response delete(String path) throws ETSdkException;
10+
}

0 commit comments

Comments
 (0)