io.github.eduardromanyuk.turbosms.model.request.builder.TsMessageSendRequestAbstractBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of turbosms-spring-boot-starter Show documentation
Show all versions of turbosms-spring-boot-starter Show documentation
This starter provides infrastructure for using TurboSMS sms/viber provider.
HTTP API was used for communication.
The newest version!
package io.github.eduardromanyuk.turbosms.model.request.builder;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public abstract class TsMessageSendRequestAbstractBuilder> {
protected T message;
protected TsMessageSendRequestAbstractBuilder(T message) {
this.message = message;
}
protected abstract B getBuilder();
public B text(String text) {
message.setText(text);
return getBuilder();
}
public B recipients(List recipients) {
message.setRecipients(recipients);
return getBuilder();
}
public B recipients(String... recipients) {
message.setRecipients(Arrays.asList(recipients));
return getBuilder();
}
public B recipient(String recipient) {
if (message.getRecipients() == null) {
message.setRecipients(new LinkedList<>());
}
message.getRecipients().add(recipient);
return getBuilder();
}
public B startTime(LocalDateTime startTime) {
message.setStartTime(startTime);
return getBuilder();
}
}