createWorkerBlock method

Future<void> createWorkerBlock({
  1. required String reason,
  2. required String workerId,
})

The CreateWorkerBlock operation allows you to prevent a Worker from working on your HITs. For example, you can block a Worker who is producing poor quality work. You can block up to 100,000 Workers.

May throw ServiceFault. May throw RequestError.

Parameter reason : A message explaining the reason for blocking the Worker. This parameter enables you to keep track of your Workers. The Worker does not see this message.

Parameter workerId : The ID of the Worker to block.

Implementation

Future<void> createWorkerBlock({
  required String reason,
  required String workerId,
}) async {
  ArgumentError.checkNotNull(reason, 'reason');
  ArgumentError.checkNotNull(workerId, 'workerId');
  _s.validateStringLength(
    'workerId',
    workerId,
    1,
    64,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'MTurkRequesterServiceV20170117.CreateWorkerBlock'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Reason': reason,
      'WorkerId': workerId,
    },
  );
}