updateNotificationSettings method

Future<void> updateNotificationSettings({
  1. required String hITTypeId,
  2. bool? active,
  3. NotificationSpecification? notification,
})

The UpdateNotificationSettings operation creates, updates, disables or re-enables notifications for a HIT type. If you call the UpdateNotificationSettings operation for a HIT type that already has a notification specification, the operation replaces the old specification with a new one. You can call the UpdateNotificationSettings operation to enable or disable notifications for the HIT type, without having to modify the notification specification itself by providing updates to the Active status without specifying a new notification specification. To change the Active status of a HIT type's notifications, the HIT type must already have a notification specification, or one must be provided in the same call to UpdateNotificationSettings.

May throw ServiceFault. May throw RequestError.

Parameter hITTypeId : The ID of the HIT type whose notification specification is being updated.

Parameter active : Specifies whether notifications are sent for HITs of this HIT type, according to the notification specification. You must specify either the Notification parameter or the Active parameter for the call to UpdateNotificationSettings to succeed.

Parameter notification : The notification specification for the HIT type.

Implementation

Future<void> updateNotificationSettings({
  required String hITTypeId,
  bool? active,
  NotificationSpecification? notification,
}) async {
  ArgumentError.checkNotNull(hITTypeId, 'hITTypeId');
  _s.validateStringLength(
    'hITTypeId',
    hITTypeId,
    1,
    64,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'MTurkRequesterServiceV20170117.UpdateNotificationSettings'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'HITTypeId': hITTypeId,
      if (active != null) 'Active': active,
      if (notification != null) 'Notification': notification,
    },
  );
}