
com.sailthru.client.params.job.UpdateJob Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sailthru-java-client Show documentation
Show all versions of sailthru-java-client Show documentation
Java client library for Sailthru API
package com.sailthru.client.params.job;
import com.google.gson.reflect.TypeToken;
import com.sailthru.client.SailthruUtil;
import com.sailthru.client.params.ApiFileParams;
import com.sailthru.client.params.query.Query;
import java.io.File;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author Prajwal Tuladhar
*/
public class UpdateJob extends Job implements ApiFileParams {
private static final String JOB = "update";
protected String emails;
protected String url;
protected transient File file;
protected Map update;
protected Map query;
public UpdateJob() {
this.job = JOB;
this.update = new HashMap();
}
public UpdateJob setEmails(List emails) {
this.emails = SailthruUtil.arrayListToCSV(emails);
return this;
}
public UpdateJob setUrl(String url) {
this.url = url;
return this;
}
public UpdateJob setUrl(URI url) {
this.url = url.toString();
return this;
}
public UpdateJob setFile(File file) {
this.file = file;
return this;
}
public UpdateJob setFile(String file) {
this.file = new File(file);
return this;
}
public UpdateJob setUpdate(Map update) {
this.update = update;
return this;
}
public UpdateJob setUpdateVars(Map vars) {
this.update.put("vars", vars);
return this;
}
public UpdateJob setUpdateLists(Map lists) {
this.update.put("lists", lists);
return this;
}
public UpdateJob setUpdateOptout(String optout) {
this.update.put("optout", optout);
return this;
}
public UpdateJob setQuery(Query query) {
this.query = query.toHashMap();
return this;
}
@Override
public Type getType() {
return new TypeToken() {}.getType();
}
public Map getFileParams() {
Map files = new HashMap();
if (this.file != null) {
files.put("file", this.file);
}
return files;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy