Skip to content

Commit f30761f

Browse files
author
awstools
committed
feat(client-personalize-events): This release provides support for creation and use of metric attributions in AWS Personalize
1 parent 6f15a0a commit f30761f

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

clients/client-personalize-events/src/models/models_0.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import {
33
ExceptionOptionType as __ExceptionOptionType,
44
LazyJsonString as __LazyJsonString,
5+
SENSITIVE_STRING,
56
} from "@aws-sdk/smithy-client";
67

78
import { PersonalizeEventsServiceException as __BaseException } from "./PersonalizeEventsServiceException";
@@ -25,6 +26,16 @@ export class InvalidInputException extends __BaseException {
2526
}
2627
}
2728

29+
/**
30+
* <p>Contains information about a metric attribution associated with an event. For more information about metric attributions, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html">Measuring impact of recommendations</a>.</p>
31+
*/
32+
export interface MetricAttribution {
33+
/**
34+
* <p>The source of the event, such as a third party.</p>
35+
*/
36+
eventAttributionSource: string | undefined;
37+
}
38+
2839
/**
2940
* <p>Represents user interaction event information sent using the
3041
* <code>PutEvents</code> API.</p>
@@ -75,14 +86,27 @@ export interface Event {
7586
sentAt: Date | undefined;
7687

7788
/**
78-
* <p>The ID of the recommendation.</p>
89+
* <p>The ID of the list of recommendations that contains the item the user interacted with. Provide a <code>recommendationId</code> to have Amazon Personalize implicitly record the
90+
* recommendations you show your user as impressions data. Or provide a <code>recommendationId</code> if you use a metric attribution to measure the impact of recommendations.
91+
* </p>
92+
* <p>
93+
* For more information on recording impressions data, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data">Recording impressions data</a>.
94+
* For more information on creating a metric attribution see <a href="https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html">Measuring impact of recommendations</a>.
95+
* </p>
7996
*/
8097
recommendationId?: string;
8198

8299
/**
83-
* <p>A list of item IDs that represents the sequence of items you have shown the user. For example, <code>["itemId1", "itemId2", "itemId3"]</code>.</p>
100+
* <p>A list of item IDs that represents the sequence of items you have shown the user. For example, <code>["itemId1", "itemId2", "itemId3"]</code>. Provide a list of
101+
* items to manually record impressions data for an event. For more information on recording impressions data,
102+
* see <a href="https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data">Recording impressions data</a>. </p>
84103
*/
85104
impression?: string[];
105+
106+
/**
107+
* <p>Contains information about the metric attribution associated with an event. For more information about metric attributions, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html">Measuring impact of recommendations</a>.</p>
108+
*/
109+
metricAttribution?: MetricAttribution;
86110
}
87111

88112
export interface PutEventsRequest {
@@ -219,44 +243,60 @@ export interface PutUsersRequest {
219243
users: User[] | undefined;
220244
}
221245

246+
/**
247+
* @internal
248+
*/
249+
export const MetricAttributionFilterSensitiveLog = (obj: MetricAttribution): any => ({
250+
...obj,
251+
});
252+
222253
/**
223254
* @internal
224255
*/
225256
export const EventFilterSensitiveLog = (obj: Event): any => ({
226257
...obj,
258+
...(obj.itemId && { itemId: SENSITIVE_STRING }),
259+
...(obj.properties && { properties: SENSITIVE_STRING }),
260+
...(obj.impression && { impression: SENSITIVE_STRING }),
227261
});
228262

229263
/**
230264
* @internal
231265
*/
232266
export const PutEventsRequestFilterSensitiveLog = (obj: PutEventsRequest): any => ({
233267
...obj,
268+
...(obj.userId && { userId: SENSITIVE_STRING }),
269+
...(obj.eventList && { eventList: SENSITIVE_STRING }),
234270
});
235271

236272
/**
237273
* @internal
238274
*/
239275
export const ItemFilterSensitiveLog = (obj: Item): any => ({
240276
...obj,
277+
...(obj.properties && { properties: SENSITIVE_STRING }),
241278
});
242279

243280
/**
244281
* @internal
245282
*/
246283
export const PutItemsRequestFilterSensitiveLog = (obj: PutItemsRequest): any => ({
247284
...obj,
285+
...(obj.items && { items: obj.items.map((item) => ItemFilterSensitiveLog(item)) }),
248286
});
249287

250288
/**
251289
* @internal
252290
*/
253291
export const UserFilterSensitiveLog = (obj: User): any => ({
254292
...obj,
293+
...(obj.properties && { properties: SENSITIVE_STRING }),
255294
});
256295

257296
/**
258297
* @internal
259298
*/
260299
export const PutUsersRequestFilterSensitiveLog = (obj: PutUsersRequest): any => ({
261300
...obj,
301+
...(obj.users && { users: obj.users.map((item) => UserFilterSensitiveLog(item)) }),
262302
});

clients/client-personalize-events/src/protocols/Aws_restJson1.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
Event,
2222
InvalidInputException,
2323
Item,
24+
MetricAttribution,
2425
ResourceInUseException,
2526
ResourceNotFoundException,
2627
User,
@@ -286,6 +287,9 @@ const serializeAws_restJson1Event = (input: Event, context: __SerdeContext): any
286287
...(input.eventValue != null && { eventValue: __serializeFloat(input.eventValue) }),
287288
...(input.impression != null && { impression: serializeAws_restJson1Impression(input.impression, context) }),
288289
...(input.itemId != null && { itemId: input.itemId }),
290+
...(input.metricAttribution != null && {
291+
metricAttribution: serializeAws_restJson1MetricAttribution(input.metricAttribution, context),
292+
}),
289293
...(input.properties != null && { properties: __LazyJsonString.fromObject(input.properties) }),
290294
...(input.recommendationId != null && { recommendationId: input.recommendationId }),
291295
...(input.sentAt != null && { sentAt: Math.round(input.sentAt.getTime() / 1000) }),
@@ -323,6 +327,12 @@ const serializeAws_restJson1ItemList = (input: Item[], context: __SerdeContext):
323327
});
324328
};
325329

330+
const serializeAws_restJson1MetricAttribution = (input: MetricAttribution, context: __SerdeContext): any => {
331+
return {
332+
...(input.eventAttributionSource != null && { eventAttributionSource: input.eventAttributionSource }),
333+
};
334+
};
335+
326336
const serializeAws_restJson1User = (input: User, context: __SerdeContext): any => {
327337
return {
328338
...(input.properties != null && { properties: __LazyJsonString.fromObject(input.properties) }),

0 commit comments

Comments
 (0)