diff --git a/README.md b/README.md index de43e19..0da5bd7 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ However, it is easy to extend the API and add support for any method you need (s ### Code samples * [Using an existing method implementation (Java)](src/test/java/com/ecwid/maleorang/examples/ExistingMethodExample.java) -* [Using an existing method implementation (Kotlin)](src/test/java/com/ecwid/maleorang/method/v3_0/members/MembersTest.kt) +* [Using an existing method implementation (Kotlin)](src/test/java/com/ecwid/maleorang/method/v3_0/lists/members/MembersTest.kt) * [Using a custom method implementation (Java)](src/test/java/com/ecwid/maleorang/examples/CustomMethodExample.java) ### Build tools integration diff --git a/build.gradle b/build.gradle index 624da62..0172222 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ buildscript { + ext.kotlin_version = '1.1.2-2' repositories { mavenCentral() jcenter() @@ -6,10 +7,12 @@ buildscript { dependencies { classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.9" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.3" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply from: 'wrapper.gradle' +apply plugin: 'kotlin' apply from: 'compile.gradle' apply from: 'test.gradle' apply from: 'publish.gradle' @@ -27,4 +30,5 @@ dependencies { compile 'joda-time:joda-time:2.9.4' testCompile 'org.testng:testng:6.8.21' + compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" } diff --git a/publish.gradle b/publish.gradle index edb7d28..495b023 100644 --- a/publish.gradle +++ b/publish.gradle @@ -3,7 +3,7 @@ apply plugin: 'signing' group = 'com.ecwid' archivesBaseName = "maleorang" -version = '3.0-0.9.4' +version = '3.0-0.9.6' task javadocJar(type: Jar) { classifier = 'javadoc' @@ -64,6 +64,11 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass name 'Vasily Karyaev' email 'v.karyaev@gmail.com' } + developer { + id 'lararojasmr' + name 'Manuel Lara' + email 'lararojas.mr@gmail.com' + } } } } diff --git a/src/main/java/com/ecwid/maleorang/MailchimpClient.kt b/src/main/java/com/ecwid/maleorang/MailchimpClient.kt index 146185c..f9e3335 100644 --- a/src/main/java/com/ecwid/maleorang/MailchimpClient.kt +++ b/src/main/java/com/ecwid/maleorang/MailchimpClient.kt @@ -60,12 +60,15 @@ open class MailchimpClient protected constructor ( var description = response.reasonPhrase if (response.responseBody != null) { - val error = JsonParser().parse(response.responseBody).asJsonObject - code = error.get("status").asInt - description = error.get("detail").asString + try { + val error = JsonParser().parse(response.responseBody).asJsonObject + code = error.get("status").asInt + description = error.get("detail").asString + } catch (e: Exception){} } + throw MailchimpException(code, response.responseBody.toString()) + //throw MailchimpException(code, description) - throw MailchimpException(code, description) } return MailchimpObject.fromJson(response.responseBody ?: "{}", method.resultType) diff --git a/src/main/java/com/ecwid/maleorang/MailchimpMethodInfo.kt b/src/main/java/com/ecwid/maleorang/MailchimpMethodInfo.kt index 8d17315..783f9b9 100644 --- a/src/main/java/com/ecwid/maleorang/MailchimpMethodInfo.kt +++ b/src/main/java/com/ecwid/maleorang/MailchimpMethodInfo.kt @@ -1,14 +1,10 @@ package com.ecwid.maleorang import com.ecwid.maleorang.annotation.* -import com.ecwid.maleorang.annotation.Method -import com.ecwid.maleorang.util.DateUtil.formatDate import com.ecwid.maleorang.util.ClassUtil.getAnnotatedFields - +import com.ecwid.maleorang.util.DateUtil.formatDate import java.net.URLEncoder -import java.util.Collections -import java.util.Date -import java.util.TreeMap +import java.util.* import java.util.regex.Matcher import java.util.regex.Pattern @@ -34,7 +30,8 @@ internal class MailchimpMethodInfo(private val method: MailchimpMethod<*>) { val requestBody: String? = when (httpMethod) { HttpMethod.POST, HttpMethod.PATCH, HttpMethod.PUT -> method.toJson() - else -> null.apply { require(method.mapping.isEmpty(), { "$httpMethod method is not supposed to have request body: $method" }) } + else -> null.apply { require(method.mapping.isEmpty(), { "$httpMethod method is not supposed to have request " + + "body: $method mapping: "+ method.mapping }) } } fun buildUrl(apiKey: String): String { diff --git a/src/main/java/com/ecwid/maleorang/MailchimpObjectGsonFactory.kt b/src/main/java/com/ecwid/maleorang/MailchimpObjectGsonFactory.kt index b0fb8d0..1e6b7cd 100644 --- a/src/main/java/com/ecwid/maleorang/MailchimpObjectGsonFactory.kt +++ b/src/main/java/com/ecwid/maleorang/MailchimpObjectGsonFactory.kt @@ -4,9 +4,8 @@ import com.ecwid.maleorang.util.DateUtil.formatDate import com.ecwid.maleorang.util.DateUtil.parseDate import com.google.gson.* import com.google.gson.reflect.TypeToken - import java.lang.reflect.Type -import java.util.Date +import java.util.* /** * Factory creating [Gson] objects to be used for MailChimp API calls wrapping. diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationEmailMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationEmailMethod.kt new file mode 100644 index 0000000..9a4533d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationEmailMethod.kt @@ -0,0 +1,31 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowEmailInfo + + +/** + * [Get information about automations](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id_emails_workflow_email_id) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails/{workflow_email_id}") +class GetAutomationEmailMethod( + + @JvmField + @PathParam + val workflow_id: String, + + @JvmField + @PathParam + val workflow_email_id: String + +) : MailchimpMethod() { + + class Response : MailchimpObject() { + @JvmField + @Field + var email: WorkflowEmailInfo? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationEmailsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationEmailsMethod.kt new file mode 100644 index 0000000..12b3fe1 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationEmailsMethod.kt @@ -0,0 +1,34 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowEmailInfo + +/** + * [Get information about automations](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails") +class GetAutomationEmailsMethod( + + @JvmField + @PathParam + val workflow_id: String + +) : MailchimpMethod() { + + class Response : MailchimpObject() { + @JvmField + @Field + var emails: List? = null + + @JvmField + @Field + var total_items: Int? = null + + @JvmField + @Field + var _links: MailchimpObject? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationMethod.kt new file mode 100644 index 0000000..211ce76 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationMethod.kt @@ -0,0 +1,25 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowInfo + +/** + * [Get information about a specific automation workflow](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/#read-get_automations_workflow_id) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/automations/{workflow_id}") +class GetAutomationMethod( + @JvmField + @PathParam + val workflow_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationsMethod.kt new file mode 100644 index 0000000..dd7c329 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetAutomationsMethod.kt @@ -0,0 +1,56 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowInfo + +/** + * [Get information about automations](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/#read-get_automations) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/automations") +class GetAutomationsMethod : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var before_create_time: String? = null + + @JvmField + @QueryStringParam + var since_create_time: String? = null + + @JvmField + @QueryStringParam + var before_send_time: String? = null + + @JvmField + @QueryStringParam + var since_send_time: String? = null + + @JvmField + @QueryStringParam + var status: String? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var automations: List? = null + + @JvmField + @Field + var total_items: Int? = null + + @JvmField + @Field + var _links: MailchimpObject? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetQueueAutomationMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetQueueAutomationMethod.kt new file mode 100644 index 0000000..f43b8b7 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetQueueAutomationMethod.kt @@ -0,0 +1,45 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowEmailQueue + + +/** + * [Get information about automations](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id_emails_workflow_email_id) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails/{workflow_email_id}/queue") +class GetQueueAutomationMethod( + + @JvmField + @PathParam + val workflow_id: String, + + @JvmField + @PathParam + val workflow_email_id: String + +) : MailchimpMethod(){ + + class Response : MailchimpObject() { + + @JvmField + @Field + var workflow_id: String? = null + + @JvmField + @Field + var email_id: String? = null + + @JvmField + @Field + var queue: List? = null + + @JvmField + @Field + var total_items: Int? = null + + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetQueueEmailAutomationMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetQueueEmailAutomationMethod.kt new file mode 100644 index 0000000..e7fbd14 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/GetQueueEmailAutomationMethod.kt @@ -0,0 +1,28 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowEmailQueue + + +/** + * [Get information about automations](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id_emails_workflow_email_id) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash}") +class GetQueueEmailAutomationMethod( + + @JvmField + @PathParam + val workflow_id: String, + + @JvmField + @PathParam + val workflow_email_id: String, + + @JvmField + @PathParam + val subscriber_hash: String + +) : MailchimpMethod() diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/QueueEmailAutomationMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/QueueEmailAutomationMethod.kt new file mode 100644 index 0000000..cae66c0 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/QueueEmailAutomationMethod.kt @@ -0,0 +1,28 @@ +package com.ecwid.maleorang.method.v3_0.automation + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.automation.info.WorkflowEmailQueue + + +/** + * [Get information about automations](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id_emails_workflow_email_id) + */ +@Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails/{workflow_email_id}/queue") +class QueueEmailAutomationMethod( + + @JvmField + @PathParam + val workflow_id: String, + + @JvmField + @PathParam + val workflow_email_id: String + +) : MailchimpMethod(){ + + @JvmField + @PathParam + val email_address: String? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/ToggleAutomationMethods.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/ToggleAutomationMethods.kt new file mode 100644 index 0000000..145808d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/ToggleAutomationMethods.kt @@ -0,0 +1,35 @@ +package com.ecwid.maleorang.method.v3_0.automation + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * Base class for automations activate/deactivate operations + */ +sealed class ToggleAutomationMethods : MailchimpMethod() { + /** + * [Pause Automation](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/#) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/automations/{workflow_id}/actions/pause-all-emails") + class Deactivate( + + @JvmField + @PathParam + val workflow_id: String + + ) : ToggleAutomationMethods() + + /** + * [Activate Automation](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/#) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/automations/{workflow_id}/actions/start-all-emails") + class Activate( + + @JvmField + @PathParam + val workflow_id: String + + ) : ToggleAutomationMethods() + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/ToggleEmailAutomationMethods.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/ToggleEmailAutomationMethods.kt new file mode 100644 index 0000000..cef777d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/ToggleEmailAutomationMethods.kt @@ -0,0 +1,43 @@ +package com.ecwid.maleorang.method.v3_0.automation + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * Base class for automations activate/deactivate operations + */ +sealed class ToggleEmailAutomationMethods : MailchimpMethod() { + /** + * [Pause Automation](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#action-post_automations_workflow_id_emails_workflow_email_id_actions_pause) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails/{workflow_email_id}/actions/pause") + class Deactivate( + + @JvmField + @PathParam + val workflow_id: String, + + @JvmField + @PathParam + val workflow_email_id: String + + ) : ToggleEmailAutomationMethods() + + /** + * [Activate Automation](http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#action-post_automations_workflow_id_emails_workflow_email_id_actions_start) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/automations/{workflow_id}/emails/{workflow_email_id}/actions/start") + class Activate( + + @JvmField + @PathParam + val workflow_id: String, + + @JvmField + @PathParam + val workflow_email_id: String + + ) : ToggleEmailAutomationMethods() + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/AutomationCampaignSetting.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/AutomationCampaignSetting.kt new file mode 100644 index 0000000..7580dc8 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/AutomationCampaignSetting.kt @@ -0,0 +1,44 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class AutomationCampaignSetting : MailchimpObject() { + + @JvmField + @Field + var title: String? = null + + @JvmField + @Field + var from_name: String? = null + + @JvmField + @Field + var reply_to: String? = null + + @JvmField + @Field + var use_conversation: Boolean? = null + + @JvmField + @Field + var to_name: String? = null + + @JvmField + @Field + var authenticate: Boolean? = null + + @JvmField + @Field + var auto_footer: Boolean? = null + + @JvmField + @Field + var inline_css: Boolean? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/QueueEmailListInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/QueueEmailListInfo.kt new file mode 100644 index 0000000..157da94 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/QueueEmailListInfo.kt @@ -0,0 +1,85 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.ecwid.maleorang.method.v3_0.campaign.* +import java.util.* + +/** + * Created by Ing. Manuel Lara on 07/05/17. + */ +class QueueEmailListInfo : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var workflow_id: String? = null + + @JvmField + @Field + var position: String? = null + + @JvmField + @Field + var delay: MailchimpObject? = null + + @JvmField + @Field + var create_time: String? = null + + @JvmField + @Field + var start_time: String? = null + + @JvmField + @Field + var status: String? = null + + @JvmField + @Field + var archive_url: String? = null + + @JvmField + @Field + var emails_sent: String? = null + + @JvmField + @Field + var send_time: String? = null + + @JvmField + @Field + var content_type: String? = null + + @JvmField + @Field + var social_card: MailchimpObject? = null + + @JvmField + @Field + var recipients: RecipientsWorkflowInfo? = null + + @JvmField + @Field + var settings: AutomationCampaignSetting? = null + + @JvmField + @Field + var tracking: TrackingWorkflowInfo? = null + + @JvmField + @Field + var trigger_settings: MailchimpObject? = null + + @JvmField + @Field + var report_summary: ReportSummaryWorkflow? = null + + @JvmField + @Field + var _links: MailchimpObject? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/RecipientsWorkflowInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/RecipientsWorkflowInfo.kt new file mode 100644 index 0000000..7f0a6fd --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/RecipientsWorkflowInfo.kt @@ -0,0 +1,23 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class RecipientsWorkflowInfo : MailchimpObject() { + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var list_name: String? = null + + @JvmField + @Field + var segment_opts: MailchimpObject? = null //TODO create SegmentOpts Object + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/ReportSummaryWorkflow.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/ReportSummaryWorkflow.kt new file mode 100644 index 0000000..b6921f4 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/ReportSummaryWorkflow.kt @@ -0,0 +1,37 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class ReportSummaryWorkflow : MailchimpObject() { + + @JvmField + @Field + var opens: Int? = null + + @JvmField + @Field + var unique_opens: Int? = null + + @JvmField + @Field + var open_rate: Double? = null + + @JvmField + @Field + var clicks: Int? = null + + @JvmField + @Field + var subscriber_clicks: Int? = null + + @JvmField + @Field + var click_rate: Int? = null + + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/TrackingWorkflowInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/TrackingWorkflowInfo.kt new file mode 100644 index 0000000..8d95185 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/TrackingWorkflowInfo.kt @@ -0,0 +1,48 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class TrackingWorkflowInfo : MailchimpObject() { + + @JvmField + @Field + var opens: Boolean? = null + + @JvmField + @Field + var html_clicks: Boolean? = null + + @JvmField + @Field + var text_clicks: Boolean? = null + + @JvmField + @Field + var goal_tracking: Boolean? = null + + @JvmField + @Field + var ecomm360: Boolean? = null + + @JvmField + @Field + var google_analytics: Boolean? = null + + @JvmField + @Field + var clicktale: Boolean? = null + + @JvmField + @Field + var salesforce: MailchimpObject? = null + + @JvmField + @Field + var capsule: MailchimpObject? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowEmailInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowEmailInfo.kt new file mode 100644 index 0000000..35d0f80 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowEmailInfo.kt @@ -0,0 +1,85 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.ecwid.maleorang.method.v3_0.campaign.* +import java.util.* + +/** + * Created by Ing. Manuel Lara on 07/05/17. + */ +class WorkflowEmailInfo : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var workflow_id: String? = null + + @JvmField + @Field + var position: String? = null + + @JvmField + @Field + var delay: MailchimpObject? = null + + @JvmField + @Field + var create_time: String? = null + + @JvmField + @Field + var start_time: String? = null + + @JvmField + @Field + var status: String? = null + + @JvmField + @Field + var archive_url: String? = null + + @JvmField + @Field + var emails_sent: String? = null + + @JvmField + @Field + var send_time: String? = null + + @JvmField + @Field + var content_type: String? = null + + @JvmField + @Field + var social_card: MailchimpObject? = null + + @JvmField + @Field + var recipients: RecipientsWorkflowInfo? = null + + @JvmField + @Field + var settings: AutomationCampaignSetting? = null + + @JvmField + @Field + var tracking: TrackingWorkflowInfo? = null + + @JvmField + @Field + var trigger_settings: MailchimpObject? = null + + @JvmField + @Field + var report_summary: ReportSummaryWorkflow? = null + + @JvmField + @Field + var _links: MailchimpObject? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowEmailQueue.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowEmailQueue.kt new file mode 100644 index 0000000..de8dee5 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowEmailQueue.kt @@ -0,0 +1,41 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.ecwid.maleorang.method.v3_0.campaign.* +import java.util.* + +/** + * Created by Ing. Manuel Lara on 07/05/17. + */ +class WorkflowEmailQueue : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var workflow_id: String? = null + + @JvmField + @Field + var email_id: String? = null + + @JvmField + @Field + var list_id: MailchimpObject? = null + + @JvmField + @Field + var email_address: String? = null + + @JvmField + @Field + var next_send: String? = null + + @JvmField + @Field + var _links: MailchimpObject? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowInfo.kt new file mode 100644 index 0000000..5cda3a8 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/automation/info/WorkflowInfo.kt @@ -0,0 +1,57 @@ +package com.ecwid.maleorang.method.v3_0.automation.info + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.ecwid.maleorang.method.v3_0.campaign.* +import java.util.* + +/** + * Created by Ing. Manuel Lara on 07/05/17. + */ +class WorkflowInfo : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var create_time: String? = null + + @JvmField + @Field + var start_time: String? = null + + @JvmField + @Field + var status: String? = null + + @JvmField + @Field + var emails_sent: String? = null + + @JvmField + @Field + var recipients: RecipientsWorkflowInfo? = null + + @JvmField + @Field + var settings: AutomationCampaignSetting? = null + + @JvmField + @Field + var tracking: TrackingWorkflowInfo? = null + + @JvmField + @Field + var trigger_settings: MailchimpObject? = null + + @JvmField + @Field + var report_summary: ReportSummaryWorkflow? = null + + @JvmField + @Field + var _links: MailchimpObject? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/CampaignInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/CampaignInfo.kt new file mode 100644 index 0000000..e7e6b1a --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/CampaignInfo.kt @@ -0,0 +1,55 @@ +package com.ecwid.maleorang.method.v3_0.campaign + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.ecwid.maleorang.method.v3_0.reports.email.TypeCampaign +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignInfo : MailchimpObject() { + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var type: TypeCampaign? = null + + @JvmField + @Field + var create_time: Date? = null + + @JvmField + @Field + var archive_url: String? = null + + @JvmField + @Field + var long_archive_url: String? = null + + @JvmField + @Field + var status: String? = null + + @JvmField + @Field + var emails_sent: Int? = null + + @JvmField + @Field + var content_type: String? = null + + @JvmField + @Field + var recipients: RecipientsCampaignInfo? = null + + @JvmField + @Field + var settings: CampaignSettingsInfo? = null + + + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/CampaignSettingsInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/CampaignSettingsInfo.kt new file mode 100644 index 0000000..4c4592f --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/CampaignSettingsInfo.kt @@ -0,0 +1,66 @@ +package com.ecwid.maleorang.method.v3_0.campaign + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class CampaignSettingsInfo : MailchimpObject() { + @JvmField + @Field + var subject_line: String? = null + + @JvmField + @Field + var title: String? = null + + @JvmField + @Field + var from_name: String? = null + + @JvmField + @Field + var reply_to: String? = null + + @JvmField + @Field + var use_conversation: String? = null + + @JvmField + @Field + var to_name: String? = null + + @JvmField + @Field + var folder_id: String? = null + + @JvmField + @Field + var authenticate: Boolean? = null + + @JvmField + @Field + var auto_footer: Boolean? = null + + @JvmField + @Field + var inline_css: Boolean? = null + + @JvmField + @Field + var auto_tweet: Boolean? = null + + @JvmField + @Field + var fb_comments: Boolean? = null + + @JvmField + @Field + var timewrap: Boolean? = null + + @JvmField + @Field + var drag_and_drop: Boolean? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/GetCampaignMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/GetCampaignMethod.kt new file mode 100644 index 0000000..6b2202e --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/GetCampaignMethod.kt @@ -0,0 +1,26 @@ +package com.ecwid.maleorang.method.v3_0.campaign + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* +import org.apache.commons.codec.digest.DigestUtils + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}") +class GetCampaignMethod( + @JvmField + @PathParam + val campaign_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/GetCampaignsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/GetCampaignsMethod.kt new file mode 100644 index 0000000..27bde55 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/GetCampaignsMethod.kt @@ -0,0 +1,73 @@ +package com.ecwid.maleorang.method.v3_0.campaign + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/campaigns") +class GetCampaignsMethod : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + @JvmField + @QueryStringParam + var type: String? = null + + @JvmField + @QueryStringParam + var status: String? = null + + @JvmField + @QueryStringParam + var before_send_time: Date? = null + + @JvmField + @QueryStringParam + var since_send_opt: String? = null + + @JvmField + @QueryStringParam + var before_create_time: Date? = null + + @JvmField + @QueryStringParam + var since_create_time: Date? = null + + @JvmField + @QueryStringParam + var list_id: String? = null + + @JvmField + @QueryStringParam + var folder_id: String? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var campaigns: List? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/RecipientsCampaignInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/RecipientsCampaignInfo.kt new file mode 100644 index 0000000..4705ae4 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/RecipientsCampaignInfo.kt @@ -0,0 +1,19 @@ +package com.ecwid.maleorang.method.v3_0.campaign + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class RecipientsCampaignInfo : MailchimpObject() { + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var segment_opts: MailchimpObject? = null //TODO create SegmentOpts Object + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/TypeCampaign.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/TypeCampaign.kt new file mode 100644 index 0000000..184206d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaign/TypeCampaign.kt @@ -0,0 +1,13 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + +/** + * Created by larar on 15/10/2016. + */ + +enum class TypeCampaign(val type: String) { + REGULAR("regular"), + PLAINTEXT("plaintext"), + ABSPLIT("absplit"), + RSS("rss"), + VARIATE("variate") +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/CampaignActionMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/CampaignActionMethod.kt new file mode 100644 index 0000000..30378f6 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/CampaignActionMethod.kt @@ -0,0 +1,74 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* + +/** + * Base class for campaign action operations. + */ +sealed class CampaignActionMethod : MailchimpMethod() { + + /** + * [Cancel a Regular or Plain-Text Campaign after you send](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_cancel_send) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/cancel-send") + class CancelSend(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + + /** + * [Pause an RSS-Driven campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_pause) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/pause") + class Pause(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + + /** + * [Replicate a campaign in saved or send status](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_replicate) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/replicate") + class Replicate(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + + /** + * [Resume an RSS-Driven campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_resume) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/resume") + class Resume(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + + /** + * [Schedule a campaign for delivery](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_schedule) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/schedule") + class Schedule(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() { + + /** + * The date and time in UTC to schedule the campaign for delivery. Campaigns may only be scheduled to send on the quarter-hour (:00, :15, :30, :45). + */ + @JvmField + @Field + var schedule_time: Date? = null + + @JvmField + @Field + var timewarp: Boolean? = null + + } + + /** + * [Send a MailChimp campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_send) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/send") + class Send(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + + /** + * [Send a Test email](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_test) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/test") + class Test(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + + /** + * [Unschedule a scheduled campaign that hasn’t started sending](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#action-post_campaigns_campaign_id_actions_unschedule) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/actions/unschedule") + class Unschedule(@JvmField @PathParam val campaign_id: String) : CampaignActionMethod() + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/CampaignInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/CampaignInfo.kt new file mode 100644 index 0000000..ede6247 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/CampaignInfo.kt @@ -0,0 +1,629 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.google.gson.annotations.SerializedName +import java.util.* + +class CampaignInfo : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var type: Type? = null + + enum class Type { + @SerializedName("regular") + REGULAR, + @SerializedName("plaintext") + PLAINTEXT, + @SerializedName("absplit") + ABSPLIT, + @SerializedName("rss") + RSS, + @SerializedName("variate") + VARIATE + } + + @JvmField + @Field + var create_time: Date? = null + + @JvmField + @Field + var archive_url: String? = null + + @JvmField + @Field + var long_archive_url: String? = null + + @JvmField + @Field + var status: Status? = null + + enum class Status { + @SerializedName("save") + SAVE, + @SerializedName("paused") + PAUSED, + @SerializedName("schedule") + SCHEDULE, + @SerializedName("sending") + SENDING, + @SerializedName("sent") + SENT + } + + @JvmField + @Field + var emails_sent: Int? = null + + @JvmField + @Field + var send_time: Date? = null + + @JvmField + @Field + var content_type: String? = null + + @JvmField + @Field + var recipients: RecipientsInfo? = null + + class RecipientsInfo : MailchimpObject() { + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var list_name: String? = null + + @JvmField + @Field + var segment_text: String? = null + + @JvmField + @Field + var recipient_count: Int? = null + + @JvmField + @Field + var segment_opts: SegmentOptsInfo? = null + + class SegmentOptsInfo : MailchimpObject() { + + @JvmField + @Field + var saved_segment_id: Int? = null + + @JvmField + @Field + var match: String? = null + + @JvmField + @Field + var conditions: Array? = null + } + } + + @JvmField + @Field + var settings: SettingsInfo? = null + + class SettingsInfo : MailchimpObject() { + + @JvmField + @Field + var subject_line: String? = null + + @JvmField + @Field + var title: String? = null + + @JvmField + @Field + var from_name: String? = null + + @JvmField + @Field + var reply_to: String? = null + + @JvmField + @Field + var use_conversation: Boolean? = null + + @JvmField + @Field + var to_name: String? = null + + @JvmField + @Field + var folder_id: String? = null + + @JvmField + @Field + var authenticate: Boolean? = null + + @JvmField + @Field + var auto_footer: Boolean? = null + + @JvmField + @Field + var inline_css: Boolean? = null + + @JvmField + @Field + var auto_tweet: Boolean? = null + + @JvmField + @Field + var auto_fb_post: Array? = null + + @JvmField + @Field + var fb_comments: Boolean? = null + + @JvmField + @Field + var timewarp: Boolean? = null + + @JvmField + @Field + var template_id: Int? = null + + @JvmField + @Field + var drag_and_drop: Boolean? = null + + } + + @JvmField + @Field + var variate_settings: VariateSettingsInfo? = null + + class VariateSettingsInfo : MailchimpObject() { + + @JvmField + @Field + var winning_combination_id: String? = null + + @JvmField + @Field + var winning_campaign_id: String? = null + + @JvmField + @Field + var winner_criteria: WinnerCriteria? = null + + enum class WinnerCriteria { + @SerializedName("opens") + OPENS, + @SerializedName("clicks") + CLICKS, + @SerializedName("manual") + MANUAL, + @SerializedName("total_revenue") + TOTAL_REVENUE + } + + @JvmField + @Field + var wait_time: Int? = null + + @JvmField + @Field + var test_size: Int? = null + + @JvmField + @Field + var subject_lines: Array? = null + + @JvmField + @Field + var send_times: Array? = null + + @JvmField + @Field + var from_names: Array? = null + + @JvmField + @Field + var reply_to_addresses: Array? = null + + @JvmField + @Field + var contents: Array? = null + + @JvmField + @Field + var combinations: Array? = null + + class CombinationInfo : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var subject_line: String? = null + + @JvmField + @Field + var send_time: Int? = null + + @JvmField + @Field + var from_name: Int? = null + + @JvmField + @Field + var reply_to: Int? = null + + @JvmField + @Field + var content_description: Int? = null + + @JvmField + @Field + var recipients: Int? = null + } + } + + @JvmField + @Field + var tracking: TrackingInfo? = null + + class TrackingInfo : MailchimpObject() { + + @JvmField + @Field + var opens: Boolean? = null + + @JvmField + @Field + var html_clicks: Boolean? = null + + @JvmField + @Field + var text_clicks: Boolean? = null + + @JvmField + @Field + var goal_tracking: Boolean? = null + + @JvmField + @Field + var ecomm360: Boolean? = null + + @JvmField + @Field + var google_analytics: String? = null + + @JvmField + @Field + var clicktale: String? = null + + @JvmField + @Field + var salesforce: SalesforceInfo? = null + + class SalesforceInfo : MailchimpObject() { + + @JvmField + @Field + var campaign: Boolean? = null + + @JvmField + @Field + var notes: Boolean? = null + } + + @JvmField + @Field + var highrise: HighriseInfo? = null + + class HighriseInfo : MailchimpObject() { + + @JvmField + @Field + var campaign: Boolean? = null + + @JvmField + @Field + var notes: Boolean? = null + } + + @JvmField + @Field + var capsule: CapsuleInfo? = null + + class CapsuleInfo : MailchimpObject() { + + @JvmField + @Field + var notes: Boolean? = null + } + } + + @JvmField + @Field + var rss_opts: RSSOptsInfo? = null + + class RSSOptsInfo : MailchimpObject() { + + @JvmField + @Field + var feed_url: String? = null + + @JvmField + @Field + var frequency: Frequency? = null + + enum class Frequency { + @SerializedName("daily") + DAILY, + @SerializedName("weekly") + WEEKLY, + @SerializedName("monthly") + MONTHLY + } + + @JvmField + @Field + var schedule: ScheduleInfo? = null + + class ScheduleInfo : MailchimpObject() { + + @JvmField + @Field + var hour: Int? = null + + @JvmField + @Field + var daily_send: DailySendInfo? = null + + class DailySendInfo : MailchimpObject() { + + @JvmField + @Field + var sunday: Boolean? = null + + @JvmField + @Field + var monday: Boolean? = null + + @JvmField + @Field + var tuesday: Boolean? = null + + @JvmField + @Field + var wednesday: Boolean? = null + + @JvmField + @Field + var thursday: Boolean? = null + + @JvmField + @Field + var friday: Boolean? = null + + @JvmField + @Field + var saturday: Boolean? = null + + } + + @JvmField + @Field + var weekly_send_day: DayOfWeek? = null + + @JvmField + @Field + var monthly_send_date: Int? = null + + } + + @JvmField + @Field + var last_sent: String? = null + + @JvmField + @Field + var constrain_rss_img: Boolean? = null + } + + @JvmField + @Field + var ab_split_opts: ABSplitOptsInfo? = null + + class ABSplitOptsInfo : MailchimpObject() { + + @JvmField + @Field + var split_test: Type? = null + + enum class Type { + @SerializedName("subject") + SUBJECT, + @SerializedName("from_name") + FROM_NAME, + @SerializedName("schedule") + SCHEDULE + } + + @JvmField + @Field + var pick_winner: PickWinner? = null + + enum class PickWinner { + @SerializedName("opens") + SUBJECT, + @SerializedName("clicks") + FROM_NAME, + @SerializedName("manual") + SCHEDULE + } + + @JvmField + @Field + var wait_units: WaitUnits? = null + + enum class WaitUnits { + @SerializedName("hours") + HOURS, + @SerializedName("days") + DAYS + } + + @JvmField + @Field + var wait_time: Int? = null + + @JvmField + @Field + var split_size: Int? = null + + @JvmField + @Field + var from_name_a: String? = null + + @JvmField + @Field + var from_name_b: String? = null + + @JvmField + @Field + var reply_email_a: String? = null + + @JvmField + @Field + var reply_email_b: String? = null + + @JvmField + @Field + var subject_a: String? = null + + @JvmField + @Field + var subject_b: String? = null + + @JvmField + @Field + var send_time_a: Date? = null + + @JvmField + @Field + var send_time_b: Date? = null + + @JvmField + @Field + var send_time_winner: Date? = null + + } + + @JvmField + @Field + var social_card: SocialCardInfo? = null + + class SocialCardInfo : MailchimpObject() { + + @JvmField + @Field + var image_url: String? = null + + @JvmField + @Field + var description: String? = null + + @JvmField + @Field + var title: String? = null + + } + + @JvmField + @Field + var report_summary: ReportSummaryInfo? = null + + class ReportSummaryInfo : MailchimpObject() { + + @JvmField + @Field + var opens: Int? = null + + @JvmField + @Field + var unique_opens: Int? = null + + @JvmField + @Field + var open_rate: Double? = null + + @JvmField + @Field + var clicks: Int? = null + + @JvmField + @Field + var subscriber_clicks: Int? = null + + @JvmField + @Field + var click_rate: Double? = null + + @JvmField + @Field + var ecommerce: EcommerceInfo? = null + + class EcommerceInfo : MailchimpObject() { + + @JvmField + @Field + var total_orders: Int? = null + + @JvmField + @Field + var total_spent: Double? = null + + @JvmField + @Field + var total_revenue: Double? = null + } + } + + @JvmField + @Field + var delivery_status: DeliveryStatusInfo? = null + + class DeliveryStatusInfo : MailchimpObject() { + + @JvmField + @Field + var enabled: Boolean? = null + + @JvmField + @Field + var can_cancel: Boolean? = null + + @JvmField + @Field + var status: String? = null + + @JvmField + @Field + var emails_sent: Int? = null + + @JvmField + @Field + var emails_canceled: Int? = null + + } +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/DayOfWeek.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/DayOfWeek.kt new file mode 100644 index 0000000..a9e2417 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/DayOfWeek.kt @@ -0,0 +1,20 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.google.gson.annotations.SerializedName + +enum class DayOfWeek { + @SerializedName("sunday") + SUNDAY, + @SerializedName("monday") + MONDAY, + @SerializedName("tuesday") + TUESDAY, + @SerializedName("wednesday") + WEDNESDAY, + @SerializedName("thursday") + THURSDAY, + @SerializedName("friday") + FRIDAY, + @SerializedName("saturday") + SATURDAY, +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/DeleteCampaignMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/DeleteCampaignMethod.kt new file mode 100644 index 0000000..571075c --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/DeleteCampaignMethod.kt @@ -0,0 +1,18 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.APIVersion +import com.ecwid.maleorang.annotation.HttpMethod +import com.ecwid.maleorang.annotation.Method +import com.ecwid.maleorang.annotation.PathParam + +/** + * [Remove a campaign from your MailChimp account](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#delete-delete_campaigns_campaign_id) + */ +@Method(httpMethod = HttpMethod.DELETE, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}") +class DeleteCampaignMethod( + @JvmField + @PathParam + val campaign_id: String +) : MailchimpMethod() diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/EditCampaignMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/EditCampaignMethod.kt new file mode 100644 index 0000000..6197940 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/EditCampaignMethod.kt @@ -0,0 +1,56 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.campaigns.CampaignInfo.* + +/** + * Base class for campaign create or update operations. + */ +sealed class EditCampaignMethod : MailchimpMethod() { + + /** + * [Create a new MailChimp campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#create-post_campaigns) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/campaigns") + class Create() : EditCampaignMethod() + + /** + * [Update some or all of the settings for a specific campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#edit-patch_campaigns_campaign_id) + */ + @Method(httpMethod = HttpMethod.PATCH, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}") + class Update( + @JvmField + @PathParam + val campaign_id: String + ) : EditCampaignMethod() + + @JvmField + @Field + var type: CampaignInfo.Type? = null + + @JvmField + @Field + var recipients: RecipientsInfo? = null + + @JvmField + @Field + var settings: SettingsInfo? = null + + @JvmField + @Field + var variate_settings: VariateSettingsInfo? = null + + @JvmField + @Field + var tracking: TrackingInfo? = null + + @JvmField + @Field + var rss_opts: RSSOptsInfo? = null + + @JvmField + @Field + var social_card: SocialCardInfo? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/GetCampaignMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/GetCampaignMethod.kt new file mode 100644 index 0000000..efd9401 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/GetCampaignMethod.kt @@ -0,0 +1,20 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* + +/** + * [Get information about a specific campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#read-get_campaigns_campaign_id) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}") +class GetCampaignMethod(@JvmField @PathParam val campaign_id: String) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/GetCampaignsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/GetCampaignsMethod.kt new file mode 100644 index 0000000..e61c113 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/GetCampaignsMethod.kt @@ -0,0 +1,86 @@ +package com.ecwid.maleorang.method.v3_0.campaigns + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.campaigns.CampaignInfo.Status +import com.ecwid.maleorang.method.v3_0.campaigns.CampaignInfo.Type +import java.util.* + +/** + * [Get all campaigns in an account.](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#read-get_campaigns) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/campaigns") +class GetCampaignsMethod : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + @JvmField + @QueryStringParam + var type: Type? = null + + @JvmField + @QueryStringParam + var status: Status? = null + + @JvmField + @QueryStringParam + var before_send_time: Date? = null + + @JvmField + @QueryStringParam + var since_send_time: Date? = null + + @JvmField + @QueryStringParam + var before_create_time: Date? = null + + @JvmField + @QueryStringParam + var since_create_time: Date? = null + + @JvmField + @QueryStringParam + var list_id: String? = null + + @JvmField + @QueryStringParam + var folder_id: String? = null + + @JvmField + @QueryStringParam + var sort_field: String? = null + + @JvmField + @QueryStringParam + var sort_dir: SortDir? = null + + enum class SortDir { + ASC, + DESC + } + + class Response : MailchimpObject() { + @JvmField + @Field + var campaigns: List? = null + + @JvmField + @Field + var total_items: Int? = null + } +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/ContentInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/ContentInfo.kt new file mode 100644 index 0000000..47e0bf3 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/ContentInfo.kt @@ -0,0 +1,36 @@ +package com.ecwid.maleorang.method.v3_0.campaigns.content + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +class ContentInfo : MailchimpObject() { + + @JvmField + @Field + var variate_contents: VariateContents? = null + + class VariateContents : MailchimpObject() { + + @JvmField + @Field + var content_label: String? = null + + @JvmField + @Field + var plain_text: String? = null + + @JvmField + @Field + var html: String? = null + + } + + @JvmField + @Field + var plain_text: String? = null + + @JvmField + @Field + var html: String? = null + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/GetCampaignContentMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/GetCampaignContentMethod.kt new file mode 100644 index 0000000..4fba140 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/GetCampaignContentMethod.kt @@ -0,0 +1,20 @@ +package com.ecwid.maleorang.method.v3_0.campaigns.content + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* + +/** + * [Get the the HTML and plain-text content for a campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/content/#read-get_campaigns_campaign_id_content) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/content") +class GetCampaignContentMethod(@JvmField @PathParam val campaign_id: String) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/SetCampaignContentMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/SetCampaignContentMethod.kt new file mode 100644 index 0000000..e790e36 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/campaigns/content/SetCampaignContentMethod.kt @@ -0,0 +1,105 @@ +package com.ecwid.maleorang.method.v3_0.campaigns.content + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.google.gson.annotations.SerializedName + +/** + * [Set the content for a campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/content/#edit-put_campaigns_campaign_id_content) + */ +@Method(httpMethod = HttpMethod.PUT, version = APIVersion.v3_0, path = "/campaigns/{campaign_id}/content") +class SetCampaignContentMethod(@JvmField @PathParam val campaign_id: String) : MailchimpMethod() { + + @JvmField + @Field + var plain_text: String? = null + + @JvmField + @Field + var html: String? = null + + @JvmField + @Field + var url: String? = null + + @JvmField + @Field + var template: Template? = null + + class Template : MailchimpObject() { + + @JvmField + @Field + var id: Int? = null + + @JvmField + @Field + var sections: Map? = null + + } + + @JvmField + @Field + var archive: Archive? = null + + class Archive : MailchimpObject() { + + @JvmField + @Field + var archive_content: String? = null + + @JvmField + @Field + var archive_type: ArchiveType? = null + + enum class ArchiveType { + @SerializedName("zip") + ZIP, + @SerializedName("tar.gz") + TAR_GZ, + @SerializedName("tar.bz2") + TAR_BZ2, + @SerializedName("tar") + TAR, + @SerializedName("tgz") + TGZ, + @SerializedName("tbz") + TBZ, + } + } + + @JvmField + @Field + var variate_contents: Array? = null + + class VariateContents : MailchimpObject() { + + @JvmField + @Field + var content_label: String? = null + + @JvmField + @Field + var plain_text: String? = null + + @JvmField + @Field + var html: String? = null + + @JvmField + @Field + var url: String? = null + + @JvmField + @Field + var template: Template? = null + + @JvmField + @Field + var archive: Archive? = null + + } + + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/DeleteListMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/DeleteListMethod.kt new file mode 100644 index 0000000..5df94c2 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/DeleteListMethod.kt @@ -0,0 +1,18 @@ +package com.ecwid.maleorang.method.v3_0.lists + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.APIVersion +import com.ecwid.maleorang.annotation.HttpMethod +import com.ecwid.maleorang.annotation.Method +import com.ecwid.maleorang.annotation.PathParam + +/** + * [Delete a list from your MailChimp account](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/#delete-delete_lists_list_id) + */ +@Method(httpMethod = HttpMethod.DELETE, version = APIVersion.v3_0, path = "/lists/{list_id}") +class DeleteListMethod( + @JvmField + @PathParam + val list_id: String +) : MailchimpMethod() \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/EditListMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/EditListMethod.kt new file mode 100644 index 0000000..24e85a2 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/EditListMethod.kt @@ -0,0 +1,50 @@ +package com.ecwid.maleorang.method.v3_0.lists + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* + +sealed class EditListMethod : MailchimpMethod() { + + /** + * [Create a new list in your MailChimp account](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/#create-post_lists) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/lists") + class Create() : EditListMethod() + + @JvmField + @Field + var name: String? = null + + @JvmField + @Field + var contact: ContactInfo? = null + + @JvmField + @Field + var permission_reminder: String? = null + + @JvmField + @Field + var use_archive_bar: String? = null + + @JvmField + @Field + var campaign_defaults: CampaignDefaultsInfo? = null + + @JvmField + @Field + var notify_on_subscribe: String? = null + + @JvmField + @Field + var notify_on_unsubscribe: String? = null + + @JvmField + @Field + var email_type_option: Boolean? = null + + @JvmField + @Field + var visibility: String? = null + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/EditMergeFieldMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/EditMergeFieldMethod.kt new file mode 100644 index 0000000..695dd83 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/EditMergeFieldMethod.kt @@ -0,0 +1,97 @@ +package com.ecwid.maleorang.method.v3_0.lists.merge_fields + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import com.ecwid.maleorang.method.v3_0.lists.members.MemberInfo + +/** + * Base class for editing merge fields (formerly merge vars) for a specific list + */ +sealed class EditMergeFieldMethod : MailchimpMethod() { + + /** + * [Add a new merge field for a specific list](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/merge-fields/#create-post_lists_list_id_merge_fields) + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/lists/{list_id}/merge-fields") + class Create( + @JvmField + @PathParam + val list_id: String, + + @JvmField + @Field + val type: MergeFieldInfo.Type? = null + ) : EditMergeFieldMethod() + + /** + * [Update a specific merge field in a list](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/merge-fields/#edit-patch_lists_list_id_merge_fields_merge_id) + */ + @Method(httpMethod = HttpMethod.PATCH, version = APIVersion.v3_0, path = "/lists/{list_id}/merge-fields/{merge_id}") + class Update( + @JvmField + @PathParam + val list_id: String, + + @JvmField + @PathParam + val merge_id: String + ) : EditMergeFieldMethod() + + @JvmField + @Field + var tag: String? = null + + @JvmField + @Field + var name: String? = null + + @JvmField + @Field + var required: Boolean? = null + + @JvmField + @Field + var default_value: String? = null + + @JvmField + @Field + var public: Boolean? = null + + @JvmField + @Field + var display_order: Int? = null + + @JvmField + @Field + var options: OptionsInfo? = null + + class OptionsInfo : MailchimpObject() { + + @JvmField + @Field + var default_country: Int? = null + + @JvmField + @Field + var phone_format: String? = null + + @JvmField + @Field + var date_format: String? = null + + @JvmField + @Field + var choices: Array? = null + + @JvmField + @Field + var size: Int? = null + + } + + @JvmField + @Field + var help_text: String? = null + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/GetMergeFieldsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/GetMergeFieldsMethod.kt new file mode 100644 index 0000000..1d87182 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/GetMergeFieldsMethod.kt @@ -0,0 +1,51 @@ +package com.ecwid.maleorang.method.v3_0.lists.merge_fields + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * [Get a list of all merge fields (formerly merge vars) for a list](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/merge-fields/#read-get_lists_list_id_merge_fields) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/lists/{list_id}/merge-fields") +class GetMergeFieldsMethod(@JvmField @PathParam val list_id: String) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + @JvmField + @QueryStringParam + var type: MergeFieldInfo.Type? = null + + @JvmField + @QueryStringParam + var required: Boolean? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var merge_fields: List? = null + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/MergeFieldInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/MergeFieldInfo.kt new file mode 100644 index 0000000..475bf4b --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/merge_fields/MergeFieldInfo.kt @@ -0,0 +1,102 @@ +package com.ecwid.maleorang.method.v3_0.lists.merge_fields + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.google.gson.annotations.SerializedName + +class MergeFieldInfo : MailchimpObject() { + + @JvmField + @Field + var merge_id: Int? = null + + @JvmField + @Field + var tag: String? = null + + @JvmField + @Field + var name: String? = null + + @JvmField + @Field + var type: Type? = null + + enum class Type { + @SerializedName("text") + TEXT, + @SerializedName("number") + NUMBER, + @SerializedName("address") + ADDRESS, + @SerializedName("phone") + PHONE, + @SerializedName("date") + DATE, + @SerializedName("url") + URL, + @SerializedName("imageurl") + IMAGEURL, + @SerializedName("radio") + RADIO, + @SerializedName("dropdown") + DROPDOWN, + @SerializedName("birthday") + BIRTHDAY, + @SerializedName("zip") + ZIP + } + + @JvmField + @Field + var required: Boolean? = null + + @JvmField + @Field + var default_value: String? = null + + @JvmField + @Field + var public: Boolean? = null + + @JvmField + @Field + var display_order: Int? = null + + @JvmField + @Field + var options: OptionsInfo? = null + + class OptionsInfo : MailchimpObject() { + + @JvmField + @Field + var default_country: Int? = null + + @JvmField + @Field + var phone_format: String? = null + + @JvmField + @Field + var date_format: String? = null + + @JvmField + @Field + var choices: Array? = null + + @JvmField + @Field + var size: Int? = null + + } + + @JvmField + @Field + var help_text: String? = null + + @JvmField + @Field + var list_id: String? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/DeleteSegmentMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/DeleteSegmentMethod.kt new file mode 100644 index 0000000..7198b6e --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/DeleteSegmentMethod.kt @@ -0,0 +1,22 @@ +package com.ecwid.maleorang.method.v3_0.lists.segments + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.APIVersion +import com.ecwid.maleorang.annotation.HttpMethod +import com.ecwid.maleorang.annotation.Method +import com.ecwid.maleorang.annotation.PathParam + +/** + * Created by: Manuel Lara + */ +@Method(httpMethod = HttpMethod.DELETE, version = APIVersion.v3_0, path = "/lists/{list_id}/segments/{segment_id}") +class DeleteSegmentMethod( + @JvmField + @PathParam + val list_id: String, + + @JvmField + @PathParam + val segment_id: String +) : MailchimpMethod() diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/EditSegmentMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/EditSegmentMethod.kt new file mode 100644 index 0000000..d1917f1 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/EditSegmentMethod.kt @@ -0,0 +1,51 @@ +package com.ecwid.maleorang.method.v3_0.lists.segments + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * Created by: Manuel Lara + */ +sealed class EditSegmentMethod : MailchimpMethod() { + /** + * + */ + @Method(httpMethod = HttpMethod.POST, version = APIVersion.v3_0, path = "/lists/{list_id}/segments") + class Create( + @JvmField + @PathParam + val list_id: String + + ) : EditSegmentMethod() + + /** + * + */ + @Method(httpMethod = HttpMethod.PATCH, version = APIVersion.v3_0, path = "/lists/{list_id}/segments/{segment_id}") + class Update( + @JvmField + @PathParam + val list_id: String, + + @JvmField + @PathParam + val segment_id: String + + ) : EditSegmentMethod() + + + @JvmField + @Field + var name: String? = null + + @JvmField + @Field + var static_segment: List? = null + + @JvmField + @Field + var options: MailchimpObject? = null //TODO create a options object for Segments + + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/GetSegmentMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/GetSegmentMethod.kt new file mode 100644 index 0000000..79e5e34 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/GetSegmentMethod.kt @@ -0,0 +1,28 @@ +package com.ecwid.maleorang.method.v3_0.lists.segments + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.annotation.* + +/** + * Created by: Manuel Lara + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/lists/{list_id}/segments/{segment_id}") +class GetSegmentMethod( + @JvmField + @PathParam + val list_id: String, + + @JvmField + @PathParam + val segment_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/GetSegmentsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/GetSegmentsMethod.kt new file mode 100644 index 0000000..add5a32 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/GetSegmentsMethod.kt @@ -0,0 +1,69 @@ +package com.ecwid.maleorang.method.v3_0.lists.segments + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* + +/** + * Created by: Manuel Lara + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path ="/lists/{list_id}/segments") +class GetSegmentsMethod( + @JvmField + @PathParam + val list_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + @JvmField + @QueryStringParam + var type: TypeSegment? = null + + @JvmField + @QueryStringParam + var since_created_at: Date? = null + + @JvmField + @QueryStringParam + var before_created_at: Date? = null + + @JvmField + @QueryStringParam + var since_updated_at: Date? = null + + @JvmField + @QueryStringParam + var before_updated_at: Date? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var segments: List? = null + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/SegmentInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/SegmentInfo.kt new file mode 100644 index 0000000..b375337 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/SegmentInfo.kt @@ -0,0 +1,44 @@ +package com.ecwid.maleorang.method.v3_0.lists.segments + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ +class SegmentInfo : MailchimpObject() { + + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var name: String? = null + + @JvmField + @Field + var member_count: Int? = null + + @JvmField + @Field + var type: TypeSegment? = null + + @JvmField + @Field + var create_at: Date? = null + + @JvmField + @Field + var updated_at: Date? = null + + @JvmField + @Field + var options: MailchimpObject? = null //TODO: must create a options object + + @JvmField + @Field + var list_id: String? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/TypeSegment.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/TypeSegment.kt new file mode 100644 index 0000000..b3e830a --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/lists/segments/TypeSegment.kt @@ -0,0 +1,10 @@ +package com.ecwid.maleorang.method.v3_0.lists.segments + +/** + * Created by: Manuel Lara + */ +enum class TypeSegment(val type: String) { + SAVED("saved"), + STATIC("static"), + FUZZY("fuzzy") +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignBounceReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignBounceReport.kt new file mode 100644 index 0000000..51b0a75 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignBounceReport.kt @@ -0,0 +1,23 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignBounceReport : MailchimpObject() { + @JvmField + @Field + var hard_bounces: Int? = null + + @JvmField + @Field + var soft_bounces: Int? = null + + @JvmField + @Field + var syntax_errors: Int? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignClicksReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignClicksReport.kt new file mode 100644 index 0000000..ff279e4 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignClicksReport.kt @@ -0,0 +1,32 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignClicksReport : MailchimpObject() { + @JvmField + @Field + var clicks_total: Int? = null + + @JvmField + @Field + var unique_clicks: Int? = null + + @JvmField + @Field + var unique_subscriber_clicks: Int? = null + + @JvmField + @Field + var click_rate: Double? = null + + @JvmField + @Field + var last_click: Date? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignDeliveryStatusReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignDeliveryStatusReport.kt new file mode 100644 index 0000000..e22046d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignDeliveryStatusReport.kt @@ -0,0 +1,32 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignDeliveryStatusReport : MailchimpObject() { + @JvmField + @Field + var enabled: Boolean? = null + + @JvmField + @Field + var can_cancel: Boolean? = null + + @JvmField + @Field + var status: String? = null + + @JvmField + @Field + var emails_sent: Int? = null + + @JvmField + @Field + var emails_canceled: Int? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignEcommerceReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignEcommerceReport.kt new file mode 100644 index 0000000..a29f868 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignEcommerceReport.kt @@ -0,0 +1,24 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignEcommerceReport : MailchimpObject() { + @JvmField + @Field + var total_orders: Int? = null + + @JvmField + @Field + var total_spent: Double? = null + + @JvmField + @Field + var total_revenue: Double? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignFacebookLikesReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignFacebookLikesReport.kt new file mode 100644 index 0000000..079775d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignFacebookLikesReport.kt @@ -0,0 +1,24 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignFacebookLikesReport : MailchimpObject() { + @JvmField + @Field + var recipient_likes: Int? = null + + @JvmField + @Field + var unique_likes: Int? = null + + @JvmField + @Field + var facebook_likes: Int? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignForwardsReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignForwardsReport.kt new file mode 100644 index 0000000..5d1de41 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignForwardsReport.kt @@ -0,0 +1,20 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignForwardsReport : MailchimpObject() { + @JvmField + @Field + var forwards_count: Int? = null + + @JvmField + @Field + var forwards_opens: Int? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignIndustryStatsReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignIndustryStatsReport.kt new file mode 100644 index 0000000..5c3f899 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignIndustryStatsReport.kt @@ -0,0 +1,41 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignIndustryStatsReport : MailchimpObject() { + + @JvmField + @Field + var type: String? = null + + @JvmField + @Field + var open_rate: Double? = null + + @JvmField + @Field + var click_rate: Double? = null + + @JvmField + @Field + var bounce_rate: Double? = null + + @JvmField + @Field + var unopen_rate: Double? = null + + @JvmField + @Field + var unsub_rate: Double? = null + + @JvmField + @Field + var abuse_rate: Double? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignListStatsReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignListStatsReport.kt new file mode 100644 index 0000000..4eadc85 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignListStatsReport.kt @@ -0,0 +1,28 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignListStatsReport : MailchimpObject() { + @JvmField + @Field + var sub_rate: Double? = null + + @JvmField + @Field + var unsub_rate: Double? = null + + @JvmField + @Field + var open_rate: Double? = null + + @JvmField + @Field + var click_rate: Double? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignLocationInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignLocationInfo.kt new file mode 100644 index 0000000..1c97920 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignLocationInfo.kt @@ -0,0 +1,22 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class CampaignLocationInfo : MailchimpObject() { + @JvmField + @Field + var country_code: String? = null + + @JvmField + @Field + var region: String? = null + + @JvmField + @Field + var opens: Int? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignOpensReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignOpensReport.kt new file mode 100644 index 0000000..ea639a1 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignOpensReport.kt @@ -0,0 +1,28 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignOpensReport : MailchimpObject() { + @JvmField + @Field + var opens_total: Int? = null + + @JvmField + @Field + var unique_opens: Int? = null + + @JvmField + @Field + var open_rate: Double? = null + + @JvmField + @Field + var last_open: Date? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignReportInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignReportInfo.kt new file mode 100644 index 0000000..1965767 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignReportInfo.kt @@ -0,0 +1,108 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignReportInfo : MailchimpObject() { + @JvmField + @Field + var id: String? = null + + @JvmField + @Field + var campaign_title: String? = null + + @JvmField + @Field + var type: String? = null + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var list_name: String? = null + + @JvmField + @Field + var subject_line: String? = null + + @JvmField + @Field + var emails_sent: Int? = null + + @JvmField + @Field + var abuse_reports: Int? = null + + @JvmField + @Field + var unsubscribed: Int? = null + + @JvmField + @Field + var send_time: Date? = null + + @JvmField + @Field + var rss_last_send: String? = null + + @JvmField + @Field + var bounces: CampaignBounceReport? = null + + @JvmField + @Field + var forwards: CampaignForwardsReport? = null + + @JvmField + @Field + var opens: CampaignOpensReport? = null + + @JvmField + @Field + var clicks: CampaignClicksReport? = null + + @JvmField + @Field + var facebook_likes: CampaignFacebookLikesReport? = null + + @JvmField + @Field + var industry_stats: CampaignIndustryStatsReport? = null + + @JvmField + @Field + var list_stats: CampaignListStatsReport? = null + + @JvmField + @Field + var ab_split: MailchimpObject? = null //TODO create abSplit Object + + @JvmField + @Field + var timewarp: CampaignTimewarpReport? = null + + @JvmField + @Field + var timeseries: List? = null + + @JvmField + @Field + var share_report: CampaignShareVIPReport? = null + + @JvmField + @Field + var ecommerce: CampaignEcommerceReport? = null + + @JvmField + @Field + var delivery_status: CampaignDeliveryStatusReport? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignShareVIPReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignShareVIPReport.kt new file mode 100644 index 0000000..9de4a9a --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignShareVIPReport.kt @@ -0,0 +1,20 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignShareVIPReport : MailchimpObject() { + @JvmField + @Field + var share_url: String? = null + + @JvmField + @Field + var share_password: String? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignTimeseriesReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignTimeseriesReport.kt new file mode 100644 index 0000000..a43e6bd --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignTimeseriesReport.kt @@ -0,0 +1,28 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignTimeseriesReport : MailchimpObject() { + @JvmField + @Field + var timestamp: Date? = null + + @JvmField + @Field + var emails_sent: Int? = null + + @JvmField + @Field + var unique_opens: Int? = null + + @JvmField + @Field + var recipients_clicks: Int? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignTimewarpReport.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignTimewarpReport.kt new file mode 100644 index 0000000..29f60b3 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/CampaignTimewarpReport.kt @@ -0,0 +1,48 @@ +package com.ecwid.maleorang.method.v3_0.reports + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignTimewarpReport : MailchimpObject() { + @JvmField + @Field + var gmt_offset: Int? = null + + @JvmField + @Field + var opens: Int? = null + + @JvmField + @Field + var last_open: Date? = null + + @JvmField + @Field + var unique_opens: Int? = null + + @JvmField + @Field + var clicks: Int? = null + + @JvmField + @Field + var subject_line: String? = null + + @JvmField + @Field + var last_click: Date? = null + + @JvmField + @Field + var unique_clicks: Int? = null + + @JvmField + @Field + var bounces: Int? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignReportMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignReportMethod.kt new file mode 100644 index 0000000..f986ffb --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignReportMethod.kt @@ -0,0 +1,57 @@ +package com.ecwid.maleorang.method.v3_0.reports + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = " /reports/{campaign_id}") +class GetCampaignReportMethod( + @JvmField + @PathParam + val campaign_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + @JvmField + @QueryStringParam + var type: String? = null + + @JvmField + @QueryStringParam + var before_send_time: Date? = null + + @JvmField + @QueryStringParam + var since_send_time: Date? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var report: CampaignReportInfo? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignsLocationMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignsLocationMethod.kt new file mode 100644 index 0000000..d016c6f --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignsLocationMethod.kt @@ -0,0 +1,49 @@ +package com.ecwid.maleorang.method.v3_0.reports + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/reports/{campaign_id}/locations") +class GetCampaignLocationMethod( + @JvmField + @PathParam + val campaign_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + + class Response : MailchimpObject() { + @JvmField + @Field + var locations: List? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignsReportsMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignsReportsMethod.kt new file mode 100644 index 0000000..5d244d8 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/GetCampaignsReportsMethod.kt @@ -0,0 +1,54 @@ +package com.ecwid.maleorang.method.v3_0.reports + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/reports") +class GetCampaignsReportsMethod : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + @JvmField + @QueryStringParam + var type: String? = null + + @JvmField + @QueryStringParam + var before_send_time: Date? = null + + @JvmField + @QueryStringParam + var since_send_time: Date? = null + + + class Response : MailchimpObject() { + @JvmField + @Field + var reports: List? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/CampaignEmailAbuseInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/CampaignEmailAbuseInfo.kt new file mode 100644 index 0000000..ccaf536 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/CampaignEmailAbuseInfo.kt @@ -0,0 +1,44 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class CampaignEmailAbuseInfo : MailchimpObject() { + @JvmField + @Field + var id: Int? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var email_id: String? = null + + @JvmField + @Field + var email_address: String? = null + + @JvmField + @Field + var merge_fields: MailchimpObject? = null + + @JvmField + @Field + var vip: Boolean? = null + + @JvmField + @Field + var date: Date? = null + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/CampaignEmailActivityInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/CampaignEmailActivityInfo.kt new file mode 100644 index 0000000..72de4db --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/CampaignEmailActivityInfo.kt @@ -0,0 +1,30 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field + +/** + * Created by: Manuel Lara + */ + +class CampaignEmailActivityInfo : MailchimpObject() { + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var email_id: String? = null + + @JvmField + @Field + var email_address: String? = null + + @JvmField + @Field + var activity: List? = null +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/EmailReportActivityDetails.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/EmailReportActivityDetails.kt new file mode 100644 index 0000000..a86ce8f --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/EmailReportActivityDetails.kt @@ -0,0 +1,41 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +/** + * Created by: Manuel Lara + */ + +class EmailReportActivityDetails : MailchimpObject() { + @JvmField + @Field + var action: TypeEmailActivity? = null + + @JvmField + @Field + var type: TypeBounceActivity? = null + + @JvmField + @Field + var timestamp: Date? = null + + @JvmField + @Field + var url: String? = null + + @JvmField + @Field + var ip: String? = null + + + fun setAction(action: String) { + this.action = TypeEmailActivity.valueOf(action) + } + + fun setType(type: String) { + this.type = TypeBounceActivity.valueOf(type) + } + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignEmailActivityForSuscriberMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignEmailActivityForSuscriberMethod.kt new file mode 100644 index 0000000..0fc4b31 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignEmailActivityForSuscriberMethod.kt @@ -0,0 +1,56 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* +import org.apache.commons.codec.digest.DigestUtils + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = " /reports/{campaign_id}/email-activity/{subscriber_hash}") +class GetCampaignEmailActivityForSuscriberMethod( + @JvmField + @PathParam + val campaign_id: String, + email: String +) : MailchimpMethod() { + + @JvmField + @PathParam + val subscriber_hash: String = DigestUtils.md5Hex(email.toLowerCase()) + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + + class Response : MailchimpObject() { + @JvmField + @Field + var emails: CampaignEmailActivityInfo? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignsAbuseEmailActivityMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignsAbuseEmailActivityMethod.kt new file mode 100644 index 0000000..54ab5f8 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignsAbuseEmailActivityMethod.kt @@ -0,0 +1,40 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/reports/{campaign_id}/abuse-reports") +class GetCampaignsAbuseEmailActivityMethod( + @JvmField + @PathParam + val campaign_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var abuse_report: List? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignsEmailActivityMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignsEmailActivityMethod.kt new file mode 100644 index 0000000..777b96d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/GetCampaignsEmailActivityMethod.kt @@ -0,0 +1,50 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* +import java.util.* + +/** + * Created by: Manuel Lara + */ + +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/reports/{campaign_id}/email-activity") +class GetCampaignsEmailActivityMethod( + @JvmField + @PathParam + val campaign_id: String +) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = 0 + + @JvmField + @QueryStringParam + var offset: Int? = null + + + class Response : MailchimpObject() { + @JvmField + @Field + var emails: List? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/TypeBounceActivity.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/TypeBounceActivity.kt new file mode 100644 index 0000000..a0a91a5 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/TypeBounceActivity.kt @@ -0,0 +1,16 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + +import com.google.gson.annotations.SerializedName + +/** + * Created by larar on 15/10/2016. + */ + +enum class TypeBounceActivity(val type: String) { + @SerializedName("hard") + HARD("hard"), + @SerializedName("soft") + SOFT("soft"), + @SerializedName("null") + NONE("null") +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/TypeEmailActivity.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/TypeEmailActivity.kt new file mode 100644 index 0000000..773e38d --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email/TypeEmailActivity.kt @@ -0,0 +1,16 @@ +package com.ecwid.maleorang.method.v3_0.reports.email + +import com.google.gson.annotations.SerializedName + +/** + * Created by larar on 15/10/2016. + */ + +enum class TypeEmailActivity(val type: String) { + @SerializedName("bounce") + BOUNCE("bounce"), + @SerializedName("click") + CLICK("click"), + @SerializedName("open") + OPEN("open") +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email_activity/EmailActivityInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email_activity/EmailActivityInfo.kt new file mode 100644 index 0000000..27cf986 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email_activity/EmailActivityInfo.kt @@ -0,0 +1,70 @@ +package com.ecwid.maleorang.method.v3_0.reports.email_activity + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import com.google.gson.annotations.SerializedName +import java.util.* + +class EmailActivityInfo : MailchimpObject() { + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var list_id: String? = null + + @JvmField + @Field + var email_id: String? = null + + @JvmField + @Field + var email_address: String? = null + + @JvmField + @Field + var activity: Array? = null + + class ActivityInfo : MailchimpObject() { + + @JvmField + @Field + var action: Action? = null + + enum class Action { + @SerializedName("open") + OPEN, + @SerializedName("click") + CLICK, + @SerializedName("bounce") + BOUNCE + } + + @JvmField + @Field + var type: Type? = null + + enum class Type { + @SerializedName("hard") + HARD, + @SerializedName("soft") + SOFT + } + + @JvmField + @Field + var timestamp: Date? = null + + @JvmField + @Field + var url: String? = null + + @JvmField + @Field + var ip: String? = null + + } + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email_activity/GetEmailActivitysMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email_activity/GetEmailActivitysMethod.kt new file mode 100644 index 0000000..b6aa8aa --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/email_activity/GetEmailActivitysMethod.kt @@ -0,0 +1,43 @@ +package com.ecwid.maleorang.method.v3_0.reports.email_activity + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * [Get a list of member’s subscriber activity in a specific campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/reports/email-activity/#read-get_reports_campaign_id_email_activity) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/reports/{campaign_id}/email-activity") +class GetEmailActivitysMethod(@JvmField @PathParam val campaign_id: String) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var emails: List? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } + +} diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/unsubscribed/GetUnsubscribedMethod.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/unsubscribed/GetUnsubscribedMethod.kt new file mode 100644 index 0000000..beabcc8 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/unsubscribed/GetUnsubscribedMethod.kt @@ -0,0 +1,43 @@ +package com.ecwid.maleorang.method.v3_0.reports.unsubscribed + +import com.ecwid.maleorang.MailchimpMethod +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.* + +/** + * [Get information about members who have unsubscribed from a specific campaign](https://developer.mailchimp.com/documentation/mailchimp/reference/reports/unsubscribed/#read-get_reports_campaign_id_unsubscribed) + */ +@Method(httpMethod = HttpMethod.GET, version = APIVersion.v3_0, path = "/reports/{campaign_id}/unsubscribed") +class GetUnsubscribedMethod(@JvmField @PathParam val campaign_id: String) : MailchimpMethod() { + + @JvmField + @QueryStringParam + var fields: String? = null + + @JvmField + @QueryStringParam + var exclude_fields: String? = null + + @JvmField + @QueryStringParam + var count: Int? = null + + @JvmField + @QueryStringParam + var offset: Int? = null + + class Response : MailchimpObject() { + @JvmField + @Field + var unsubscribes: List? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var total_items: Int? = null + } + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/method/v3_0/reports/unsubscribed/UnsubscribeInfo.kt b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/unsubscribed/UnsubscribeInfo.kt new file mode 100644 index 0000000..1222209 --- /dev/null +++ b/src/main/java/com/ecwid/maleorang/method/v3_0/reports/unsubscribed/UnsubscribeInfo.kt @@ -0,0 +1,41 @@ +package com.ecwid.maleorang.method.v3_0.reports.unsubscribed + +import com.ecwid.maleorang.MailchimpObject +import com.ecwid.maleorang.annotation.Field +import java.util.* + +class UnsubscribeInfo : MailchimpObject() { + + @JvmField + @Field + var email_id: String? = null + + @JvmField + @Field + var email_address: String? = null + + @JvmField + @Field + var merge_fields: MailchimpObject? = null + + @JvmField + @Field + var vip: Boolean? = null + + @JvmField + @Field + var timestamp: Date? = null + + @JvmField + @Field + var reason: String? = null + + @JvmField + @Field + var campaign_id: String? = null + + @JvmField + @Field + var list_id: String? = null + +} \ No newline at end of file diff --git a/src/main/java/com/ecwid/maleorang/util/DateUtil.kt b/src/main/java/com/ecwid/maleorang/util/DateUtil.kt index 12414e5..265393f 100644 --- a/src/main/java/com/ecwid/maleorang/util/DateUtil.kt +++ b/src/main/java/com/ecwid/maleorang/util/DateUtil.kt @@ -6,7 +6,6 @@ import java.util.* internal object DateUtil { private val format = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC) - fun formatDate(date: Date) = format.print(date.time) fun parseDate(string: String) = Date(format.parseMillis(string)) }