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

software.amazon.awssdk.services.personalizeruntime.model.GetRecommendationsRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Personalize Runtime module holds the client classes that are used for communicating with Personalize Runtime.

There is a newer version: 2.29.15
Show 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.personalizeruntime.model;

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 java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class GetRecommendationsRequest extends PersonalizeRuntimeRequest implements
        ToCopyableBuilder {
    private static final SdkField CAMPAIGN_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("campaignArn").getter(getter(GetRecommendationsRequest::campaignArn))
            .setter(setter(Builder::campaignArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("campaignArn").build()).build();

    private static final SdkField ITEM_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("itemId")
            .getter(getter(GetRecommendationsRequest::itemId)).setter(setter(Builder::itemId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("itemId").build()).build();

    private static final SdkField USER_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("userId")
            .getter(getter(GetRecommendationsRequest::userId)).setter(setter(Builder::userId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userId").build()).build();

    private static final SdkField NUM_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("numResults").getter(getter(GetRecommendationsRequest::numResults)).setter(setter(Builder::numResults))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numResults").build()).build();

    private static final SdkField> CONTEXT_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("context")
            .getter(getter(GetRecommendationsRequest::context))
            .setter(setter(Builder::context))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("context").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField FILTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("filterArn").getter(getter(GetRecommendationsRequest::filterArn)).setter(setter(Builder::filterArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("filterArn").build()).build();

    private static final SdkField> FILTER_VALUES_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("filterValues")
            .getter(getter(GetRecommendationsRequest::filterValues))
            .setter(setter(Builder::filterValues))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("filterValues").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField RECOMMENDER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("recommenderArn").getter(getter(GetRecommendationsRequest::recommenderArn))
            .setter(setter(Builder::recommenderArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recommenderArn").build()).build();

    private static final SdkField> PROMOTIONS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("promotions")
            .getter(getter(GetRecommendationsRequest::promotions))
            .setter(setter(Builder::promotions))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("promotions").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(Promotion::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField>> METADATA_COLUMNS_FIELD = SdkField
            .>> builder(MarshallingType.MAP)
            .memberName("metadataColumns")
            .getter(getter(GetRecommendationsRequest::metadataColumns))
            .setter(setter(Builder::metadataColumns))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metadataColumns").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CAMPAIGN_ARN_FIELD,
            ITEM_ID_FIELD, USER_ID_FIELD, NUM_RESULTS_FIELD, CONTEXT_FIELD, FILTER_ARN_FIELD, FILTER_VALUES_FIELD,
            RECOMMENDER_ARN_FIELD, PROMOTIONS_FIELD, METADATA_COLUMNS_FIELD));

    private final String campaignArn;

    private final String itemId;

    private final String userId;

    private final Integer numResults;

    private final Map context;

    private final String filterArn;

    private final Map filterValues;

    private final String recommenderArn;

    private final List promotions;

    private final Map> metadataColumns;

    private GetRecommendationsRequest(BuilderImpl builder) {
        super(builder);
        this.campaignArn = builder.campaignArn;
        this.itemId = builder.itemId;
        this.userId = builder.userId;
        this.numResults = builder.numResults;
        this.context = builder.context;
        this.filterArn = builder.filterArn;
        this.filterValues = builder.filterValues;
        this.recommenderArn = builder.recommenderArn;
        this.promotions = builder.promotions;
        this.metadataColumns = builder.metadataColumns;
    }

    /**
     * 

* The Amazon Resource Name (ARN) of the campaign to use for getting recommendations. *

* * @return The Amazon Resource Name (ARN) of the campaign to use for getting recommendations. */ public final String campaignArn() { return campaignArn; } /** *

* The item ID to provide recommendations for. *

*

* Required for RELATED_ITEMS recipe type. *

* * @return The item ID to provide recommendations for.

*

* Required for RELATED_ITEMS recipe type. */ public final String itemId() { return itemId; } /** *

* The user ID to provide recommendations for. *

*

* Required for USER_PERSONALIZATION recipe type. *

* * @return The user ID to provide recommendations for.

*

* Required for USER_PERSONALIZATION recipe type. */ public final String userId() { return userId; } /** *

* The number of results to return. The default is 25. If you are including metadata in recommendations, the maximum * is 50. Otherwise, the maximum is 500. *

* * @return The number of results to return. The default is 25. If you are including metadata in recommendations, the * maximum is 50. Otherwise, the maximum is 500. */ public final Integer numResults() { return numResults; } /** * For responses, this returns true if the service returned a value for the Context 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 hasContext() { return context != null && !(context instanceof SdkAutoConstructMap); } /** *

* The contextual metadata to use when getting recommendations. Contextual metadata includes any interaction * information that might be relevant when getting a user's recommendations, such as the user's current location or * device type. *

*

* 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 #hasContext} method. *

* * @return The contextual metadata to use when getting recommendations. Contextual metadata includes any interaction * information that might be relevant when getting a user's recommendations, such as the user's current * location or device type. */ public final Map context() { return context; } /** *

* The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations. *

*

* When using this parameter, be sure the filter resource is ACTIVE. *

* * @return The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations.

*

* When using this parameter, be sure the filter resource is ACTIVE. */ public final String filterArn() { return filterArn; } /** * For responses, this returns true if the service returned a value for the FilterValues 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 hasFilterValues() { return filterValues != null && !(filterValues instanceof SdkAutoConstructMap); } /** *

* The values to use when filtering recommendations. For each placeholder parameter in your filter expression, * provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. * Separate multiple values for one parameter with a comma. *

*

* For filter expressions that use an INCLUDE element to include items, you must provide values for all * parameters that are defined in the expression. For filters with expressions that use an EXCLUDE * element to exclude items, you can omit the filter-values.In this case, Amazon Personalize doesn't * use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering * recommendations and user segments. *

*

* 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 #hasFilterValues} method. *

* * @return The values to use when filtering recommendations. For each placeholder parameter in your filter * expression, provide the parameter name (in matching case) as a key and the filter value(s) as the * corresponding value. Separate multiple values for one parameter with a comma.

*

* For filter expressions that use an INCLUDE element to include items, you must provide values * for all parameters that are defined in the expression. For filters with expressions that use an * EXCLUDE element to exclude items, you can omit the filter-values.In this case, * Amazon Personalize doesn't use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering recommendations and user * segments. */ public final Map filterValues() { return filterValues; } /** *

* The Amazon Resource Name (ARN) of the recommender to use to get recommendations. Provide a recommender ARN if you * created a Domain dataset group with a recommender for a domain use case. *

* * @return The Amazon Resource Name (ARN) of the recommender to use to get recommendations. Provide a recommender * ARN if you created a Domain dataset group with a recommender for a domain use case. */ public final String recommenderArn() { return recommenderArn; } /** * For responses, this returns true if the service returned a value for the Promotions 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 hasPromotions() { return promotions != null && !(promotions instanceof SdkAutoConstructList); } /** *

* The promotions to apply to the recommendation request. A promotion defines additional business rules that apply * to a configurable subset of recommended items. *

*

* 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 #hasPromotions} method. *

* * @return The promotions to apply to the recommendation request. A promotion defines additional business rules that * apply to a configurable subset of recommended items. */ public final List promotions() { return promotions; } /** * For responses, this returns true if the service returned a value for the MetadataColumns 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 hasMetadataColumns() { return metadataColumns != null && !(metadataColumns instanceof SdkAutoConstructMap); } /** *

* If you enabled metadata in recommendations when you created or updated the campaign or recommender, specify the * metadata columns from your Items dataset to include in item recommendations. The map key is ITEMS * and the value is a list of column names from your Items dataset. The maximum number of columns you can provide is * 10. *

*

* For information about enabling metadata for a campaign, see Enabling * metadata in recommendations for a campaign. For information about enabling metadata for a recommender, see Enabling metadata in recommendations for a recommender. *

*

* 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 #hasMetadataColumns} method. *

* * @return If you enabled metadata in recommendations when you created or updated the campaign or recommender, * specify the metadata columns from your Items dataset to include in item recommendations. The map key is * ITEMS and the value is a list of column names from your Items dataset. The maximum number of * columns you can provide is 10.

*

* For information about enabling metadata for a campaign, see Enabling metadata in recommendations for a campaign. For information about enabling metadata for a * recommender, see Enabling metadata in recommendations for a recommender. */ public final Map> metadataColumns() { return metadataColumns; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(campaignArn()); hashCode = 31 * hashCode + Objects.hashCode(itemId()); hashCode = 31 * hashCode + Objects.hashCode(userId()); hashCode = 31 * hashCode + Objects.hashCode(numResults()); hashCode = 31 * hashCode + Objects.hashCode(hasContext() ? context() : null); hashCode = 31 * hashCode + Objects.hashCode(filterArn()); hashCode = 31 * hashCode + Objects.hashCode(hasFilterValues() ? filterValues() : null); hashCode = 31 * hashCode + Objects.hashCode(recommenderArn()); hashCode = 31 * hashCode + Objects.hashCode(hasPromotions() ? promotions() : null); hashCode = 31 * hashCode + Objects.hashCode(hasMetadataColumns() ? metadataColumns() : null); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GetRecommendationsRequest)) { return false; } GetRecommendationsRequest other = (GetRecommendationsRequest) obj; return Objects.equals(campaignArn(), other.campaignArn()) && Objects.equals(itemId(), other.itemId()) && Objects.equals(userId(), other.userId()) && Objects.equals(numResults(), other.numResults()) && hasContext() == other.hasContext() && Objects.equals(context(), other.context()) && Objects.equals(filterArn(), other.filterArn()) && hasFilterValues() == other.hasFilterValues() && Objects.equals(filterValues(), other.filterValues()) && Objects.equals(recommenderArn(), other.recommenderArn()) && hasPromotions() == other.hasPromotions() && Objects.equals(promotions(), other.promotions()) && hasMetadataColumns() == other.hasMetadataColumns() && Objects.equals(metadataColumns(), other.metadataColumns()); } /** * 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("GetRecommendationsRequest").add("CampaignArn", campaignArn()).add("ItemId", itemId()) .add("UserId", userId()).add("NumResults", numResults()) .add("Context", context() == null ? null : "*** Sensitive Data Redacted ***").add("FilterArn", filterArn()) .add("FilterValues", filterValues() == null ? null : "*** Sensitive Data Redacted ***") .add("RecommenderArn", recommenderArn()).add("Promotions", hasPromotions() ? promotions() : null) .add("MetadataColumns", hasMetadataColumns() ? metadataColumns() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "campaignArn": return Optional.ofNullable(clazz.cast(campaignArn())); case "itemId": return Optional.ofNullable(clazz.cast(itemId())); case "userId": return Optional.ofNullable(clazz.cast(userId())); case "numResults": return Optional.ofNullable(clazz.cast(numResults())); case "context": return Optional.ofNullable(clazz.cast(context())); case "filterArn": return Optional.ofNullable(clazz.cast(filterArn())); case "filterValues": return Optional.ofNullable(clazz.cast(filterValues())); case "recommenderArn": return Optional.ofNullable(clazz.cast(recommenderArn())); case "promotions": return Optional.ofNullable(clazz.cast(promotions())); case "metadataColumns": return Optional.ofNullable(clazz.cast(metadataColumns())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetRecommendationsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends PersonalizeRuntimeRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the campaign to use for getting recommendations. *

* * @param campaignArn * The Amazon Resource Name (ARN) of the campaign to use for getting recommendations. * @return Returns a reference to this object so that method calls can be chained together. */ Builder campaignArn(String campaignArn); /** *

* The item ID to provide recommendations for. *

*

* Required for RELATED_ITEMS recipe type. *

* * @param itemId * The item ID to provide recommendations for.

*

* Required for RELATED_ITEMS recipe type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder itemId(String itemId); /** *

* The user ID to provide recommendations for. *

*

* Required for USER_PERSONALIZATION recipe type. *

* * @param userId * The user ID to provide recommendations for.

*

* Required for USER_PERSONALIZATION recipe type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userId(String userId); /** *

* The number of results to return. The default is 25. If you are including metadata in recommendations, the * maximum is 50. Otherwise, the maximum is 500. *

* * @param numResults * The number of results to return. The default is 25. If you are including metadata in recommendations, * the maximum is 50. Otherwise, the maximum is 500. * @return Returns a reference to this object so that method calls can be chained together. */ Builder numResults(Integer numResults); /** *

* The contextual metadata to use when getting recommendations. Contextual metadata includes any interaction * information that might be relevant when getting a user's recommendations, such as the user's current location * or device type. *

* * @param context * The contextual metadata to use when getting recommendations. Contextual metadata includes any * interaction information that might be relevant when getting a user's recommendations, such as the * user's current location or device type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder context(Map context); /** *

* The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations. *

*

* When using this parameter, be sure the filter resource is ACTIVE. *

* * @param filterArn * The ARN of the filter to apply to the returned recommendations. For more information, see Filtering * Recommendations.

*

* When using this parameter, be sure the filter resource is ACTIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filterArn(String filterArn); /** *

* The values to use when filtering recommendations. For each placeholder parameter in your filter expression, * provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. * Separate multiple values for one parameter with a comma. *

*

* For filter expressions that use an INCLUDE element to include items, you must provide values for * all parameters that are defined in the expression. For filters with expressions that use an * EXCLUDE element to exclude items, you can omit the filter-values.In this case, * Amazon Personalize doesn't use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering * recommendations and user segments. *

* * @param filterValues * The values to use when filtering recommendations. For each placeholder parameter in your filter * expression, provide the parameter name (in matching case) as a key and the filter value(s) as the * corresponding value. Separate multiple values for one parameter with a comma.

*

* For filter expressions that use an INCLUDE element to include items, you must provide * values for all parameters that are defined in the expression. For filters with expressions that use an * EXCLUDE element to exclude items, you can omit the filter-values.In this * case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering recommendations and * user segments. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filterValues(Map filterValues); /** *

* The Amazon Resource Name (ARN) of the recommender to use to get recommendations. Provide a recommender ARN if * you created a Domain dataset group with a recommender for a domain use case. *

* * @param recommenderArn * The Amazon Resource Name (ARN) of the recommender to use to get recommendations. Provide a recommender * ARN if you created a Domain dataset group with a recommender for a domain use case. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recommenderArn(String recommenderArn); /** *

* The promotions to apply to the recommendation request. A promotion defines additional business rules that * apply to a configurable subset of recommended items. *

* * @param promotions * The promotions to apply to the recommendation request. A promotion defines additional business rules * that apply to a configurable subset of recommended items. * @return Returns a reference to this object so that method calls can be chained together. */ Builder promotions(Collection promotions); /** *

* The promotions to apply to the recommendation request. A promotion defines additional business rules that * apply to a configurable subset of recommended items. *

* * @param promotions * The promotions to apply to the recommendation request. A promotion defines additional business rules * that apply to a configurable subset of recommended items. * @return Returns a reference to this object so that method calls can be chained together. */ Builder promotions(Promotion... promotions); /** *

* The promotions to apply to the recommendation request. A promotion defines additional business rules that * apply to a configurable subset of recommended items. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.personalizeruntime.model.Promotion.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.personalizeruntime.model.Promotion#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.personalizeruntime.model.Promotion.Builder#build()} is called * immediately and its result is passed to {@link #promotions(List)}. * * @param promotions * a consumer that will call methods on * {@link software.amazon.awssdk.services.personalizeruntime.model.Promotion.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #promotions(java.util.Collection) */ Builder promotions(Consumer... promotions); /** *

* If you enabled metadata in recommendations when you created or updated the campaign or recommender, specify * the metadata columns from your Items dataset to include in item recommendations. The map key is * ITEMS and the value is a list of column names from your Items dataset. The maximum number of * columns you can provide is 10. *

*

* For information about enabling metadata for a campaign, see Enabling metadata in recommendations for a campaign. For information about enabling metadata for a * recommender, see Enabling metadata in recommendations for a recommender. *

* * @param metadataColumns * If you enabled metadata in recommendations when you created or updated the campaign or recommender, * specify the metadata columns from your Items dataset to include in item recommendations. The map key * is ITEMS and the value is a list of column names from your Items dataset. The maximum * number of columns you can provide is 10.

*

* For information about enabling metadata for a campaign, see Enabling metadata in recommendations for a campaign. For information about enabling metadata for * a recommender, see Enabling metadata in recommendations for a recommender. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metadataColumns(Map> metadataColumns); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends PersonalizeRuntimeRequest.BuilderImpl implements Builder { private String campaignArn; private String itemId; private String userId; private Integer numResults; private Map context = DefaultSdkAutoConstructMap.getInstance(); private String filterArn; private Map filterValues = DefaultSdkAutoConstructMap.getInstance(); private String recommenderArn; private List promotions = DefaultSdkAutoConstructList.getInstance(); private Map> metadataColumns = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(GetRecommendationsRequest model) { super(model); campaignArn(model.campaignArn); itemId(model.itemId); userId(model.userId); numResults(model.numResults); context(model.context); filterArn(model.filterArn); filterValues(model.filterValues); recommenderArn(model.recommenderArn); promotions(model.promotions); metadataColumns(model.metadataColumns); } public final String getCampaignArn() { return campaignArn; } public final void setCampaignArn(String campaignArn) { this.campaignArn = campaignArn; } @Override public final Builder campaignArn(String campaignArn) { this.campaignArn = campaignArn; return this; } public final String getItemId() { return itemId; } public final void setItemId(String itemId) { this.itemId = itemId; } @Override public final Builder itemId(String itemId) { this.itemId = itemId; return this; } public final String getUserId() { return userId; } public final void setUserId(String userId) { this.userId = userId; } @Override public final Builder userId(String userId) { this.userId = userId; return this; } public final Integer getNumResults() { return numResults; } public final void setNumResults(Integer numResults) { this.numResults = numResults; } @Override public final Builder numResults(Integer numResults) { this.numResults = numResults; return this; } public final Map getContext() { if (context instanceof SdkAutoConstructMap) { return null; } return context; } public final void setContext(Map context) { this.context = ContextCopier.copy(context); } @Override public final Builder context(Map context) { this.context = ContextCopier.copy(context); return this; } public final String getFilterArn() { return filterArn; } public final void setFilterArn(String filterArn) { this.filterArn = filterArn; } @Override public final Builder filterArn(String filterArn) { this.filterArn = filterArn; return this; } public final Map getFilterValues() { if (filterValues instanceof SdkAutoConstructMap) { return null; } return filterValues; } public final void setFilterValues(Map filterValues) { this.filterValues = FilterValuesCopier.copy(filterValues); } @Override public final Builder filterValues(Map filterValues) { this.filterValues = FilterValuesCopier.copy(filterValues); return this; } public final String getRecommenderArn() { return recommenderArn; } public final void setRecommenderArn(String recommenderArn) { this.recommenderArn = recommenderArn; } @Override public final Builder recommenderArn(String recommenderArn) { this.recommenderArn = recommenderArn; return this; } public final List getPromotions() { List result = PromotionListCopier.copyToBuilder(this.promotions); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setPromotions(Collection promotions) { this.promotions = PromotionListCopier.copyFromBuilder(promotions); } @Override public final Builder promotions(Collection promotions) { this.promotions = PromotionListCopier.copy(promotions); return this; } @Override @SafeVarargs public final Builder promotions(Promotion... promotions) { promotions(Arrays.asList(promotions)); return this; } @Override @SafeVarargs public final Builder promotions(Consumer... promotions) { promotions(Stream.of(promotions).map(c -> Promotion.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Map> getMetadataColumns() { if (metadataColumns instanceof SdkAutoConstructMap) { return null; } return metadataColumns; } public final void setMetadataColumns(Map> metadataColumns) { this.metadataColumns = MetadataColumnsCopier.copy(metadataColumns); } @Override public final Builder metadataColumns(Map> metadataColumns) { this.metadataColumns = MetadataColumnsCopier.copy(metadataColumns); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetRecommendationsRequest build() { return new GetRecommendationsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy