associateQualificationWithWorker method

Future<void> associateQualificationWithWorker({
  1. required String qualificationTypeId,
  2. required String workerId,
  3. int? integerValue,
  4. bool? sendNotification,
})

The AssociateQualificationWithWorker operation gives a Worker a Qualification. AssociateQualificationWithWorker does not require that the Worker submit a Qualification request. It gives the Qualification directly to the Worker.

You can only assign a Qualification of a Qualification type that you created (using the CreateQualificationType operation).

May throw ServiceFault. May throw RequestError.

Parameter qualificationTypeId : The ID of the Qualification type to use for the assigned Qualification.

Parameter workerId : The ID of the Worker to whom the Qualification is being assigned. Worker IDs are included with submitted HIT assignments and Qualification requests.

Parameter integerValue : The value of the Qualification to assign.

Parameter sendNotification : Specifies whether to send a notification email message to the Worker saying that the qualification was assigned to the Worker. Note: this is true by default.

Implementation

Future<void> associateQualificationWithWorker({
  required String qualificationTypeId,
  required String workerId,
  int? integerValue,
  bool? sendNotification,
}) async {
  ArgumentError.checkNotNull(qualificationTypeId, 'qualificationTypeId');
  _s.validateStringLength(
    'qualificationTypeId',
    qualificationTypeId,
    1,
    64,
    isRequired: true,
  );
  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.AssociateQualificationWithWorker'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'QualificationTypeId': qualificationTypeId,
      'WorkerId': workerId,
      if (integerValue != null) 'IntegerValue': integerValue,
      if (sendNotification != null) 'SendNotification': sendNotification,
    },
  );
}