com.mailgun.model.mailing.lists.MailingListNewMemberRequest Maven / Gradle / Ivy
Show all versions of mailgun-java Show documentation
package com.mailgun.model.mailing.lists;
import com.mailgun.enums.YesNo;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import java.util.Map;
/**
*
* Mailing list new member request.
*
*
* @see Mailing Lists
*/
@Getter
@ToString
@EqualsAndHashCode
@Builder
public class MailingListNewMemberRequest {
/**
*
* Valid email address specification, e.g. {@code "Alice "} or just {@code "[email protected]" }.
*
*/
String address;
/**
*
* Optional member name.
*
*/
String name;
/**
*
* A map with arbitrary keys/values that turns into a JSON dictionary, e.g. {@code {"sex":"female","age":27} }.
*
*/
Map vars;
/**
*
* yes
to add as subscribed (default).
*
*
* no
as unsubscribed.
*
*/
String subscribed;
/**
*
* yes
to update member if present.
*
*
* no
to raise error in case of a duplicate member (default).
*
*/
String upsert;
public static class MailingListNewMemberRequestBuilder {
/**
*
* true
to add as subscribed (default).
*
*
* false
as unsubscribed.
*
*
* @param subscribed true
to lists subscribed, false
for unsubscribed
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MailingListNewMemberRequest.MailingListNewMemberRequestBuilder subscribed(boolean subscribed) {
this.subscribed = YesNo.getValue(subscribed);
return this;
}
/**
*
* true
to update member if present.
*
*
* false
to raise error in case of a duplicate member (default).
*
*
* @param upsert true
to update member if present, false
to raise error in case of a duplicate member.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MailingListNewMemberRequest.MailingListNewMemberRequestBuilder upsert(boolean upsert) {
this.upsert = YesNo.getValue(upsert);
return this;
}
}
}