All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sailthru.client.params.User Maven / Gradle / Ivy

The newest version!
package com.sailthru.client.params;

import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.sailthru.client.ApiAction;
import java.lang.reflect.Type;
import java.util.Map;

/**
 * User params
 * @author Prajwal Tuladhar 
 */
public class User extends AbstractApiParams implements ApiParams {
    public static final String PARAM_TEMPLATE = "user";
    
    protected String id;
    protected String key;
    protected Map fields;
    protected Map keys;
    protected String keysconflict;
    protected Map vars;
    protected Map lists;
    protected String optout_email;
    protected String optout_sms_status;
    protected Map login;
    @SerializedName("sms_marketing_status")
    protected OptOutType smsMarketingStatus;
    @SerializedName("sms_transactional_status")
    protected OptOutType smsTransactionalStatus;
    
    public User(String id) {
        this.id = id;
    }

    public User() {
        // this will be used when new user_id is to be created
    }
    
    public User setKey(String key) {
        this.key = key;
        return this;
    }
    
    public User setFields(Map fields) {
        this.fields = fields;
        return this;
    }
    
    public User setKeys(Map keys) {
        this.keys = keys;
        return this;
    }

    public User setKeysConflict(String keysConflict) {
        this.keysconflict = keysConflict;
        return this;
    }
    
    public User setVars(Map vars) {
        this.vars = vars;
        return this;
    }
    
    public User setLists(Map lists) {
        this.lists = lists;
        return this;
    }
    
    public User setOptoutEmail(String optoutEmail) {
        this.optout_email = optoutEmail;
        return this;
    }

    public User setOptoutSmsStatus(String optoutSmsStatus) {
        this.optout_sms_status = optoutSmsStatus;
        return this;
    }

    public User setLogin(Map login) {
        this.login = login;
        return this;
    }

    public User setSmsMarketingStatus(OptOutType smsMarketingStatus) {
        this.smsMarketingStatus = smsMarketingStatus;
        return this;
    }

    public User setSmsTransactionalStatus(OptOutType smsTransactionalStatus) {
        this.smsTransactionalStatus = smsTransactionalStatus;
        return this;
    }

    public Type getType() {
        java.lang.reflect.Type _type = new TypeToken() {}.getType();
        return _type;
    }

    public ApiAction getApiCall() {
        return ApiAction.user;
    }

    public enum OptOutType {
        OPT_OUT_TYPE_STOP("opt-out"),
        OPT_OUT_TYPE_START("opt-in"),
        OPT_OUT_TYPE_PENDING("pending"),
        OPT_OUT_TYPE_DOUBLE_OPT_IN("double-opt-in");
        public final String optOutTypeStr;

        OptOutType(String optOutTypeStr) {
            this.optOutTypeStr = optOutTypeStr;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy