sendEvent method

Future<void> sendEvent({
  1. required List<Entity> entities,
  2. required String eventId,
  3. required String eventTimestamp,
  4. required String eventTypeName,
  5. required Map<String, String> eventVariables,
  6. String? assignedLabel,
  7. String? labelTimestamp,
})

Stores events in Amazon Fraud Detector without generating fraud predictions for those events. For example, you can use SendEvent to upload a historical dataset, which you can then later use to train a model.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter entities : An array of entities.

Parameter eventId : The event ID to upload.

Parameter eventTimestamp : The timestamp that defines when the event under evaluation occurred. The timestamp must be specified using ISO 8601 standard in UTC.

Parameter eventTypeName : The event type name of the event.

Parameter eventVariables : Names of the event type's variables you defined in Amazon Fraud Detector to represent data elements and their corresponding values for the event you are sending for evaluation.

Parameter assignedLabel : The label to associate with the event. Required if specifying labelTimestamp.

Parameter labelTimestamp : The timestamp associated with the label. Required if specifying assignedLabel.

Implementation

Future<void> sendEvent({
  required List<Entity> entities,
  required String eventId,
  required String eventTimestamp,
  required String eventTypeName,
  required Map<String, String> eventVariables,
  String? assignedLabel,
  String? labelTimestamp,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.SendEvent'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'entities': entities,
      'eventId': eventId,
      'eventTimestamp': eventTimestamp,
      'eventTypeName': eventTypeName,
      'eventVariables': eventVariables,
      if (assignedLabel != null) 'assignedLabel': assignedLabel,
      if (labelTimestamp != null) 'labelTimestamp': labelTimestamp,
    },
  );
}