sendTestEventNotification method

Future<void> sendTestEventNotification({
  1. required NotificationSpecification notification,
  2. required EventType testEventType,
})

The SendTestEventNotification operation causes Amazon Mechanical Turk to send a notification message as if a HIT event occurred, according to the provided notification specification. This allows you to test notifications without setting up notifications for a real HIT type and trying to trigger them using the website. When you call this operation, the service attempts to send the test notification immediately.

May throw ServiceFault. May throw RequestError.

Parameter notification : The notification specification to test. This value is identical to the value you would provide to the UpdateNotificationSettings operation when you establish the notification specification for a HIT type.

Parameter testEventType : The event to simulate to test the notification specification. This event is included in the test message even if the notification specification does not include the event type. The notification specification does not filter out the test event.

Implementation

Future<void> sendTestEventNotification({
  required NotificationSpecification notification,
  required EventType testEventType,
}) async {
  ArgumentError.checkNotNull(notification, 'notification');
  ArgumentError.checkNotNull(testEventType, 'testEventType');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'MTurkRequesterServiceV20170117.SendTestEventNotification'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Notification': notification,
      'TestEventType': testEventType.toValue(),
    },
  );
}