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

com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters Maven / Gradle / Ivy

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

import com.sinch.sdk.core.models.OptionalValue;
import java.util.Collection;

/**
 * Parameters request to update" a group
 *
 * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/UpdateGroup
 * @since 1.0
 */
public class GroupUpdateRequestParameters {

  private final OptionalValue name;
  private final OptionalValue> add;
  private final OptionalValue> remove;
  private final OptionalValue addFromGroup;
  private final OptionalValue removeFromGroup;
  private final OptionalValue autoUpdate;

  private GroupUpdateRequestParameters(
      OptionalValue name,
      OptionalValue> add,
      OptionalValue> remove,
      OptionalValue addFromGroup,
      OptionalValue removeFromGroup,
      OptionalValue autoUpdate) {
    this.name = name;
    this.add = add;
    this.remove = remove;
    this.addFromGroup = addFromGroup;
    this.removeFromGroup = removeFromGroup;
    this.autoUpdate = autoUpdate;
  }

  public OptionalValue getName() {
    return name;
  }

  public OptionalValue> getAdd() {
    return add;
  }

  public OptionalValue> getRemove() {
    return remove;
  }

  public OptionalValue getAddFromGroup() {
    return addFromGroup;
  }

  public OptionalValue getRemoveFromGroup() {
    return removeFromGroup;
  }

  public OptionalValue getAutoUpdate() {
    return autoUpdate;
  }

  @Override
  public String toString() {
    return "GroupUpdateRequestParameters{"
        + "name='"
        + name
        + '\''
        + ", add="
        + add
        + ", remove="
        + remove
        + ", addFromGroup='"
        + addFromGroup
        + '\''
        + ", removeFromGroup='"
        + removeFromGroup
        + '\''
        + ", autoUpdate="
        + autoUpdate
        + '}';
  }

  public static Builder builder() {
    return new Builder();
  }

  public static Builder builder(GroupUpdateRequestParameters parameters) {
    return new Builder(parameters);
  }

  public static class Builder {

    OptionalValue name = OptionalValue.empty();

    OptionalValue> add = OptionalValue.empty();

    OptionalValue> remove = OptionalValue.empty();

    OptionalValue addFromGroup = OptionalValue.empty();

    OptionalValue removeFromGroup = OptionalValue.empty();

    OptionalValue autoUpdate = OptionalValue.empty();

    private Builder() {}

    private Builder(GroupUpdateRequestParameters parameters) {
      this.name = parameters.getName();
      this.add = parameters.getAdd();
      this.remove = parameters.getRemove();
      this.addFromGroup = parameters.getAddFromGroup();
      this.removeFromGroup = parameters.getRemoveFromGroup();
      this.autoUpdate = parameters.getAutoUpdate();
    }

    /**
     * @param name The name of the group. Omitting name from the JSON body will leave the name
     *     unchanged. To remove an existing name set, name explicitly to the JSON value null.
     * @return current builder
     */
    public Builder setName(String name) {
      this.name = OptionalValue.of(name);
      return this;
    }

    /**
     * @param add Add a list of phone numbers (MSISDNs) to this group. The phone numbers are a
     *     strings within an array and must be in E.164 format.
     * @return current builder
     */
    public Builder setAdd(Collection add) {
      this.add = OptionalValue.of(add);
      return this;
    }

    /**
     * @param remove Remove a list of phone numbers (MSISDNs) to this group.The phone numbers are a
     *     strings within an array and must be in E.164 format.
     * @return current builder
     */
    public Builder setRemove(Collection remove) {
      this.remove = OptionalValue.of(remove);
      return this;
    }

    /**
     * @param addFromGroup Copy the members from the another group into this group. Constraints:
     *     Must be valid group ID
     * @return current builder
     */
    public Builder setAddFromGroup(String addFromGroup) {
      this.addFromGroup = OptionalValue.of(addFromGroup);
      return this;
    }

    /**
     * @param removeFromGroup Remove the members in a specified group from this group.
     *     

Constraints: Must be valid group ID * @return current builder */ public Builder setRemoveFromGroup(String removeFromGroup) { this.removeFromGroup = OptionalValue.of(removeFromGroup); return this; } /** * @param autoUpdate auto update settings * @return current builder */ public Builder setAutoUpdate(GroupAutoUpdateRequestParameters autoUpdate) { this.autoUpdate = OptionalValue.of(autoUpdate); return this; } public GroupUpdateRequestParameters build() { return new GroupUpdateRequestParameters( name, add, remove, addFromGroup, removeFromGroup, autoUpdate); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy