getAssignment method

Future<GetAssignmentResponse> getAssignment({
  1. required String assignmentId,
})

The GetAssignment operation retrieves the details of the specified Assignment.

May throw ServiceFault. May throw RequestError.

Parameter assignmentId : The ID of the Assignment to be retrieved.

Implementation

Future<GetAssignmentResponse> getAssignment({
  required String assignmentId,
}) async {
  ArgumentError.checkNotNull(assignmentId, 'assignmentId');
  _s.validateStringLength(
    'assignmentId',
    assignmentId,
    1,
    64,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'MTurkRequesterServiceV20170117.GetAssignment'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AssignmentId': assignmentId,
    },
  );

  return GetAssignmentResponse.fromJson(jsonResponse.body);
}