putEvents method
Records user interaction event data. For more information see event-record-api.
May throw InvalidInputException.
Parameter eventList
:
A list of event data from the session.
Parameter sessionId
:
The session ID associated with the user's visit. Your application
generates the sessionId when a user first visits your website or uses your
application. Amazon Personalize uses the sessionId to associate events
with the user before they log in. For more information see
event-record-api.
Parameter trackingId
:
The tracking ID for the event. The ID is generated by a call to the CreateEventTracker
API.
Parameter userId
:
The user associated with the event.
Implementation
Future<void> putEvents({
required List<Event> eventList,
required String sessionId,
required String trackingId,
String? userId,
}) async {
ArgumentError.checkNotNull(eventList, 'eventList');
ArgumentError.checkNotNull(sessionId, 'sessionId');
_s.validateStringLength(
'sessionId',
sessionId,
1,
256,
isRequired: true,
);
ArgumentError.checkNotNull(trackingId, 'trackingId');
_s.validateStringLength(
'trackingId',
trackingId,
1,
256,
isRequired: true,
);
_s.validateStringLength(
'userId',
userId,
1,
256,
);
final $payload = <String, dynamic>{
'eventList': eventList,
'sessionId': sessionId,
'trackingId': trackingId,
if (userId != null) 'userId': userId,
};
await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/events',
exceptionFnMap: _exceptionFns,
);
}