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

software.amazon.awssdk.services.pinpoint.model.CampaignSmsMessage Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating with Amazon Pinpoint Service

The newest version!
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.pinpoint.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Specifies the content and settings for an SMS message that's sent to recipients of a campaign. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CampaignSmsMessage implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField BODY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Body") .getter(getter(CampaignSmsMessage::body)).setter(setter(Builder::body)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Body").build()).build(); private static final SdkField MESSAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("MessageType").getter(getter(CampaignSmsMessage::messageTypeAsString)) .setter(setter(Builder::messageType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageType").build()).build(); private static final SdkField ORIGINATION_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("OriginationNumber").getter(getter(CampaignSmsMessage::originationNumber)) .setter(setter(Builder::originationNumber)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginationNumber").build()).build(); private static final SdkField SENDER_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SenderId").getter(getter(CampaignSmsMessage::senderId)).setter(setter(Builder::senderId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SenderId").build()).build(); private static final SdkField ENTITY_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("EntityId").getter(getter(CampaignSmsMessage::entityId)).setter(setter(Builder::entityId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityId").build()).build(); private static final SdkField TEMPLATE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TemplateId").getter(getter(CampaignSmsMessage::templateId)).setter(setter(Builder::templateId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateId").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BODY_FIELD, MESSAGE_TYPE_FIELD, ORIGINATION_NUMBER_FIELD, SENDER_ID_FIELD, ENTITY_ID_FIELD, TEMPLATE_ID_FIELD)); private static final long serialVersionUID = 1L; private final String body; private final String messageType; private final String originationNumber; private final String senderId; private final String entityId; private final String templateId; private CampaignSmsMessage(BuilderImpl builder) { this.body = builder.body; this.messageType = builder.messageType; this.originationNumber = builder.originationNumber; this.senderId = builder.senderId; this.entityId = builder.entityId; this.templateId = builder.templateId; } /** *

* The body of the SMS message. *

* * @return The body of the SMS message. */ public final String body() { return body; } /** *

* The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or time-sensitive, such as a * one-time passwords) and PROMOTIONAL (for messsages that aren't critical or time-sensitive, such as marketing * messages). *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #messageType} will * return {@link MessageType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #messageTypeAsString}. *

* * @return The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or time-sensitive, * such as a one-time passwords) and PROMOTIONAL (for messsages that aren't critical or time-sensitive, such * as marketing messages). * @see MessageType */ public final MessageType messageType() { return MessageType.fromValue(messageType); } /** *

* The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or time-sensitive, such as a * one-time passwords) and PROMOTIONAL (for messsages that aren't critical or time-sensitive, such as marketing * messages). *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #messageType} will * return {@link MessageType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #messageTypeAsString}. *

* * @return The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or time-sensitive, * such as a one-time passwords) and PROMOTIONAL (for messsages that aren't critical or time-sensitive, such * as marketing messages). * @see MessageType */ public final String messageTypeAsString() { return messageType; } /** *

* The long code to send the SMS message from. This value should be one of the dedicated long codes that's assigned * to your AWS account. Although it isn't required, we recommend that you specify the long code using an E.164 * format to ensure prompt and accurate delivery of the message. For example, +12065550100. *

* * @return The long code to send the SMS message from. This value should be one of the dedicated long codes that's * assigned to your AWS account. Although it isn't required, we recommend that you specify the long code * using an E.164 format to ensure prompt and accurate delivery of the message. For example, +12065550100. */ public final String originationNumber() { return originationNumber; } /** *

* The sender ID to display on recipients' devices when they receive the SMS message. *

* * @return The sender ID to display on recipients' devices when they receive the SMS message. */ public final String senderId() { return senderId; } /** *

* The entity ID or Principal Entity (PE) id received from the regulatory body for sending SMS in your country. *

* * @return The entity ID or Principal Entity (PE) id received from the regulatory body for sending SMS in your * country. */ public final String entityId() { return entityId; } /** *

* The template ID received from the regulatory body for sending SMS in your country. *

* * @return The template ID received from the regulatory body for sending SMS in your country. */ public final String templateId() { return templateId; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(body()); hashCode = 31 * hashCode + Objects.hashCode(messageTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(originationNumber()); hashCode = 31 * hashCode + Objects.hashCode(senderId()); hashCode = 31 * hashCode + Objects.hashCode(entityId()); hashCode = 31 * hashCode + Objects.hashCode(templateId()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CampaignSmsMessage)) { return false; } CampaignSmsMessage other = (CampaignSmsMessage) obj; return Objects.equals(body(), other.body()) && Objects.equals(messageTypeAsString(), other.messageTypeAsString()) && Objects.equals(originationNumber(), other.originationNumber()) && Objects.equals(senderId(), other.senderId()) && Objects.equals(entityId(), other.entityId()) && Objects.equals(templateId(), other.templateId()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("CampaignSmsMessage").add("Body", body()).add("MessageType", messageTypeAsString()) .add("OriginationNumber", originationNumber()).add("SenderId", senderId()).add("EntityId", entityId()) .add("TemplateId", templateId()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Body": return Optional.ofNullable(clazz.cast(body())); case "MessageType": return Optional.ofNullable(clazz.cast(messageTypeAsString())); case "OriginationNumber": return Optional.ofNullable(clazz.cast(originationNumber())); case "SenderId": return Optional.ofNullable(clazz.cast(senderId())); case "EntityId": return Optional.ofNullable(clazz.cast(entityId())); case "TemplateId": return Optional.ofNullable(clazz.cast(templateId())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CampaignSmsMessage) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The body of the SMS message. *

* * @param body * The body of the SMS message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder body(String body); /** *

* The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or time-sensitive, such * as a one-time passwords) and PROMOTIONAL (for messsages that aren't critical or time-sensitive, such as * marketing messages). *

* * @param messageType * The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or * time-sensitive, such as a one-time passwords) and PROMOTIONAL (for messsages that aren't critical or * time-sensitive, such as marketing messages). * @see MessageType * @return Returns a reference to this object so that method calls can be chained together. * @see MessageType */ Builder messageType(String messageType); /** *

* The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or time-sensitive, such * as a one-time passwords) and PROMOTIONAL (for messsages that aren't critical or time-sensitive, such as * marketing messages). *

* * @param messageType * The SMS message type. Valid values are TRANSACTIONAL (for messages that are critical or * time-sensitive, such as a one-time passwords) and PROMOTIONAL (for messsages that aren't critical or * time-sensitive, such as marketing messages). * @see MessageType * @return Returns a reference to this object so that method calls can be chained together. * @see MessageType */ Builder messageType(MessageType messageType); /** *

* The long code to send the SMS message from. This value should be one of the dedicated long codes that's * assigned to your AWS account. Although it isn't required, we recommend that you specify the long code using * an E.164 format to ensure prompt and accurate delivery of the message. For example, +12065550100. *

* * @param originationNumber * The long code to send the SMS message from. This value should be one of the dedicated long codes * that's assigned to your AWS account. Although it isn't required, we recommend that you specify the * long code using an E.164 format to ensure prompt and accurate delivery of the message. For example, * +12065550100. * @return Returns a reference to this object so that method calls can be chained together. */ Builder originationNumber(String originationNumber); /** *

* The sender ID to display on recipients' devices when they receive the SMS message. *

* * @param senderId * The sender ID to display on recipients' devices when they receive the SMS message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder senderId(String senderId); /** *

* The entity ID or Principal Entity (PE) id received from the regulatory body for sending SMS in your country. *

* * @param entityId * The entity ID or Principal Entity (PE) id received from the regulatory body for sending SMS in your * country. * @return Returns a reference to this object so that method calls can be chained together. */ Builder entityId(String entityId); /** *

* The template ID received from the regulatory body for sending SMS in your country. *

* * @param templateId * The template ID received from the regulatory body for sending SMS in your country. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateId(String templateId); } static final class BuilderImpl implements Builder { private String body; private String messageType; private String originationNumber; private String senderId; private String entityId; private String templateId; private BuilderImpl() { } private BuilderImpl(CampaignSmsMessage model) { body(model.body); messageType(model.messageType); originationNumber(model.originationNumber); senderId(model.senderId); entityId(model.entityId); templateId(model.templateId); } public final String getBody() { return body; } public final void setBody(String body) { this.body = body; } @Override public final Builder body(String body) { this.body = body; return this; } public final String getMessageType() { return messageType; } public final void setMessageType(String messageType) { this.messageType = messageType; } @Override public final Builder messageType(String messageType) { this.messageType = messageType; return this; } @Override public final Builder messageType(MessageType messageType) { this.messageType(messageType == null ? null : messageType.toString()); return this; } public final String getOriginationNumber() { return originationNumber; } public final void setOriginationNumber(String originationNumber) { this.originationNumber = originationNumber; } @Override public final Builder originationNumber(String originationNumber) { this.originationNumber = originationNumber; return this; } public final String getSenderId() { return senderId; } public final void setSenderId(String senderId) { this.senderId = senderId; } @Override public final Builder senderId(String senderId) { this.senderId = senderId; return this; } public final String getEntityId() { return entityId; } public final void setEntityId(String entityId) { this.entityId = entityId; } @Override public final Builder entityId(String entityId) { this.entityId = entityId; return this; } public final String getTemplateId() { return templateId; } public final void setTemplateId(String templateId) { this.templateId = templateId; } @Override public final Builder templateId(String templateId) { this.templateId = templateId; return this; } @Override public CampaignSmsMessage build() { return new CampaignSmsMessage(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy