-
Notifications
You must be signed in to change notification settings - Fork 244
/
input.rs
671 lines (668 loc) · 38.5 KB
/
input.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
// 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)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, 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,
) -> std::result::Result<
crate::input::GetPersonalizedRankingInput,
aws_smithy_http::operation::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,
})
}
}
}
#[doc(hidden)]
pub type GetPersonalizedRankingInputOperationOutputAlias = crate::operation::GetPersonalizedRanking;
#[doc(hidden)]
pub type GetPersonalizedRankingInputOperationRetryAlias = aws_http::retry::AwsErrorRetryPolicy;
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::AwsErrorRetryPolicy,
>,
aws_smithy_http::operation::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::GetPersonalizedRankingInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::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::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(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(),
));
aws_endpoint::set_endpoint_resolver(
&mut request.properties_mut(),
_config.endpoint_resolver.clone(),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.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_policy(aws_http::retry::AwsErrorRetryPolicy::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)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, 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>,
}
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</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
}
/// <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
}
/// Consumes the builder and constructs a [`GetRecommendationsInput`](crate::input::GetRecommendationsInput)
pub fn build(
self,
) -> std::result::Result<
crate::input::GetRecommendationsInput,
aws_smithy_http::operation::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,
})
}
}
}
#[doc(hidden)]
pub type GetRecommendationsInputOperationOutputAlias = crate::operation::GetRecommendations;
#[doc(hidden)]
pub type GetRecommendationsInputOperationRetryAlias = aws_http::retry::AwsErrorRetryPolicy;
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::AwsErrorRetryPolicy,
>,
aws_smithy_http::operation::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::GetRecommendationsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::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::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(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(),
));
aws_endpoint::set_endpoint_resolver(
&mut request.properties_mut(),
_config.endpoint_resolver.clone(),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.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_policy(aws_http::retry::AwsErrorRetryPolicy::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)]
pub struct GetRecommendationsInput {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.</p>
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>
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>
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>
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>
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>
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>
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>
pub recommender_arn: std::option::Option<std::string::String>,
}
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</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()
}
}
impl std::fmt::Debug for GetRecommendationsInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("GetRecommendationsInput");
formatter.field("campaign_arn", &self.campaign_arn);
formatter.field("item_id", &self.item_id);
formatter.field("user_id", &self.user_id);
formatter.field("num_results", &self.num_results);
formatter.field("context", &self.context);
formatter.field("filter_arn", &self.filter_arn);
formatter.field("filter_values", &self.filter_values);
formatter.field("recommender_arn", &self.recommender_arn);
formatter.finish()
}
}
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct GetPersonalizedRankingInput {
/// <p>The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.</p>
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>
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>
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>
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>
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>
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()
}
}
impl std::fmt::Debug for GetPersonalizedRankingInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("GetPersonalizedRankingInput");
formatter.field("campaign_arn", &self.campaign_arn);
formatter.field("input_list", &self.input_list);
formatter.field("user_id", &self.user_id);
formatter.field("context", &self.context);
formatter.field("filter_arn", &self.filter_arn);
formatter.field("filter_values", &self.filter_values);
formatter.finish()
}
}