listBonusPayments method

Future<ListBonusPaymentsResponse> listBonusPayments({
  1. String? assignmentId,
  2. String? hITId,
  3. int? maxResults,
  4. String? nextToken,
})

The ListBonusPayments operation retrieves the amounts of bonuses you have paid to Workers for a given HIT or assignment.

May throw ServiceFault. May throw RequestError.

Parameter assignmentId : The ID of the assignment associated with the bonus payments to retrieve. If specified, only bonus payments for the given assignment are returned. Either the HITId parameter or the AssignmentId parameter must be specified

Parameter hITId : The ID of the HIT associated with the bonus payments to retrieve. If not specified, all bonus payments for all assignments for the given HIT are returned. Either the HITId parameter or the AssignmentId parameter must be specified

Parameter nextToken : Pagination token

Implementation

Future<ListBonusPaymentsResponse> listBonusPayments({
  String? assignmentId,
  String? hITId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateStringLength(
    'assignmentId',
    assignmentId,
    1,
    64,
  );
  _s.validateStringLength(
    'hITId',
    hITId,
    1,
    64,
  );
  _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.ListBonusPayments'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (assignmentId != null) 'AssignmentId': assignmentId,
      if (hITId != null) 'HITId': hITId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListBonusPaymentsResponse.fromJson(jsonResponse.body);
}