// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
use std::fmt::Write;
/// See [`GetPersonalizedRankingInput`](crate::input::GetPersonalizedRankingInput).
pub mod get_personalized_ranking_input {
/// A builder for [`GetPersonalizedRankingInput`](crate::input::GetPersonalizedRankingInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) campaign_arn: std::option::Option<std::string::String>,
pub(crate) input_list: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) user_id: std::option::Option<std::string::String>,
pub(crate) context: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) filter_arn: std::option::Option<std::string::String>,
pub(crate) filter_values: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.</p>
pub fn campaign_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.campaign_arn = Some(input.into());
self
}
/// <p>The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.</p>
pub fn set_campaign_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.campaign_arn = input;
self
}
/// Appends an item to `input_list`.
///
/// To override the contents of this collection use [`set_input_list`](Self::set_input_list).
///
/// <p>A list of items (by <code>itemId</code>) to rank. If an item was not included in the training dataset, the item is appended to the end of the reranked list. The maximum is 500.</p>
pub fn input_list(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.input_list.unwrap_or_default();
v.push(input.into());
self.input_list = Some(v);
self
}
/// <p>A list of items (by <code>itemId</code>) to rank. If an item was not included in the training dataset, the item is appended to the end of the reranked list. The maximum is 500.</p>
pub fn set_input_list(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.input_list = input;
self
}
/// <p>The user for which you want the campaign to provide a personalized ranking.</p>
pub fn user_id(mut self, input: impl Into<std::string::String>) -> Self {
self.user_id = Some(input.into());
self
}
/// <p>The user for which you want the campaign to provide a personalized ranking.</p>
pub fn set_user_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.user_id = input;
self
}
/// Adds a key-value pair to `context`.
///
/// To override the contents of this collection use [`set_context`](Self::set_context).
///
/// <p>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.</p>
pub fn context(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.context.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.context = Some(hash_map);
self
}
/// <p>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.</p>
pub fn set_context(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.context = input;
self
}
/// <p>The Amazon Resource Name (ARN) of a filter you created to include items or exclude items from recommendations for a given user. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
pub fn filter_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.filter_arn = Some(input.into());
self
}
/// <p>The Amazon Resource Name (ARN) of a filter you created to include items or exclude items from recommendations for a given user. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
pub fn set_filter_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.filter_arn = input;
self
}
/// Adds a key-value pair to `filter_values`.
///
/// To override the contents of this collection use [`set_filter_values`](Self::set_filter_values).
///
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
pub fn filter_values(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.filter_values.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.filter_values = Some(hash_map);
self
}
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
pub fn set_filter_values(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.filter_values = input;
self
}
/// Consumes the builder and constructs a [`GetPersonalizedRankingInput`](crate::input::GetPersonalizedRankingInput).
pub fn build(
self,
) -> Result<
crate::input::GetPersonalizedRankingInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetPersonalizedRankingInput {
campaign_arn: self.campaign_arn,
input_list: self.input_list,
user_id: self.user_id,
context: self.context,
filter_arn: self.filter_arn,
filter_values: self.filter_values,
})
}
}
}
impl GetPersonalizedRankingInput {
/// Consumes the builder and constructs an Operation<[`GetPersonalizedRanking`](crate::operation::GetPersonalizedRanking)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::GetPersonalizedRanking,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::GetPersonalizedRankingInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/personalize-ranking").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetPersonalizedRankingInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_get_personalized_ranking(
&self,
)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::GetPersonalizedRanking::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetPersonalizedRanking",
"personalizeruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`GetPersonalizedRankingInput`](crate::input::GetPersonalizedRankingInput).
pub fn builder() -> crate::input::get_personalized_ranking_input::Builder {
crate::input::get_personalized_ranking_input::Builder::default()
}
}
/// See [`GetRecommendationsInput`](crate::input::GetRecommendationsInput).
pub mod get_recommendations_input {
/// A builder for [`GetRecommendationsInput`](crate::input::GetRecommendationsInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) campaign_arn: std::option::Option<std::string::String>,
pub(crate) item_id: std::option::Option<std::string::String>,
pub(crate) user_id: std::option::Option<std::string::String>,
pub(crate) num_results: std::option::Option<i32>,
pub(crate) context: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) filter_arn: std::option::Option<std::string::String>,
pub(crate) filter_values: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) recommender_arn: std::option::Option<std::string::String>,
pub(crate) promotions: std::option::Option<std::vec::Vec<crate::model::Promotion>>,
}
impl Builder {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.</p>
pub fn campaign_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.campaign_arn = Some(input.into());
self
}
/// <p>The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.</p>
pub fn set_campaign_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.campaign_arn = input;
self
}
/// <p>The item ID to provide recommendations for.</p>
/// <p>Required for <code>RELATED_ITEMS</code> recipe type.</p>
pub fn item_id(mut self, input: impl Into<std::string::String>) -> Self {
self.item_id = Some(input.into());
self
}
/// <p>The item ID to provide recommendations for.</p>
/// <p>Required for <code>RELATED_ITEMS</code> recipe type.</p>
pub fn set_item_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.item_id = input;
self
}
/// <p>The user ID to provide recommendations for.</p>
/// <p>Required for <code>USER_PERSONALIZATION</code> recipe type.</p>
pub fn user_id(mut self, input: impl Into<std::string::String>) -> Self {
self.user_id = Some(input.into());
self
}
/// <p>The user ID to provide recommendations for.</p>
/// <p>Required for <code>USER_PERSONALIZATION</code> recipe type.</p>
pub fn set_user_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.user_id = input;
self
}
/// <p>The number of results to return. The default is 25. The maximum is 500.</p>
pub fn num_results(mut self, input: i32) -> Self {
self.num_results = Some(input);
self
}
/// <p>The number of results to return. The default is 25. The maximum is 500.</p>
pub fn set_num_results(mut self, input: std::option::Option<i32>) -> Self {
self.num_results = input;
self
}
/// Adds a key-value pair to `context`.
///
/// To override the contents of this collection use [`set_context`](Self::set_context).
///
/// <p>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.</p>
pub fn context(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.context.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.context = Some(hash_map);
self
}
/// <p>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.</p>
pub fn set_context(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.context = input;
self
}
/// <p>The ARN of the filter to apply to the returned recommendations. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
/// <p>When using this parameter, be sure the filter resource is <code>ACTIVE</code>.</p>
pub fn filter_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.filter_arn = Some(input.into());
self
}
/// <p>The ARN of the filter to apply to the returned recommendations. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
/// <p>When using this parameter, be sure the filter resource is <code>ACTIVE</code>.</p>
pub fn set_filter_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.filter_arn = input;
self
}
/// Adds a key-value pair to `filter_values`.
///
/// To override the contents of this collection use [`set_filter_values`](Self::set_filter_values).
///
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
pub fn filter_values(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.filter_values.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.filter_values = Some(hash_map);
self
}
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
pub fn set_filter_values(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.filter_values = input;
self
}
/// <p>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.</p>
pub fn recommender_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.recommender_arn = Some(input.into());
self
}
/// <p>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.</p>
pub fn set_recommender_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.recommender_arn = input;
self
}
/// Appends an item to `promotions`.
///
/// To override the contents of this collection use [`set_promotions`](Self::set_promotions).
///
/// <p>The promotions to apply to the recommendation request. A promotion defines additional business rules that apply to a configurable subset of recommended items.</p>
pub fn promotions(mut self, input: crate::model::Promotion) -> Self {
let mut v = self.promotions.unwrap_or_default();
v.push(input);
self.promotions = Some(v);
self
}
/// <p>The promotions to apply to the recommendation request. A promotion defines additional business rules that apply to a configurable subset of recommended items.</p>
pub fn set_promotions(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Promotion>>,
) -> Self {
self.promotions = input;
self
}
/// Consumes the builder and constructs a [`GetRecommendationsInput`](crate::input::GetRecommendationsInput).
pub fn build(
self,
) -> Result<
crate::input::GetRecommendationsInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetRecommendationsInput {
campaign_arn: self.campaign_arn,
item_id: self.item_id,
user_id: self.user_id,
num_results: self.num_results.unwrap_or_default(),
context: self.context,
filter_arn: self.filter_arn,
filter_values: self.filter_values,
recommender_arn: self.recommender_arn,
promotions: self.promotions,
})
}
}
}
impl GetRecommendationsInput {
/// Consumes the builder and constructs an Operation<[`GetRecommendations`](crate::operation::GetRecommendations)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::GetRecommendations,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::GetRecommendationsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/recommendations").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetRecommendationsInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_get_recommendations(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::GetRecommendations::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetRecommendations",
"personalizeruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`GetRecommendationsInput`](crate::input::GetRecommendationsInput).
pub fn builder() -> crate::input::get_recommendations_input::Builder {
crate::input::get_recommendations_input::Builder::default()
}
}
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetRecommendationsInput {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.</p>
#[doc(hidden)]
pub campaign_arn: std::option::Option<std::string::String>,
/// <p>The item ID to provide recommendations for.</p>
/// <p>Required for <code>RELATED_ITEMS</code> recipe type.</p>
#[doc(hidden)]
pub item_id: std::option::Option<std::string::String>,
/// <p>The user ID to provide recommendations for.</p>
/// <p>Required for <code>USER_PERSONALIZATION</code> recipe type.</p>
#[doc(hidden)]
pub user_id: std::option::Option<std::string::String>,
/// <p>The number of results to return. The default is 25. The maximum is 500.</p>
#[doc(hidden)]
pub num_results: i32,
/// <p>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.</p>
#[doc(hidden)]
pub context:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
/// <p>The ARN of the filter to apply to the returned recommendations. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
/// <p>When using this parameter, be sure the filter resource is <code>ACTIVE</code>.</p>
#[doc(hidden)]
pub filter_arn: std::option::Option<std::string::String>,
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
#[doc(hidden)]
pub filter_values:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
/// <p>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.</p>
#[doc(hidden)]
pub recommender_arn: std::option::Option<std::string::String>,
/// <p>The promotions to apply to the recommendation request. A promotion defines additional business rules that apply to a configurable subset of recommended items.</p>
#[doc(hidden)]
pub promotions: std::option::Option<std::vec::Vec<crate::model::Promotion>>,
}
impl GetRecommendationsInput {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.</p>
pub fn campaign_arn(&self) -> std::option::Option<&str> {
self.campaign_arn.as_deref()
}
/// <p>The item ID to provide recommendations for.</p>
/// <p>Required for <code>RELATED_ITEMS</code> recipe type.</p>
pub fn item_id(&self) -> std::option::Option<&str> {
self.item_id.as_deref()
}
/// <p>The user ID to provide recommendations for.</p>
/// <p>Required for <code>USER_PERSONALIZATION</code> recipe type.</p>
pub fn user_id(&self) -> std::option::Option<&str> {
self.user_id.as_deref()
}
/// <p>The number of results to return. The default is 25. The maximum is 500.</p>
pub fn num_results(&self) -> i32 {
self.num_results
}
/// <p>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.</p>
pub fn context(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.context.as_ref()
}
/// <p>The ARN of the filter to apply to the returned recommendations. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
/// <p>When using this parameter, be sure the filter resource is <code>ACTIVE</code>.</p>
pub fn filter_arn(&self) -> std::option::Option<&str> {
self.filter_arn.as_deref()
}
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
pub fn filter_values(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.filter_values.as_ref()
}
/// <p>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.</p>
pub fn recommender_arn(&self) -> std::option::Option<&str> {
self.recommender_arn.as_deref()
}
/// <p>The promotions to apply to the recommendation request. A promotion defines additional business rules that apply to a configurable subset of recommended items.</p>
pub fn promotions(&self) -> std::option::Option<&[crate::model::Promotion]> {
self.promotions.as_deref()
}
}
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetPersonalizedRankingInput {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.</p>
#[doc(hidden)]
pub campaign_arn: std::option::Option<std::string::String>,
/// <p>A list of items (by <code>itemId</code>) to rank. If an item was not included in the training dataset, the item is appended to the end of the reranked list. The maximum is 500.</p>
#[doc(hidden)]
pub input_list: std::option::Option<std::vec::Vec<std::string::String>>,
/// <p>The user for which you want the campaign to provide a personalized ranking.</p>
#[doc(hidden)]
pub user_id: std::option::Option<std::string::String>,
/// <p>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.</p>
#[doc(hidden)]
pub context:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
/// <p>The Amazon Resource Name (ARN) of a filter you created to include items or exclude items from recommendations for a given user. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
#[doc(hidden)]
pub filter_arn: std::option::Option<std::string::String>,
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
#[doc(hidden)]
pub filter_values:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl GetPersonalizedRankingInput {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.</p>
pub fn campaign_arn(&self) -> std::option::Option<&str> {
self.campaign_arn.as_deref()
}
/// <p>A list of items (by <code>itemId</code>) to rank. If an item was not included in the training dataset, the item is appended to the end of the reranked list. The maximum is 500.</p>
pub fn input_list(&self) -> std::option::Option<&[std::string::String]> {
self.input_list.as_deref()
}
/// <p>The user for which you want the campaign to provide a personalized ranking.</p>
pub fn user_id(&self) -> std::option::Option<&str> {
self.user_id.as_deref()
}
/// <p>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.</p>
pub fn context(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.context.as_ref()
}
/// <p>The Amazon Resource Name (ARN) of a filter you created to include items or exclude items from recommendations for a given user. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
pub fn filter_arn(&self) -> std::option::Option<&str> {
self.filter_arn.as_deref()
}
/// <p>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. </p>
/// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering Recommendations</a>.</p>
pub fn filter_values(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.filter_values.as_ref()
}
}