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

com.sinch.sdk.domains.sms.models.BaseDeliveryReport Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.sinch.sdk.domains.sms.models;

import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent;
import java.util.Objects;
import java.util.Optional;

/**
 * Base class for Delivery Report WebHook
 *
 * @since 1.0
 */
public abstract class BaseDeliveryReport implements WebhooksEvent {

  private final String batchId;
  private final String clientReference;

  /**
   * @param batchId Required. The ID of the batch this delivery report belongs to.
   * @param clientReference The client identifier of the batch this delivery report belongs to, if
   *     set when submitting batch.
   */
  public BaseDeliveryReport(String batchId, String clientReference) {
    Objects.requireNonNull(batchId);
    this.batchId = batchId;
    this.clientReference = clientReference;
  }

  public String getBatchId() {
    return batchId;
  }

  public Optional getClientReference() {
    return Optional.ofNullable(clientReference);
  }

  @Override
  public String toString() {
    return "BaseDeliveryReport{"
        + "batchId='"
        + batchId
        + '\''
        + ", clientReference='"
        + clientReference
        + '\''
        + '}';
  }

  public abstract static class Builder> {
    protected String batchId;
    protected String clientReference;

    public B setBatchId(String batchId) {
      this.batchId = batchId;
      return self();
    }

    public B setClientReference(String clientReference) {
      this.clientReference = clientReference;
      return self();
    }

    @SuppressWarnings("unchecked")
    protected B self() {
      return (B) this;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy