software.amazon.awssdk.services.personalizeruntime.PersonalizeRuntimeClient Maven / Gradle / Ivy
Show all versions of personalizeruntime Show documentation
/*
* 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;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.awscore.AwsClient;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.regions.ServiceMetadata;
import software.amazon.awssdk.services.personalizeruntime.model.GetActionRecommendationsRequest;
import software.amazon.awssdk.services.personalizeruntime.model.GetActionRecommendationsResponse;
import software.amazon.awssdk.services.personalizeruntime.model.GetPersonalizedRankingRequest;
import software.amazon.awssdk.services.personalizeruntime.model.GetPersonalizedRankingResponse;
import software.amazon.awssdk.services.personalizeruntime.model.GetRecommendationsRequest;
import software.amazon.awssdk.services.personalizeruntime.model.GetRecommendationsResponse;
import software.amazon.awssdk.services.personalizeruntime.model.InvalidInputException;
import software.amazon.awssdk.services.personalizeruntime.model.PersonalizeRuntimeException;
import software.amazon.awssdk.services.personalizeruntime.model.ResourceNotFoundException;
/**
* Service client for accessing Amazon Personalize Runtime. This can be created using the static {@link #builder()}
* method.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
@SdkPublicApi
@ThreadSafe
public interface PersonalizeRuntimeClient extends AwsClient {
String SERVICE_NAME = "personalize";
/**
* Value for looking up the service's metadata from the
* {@link software.amazon.awssdk.regions.ServiceMetadataProvider}.
*/
String SERVICE_METADATA_ID = "personalize-runtime";
/**
*
* Returns a list of recommended actions in sorted in descending order by prediction score. Use the
* GetActionRecommendations
API if you have a custom campaign that deploys a solution version trained
* with a PERSONALIZED_ACTIONS recipe.
*
*
* For more information about PERSONALIZED_ACTIONS recipes, see PERSONALIZED_ACTIONS
* recipes. For more information about getting action recommendations, see Getting action
* recommendations.
*
*
* @param getActionRecommendationsRequest
* @return Result of the GetActionRecommendations operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @throws ResourceNotFoundException
* The specified resource does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws PersonalizeRuntimeException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample PersonalizeRuntimeClient.GetActionRecommendations
* @see AWS API Documentation
*/
default GetActionRecommendationsResponse getActionRecommendations(
GetActionRecommendationsRequest getActionRecommendationsRequest) throws InvalidInputException,
ResourceNotFoundException, AwsServiceException, SdkClientException, PersonalizeRuntimeException {
throw new UnsupportedOperationException();
}
/**
*
* Returns a list of recommended actions in sorted in descending order by prediction score. Use the
* GetActionRecommendations
API if you have a custom campaign that deploys a solution version trained
* with a PERSONALIZED_ACTIONS recipe.
*
*
* For more information about PERSONALIZED_ACTIONS recipes, see PERSONALIZED_ACTIONS
* recipes. For more information about getting action recommendations, see Getting action
* recommendations.
*
*
*
* This is a convenience which creates an instance of the {@link GetActionRecommendationsRequest.Builder} avoiding
* the need to create one manually via {@link GetActionRecommendationsRequest#builder()}
*
*
* @param getActionRecommendationsRequest
* A {@link Consumer} that will call methods on
* {@link software.amazon.awssdk.services.personalizeruntime.model.GetActionRecommendationsRequest.Builder}
* to create a request.
* @return Result of the GetActionRecommendations operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @throws ResourceNotFoundException
* The specified resource does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws PersonalizeRuntimeException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample PersonalizeRuntimeClient.GetActionRecommendations
* @see AWS API Documentation
*/
default GetActionRecommendationsResponse getActionRecommendations(
Consumer getActionRecommendationsRequest) throws InvalidInputException,
ResourceNotFoundException, AwsServiceException, SdkClientException, PersonalizeRuntimeException {
return getActionRecommendations(GetActionRecommendationsRequest.builder().applyMutation(getActionRecommendationsRequest)
.build());
}
/**
*
* Re-ranks a list of recommended items for the given user. The first item in the list is deemed the most likely
* item to be of interest to the user.
*
*
*
* The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.
*
*
*
* @param getPersonalizedRankingRequest
* @return Result of the GetPersonalizedRanking operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @throws ResourceNotFoundException
* The specified resource does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws PersonalizeRuntimeException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample PersonalizeRuntimeClient.GetPersonalizedRanking
* @see AWS API Documentation
*/
default GetPersonalizedRankingResponse getPersonalizedRanking(GetPersonalizedRankingRequest getPersonalizedRankingRequest)
throws InvalidInputException, ResourceNotFoundException, AwsServiceException, SdkClientException,
PersonalizeRuntimeException {
throw new UnsupportedOperationException();
}
/**
*
* Re-ranks a list of recommended items for the given user. The first item in the list is deemed the most likely
* item to be of interest to the user.
*
*
*
* The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.
*
*
*
* This is a convenience which creates an instance of the {@link GetPersonalizedRankingRequest.Builder} avoiding the
* need to create one manually via {@link GetPersonalizedRankingRequest#builder()}
*
*
* @param getPersonalizedRankingRequest
* A {@link Consumer} that will call methods on
* {@link software.amazon.awssdk.services.personalizeruntime.model.GetPersonalizedRankingRequest.Builder} to
* create a request.
* @return Result of the GetPersonalizedRanking operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @throws ResourceNotFoundException
* The specified resource does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws PersonalizeRuntimeException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample PersonalizeRuntimeClient.GetPersonalizedRanking
* @see AWS API Documentation
*/
default GetPersonalizedRankingResponse getPersonalizedRanking(
Consumer getPersonalizedRankingRequest) throws InvalidInputException,
ResourceNotFoundException, AwsServiceException, SdkClientException, PersonalizeRuntimeException {
return getPersonalizedRanking(GetPersonalizedRankingRequest.builder().applyMutation(getPersonalizedRankingRequest)
.build());
}
/**
*
* Returns a list of recommended items. For campaigns, the campaign's Amazon Resource Name (ARN) is required and the
* required user and item input depends on the recipe type used to create the solution backing the campaign as
* follows:
*
*
* -
*
* USER_PERSONALIZATION - userId
required, itemId
not used
*
*
* -
*
* RELATED_ITEMS - itemId
required, userId
not used
*
*
*
*
*
* Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING use the API.
*
*
*
* For recommenders, the recommender's ARN is required and the required item and user input depends on the use case
* (domain-based recipe) backing the recommender. For information on use case requirements see Choosing recommender use
* cases.
*
*
* @param getRecommendationsRequest
* @return Result of the GetRecommendations operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @throws ResourceNotFoundException
* The specified resource does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws PersonalizeRuntimeException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample PersonalizeRuntimeClient.GetRecommendations
* @see AWS API Documentation
*/
default GetRecommendationsResponse getRecommendations(GetRecommendationsRequest getRecommendationsRequest)
throws InvalidInputException, ResourceNotFoundException, AwsServiceException, SdkClientException,
PersonalizeRuntimeException {
throw new UnsupportedOperationException();
}
/**
*
* Returns a list of recommended items. For campaigns, the campaign's Amazon Resource Name (ARN) is required and the
* required user and item input depends on the recipe type used to create the solution backing the campaign as
* follows:
*
*
* -
*
* USER_PERSONALIZATION - userId
required, itemId
not used
*
*
* -
*
* RELATED_ITEMS - itemId
required, userId
not used
*
*
*
*
*
* Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING use the API.
*
*
*
* For recommenders, the recommender's ARN is required and the required item and user input depends on the use case
* (domain-based recipe) backing the recommender. For information on use case requirements see Choosing recommender use
* cases.
*
*
*
* This is a convenience which creates an instance of the {@link GetRecommendationsRequest.Builder} avoiding the
* need to create one manually via {@link GetRecommendationsRequest#builder()}
*
*
* @param getRecommendationsRequest
* A {@link Consumer} that will call methods on
* {@link software.amazon.awssdk.services.personalizeruntime.model.GetRecommendationsRequest.Builder} to
* create a request.
* @return Result of the GetRecommendations operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @throws ResourceNotFoundException
* The specified resource does not exist.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws PersonalizeRuntimeException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample PersonalizeRuntimeClient.GetRecommendations
* @see AWS API Documentation
*/
default GetRecommendationsResponse getRecommendations(Consumer getRecommendationsRequest)
throws InvalidInputException, ResourceNotFoundException, AwsServiceException, SdkClientException,
PersonalizeRuntimeException {
return getRecommendations(GetRecommendationsRequest.builder().applyMutation(getRecommendationsRequest).build());
}
/**
* Create a {@link PersonalizeRuntimeClient} with the region loaded from the
* {@link software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain} and credentials loaded from the
* {@link software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider}.
*/
static PersonalizeRuntimeClient create() {
return builder().build();
}
/**
* Create a builder that can be used to configure and create a {@link PersonalizeRuntimeClient}.
*/
static PersonalizeRuntimeClientBuilder builder() {
return new DefaultPersonalizeRuntimeClientBuilder();
}
static ServiceMetadata serviceMetadata() {
return ServiceMetadata.of(SERVICE_METADATA_ID);
}
@Override
default PersonalizeRuntimeServiceClientConfiguration serviceClientConfiguration() {
throw new UnsupportedOperationException();
}
}