将多个文件附加到 Google 课堂作业?

Attach multiple files to a Google Classroom assignment?

我正在尝试创建一个附有多个文件的课堂作业,这是我的代码和一个文件:

  Classroom.Courses.CourseWork.create({
        courseId: id,
        title : title,
        description : desc,
        workType : 'ASSIGNMENT',
        materials: [
          {
            driveFile:{
              driveFile: {
                id: fileId, 
                title: fileName
              },
              shareMode: "STUDENT_COPY"
            },
          }
        ],
        state : "PUBLISHED"
      }, id)

如何添加另一个文件?我试图复制 'driveFile' 但没有成功:

materials: [
      {
        driveFile:{
          driveFile: {
            id: fileId, 
            title: fileName
          },
          shareMode: "STUDENT_COPY"
        },
        driveFile:{
          driveFile: {
            id: fileId, 
            title: fileName
          },
          shareMode: "STUDENT_COPY"
        },
      }
    ],

找不到关于此的任何文档或其他问题。

谢谢!

试试这个代码:

{
  "workType": "ASSIGNMENT",
  "materials": [
    {
      "driveFile": {
        "driveFile": {
          "id": "FILE_ID",
          "title": "TestingFile"
        },
        "shareMode": "STUDENT_COPY"
      }
    },
    {
      "driveFile": {
        "driveFile": {
          "id": "FILE_ID",
          "title": "Sample Docs"
        },
        "shareMode": "STUDENT_COPY"
      }
    }
  ],
  "description": "Assignment 1 &2",
  "title": "Assignment"
}

结果如下:

我尝试使用 Method: courses.courseWork.create 试试这个 API 来帮助我正确构建请求。

希望对您有所帮助。