diff --git a/.gitignore b/.gitignore
index c0bbc2b..3a3e4b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ bin/
/.nb-gradle/
test.properties
out
+Main.java
+*.log
diff --git a/build.gradle b/build.gradle
index 27f4afd..2343bbf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,12 +12,13 @@ repositories {
}
dependencies {
- compile group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
- compile group: 'io.github.openfeign', name: 'feign-core', version: '10.1.0'
- compile('com.fasterxml.jackson.core:jackson-databind:2.8.3')
- compile('commons-codec:commons-codec:1.10')
+ compile group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
+ annotationProcessor 'org.projectlombok:lombok:1.18.10'
+ compile group: 'io.github.openfeign', name: 'feign-core', version: '10.4.0'
+ compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.9.3'
+ compile group: 'commons-codec', name: 'commons-codec', version: '1.13'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
- testCompile('junit:junit:4.12')
- testCompile group: 'io.github.openfeign', name: 'feign-mock', version: '10.1.0'
+ testCompile group: 'junit', name: 'junit', version: '4.12'
+ testCompile group: 'io.github.openfeign', name: 'feign-mock', version: '10.4.0'
}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index e8c6bf7..758de96 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 0af31bf..31e94e3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sat Dec 29 11:07:55 CET 2018
+#Tue Sep 24 13:01:32 JST 2019
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
+zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index 97fac78..cccdd3d 100755
--- a/gradlew
+++ b/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
##############################################################################
##
@@ -6,20 +6,38 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
+ NONSTOP* )
+ nonstop=true
+ ;;
esac
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index aec9973..f955316 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,90 +1,84 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/main/java/com/mailchimp/MailChimpClient.java b/src/main/java/com/mailchimp/MailChimpClient.java
index 0427576..35b83ea 100644
--- a/src/main/java/com/mailchimp/MailChimpClient.java
+++ b/src/main/java/com/mailchimp/MailChimpClient.java
@@ -4,6 +4,7 @@
import com.mailchimp.query.BatchesQuery;
import com.mailchimp.query.ListMembersQuery;
import com.mailchimp.query.ListsQuery;
+import com.mailchimp.query.ReportsQuery;
import feign.Param;
import feign.QueryMap;
import feign.RequestLine;
@@ -15,6 +16,7 @@ public interface MailChimpClient {
/**
* Gets API Root.
+ *
* @return root info about the account
*/
@RequestLine("GET /3.0/")
@@ -22,16 +24,19 @@ public interface MailChimpClient {
/**
* Gets member by subscriberHash in list.
+ *
* @param listId if of the list
* @param subscriberHash hash of member's email (see {@link Member#getSubscriberHash(String)})
* @return member
* @throws MailChimpErrorException when listId or subscriberHash was not found
*/
@RequestLine("GET /3.0/lists/{list-id}/members/{subscriber-hash}")
- Member getListMember(@Param("list-id") String listId, @Param("subscriber-hash") String subscriberHash);
+ Member getListMember(@Param("list-id") String listId,
+ @Param("subscriber-hash") String subscriberHash);
/**
* Creates member in list.
+ *
* @param listId id of the list where to create the member in
* @param member to create
* @return created member
@@ -42,6 +47,7 @@ public interface MailChimpClient {
/**
* Updates member in a list.
+ *
* @param listId id of the list where to create the member in
* @param subscriberHash hash of member's email (see {@link Member#getSubscriberHash(String)})
* @param member to update
@@ -49,19 +55,23 @@ public interface MailChimpClient {
* @throws MailChimpErrorException when the list-id was not found
*/
@RequestLine("PUT /3.0/lists/{list-id}/members/{subscriber-hash}")
- Member updateListMember(@Param("list-id") String listId, @Param("subscriber-hash") String subscriberHash, Member member);
+ Member updateListMember(@Param("list-id") String listId,
+ @Param("subscriber-hash") String subscriberHash, Member member);
/**
* Removes member from list.
+ *
* @param listId id of the list
* @param subscriberHash hash of member's email (see {@link Member#getSubscriberHash(String)})
* @throws MailChimpErrorException when listId or subscriberHash was not found
*/
@RequestLine("DELETE /3.0/lists/{list-id}/members/{subscriber-hash}")
- void removeListMember(@Param("list-id") String listId, @Param("subscriber-hash") String subscriberHash);
+ void removeListMember(@Param("list-id") String listId,
+ @Param("subscriber-hash") String subscriberHash);
/**
* Create subscriberList.
+ *
* @param subscriberList to create
* @return created subscriberList
*/
@@ -70,6 +80,7 @@ public interface MailChimpClient {
/**
* Removes list.
+ *
* @param listId id of the list
* @throws MailChimpErrorException when listId was not found
*/
@@ -78,6 +89,7 @@ public interface MailChimpClient {
/**
* Gets list.
+ *
* @param listId id of the list
* @return found list
* @throws MailChimpErrorException when listId was not found
@@ -87,6 +99,7 @@ public interface MailChimpClient {
/**
* Gets lists by query.
+ *
* @param query to filter results on
* @return filtered list of lists
*/
@@ -95,6 +108,7 @@ public interface MailChimpClient {
/**
* Gets list members.
+ *
* @param listId id of the list
* @param query to filter results on
* @return filtered members
@@ -105,6 +119,7 @@ public interface MailChimpClient {
/**
* Get list's member-fields.
+ *
* @param listId id of the list
* @return list's member-fields
* @throws MailChimpErrorException when listId was not found
@@ -114,6 +129,7 @@ public interface MailChimpClient {
/**
* Create merge-field for list.
+ *
* @param listId id of the list
* @param mergeField merge-field to create
* @return created merge-field for the list
@@ -124,6 +140,7 @@ public interface MailChimpClient {
/**
* Removes merge-field from list.
+ *
* @param listId id of the list
* @param mergeId id of merge-field
* @throws MailChimpErrorException when listId or mergeId was not found
@@ -133,6 +150,7 @@ public interface MailChimpClient {
/**
* Create segment in list.
+ *
* @param listId id of the list
* @param segment segment to create
* @return created segment
@@ -143,6 +161,7 @@ public interface MailChimpClient {
/**
* Modify a segment in list.
+ *
* @param listId id of the list
* @param segmentId id of segment
* @param segment segment to be modified
@@ -150,10 +169,12 @@ public interface MailChimpClient {
* @throws MailChimpErrorException when listId was not found
*/
@RequestLine("POST /3.0/lists/{list-id}/segments/{segment-id}")
- SegmentModified modifySegment(@Param("list-id") String listId, @Param("segment-id") Integer segmentId, SegmentModify segment);
+ SegmentModified modifySegment(@Param("list-id") String listId,
+ @Param("segment-id") Integer segmentId, SegmentModify segment);
/**
* Get segments in list.
+ *
* @param listId id of the list
* @return segments of the list
* @throws MailChimpErrorException when listId was not found
@@ -163,6 +184,7 @@ public interface MailChimpClient {
/**
* Get a segment in the list.
+ *
* @param listId id of the list
* @param segmentId id of the segment
* @return segment by id
@@ -173,6 +195,7 @@ public interface MailChimpClient {
/**
* Removes segment.
+ *
* @param listId id of the list
* @param segmentId id of the segment
* @throws MailChimpErrorException when listId or segmentId was not found
@@ -182,6 +205,7 @@ public interface MailChimpClient {
/**
* Create batch.
+ *
* @param batch to create
* @return created batch
*/
@@ -190,6 +214,7 @@ public interface MailChimpClient {
/**
* Get batch.
+ *
* @param batchId id of batch
* @return found batch
* @throws MailChimpErrorException when batchId was not found
@@ -199,6 +224,7 @@ public interface MailChimpClient {
/**
* Get batches by filter.
+ *
* @param query to filter
* @return filtered batches
*/
@@ -207,6 +233,7 @@ public interface MailChimpClient {
/**
* Removes batch
+ *
* @param batchId id of batch
* @throws MailChimpErrorException when batchId was not found
*/
@@ -215,6 +242,7 @@ public interface MailChimpClient {
/**
* Search members by query.
+ *
* @param query to search by
* @return found members by query
*/
@@ -223,6 +251,7 @@ public interface MailChimpClient {
/**
* Search members by query and listId.
+ *
* @param query to search by
* @param listId id of list
* @return found members by query and listId
@@ -233,9 +262,27 @@ public interface MailChimpClient {
/**
*
+ */
+ @RequestLine("GET /3.0/reports")
+ Reports getReports(@QueryMap ReportsQuery query);
+
+ @RequestLine("GET /3.0/reports/{campaign_id}/click-details")
+ CampaignClickDetails getCampaignClickDetails(@Param("campaign_id") String campaignId);
+
+ @RequestLine("GET /3.0/reports/{campaign_id}/click-details/{link_id}/members")
+ ClickReportsMembers getClickReportsMembers(
+ @Param("campaign_id") String campaignId,
+ @Param("link_id") String linkId
+ );
+
+ @RequestLine("GET /3.0/lists/{list_id}/members/{subscriber_hash}/activity")
+ MemberActivity getMemberActivity(@Param("list_id") String listId,
+ @Param("subscriber_hash") String subscriberHash);
+
+ /**
* @return builder to build the client
*/
- static MailChimpClientBuilder builder(){
+ static MailChimpClientBuilder builder() {
return new MailChimpClientBuilder();
}
}
diff --git a/src/main/java/com/mailchimp/MailChimpClientBuilder.java b/src/main/java/com/mailchimp/MailChimpClientBuilder.java
index 1419391..c2b0e89 100644
--- a/src/main/java/com/mailchimp/MailChimpClientBuilder.java
+++ b/src/main/java/com/mailchimp/MailChimpClientBuilder.java
@@ -19,7 +19,7 @@ public class MailChimpClientBuilder {
//feign specific options
private Client client = new Client.Default(null, null);
private Logger.Level logLevel = Logger.Level.NONE;
- private Logger logger = new Logger.NoOpLogger();
+ private Logger logger = new Logger.JavaLogger("HttpLogger");
//mailchimp specific options
private RequestInterceptor authRequestInterceptor;
diff --git a/src/main/java/com/mailchimp/MailChimpErrorDecoder.java b/src/main/java/com/mailchimp/MailChimpErrorDecoder.java
index c3c5619..8583de2 100644
--- a/src/main/java/com/mailchimp/MailChimpErrorDecoder.java
+++ b/src/main/java/com/mailchimp/MailChimpErrorDecoder.java
@@ -49,7 +49,7 @@ public Exception decode(String methodKey, Response response) {
}
} else if (response.status() == 503) { // 503: Service (temporary) unavailable
Date retryAfter = new RetryAfterDecoder().apply(firstOrNull(response.headers(), RETRY_AFTER));
- return new RetryableException(response.reason(), response.request().httpMethod(), retryAfter);
+ return new RetryableException(response.status(), response.reason(), response.request().httpMethod(), retryAfter, response.request());
} else {
return new ErrorDecoder.Default().decode(methodKey, response);
}
diff --git a/src/main/java/com/mailchimp/MailChimpErrorException.java b/src/main/java/com/mailchimp/MailChimpErrorException.java
index ff0e7fe..7b840f8 100644
--- a/src/main/java/com/mailchimp/MailChimpErrorException.java
+++ b/src/main/java/com/mailchimp/MailChimpErrorException.java
@@ -22,7 +22,7 @@ public class MailChimpErrorException extends FeignException {
* Creates a new instance of MailChimpErrorException
without detail message.
*/
public MailChimpErrorException(int status, String message, MailChimpError error) {
- super(message);
+ super(status, message);
this.error = error;
}
diff --git a/src/main/java/com/mailchimp/domain/CampaignClickDetails.java b/src/main/java/com/mailchimp/domain/CampaignClickDetails.java
new file mode 100644
index 0000000..9bb3ff3
--- /dev/null
+++ b/src/main/java/com/mailchimp/domain/CampaignClickDetails.java
@@ -0,0 +1,100 @@
+package com.mailchimp.domain;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.mailchimp.domain.ClickReportsMembers.MergeField;
+import com.mailchimp.domain.Link.Rel;
+import com.mailchimp.jackson.MailChimpZonedDateTimeDeserializer;
+import java.time.ZonedDateTime;
+import java.util.List;
+import lombok.Getter;
+
+/**
+ * @author YukiFujisawa
+ * @see /schema/3.0/Definitions/Reports/Response.jso
+ */
+@Getter
+public class CampaignClickDetails {
+
+ @JsonProperty("urls_clicked")
+ private List urlsClickeds;
+
+ @JsonProperty("merge_fields")
+ private MergeField mergeField;
+
+ @JsonProperty("vip")
+ private Boolean vip;
+
+ @JsonProperty("clicks")
+ private Integer clicks;
+
+ @JsonProperty("campaign_id")
+ private String campaignId;
+
+ @JsonProperty("url_id")
+ private String urlId;
+
+ @JsonProperty("list_id")
+ private String listId;
+
+ @JsonProperty("list_is_active")
+ private Boolean listIsActive;
+
+ @JsonProperty("contact_status")
+ private String contactStatus;
+
+ @JsonProperty("_links")
+ private List links;
+
+ @JsonIgnore
+ public Link getCampaign() {
+ return Link.getLink(links, Rel.CAMPAIGN);
+ }
+
+ @Getter
+ public static class UrlsClicked {
+
+ @JsonProperty("id")
+ private String id;
+
+ @JsonProperty("url")
+ private String url;
+
+ @JsonProperty("total_clicks")
+ private Integer totalClicks;
+
+ @JsonProperty("click_percentage")
+ private Double click_percentage;
+
+ @JsonProperty("unique_clicks")
+ private Integer uniqueClicks;
+
+ @JsonProperty("unique_click_percentage")
+ private Double uniqueClickPercentage;
+
+ @JsonProperty("last_click")
+ @JsonDeserialize(using = MailChimpZonedDateTimeDeserializer.class)
+ private ZonedDateTime lastClick;
+
+ @JsonProperty("campaign_id")
+ private String campaignId;
+
+ @JsonProperty("_links")
+ private List links;
+
+ @JsonIgnore
+ public Link getMembersLink() {
+ return Link.getLink(links, Rel.MEMBERS);
+ }
+
+ @JsonIgnore
+ public Link getCampaignLink() {
+ return Link.getLink(links, Rel.CAMPAIGN);
+ }
+ }
+
+
+
+
+}
diff --git a/src/main/java/com/mailchimp/domain/CampaignDefaults.java b/src/main/java/com/mailchimp/domain/CampaignDefaults.java
index e156d67..a356613 100644
--- a/src/main/java/com/mailchimp/domain/CampaignDefaults.java
+++ b/src/main/java/com/mailchimp/domain/CampaignDefaults.java
@@ -48,35 +48,4 @@ public class CampaignDefaults {
@Setter
private String language;
- public String getFromName() {
- return fromName;
- }
-
- public void setFromName(String fromName) {
- this.fromName = fromName;
- }
-
- public String getFromEmail() {
- return fromEmail;
- }
-
- public void setFromEmail(String fromEmail) {
- this.fromEmail = fromEmail;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public void setLanguage(String language) {
- this.language = language;
- }
}
diff --git a/src/main/java/com/mailchimp/domain/ClickReportsMembers.java b/src/main/java/com/mailchimp/domain/ClickReportsMembers.java
new file mode 100644
index 0000000..05e61a8
--- /dev/null
+++ b/src/main/java/com/mailchimp/domain/ClickReportsMembers.java
@@ -0,0 +1,93 @@
+package com.mailchimp.domain;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+import lombok.Getter;
+
+@Getter
+public class ClickReportsMembers {
+
+ @JsonProperty("members")
+ private List members;
+
+ @JsonProperty("campaign_id")
+ private String campaignId;
+
+ @JsonProperty("total_items")
+ private Integer totalItems;
+
+ @Getter
+ public static class ClickDetailMember {
+
+ @JsonProperty("email_id")
+ private String emailId;
+
+ @JsonProperty("email_address")
+ private String emailAddress;
+
+ @JsonProperty("merge_fields")
+ private MergeField mergeFields;
+
+ @JsonProperty("list_id")
+ private String listId;
+
+ }
+
+ @Getter
+ public static class MergeField {
+
+ @JsonProperty("FNAME")
+ private String fName;
+
+ @JsonProperty("LNAME")
+ private String lName;
+
+ @JsonProperty("ADDRESS")
+ private String address;
+
+ @JsonProperty("PHONE")
+ private String phone;
+
+ @JsonProperty("BIRTHDAY")
+ private String birthday;
+
+ @JsonProperty("MMERGE6")
+ private String mMerge6;
+
+ @JsonProperty("MMERGE7")
+ private String mMerge7;
+
+ @JsonProperty("MMERGE8")
+ private String mMerge8;
+
+ @JsonProperty("MMERGE9")
+ private String mMerge9;
+
+ @JsonProperty("MMERGE10")
+ private String mMerge10;
+
+ @JsonProperty("MMERGE11")
+ private String mMerge11;
+
+ @JsonProperty("MMERGE12")
+ private String mMerge12;
+
+ @JsonProperty("MMERGE13")
+ private String mMerge13;
+
+ @JsonProperty("MMERGE14")
+ private String mMerge14;
+
+ @JsonProperty("MMERGE15")
+ private String mMerge15;
+
+ @JsonProperty("MMERGE16")
+ private String mMerge16;
+
+ @JsonProperty("MMERGE17")
+ private String mMerge17;
+
+ @JsonProperty("MMERGE18")
+ private String mMerge18;
+ }
+}
diff --git a/src/main/java/com/mailchimp/domain/Condition.java b/src/main/java/com/mailchimp/domain/Condition.java
index a6b7ec5..112d9a0 100644
--- a/src/main/java/com/mailchimp/domain/Condition.java
+++ b/src/main/java/com/mailchimp/domain/Condition.java
@@ -13,28 +13,4 @@ public class Condition {
private String op;
@JsonProperty("value")
private String value;
-
- public String getField() {
- return field;
- }
-
- public void setField(String field) {
- this.field = field;
- }
-
- public String getOp() {
- return op;
- }
-
- public void setOp(String op) {
- this.op = op;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/mailchimp/domain/ExactMatches.java b/src/main/java/com/mailchimp/domain/ExactMatches.java
index 88fe2b8..c23f23e 100644
--- a/src/main/java/com/mailchimp/domain/ExactMatches.java
+++ b/src/main/java/com/mailchimp/domain/ExactMatches.java
@@ -17,19 +17,4 @@ public class ExactMatches {
@JsonProperty("total_items")
private Integer totalItems;
- public List getMembers() {
- return members;
- }
-
- public void setMembers(List members) {
- this.members = members;
- }
-
- public Integer getTotalItems() {
- return totalItems;
- }
-
- public void setTotalItems(Integer totalItems) {
- this.totalItems = totalItems;
- }
}
diff --git a/src/main/java/com/mailchimp/domain/Link.java b/src/main/java/com/mailchimp/domain/Link.java
new file mode 100644
index 0000000..34065b2
--- /dev/null
+++ b/src/main/java/com/mailchimp/domain/Link.java
@@ -0,0 +1,54 @@
+package com.mailchimp.domain;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+import lombok.Getter;
+
+@Getter
+public class Link {
+
+ @JsonProperty("rel")
+ private String rel;
+
+ @JsonProperty("href")
+ private String href;
+
+ @JsonProperty("method")
+ private String method;
+
+ @JsonProperty("targetSchema")
+ private String targetSchema;
+
+ @JsonProperty("schema")
+ private String schema;
+
+ public enum Rel {
+ PARENT("parent"),
+ SELF("self"),
+ MEMBERS("members"),
+ CLICK_DETAILS("click-details"),
+ CAMPAIGN("campaign");
+
+ private String title;
+
+ Rel(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return this.title;
+ }
+ }
+
+ public static Link getLink(List links, Rel targetLink) {
+ if (links == null || targetLink == null) {
+ return null;
+ }
+ for (Link link : links) {
+ if (link.getRel().equals(targetLink.getTitle())) {
+ return link;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/com/mailchimp/domain/Member.java b/src/main/java/com/mailchimp/domain/Member.java
index c383034..5484986 100644
--- a/src/main/java/com/mailchimp/domain/Member.java
+++ b/src/main/java/com/mailchimp/domain/Member.java
@@ -82,21 +82,11 @@ public static class SubscriberStats {
private SubscribeStatus status;
@JsonProperty("merge_fields")
+ @Builder.Default
@Getter
@Setter
private Map mergeFields = new HashMap<>();
-// @JsonProperty
-// @Getter
-// @Setter
-// private Map interests = new HashMap<>();
- //@JsonProperty
- //@Getter
- //@JsonIgnore
- //private SubscriberStats stats = new SubscriberStats();
-// @JsonProperty("ip_signup")
-// @Getter
-// private String ipSignup;
@JsonProperty("timestamp_signup")
@JsonDeserialize(using = MailChimpZonedDateTimeDeserializer.class)
@JsonSerialize(using = MailChimpZonedDateTimeSerializer.class)
@@ -140,10 +130,6 @@ public static class SubscriberStats {
@Setter
private String emailClient;
-// @JsonProperty
-// @Getter
-// @Setter
-// private Location location;
/**
* When creating a subscriber that already exists this status will be used.
*/
@@ -157,6 +143,7 @@ public static class SubscriberStats {
private String listId;
@JsonProperty("interests")
+ @Builder.Default
private Map interests = new HashMap<>();
@JsonIgnore
diff --git a/src/main/java/com/mailchimp/domain/MemberActivity.java b/src/main/java/com/mailchimp/domain/MemberActivity.java
new file mode 100644
index 0000000..a1898d9
--- /dev/null
+++ b/src/main/java/com/mailchimp/domain/MemberActivity.java
@@ -0,0 +1,50 @@
+package com.mailchimp.domain;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.mailchimp.jackson.MailChimpZonedDateTimeDeserializer;
+import java.time.ZonedDateTime;
+import java.util.List;
+import lombok.Getter;
+
+@Getter
+public class MemberActivity {
+
+ @JsonProperty("activity")
+ private List activities;
+
+ @Getter
+ public static class Activity {
+
+ @JsonProperty("action")
+ private Action action;
+
+ @JsonProperty("timestamp")
+ @JsonDeserialize(using = MailChimpZonedDateTimeDeserializer.class)
+ private ZonedDateTime timestamp;
+
+ @JsonProperty("url")
+ private String url;
+
+ @JsonProperty("type")
+ private String type;
+
+ @JsonProperty("campaign_id")
+ private String campaignId;
+
+ @JsonProperty("title")
+ private String title;
+
+ @JsonProperty("parent_campaign")
+ private String parentCampaign;
+
+ public static enum Action {
+ sent,
+ open,
+ click,
+ unsub;
+ }
+ }
+}
+
+
diff --git a/src/main/java/com/mailchimp/domain/Members.java b/src/main/java/com/mailchimp/domain/Members.java
index 4f3ae91..ae1f490 100644
--- a/src/main/java/com/mailchimp/domain/Members.java
+++ b/src/main/java/com/mailchimp/domain/Members.java
@@ -18,28 +18,4 @@ public class Members {
@JsonProperty("total_items")
private Integer totalItems;
-
- public List getMembers() {
- return members;
- }
-
- public void setMembers(List members) {
- this.members = members;
- }
-
- public String getListId() {
- return listId;
- }
-
- public void setListId(String listId) {
- this.listId = listId;
- }
-
- public Integer getTotalItems() {
- return totalItems;
- }
-
- public void setTotalItems(Integer totalItems) {
- this.totalItems = totalItems;
- }
}
diff --git a/src/main/java/com/mailchimp/domain/Report.java b/src/main/java/com/mailchimp/domain/Report.java
new file mode 100644
index 0000000..0af0e0e
--- /dev/null
+++ b/src/main/java/com/mailchimp/domain/Report.java
@@ -0,0 +1,210 @@
+package com.mailchimp.domain;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.mailchimp.domain.Link.Rel;
+import com.mailchimp.jackson.MailChimpZonedDateTimeDeserializer;
+import java.time.ZonedDateTime;
+import java.util.List;
+import lombok.Getter;
+
+/**
+ * @author YukiFujisawa
+ * @see /schema/3.0/Definitions/Reports/Response.json
+ */
+@Getter
+@JsonIgnoreProperties(ignoreUnknown = true) //TODO: need implementation.
+public class Report {
+
+ @JsonProperty("id")
+ private String id;
+
+ @JsonProperty("campaign_title")
+ private String campaignTitle;
+
+ @JsonProperty("type")
+ private String type;
+
+ @JsonProperty("list_id")
+ private String listId;
+
+ @JsonProperty("list_is_active")
+ private boolean listIsActive;
+
+ @JsonProperty("list_name")
+ private String listName;
+
+ @JsonProperty("subject_line")
+ private String subjectLine;
+
+ @JsonProperty("preview_text")
+ private String previewText;
+
+ @JsonProperty("emails_sent")
+ private Integer emailsSent;
+
+ @JsonProperty("abuse_reports")
+ private Integer abuseReports;
+
+ @JsonProperty("unsubscribed")
+ private Integer unsubscribed;
+
+ @JsonProperty("send_time")
+ private String sendTime;
+
+ @JsonDeserialize(using = MailChimpZonedDateTimeDeserializer.class)
+ @JsonProperty("rss_last_send")
+ private ZonedDateTime rssLastSend;
+
+ @JsonProperty("bounces")
+ private Bounces bounces;
+
+ @JsonProperty("forwards")
+ private Forward forward;
+
+ @JsonProperty("opens")
+ private Open open;
+
+ @JsonProperty("clicks")
+ private Click click;
+
+ @JsonProperty("facebook_likes")
+ private FacebookLike facebookLike;
+
+ @JsonProperty("industry_stats")
+ private IndustryStats industryStats;
+
+ @JsonProperty("list_stats")
+ private ListStats listStats;
+
+ @JsonProperty("_links")
+ private List links;
+
+ @JsonIgnore
+ public Link getClickDetailsLink() {
+ return Link.getLink(links, Rel.CLICK_DETAILS);
+ }
+
+ @JsonIgnore
+ public Link getCampaign() {
+ return Link.getLink(links, Rel.CAMPAIGN);
+ }
+
+ /**
+ * @author YukiFujisawa
+ */
+ @Getter
+ public static class Bounces {
+
+ @JsonProperty("hard_bounces")
+ private Integer hardBounces;
+
+ @JsonProperty("soft_bounces")
+ private Integer softBounces;
+
+ @JsonProperty("syntax_errors")
+ private Integer syntaxErrors;
+ }
+
+ @Getter
+ public static class Forward {
+
+ @JsonProperty("forwards_count")
+ private Integer forwardsCount;
+
+ @JsonProperty("forwards_opens")
+ private Integer forwardsOpens;
+ }
+
+ @Getter
+ public static class FacebookLike {
+
+ @JsonProperty("recipient_likes")
+ private Integer recipientLikes;
+
+ @JsonProperty("unique_likes")
+ private Integer uniqueLikes;
+
+ @JsonProperty("facebook_likes")
+ private Integer facebookLikes;
+ }
+
+ @Getter
+ public static class Open {
+
+ @JsonProperty("opens_total")
+ private Integer opensTotal;
+
+ @JsonProperty("unique_opens")
+ private Integer uniqueOpens;
+
+ @JsonProperty("open_rate")
+ private Double openRate;
+
+ @JsonDeserialize(using = MailChimpZonedDateTimeDeserializer.class)
+ @JsonProperty("last_open")
+ private ZonedDateTime lastOpen;
+ }
+
+ @Getter
+ public static class IndustryStats {
+
+ @JsonProperty("type")
+ private String type;
+
+ @JsonProperty("open_rate")
+ private Double openRate;
+
+ @JsonProperty("click_rate")
+ private Double clickRate;
+
+ @JsonProperty("bounce_rate")
+ private Double bounceRate;
+
+ @JsonProperty("unopen_rate")
+ private Double unopenRate;
+
+ @JsonProperty("unsub_rate")
+ private Double unsubRate;
+
+ @JsonProperty("abuse_rate")
+ private Double abuseRate;
+ }
+
+ @Getter
+ public static class ListStats {
+
+ @JsonProperty("sub_rate")
+ private Double subRate;
+
+ @JsonProperty("unsub_rate")
+ private Double unsubRate;
+
+ @JsonProperty("open_rate")
+ private Double openRate;
+
+ @JsonProperty("click_rate")
+ private Double clickRate;
+ }
+
+ @Getter
+ public static class Click {
+
+ @JsonProperty("clicks_total")
+ private Integer clicksTotal;
+
+ @JsonProperty("unique_clicks")
+ private Integer uniqueClicks;
+
+ @JsonProperty("unique_subscriber_clicks")
+ private Integer uniqueSubscriberClicks;
+
+ @JsonProperty("click_rate")
+ private Double clickRate;
+
+ @JsonProperty("last_click")
+ private String lastClick;
+ }
+}
diff --git a/src/main/java/com/mailchimp/domain/Reports.java b/src/main/java/com/mailchimp/domain/Reports.java
new file mode 100644
index 0000000..85a634e
--- /dev/null
+++ b/src/main/java/com/mailchimp/domain/Reports.java
@@ -0,0 +1,17 @@
+package com.mailchimp.domain;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+import lombok.Getter;
+
+/**
+ * @author YukiFujisawa
+ * @see /schema/3.0/Definitions/Reports/Response.json
+ */
+@Getter
+public class Reports {
+
+ @JsonProperty("reports")
+ private List reports;
+
+}
diff --git a/src/main/java/com/mailchimp/domain/Root.java b/src/main/java/com/mailchimp/domain/Root.java
index 177f4dc..80dc868 100644
--- a/src/main/java/com/mailchimp/domain/Root.java
+++ b/src/main/java/com/mailchimp/domain/Root.java
@@ -2,6 +2,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.mailchimp.domain.Report.IndustryStats;
import com.mailchimp.jackson.MailChimpZonedDateTimeDeserializer;
import java.time.ZonedDateTime;
import lombok.Getter;
@@ -15,33 +16,6 @@
*/
public class Root {
- /**
- * The average campaign statistics for all campaigns in the account’s specified industry.
- */
- public static class IndustryStats {
-
- /**
- * The average unique open rate for all campaigns in the account’s specified industry.
- */
- @JsonProperty("open_rate")
- @Getter
- private double openRate;
-
- /**
- * The average bounce rate for all campaigns in the account’s specified industry.
- */
- @JsonProperty("bounce_rate")
- @Getter
- private double bounceRate;
-
- /**
- * The average unique click rate for all campaigns in the account’s specified industry.
- */
- @JsonProperty("click_rate")
- @Getter
- private double clickRate;
- }
-
/**
* The MailChimp account id, used for features like list subscribe forms.
*/
diff --git a/src/main/java/com/mailchimp/domain/SubscriberList.java b/src/main/java/com/mailchimp/domain/SubscriberList.java
index c615c60..ea7ba97 100644
--- a/src/main/java/com/mailchimp/domain/SubscriberList.java
+++ b/src/main/java/com/mailchimp/domain/SubscriberList.java
@@ -84,80 +84,18 @@ public static class Contact {
@Getter
@Setter
private String phone;
-
- public String getCompany() {
- return company;
- }
-
- public void setCompany(String company) {
- this.company = company;
- }
-
- public String getAddress1() {
- return address1;
- }
-
- public void setAddress1(String address1) {
- this.address1 = address1;
- }
-
- public String getAddress2() {
- return address2;
- }
-
- public void setAddress2(String address2) {
- this.address2 = address2;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public String getZip() {
- return zip;
- }
-
- public void setZip(String zip) {
- this.zip = zip;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
}
/**
* A string that uniquely identifies this list.
*/
@Getter
+ @Setter
private String id;
@JsonProperty("total_items")
@Getter
+ @Setter
private Integer totalItems;
/**
@@ -172,6 +110,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("contact")
@Getter
+ @Setter
private Contact contact = new Contact();
/**
@@ -195,6 +134,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("campaign_defaults")
@Getter
+ @Setter
private CampaignDefaults campaignDefaults = new CampaignDefaults();
/**
@@ -218,6 +158,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("date_created")
@Getter
+ @Setter
@JsonDeserialize(using = MailChimpZonedDateTimeDeserializer.class)
private ZonedDateTime dateCreated;
@@ -226,6 +167,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("list_rating")
@Getter
+ @Setter
private Integer listRating;
/**
@@ -243,6 +185,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("subscribe_url_short")
@Getter
+ @Setter
private String subscribeUrlShort;
/**
@@ -250,6 +193,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("subscribe_url_long")
@Getter
+ @Setter
private String subscribeUrlLong;
/**
@@ -257,6 +201,7 @@ public void setPhone(String phone) {
*/
@JsonProperty("beamer_address")
@Getter
+ @Setter
private String beamerAddress;
/**
@@ -270,155 +215,13 @@ public void setPhone(String phone) {
* Any list-specific modules installed for this list.
*/
@Getter
+ @Setter
private java.util.List modules;
/**
* Stats for the list. Many of these are cached for at least five minutes.
*/
@Getter
+ @Setter
private ListStats stats;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Integer getTotalItems() {
- return totalItems;
- }
-
- public void setTotalItems(Integer totalItems) {
- this.totalItems = totalItems;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Contact getContact() {
- return contact;
- }
-
- public void setContact(Contact contact) {
- this.contact = contact;
- }
-
- public String getPermissionReminder() {
- return permissionReminder;
- }
-
- public void setPermissionReminder(String permissionReminder) {
- this.permissionReminder = permissionReminder;
- }
-
- public Boolean getUseArchiveBar() {
- return useArchiveBar;
- }
-
- public void setUseArchiveBar(Boolean useArchiveBar) {
- this.useArchiveBar = useArchiveBar;
- }
-
- public CampaignDefaults getCampaignDefaults() {
- return campaignDefaults;
- }
-
- public void setCampaignDefaults(CampaignDefaults campaignDefaults) {
- this.campaignDefaults = campaignDefaults;
- }
-
- public String getNotifyOnSubscribe() {
- return notifyOnSubscribe;
- }
-
- public void setNotifyOnSubscribe(String notifyOnSubscribe) {
- this.notifyOnSubscribe = notifyOnSubscribe;
- }
-
- public String getNotifyOnUnsubscribe() {
- return notifyOnUnsubscribe;
- }
-
- public void setNotifyOnUnsubscribe(String notifyOnUnsubscribe) {
- this.notifyOnUnsubscribe = notifyOnUnsubscribe;
- }
-
- public ZonedDateTime getDateCreated() {
- return dateCreated;
- }
-
- public void setDateCreated(ZonedDateTime dateCreated) {
- this.dateCreated = dateCreated;
- }
-
- public Integer getListRating() {
- return listRating;
- }
-
- public void setListRating(Integer listRating) {
- this.listRating = listRating;
- }
-
- public Boolean getEmailTypeOption() {
- return emailTypeOption;
- }
-
- public void setEmailTypeOption(Boolean emailTypeOption) {
- this.emailTypeOption = emailTypeOption;
- }
-
- public String getSubscribeUrlShort() {
- return subscribeUrlShort;
- }
-
- public void setSubscribeUrlShort(String subscribeUrlShort) {
- this.subscribeUrlShort = subscribeUrlShort;
- }
-
- public String getSubscribeUrlLong() {
- return subscribeUrlLong;
- }
-
- public void setSubscribeUrlLong(String subscribeUrlLong) {
- this.subscribeUrlLong = subscribeUrlLong;
- }
-
- public String getBeamerAddress() {
- return beamerAddress;
- }
-
- public void setBeamerAddress(String beamerAddress) {
- this.beamerAddress = beamerAddress;
- }
-
- public Visibility getVisibility() {
- return visibility;
- }
-
- public void setVisibility(Visibility visibility) {
- this.visibility = visibility;
- }
-
- public java.util.List getModules() {
- return modules;
- }
-
- public void setModules(java.util.List modules) {
- this.modules = modules;
- }
-
- public ListStats getStats() {
- return stats;
- }
-
- public void setStats(ListStats stats) {
- this.stats = stats;
- }
}
diff --git a/src/main/java/com/mailchimp/jackson/JacksonEncoder.java b/src/main/java/com/mailchimp/jackson/JacksonEncoder.java
index c86aafa..23bebeb 100644
--- a/src/main/java/com/mailchimp/jackson/JacksonEncoder.java
+++ b/src/main/java/com/mailchimp/jackson/JacksonEncoder.java
@@ -1,10 +1,13 @@
package com.mailchimp.jackson;
+import static feign.Util.UTF_8;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import feign.Request;
import feign.RequestTemplate;
import feign.codec.EncodeException;
import feign.codec.Encoder;
@@ -33,7 +36,9 @@ public JacksonEncoder(ObjectMapper mapper) {
@Override
public void encode(Object object, Type bodyType, RequestTemplate template) {
try {
- template.body(mapper.writeValueAsString(object));
+ String bodyText = mapper.writeValueAsString(object);
+ byte[] bodyData = bodyText != null ? bodyText.getBytes(UTF_8) : null;
+ template.body(Request.Body.encoded(bodyData, UTF_8));
} catch (JsonProcessingException e) {
throw new EncodeException(e.getMessage(), e);
}
diff --git a/src/main/java/com/mailchimp/query/ReportsQuery.java b/src/main/java/com/mailchimp/query/ReportsQuery.java
new file mode 100644
index 0000000..8f7422f
--- /dev/null
+++ b/src/main/java/com/mailchimp/query/ReportsQuery.java
@@ -0,0 +1,26 @@
+package com.mailchimp.query;
+
+import java.time.ZonedDateTime;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+/**
+ * @see https://mailchimp.com/developer/reference/reports/#get_/reports
+ */
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+@Builder
+public class ReportsQuery {
+
+ @Getter
+ private Integer count;
+
+ @Getter
+ private Integer offset;
+
+ @Getter
+ private ZonedDateTime since_send_time;
+}
diff --git a/src/test/java/com/mailchimp/MailChimpClientTest.java b/src/test/java/com/mailchimp/MailChimpClientTest.java
index 5c59204..47ec1e5 100644
--- a/src/test/java/com/mailchimp/MailChimpClientTest.java
+++ b/src/test/java/com/mailchimp/MailChimpClientTest.java
@@ -5,6 +5,7 @@
import com.mailchimp.query.BatchesQuery;
import com.mailchimp.query.ListMembersQuery;
import com.mailchimp.query.ListsQuery;
+import feign.FeignException;
import feign.Response;
import feign.mock.HttpMethod;
import feign.mock.MockClient;
@@ -486,7 +487,7 @@ public void removeBatch_existingBatchId_batchStopped(){
mailChimpClient.removeBatch("1");
}
- @Test(expected = MailChimpErrorException.class)
+ @Test(expected = FeignException.NotFound.class)
public void searchMembers_emptyQuery_throwException(){
mailChimpClient.searchMembers("");
}