list method

Future<ListStudentSubmissionsResponse> list(
  1. String courseId,
  2. String courseWorkId, {
  3. String? late,
  4. int? pageSize,
  5. String? pageToken,
  6. List<String>? states,
  7. String? userId,
  8. String? $fields,
})

Returns a list of student submissions that the requester is permitted to view, factoring in the OAuth scopes of the request.

- may be specified as the course_work_id to include student submissions for multiple course work items. Course students may only view their own work. Course teachers and domain administrators may view all student submissions. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to access the requested course or course work, or for access errors. * INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if the requested course does not exist.

Request parameters:

courseId - Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.

courseWorkId - Identifier of the student work to request. This may be set to the string literal "-" to request student work for all course work in the specified course.

late - Requested lateness value. If specified, returned student submissions are restricted by the requested value. If unspecified, submissions are returned regardless of late value. Possible string values are:

  • "LATE_VALUES_UNSPECIFIED" : No restriction on submission late values specified.
  • "LATE_ONLY" : Return StudentSubmissions where late is true.
  • "NOT_LATE_ONLY" : Return StudentSubmissions where late is false.

pageSize - Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.

pageToken - nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.

states - Requested submission states. If specified, returned student submissions match one of the specified submission states.

userId - Optional argument to restrict returned student work to those owned by the student with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal "me", indicating the requesting user

$fields - Selector specifying which fields to include in a partial response.

Completes with a ListStudentSubmissionsResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ListStudentSubmissionsResponse> list(
  core.String courseId,
  core.String courseWorkId, {
  core.String? late,
  core.int? pageSize,
  core.String? pageToken,
  core.List<core.String>? states,
  core.String? userId,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (late != null) 'late': [late],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (states != null) 'states': states,
    if (userId != null) 'userId': [userId],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/courses/' +
      commons.escapeVariable('$courseId') +
      '/courseWork/' +
      commons.escapeVariable('$courseWorkId') +
      '/studentSubmissions';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListStudentSubmissionsResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}