com.withabound.resources.Mailings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of withabound-java Show documentation
Show all versions of withabound-java Show documentation
The Abound Java SDK provides convenient access to the Abound API from applications written in Java.
The newest version!
package com.withabound.resources;
import com.withabound.AboundConfig;
import com.withabound.models.mailings.Mailing;
import com.withabound.models.mailings.MailingParams;
import com.withabound.models.mailings.MailingRequest;
import com.withabound.resources.base.AboundBulkResponse;
import com.withabound.resources.base.AboundDocumentScopedResource;
import com.withabound.resources.base.AboundResponse;
import com.withabound.resources.base.EmptyJsonObject;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import okhttp3.OkHttpClient;
public class Mailings extends AboundDocumentScopedResource {
public Mailings(final AboundConfig aboundConfig, final OkHttpClient httpClient) {
super(aboundConfig, httpClient, Mailing.class);
}
@Override
protected String getPath() {
return "/mailings";
}
public AboundBulkResponse list(final String userId, final String documentId)
throws IOException {
return super.listForDocument(userId, documentId);
}
public AboundBulkResponse list(
final String userId, final String documentId, final MailingParams params) throws IOException {
return super.listForDocument(userId, documentId, params);
}
public AboundResponse create(final String userId, final String documentId)
throws IOException {
return super.createForDocument(userId, documentId, Collections.emptyMap());
}
public AboundResponse create(
final String userId, final String documentId, final MailingRequest toCreate)
throws IOException {
final Map requestPayload =
Collections.singletonMap("mailing", toCreate);
return super.createForDocument(userId, documentId, requestPayload);
}
public AboundResponse retrieve(
final String userId, final String documentId, final String mailingId) throws IOException {
return super.retrieveForDocument(userId, documentId, mailingId);
}
public AboundResponse delete(
final String userId, final String documentId, final String mailingId) throws IOException {
return super.deleteForDocument(userId, documentId, mailingId);
}
}