list method

Future<ListAddOnAttachmentsResponse> list(
  1. String courseId,
  2. String postId, {
  3. String? itemId,
  4. int? pageSize,
  5. String? pageToken,
  6. String? $fields,
})

Returns all attachments created by an add-on under the post.

Requires the add-on to have active attachments on the post or have permission to create new attachments on the post. This method returns the following error codes: * PERMISSION_DENIED for access errors. * INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if one of the identified resources does not exist.

Request parameters:

courseId - Required. Identifier of the course.

postId - Optional. Identifier of the post under the course whose attachments to enumerate. Deprecated, use item_id instead.

itemId - Identifier of the Announcement, CourseWork, or CourseWorkMaterial whose attachments should be enumerated. This field is required, but is not marked as such while we are migrating from post_id.

pageSize - The maximum number of attachments to return. The service may return fewer than this value. If unspecified, at most 20 attachments will be returned. The maximum value is 20; values above 20 will be coerced to 20.

pageToken - A page token, received from a previous ListAddOnAttachments call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListAddOnAttachments must match the call that provided the page token.

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

Completes with a ListAddOnAttachmentsResponse.

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<ListAddOnAttachmentsResponse> list(
  core.String courseId,
  core.String postId, {
  core.String? itemId,
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (itemId != null) 'itemId': [itemId],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/courses/' +
      commons.escapeVariable('$courseId') +
      '/posts/' +
      commons.escapeVariable('$postId') +
      '/addOnAttachments';

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