deleteWorkerBlock method

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

The DeleteWorkerBlock operation allows you to reinstate a blocked Worker to work on your HITs. This operation reverses the effects of the CreateWorkerBlock operation. You need the Worker ID to use this operation. If the Worker ID is missing or invalid, this operation fails and returns the message “WorkerId is invalid.” If the specified Worker is not blocked, this operation returns successfully.

May throw ServiceFault. May throw RequestError.

Parameter workerId : The ID of the Worker to unblock.

Parameter reason : A message that explains the reason for unblocking the Worker. The Worker does not see this message.

Implementation

Future<void> deleteWorkerBlock({
  required String workerId,
  String? reason,
}) async {
  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.DeleteWorkerBlock'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'WorkerId': workerId,
      if (reason != null) 'Reason': reason,
    },
  );
}