listWorkersWithQualificationType method

Future<ListWorkersWithQualificationTypeResponse> listWorkersWithQualificationType({
  1. required String qualificationTypeId,
  2. int? maxResults,
  3. String? nextToken,
  4. QualificationStatus? status,
})

The ListWorkersWithQualificationType operation returns all of the Workers that have been associated with a given Qualification type.

May throw ServiceFault. May throw RequestError.

Parameter qualificationTypeId : The ID of the Qualification type of the Qualifications to return.

Parameter maxResults : Limit the number of results returned.

Parameter nextToken : Pagination Token

Parameter status : The status of the Qualifications to return. Can be Granted | Revoked.

Implementation

Future<ListWorkersWithQualificationTypeResponse>
    listWorkersWithQualificationType({
  required String qualificationTypeId,
  int? maxResults,
  String? nextToken,
  QualificationStatus? status,
}) async {
  ArgumentError.checkNotNull(qualificationTypeId, 'qualificationTypeId');
  _s.validateStringLength(
    'qualificationTypeId',
    qualificationTypeId,
    1,
    64,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'MTurkRequesterServiceV20170117.ListWorkersWithQualificationType'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'QualificationTypeId': qualificationTypeId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (status != null) 'Status': status.toValue(),
    },
  );

  return ListWorkersWithQualificationTypeResponse.fromJson(jsonResponse.body);
}