Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.pinpoint.model.EndpointRequest 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
/*
* 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.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Specifies the channel type and other settings for an endpoint.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EndpointRequest implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Address")
.getter(getter(EndpointRequest::address)).setter(setter(Builder::address))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address").build()).build();
private static final SdkField>> ATTRIBUTES_FIELD = SdkField
.>> builder(MarshallingType.MAP)
.memberName("Attributes")
.getter(getter(EndpointRequest::attributes))
.setter(setter(Builder::attributes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Attributes").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField.> builder(MarshallingType.LIST)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder()
.location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build())
.build()).build()).build()).build();
private static final SdkField CHANNEL_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChannelType").getter(getter(EndpointRequest::channelTypeAsString)).setter(setter(Builder::channelType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelType").build()).build();
private static final SdkField DEMOGRAPHIC_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Demographic")
.getter(getter(EndpointRequest::demographic)).setter(setter(Builder::demographic))
.constructor(EndpointDemographic::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Demographic").build()).build();
private static final SdkField EFFECTIVE_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EffectiveDate").getter(getter(EndpointRequest::effectiveDate)).setter(setter(Builder::effectiveDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EffectiveDate").build()).build();
private static final SdkField ENDPOINT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointStatus").getter(getter(EndpointRequest::endpointStatus)).setter(setter(Builder::endpointStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointStatus").build()).build();
private static final SdkField LOCATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Location")
.getter(getter(EndpointRequest::location)).setter(setter(Builder::location)).constructor(EndpointLocation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Location").build()).build();
private static final SdkField> METRICS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Metrics")
.getter(getter(EndpointRequest::metrics))
.setter(setter(Builder::metrics))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metrics").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.DOUBLE)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField OPT_OUT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("OptOut")
.getter(getter(EndpointRequest::optOut)).setter(setter(Builder::optOut))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptOut").build()).build();
private static final SdkField REQUEST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RequestId").getter(getter(EndpointRequest::requestId)).setter(setter(Builder::requestId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RequestId").build()).build();
private static final SdkField USER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("User").getter(getter(EndpointRequest::user)).setter(setter(Builder::user))
.constructor(EndpointUser::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("User").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDRESS_FIELD,
ATTRIBUTES_FIELD, CHANNEL_TYPE_FIELD, DEMOGRAPHIC_FIELD, EFFECTIVE_DATE_FIELD, ENDPOINT_STATUS_FIELD, LOCATION_FIELD,
METRICS_FIELD, OPT_OUT_FIELD, REQUEST_ID_FIELD, USER_FIELD));
private static final long serialVersionUID = 1L;
private final String address;
private final Map> attributes;
private final String channelType;
private final EndpointDemographic demographic;
private final String effectiveDate;
private final String endpointStatus;
private final EndpointLocation location;
private final Map metrics;
private final String optOut;
private final String requestId;
private final EndpointUser user;
private EndpointRequest(BuilderImpl builder) {
this.address = builder.address;
this.attributes = builder.attributes;
this.channelType = builder.channelType;
this.demographic = builder.demographic;
this.effectiveDate = builder.effectiveDate;
this.endpointStatus = builder.endpointStatus;
this.location = builder.location;
this.metrics = builder.metrics;
this.optOut = builder.optOut;
this.requestId = builder.requestId;
this.user = builder.user;
}
/**
*
* The destination address for messages or push notifications that you send to the endpoint. The address varies by
* channel. For a push-notification channel, use the token provided by the push notification service, such as an
* Apple Push Notification service (APNs) device token or a Firebase Cloud Messaging (FCM) registration token. For
* the SMS channel, use a phone number in E.164 format, such as +12065550100. For the email channel, use an email
* address.
*
*
* @return The destination address for messages or push notifications that you send to the endpoint. The address
* varies by channel. For a push-notification channel, use the token provided by the push notification
* service, such as an Apple Push Notification service (APNs) device token or a Firebase Cloud Messaging
* (FCM) registration token. For the SMS channel, use a phone number in E.164 format, such as +12065550100.
* For the email channel, use an email address.
*/
public final String address() {
return address;
}
/**
* For responses, this returns true if the service returned a value for the Attributes property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasAttributes() {
return attributes != null && !(attributes instanceof SdkAutoConstructMap);
}
/**
*
* One or more custom attributes that describe the endpoint by associating a name with an array of values. For
* example, the value of a custom attribute named Interests might be: ["Science", "Music", "Travel"]. You can use
* these attributes as filter criteria when you create segments. Attribute names are case sensitive.
*
*
* An attribute name can contain up to 50 characters. An attribute value can contain up to 100 characters. When you
* define the name of a custom attribute, avoid using the following characters: number sign (#), colon (:), question
* mark (?), backslash (\), and slash (/). The Amazon Pinpoint console can't display attribute names that contain
* these characters. This restriction doesn't apply to attribute values.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAttributes} method.
*
*
* @return One or more custom attributes that describe the endpoint by associating a name with an array of values.
* For example, the value of a custom attribute named Interests might be: ["Science", "Music", "Travel"].
* You can use these attributes as filter criteria when you create segments. Attribute names are case
* sensitive.
*
* An attribute name can contain up to 50 characters. An attribute value can contain up to 100 characters.
* When you define the name of a custom attribute, avoid using the following characters: number sign (#),
* colon (:), question mark (?), backslash (\), and slash (/). The Amazon Pinpoint console can't display
* attribute names that contain these characters. This restriction doesn't apply to attribute values.
*/
public final Map> attributes() {
return attributes;
}
/**
*
* The channel to use when sending messages or push notifications to the endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #channelType} will
* return {@link ChannelType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #channelTypeAsString}.
*
*
* @return The channel to use when sending messages or push notifications to the endpoint.
* @see ChannelType
*/
public final ChannelType channelType() {
return ChannelType.fromValue(channelType);
}
/**
*
* The channel to use when sending messages or push notifications to the endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #channelType} will
* return {@link ChannelType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #channelTypeAsString}.
*
*
* @return The channel to use when sending messages or push notifications to the endpoint.
* @see ChannelType
*/
public final String channelTypeAsString() {
return channelType;
}
/**
*
* The demographic information for the endpoint, such as the time zone and platform.
*
*
* @return The demographic information for the endpoint, such as the time zone and platform.
*/
public final EndpointDemographic demographic() {
return demographic;
}
/**
*
* The date and time, in ISO 8601 format, when the endpoint is updated.
*
*
* @return The date and time, in ISO 8601 format, when the endpoint is updated.
*/
public final String effectiveDate() {
return effectiveDate;
}
/**
*
* Specifies whether to send messages or push notifications to the endpoint. Valid values are: ACTIVE, messages are
* sent to the endpoint; and, INACTIVE, messages aren’t sent to the endpoint.
*
*
* Amazon Pinpoint automatically sets this value to ACTIVE when you create an endpoint or update an existing
* endpoint. Amazon Pinpoint automatically sets this value to INACTIVE if you update another endpoint that has the
* same address specified by the Address property.
*
*
* @return Specifies whether to send messages or push notifications to the endpoint. Valid values are: ACTIVE,
* messages are sent to the endpoint; and, INACTIVE, messages aren’t sent to the endpoint.
*
* Amazon Pinpoint automatically sets this value to ACTIVE when you create an endpoint or update an existing
* endpoint. Amazon Pinpoint automatically sets this value to INACTIVE if you update another endpoint that
* has the same address specified by the Address property.
*/
public final String endpointStatus() {
return endpointStatus;
}
/**
*
* The geographic information for the endpoint.
*
*
* @return The geographic information for the endpoint.
*/
public final EndpointLocation location() {
return location;
}
/**
* For responses, this returns true if the service returned a value for the Metrics property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasMetrics() {
return metrics != null && !(metrics instanceof SdkAutoConstructMap);
}
/**
*
* One or more custom metrics that your app reports to Amazon Pinpoint for the endpoint.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasMetrics} method.
*
*
* @return One or more custom metrics that your app reports to Amazon Pinpoint for the endpoint.
*/
public final Map metrics() {
return metrics;
}
/**
*
* Specifies whether the user who's associated with the endpoint has opted out of receiving messages and push
* notifications from you. Possible values are: ALL, the user has opted out and doesn't want to receive any messages
* or push notifications; and, NONE, the user hasn't opted out and wants to receive all messages and push
* notifications.
*
*
* @return Specifies whether the user who's associated with the endpoint has opted out of receiving messages and
* push notifications from you. Possible values are: ALL, the user has opted out and doesn't want to receive
* any messages or push notifications; and, NONE, the user hasn't opted out and wants to receive all
* messages and push notifications.
*/
public final String optOut() {
return optOut;
}
/**
*
* The unique identifier for the most recent request to update the endpoint.
*
*
* @return The unique identifier for the most recent request to update the endpoint.
*/
public final String requestId() {
return requestId;
}
/**
*
* One or more custom attributes that describe the user who's associated with the endpoint.
*
*
* @return One or more custom attributes that describe the user who's associated with the endpoint.
*/
public final EndpointUser user() {
return user;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(address());
hashCode = 31 * hashCode + Objects.hashCode(hasAttributes() ? attributes() : null);
hashCode = 31 * hashCode + Objects.hashCode(channelTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(demographic());
hashCode = 31 * hashCode + Objects.hashCode(effectiveDate());
hashCode = 31 * hashCode + Objects.hashCode(endpointStatus());
hashCode = 31 * hashCode + Objects.hashCode(location());
hashCode = 31 * hashCode + Objects.hashCode(hasMetrics() ? metrics() : null);
hashCode = 31 * hashCode + Objects.hashCode(optOut());
hashCode = 31 * hashCode + Objects.hashCode(requestId());
hashCode = 31 * hashCode + Objects.hashCode(user());
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 EndpointRequest)) {
return false;
}
EndpointRequest other = (EndpointRequest) obj;
return Objects.equals(address(), other.address()) && hasAttributes() == other.hasAttributes()
&& Objects.equals(attributes(), other.attributes())
&& Objects.equals(channelTypeAsString(), other.channelTypeAsString())
&& Objects.equals(demographic(), other.demographic()) && Objects.equals(effectiveDate(), other.effectiveDate())
&& Objects.equals(endpointStatus(), other.endpointStatus()) && Objects.equals(location(), other.location())
&& hasMetrics() == other.hasMetrics() && Objects.equals(metrics(), other.metrics())
&& Objects.equals(optOut(), other.optOut()) && Objects.equals(requestId(), other.requestId())
&& Objects.equals(user(), other.user());
}
/**
* 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("EndpointRequest").add("Address", address())
.add("Attributes", hasAttributes() ? attributes() : null).add("ChannelType", channelTypeAsString())
.add("Demographic", demographic()).add("EffectiveDate", effectiveDate()).add("EndpointStatus", endpointStatus())
.add("Location", location()).add("Metrics", hasMetrics() ? metrics() : null).add("OptOut", optOut())
.add("RequestId", requestId()).add("User", user()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Address":
return Optional.ofNullable(clazz.cast(address()));
case "Attributes":
return Optional.ofNullable(clazz.cast(attributes()));
case "ChannelType":
return Optional.ofNullable(clazz.cast(channelTypeAsString()));
case "Demographic":
return Optional.ofNullable(clazz.cast(demographic()));
case "EffectiveDate":
return Optional.ofNullable(clazz.cast(effectiveDate()));
case "EndpointStatus":
return Optional.ofNullable(clazz.cast(endpointStatus()));
case "Location":
return Optional.ofNullable(clazz.cast(location()));
case "Metrics":
return Optional.ofNullable(clazz.cast(metrics()));
case "OptOut":
return Optional.ofNullable(clazz.cast(optOut()));
case "RequestId":
return Optional.ofNullable(clazz.cast(requestId()));
case "User":
return Optional.ofNullable(clazz.cast(user()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((EndpointRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The destination address for messages or push notifications that you send to the endpoint. The address varies
* by channel. For a push-notification channel, use the token provided by the push notification service, such as
* an Apple Push Notification service (APNs) device token or a Firebase Cloud Messaging (FCM) registration
* token. For the SMS channel, use a phone number in E.164 format, such as +12065550100. For the email channel,
* use an email address.
*
*
* @param address
* The destination address for messages or push notifications that you send to the endpoint. The address
* varies by channel. For a push-notification channel, use the token provided by the push notification
* service, such as an Apple Push Notification service (APNs) device token or a Firebase Cloud Messaging
* (FCM) registration token. For the SMS channel, use a phone number in E.164 format, such as
* +12065550100. For the email channel, use an email address.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder address(String address);
/**
*
* One or more custom attributes that describe the endpoint by associating a name with an array of values. For
* example, the value of a custom attribute named Interests might be: ["Science", "Music", "Travel"]. You can
* use these attributes as filter criteria when you create segments. Attribute names are case sensitive.
*
*
* An attribute name can contain up to 50 characters. An attribute value can contain up to 100 characters. When
* you define the name of a custom attribute, avoid using the following characters: number sign (#), colon (:),
* question mark (?), backslash (\), and slash (/). The Amazon Pinpoint console can't display attribute names
* that contain these characters. This restriction doesn't apply to attribute values.
*
*
* @param attributes
* One or more custom attributes that describe the endpoint by associating a name with an array of
* values. For example, the value of a custom attribute named Interests might be: ["Science", "Music",
* "Travel"]. You can use these attributes as filter criteria when you create segments. Attribute names
* are case sensitive.
*
* An attribute name can contain up to 50 characters. An attribute value can contain up to 100
* characters. When you define the name of a custom attribute, avoid using the following characters:
* number sign (#), colon (:), question mark (?), backslash (\), and slash (/). The Amazon Pinpoint
* console can't display attribute names that contain these characters. This restriction doesn't apply to
* attribute values.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attributes(Map> attributes);
/**
*
* The channel to use when sending messages or push notifications to the endpoint.
*
*
* @param channelType
* The channel to use when sending messages or push notifications to the endpoint.
* @see ChannelType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ChannelType
*/
Builder channelType(String channelType);
/**
*
* The channel to use when sending messages or push notifications to the endpoint.
*
*
* @param channelType
* The channel to use when sending messages or push notifications to the endpoint.
* @see ChannelType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ChannelType
*/
Builder channelType(ChannelType channelType);
/**
*
* The demographic information for the endpoint, such as the time zone and platform.
*
*
* @param demographic
* The demographic information for the endpoint, such as the time zone and platform.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder demographic(EndpointDemographic demographic);
/**
*
* The demographic information for the endpoint, such as the time zone and platform.
*
* This is a convenience method that creates an instance of the {@link EndpointDemographic.Builder} avoiding the
* need to create one manually via {@link EndpointDemographic#builder()}.
*
*
* When the {@link Consumer} completes, {@link EndpointDemographic.Builder#build()} is called immediately and
* its result is passed to {@link #demographic(EndpointDemographic)}.
*
* @param demographic
* a consumer that will call methods on {@link EndpointDemographic.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #demographic(EndpointDemographic)
*/
default Builder demographic(Consumer demographic) {
return demographic(EndpointDemographic.builder().applyMutation(demographic).build());
}
/**
*
* The date and time, in ISO 8601 format, when the endpoint is updated.
*
*
* @param effectiveDate
* The date and time, in ISO 8601 format, when the endpoint is updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder effectiveDate(String effectiveDate);
/**
*
* Specifies whether to send messages or push notifications to the endpoint. Valid values are: ACTIVE, messages
* are sent to the endpoint; and, INACTIVE, messages aren’t sent to the endpoint.
*
*
* Amazon Pinpoint automatically sets this value to ACTIVE when you create an endpoint or update an existing
* endpoint. Amazon Pinpoint automatically sets this value to INACTIVE if you update another endpoint that has
* the same address specified by the Address property.
*
*
* @param endpointStatus
* Specifies whether to send messages or push notifications to the endpoint. Valid values are: ACTIVE,
* messages are sent to the endpoint; and, INACTIVE, messages aren’t sent to the endpoint.
*
* Amazon Pinpoint automatically sets this value to ACTIVE when you create an endpoint or update an
* existing endpoint. Amazon Pinpoint automatically sets this value to INACTIVE if you update another
* endpoint that has the same address specified by the Address property.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endpointStatus(String endpointStatus);
/**
*
* The geographic information for the endpoint.
*
*
* @param location
* The geographic information for the endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder location(EndpointLocation location);
/**
*
* The geographic information for the endpoint.
*
* This is a convenience method that creates an instance of the {@link EndpointLocation.Builder} avoiding the
* need to create one manually via {@link EndpointLocation#builder()}.
*
*
* When the {@link Consumer} completes, {@link EndpointLocation.Builder#build()} is called immediately and its
* result is passed to {@link #location(EndpointLocation)}.
*
* @param location
* a consumer that will call methods on {@link EndpointLocation.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #location(EndpointLocation)
*/
default Builder location(Consumer location) {
return location(EndpointLocation.builder().applyMutation(location).build());
}
/**
*
* One or more custom metrics that your app reports to Amazon Pinpoint for the endpoint.
*
*
* @param metrics
* One or more custom metrics that your app reports to Amazon Pinpoint for the endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder metrics(Map metrics);
/**
*
* Specifies whether the user who's associated with the endpoint has opted out of receiving messages and push
* notifications from you. Possible values are: ALL, the user has opted out and doesn't want to receive any
* messages or push notifications; and, NONE, the user hasn't opted out and wants to receive all messages and
* push notifications.
*
*
* @param optOut
* Specifies whether the user who's associated with the endpoint has opted out of receiving messages and
* push notifications from you. Possible values are: ALL, the user has opted out and doesn't want to
* receive any messages or push notifications; and, NONE, the user hasn't opted out and wants to receive
* all messages and push notifications.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder optOut(String optOut);
/**
*
* The unique identifier for the most recent request to update the endpoint.
*
*
* @param requestId
* The unique identifier for the most recent request to update the endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder requestId(String requestId);
/**
*
* One or more custom attributes that describe the user who's associated with the endpoint.
*
*
* @param user
* One or more custom attributes that describe the user who's associated with the endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder user(EndpointUser user);
/**
*
* One or more custom attributes that describe the user who's associated with the endpoint.
*
* This is a convenience method that creates an instance of the {@link EndpointUser.Builder} avoiding the need
* to create one manually via {@link EndpointUser#builder()}.
*
*
* When the {@link Consumer} completes, {@link EndpointUser.Builder#build()} is called immediately and its
* result is passed to {@link #user(EndpointUser)}.
*
* @param user
* a consumer that will call methods on {@link EndpointUser.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #user(EndpointUser)
*/
default Builder user(Consumer user) {
return user(EndpointUser.builder().applyMutation(user).build());
}
}
static final class BuilderImpl implements Builder {
private String address;
private Map> attributes = DefaultSdkAutoConstructMap.getInstance();
private String channelType;
private EndpointDemographic demographic;
private String effectiveDate;
private String endpointStatus;
private EndpointLocation location;
private Map metrics = DefaultSdkAutoConstructMap.getInstance();
private String optOut;
private String requestId;
private EndpointUser user;
private BuilderImpl() {
}
private BuilderImpl(EndpointRequest model) {
address(model.address);
attributes(model.attributes);
channelType(model.channelType);
demographic(model.demographic);
effectiveDate(model.effectiveDate);
endpointStatus(model.endpointStatus);
location(model.location);
metrics(model.metrics);
optOut(model.optOut);
requestId(model.requestId);
user(model.user);
}
public final String getAddress() {
return address;
}
public final void setAddress(String address) {
this.address = address;
}
@Override
public final Builder address(String address) {
this.address = address;
return this;
}
public final Map> getAttributes() {
if (attributes instanceof SdkAutoConstructMap) {
return null;
}
return attributes;
}
public final void setAttributes(Map> attributes) {
this.attributes = MapOfListOf__stringCopier.copy(attributes);
}
@Override
public final Builder attributes(Map> attributes) {
this.attributes = MapOfListOf__stringCopier.copy(attributes);
return this;
}
public final String getChannelType() {
return channelType;
}
public final void setChannelType(String channelType) {
this.channelType = channelType;
}
@Override
public final Builder channelType(String channelType) {
this.channelType = channelType;
return this;
}
@Override
public final Builder channelType(ChannelType channelType) {
this.channelType(channelType == null ? null : channelType.toString());
return this;
}
public final EndpointDemographic.Builder getDemographic() {
return demographic != null ? demographic.toBuilder() : null;
}
public final void setDemographic(EndpointDemographic.BuilderImpl demographic) {
this.demographic = demographic != null ? demographic.build() : null;
}
@Override
public final Builder demographic(EndpointDemographic demographic) {
this.demographic = demographic;
return this;
}
public final String getEffectiveDate() {
return effectiveDate;
}
public final void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
@Override
public final Builder effectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
return this;
}
public final String getEndpointStatus() {
return endpointStatus;
}
public final void setEndpointStatus(String endpointStatus) {
this.endpointStatus = endpointStatus;
}
@Override
public final Builder endpointStatus(String endpointStatus) {
this.endpointStatus = endpointStatus;
return this;
}
public final EndpointLocation.Builder getLocation() {
return location != null ? location.toBuilder() : null;
}
public final void setLocation(EndpointLocation.BuilderImpl location) {
this.location = location != null ? location.build() : null;
}
@Override
public final Builder location(EndpointLocation location) {
this.location = location;
return this;
}
public final Map getMetrics() {
if (metrics instanceof SdkAutoConstructMap) {
return null;
}
return metrics;
}
public final void setMetrics(Map metrics) {
this.metrics = MapOf__doubleCopier.copy(metrics);
}
@Override
public final Builder metrics(Map metrics) {
this.metrics = MapOf__doubleCopier.copy(metrics);
return this;
}
public final String getOptOut() {
return optOut;
}
public final void setOptOut(String optOut) {
this.optOut = optOut;
}
@Override
public final Builder optOut(String optOut) {
this.optOut = optOut;
return this;
}
public final String getRequestId() {
return requestId;
}
public final void setRequestId(String requestId) {
this.requestId = requestId;
}
@Override
public final Builder requestId(String requestId) {
this.requestId = requestId;
return this;
}
public final EndpointUser.Builder getUser() {
return user != null ? user.toBuilder() : null;
}
public final void setUser(EndpointUser.BuilderImpl user) {
this.user = user != null ? user.build() : null;
}
@Override
public final Builder user(EndpointUser user) {
this.user = user;
return this;
}
@Override
public EndpointRequest build() {
return new EndpointRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}