class CoursesCourseWork extends Resource (View source)

The "courseWork" collection of methods.

Typical usage is:

 $classroomService = new Google\Service\Classroom(...);
 $courseWork = $classroomService->courses_courseWork;

Methods

create(string $courseId, CourseWork $postBody, array $optParams = [])

Creates course work. The resulting course work (and corresponding student submissions) are associated with the Developer Console project of the OAuth client ID used to make the request. Classroom API requests to modify course work and student submissions must be made with an OAuth client ID from the associated Developer Console project. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course, create course work in the requested course, share a Drive attachment, or for access errors. INVALID_ARGUMENT if the request is malformed. NOT_FOUND if the requested course does not exist. FAILED_PRECONDITION for the following request error: * AttachmentNotVisible (courseWork.create)

delete(string $courseId, string $id, array $optParams = [])

Deletes a course work. This request must be made by the Developer Console project of the OAuth client ID used to create the corresponding course work item. This method returns the following error codes: PERMISSION_DENIED if the requesting developer project did not create the corresponding course work, if the requesting user is not permitted to delete the requested course or for access errors. FAILED_PRECONDITION if the requested course work has already been deleted. * NOT_FOUND if no course exists with the requested ID. (courseWork.delete)

get(string $courseId, string $id, array $optParams = [])

Returns course work. 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 or course work does not exist. (courseWork.get)

getAddOnContext(string $courseId, string $itemId, array $optParams = [])

Gets metadata for Classroom add-ons in the context of a specific post. To maintain the integrity of its own data and permissions model, an add-on should call this to validate query parameters and the requesting user's role whenever the add-on is opened in an iframe. 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. (courseWork.getAddOnContext)

listCoursesCourseWork(string $courseId, array $optParams = [])

Returns a list of course work that the requester is permitted to view. Course students may only view PUBLISHED course work. Course teachers and domain administrators may view all course work. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course or for access errors. INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if the requested course does not exist.

modifyAssignees(string $courseId, string $id, ModifyCourseWorkAssigneesRequest $postBody, array $optParams = [])

Modifies assignee mode and options of a coursework. Only a teacher of the course that contains the coursework may call this method. 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 or course work does not exist.

patch(string $courseId, string $id, CourseWork $postBody, array $optParams = [])

Updates one or more fields of a course work. See google.classroom.v1.CourseWork for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the OAuth client ID used to create the corresponding course work item. This method returns the following error codes: PERMISSION_DENIED if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. INVALID_ARGUMENT if the request is malformed. FAILED_PRECONDITION if the requested course work has already been deleted. NOT_FOUND if the requested course or course work does not exist. (courseWork.patch)

Details

CourseWork create(string $courseId, CourseWork $postBody, array $optParams = [])

Creates course work. The resulting course work (and corresponding student submissions) are associated with the Developer Console project of the OAuth client ID used to make the request. Classroom API requests to modify course work and student submissions must be made with an OAuth client ID from the associated Developer Console project. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course, create course work in the requested course, share a Drive attachment, or for access errors. INVALID_ARGUMENT if the request is malformed. NOT_FOUND if the requested course does not exist. FAILED_PRECONDITION for the following request error: * AttachmentNotVisible (courseWork.create)

Parameters

string $courseId

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

CourseWork $postBody
array $optParams

Optional parameters.

Return Value

CourseWork

Exceptions

Exception

ClassroomEmpty delete(string $courseId, string $id, array $optParams = [])

Deletes a course work. This request must be made by the Developer Console project of the OAuth client ID used to create the corresponding course work item. This method returns the following error codes: PERMISSION_DENIED if the requesting developer project did not create the corresponding course work, if the requesting user is not permitted to delete the requested course or for access errors. FAILED_PRECONDITION if the requested course work has already been deleted. * NOT_FOUND if no course exists with the requested ID. (courseWork.delete)

Parameters

string $courseId

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

string $id

Identifier of the course work to delete. This identifier is a Classroom-assigned identifier.

array $optParams

Optional parameters.

Return Value

ClassroomEmpty

Exceptions

Exception

CourseWork get(string $courseId, string $id, array $optParams = [])

Returns course work. 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 or course work does not exist. (courseWork.get)

Parameters

string $courseId

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

string $id

Identifier of the course work.

array $optParams

Optional parameters.

Return Value

CourseWork

Exceptions

Exception

AddOnContext getAddOnContext(string $courseId, string $itemId, array $optParams = [])

Gets metadata for Classroom add-ons in the context of a specific post. To maintain the integrity of its own data and permissions model, an add-on should call this to validate query parameters and the requesting user's role whenever the add-on is opened in an iframe. 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. (courseWork.getAddOnContext)

Parameters

string $courseId

Required. Identifier of the course.

string $itemId

Identifier of the announcement, courseWork, or courseWorkMaterial under which the attachment is attached. This field is required, but is not marked as such while we are migrating from post_id.

array $optParams

Optional parameters.

Return Value

AddOnContext

Exceptions

Exception

ListCourseWorkResponse listCoursesCourseWork(string $courseId, array $optParams = [])

Returns a list of course work that the requester is permitted to view. Course students may only view PUBLISHED course work. Course teachers and domain administrators may view all course work. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course or for access errors. INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if the requested course does not exist.

(courseWork.listCoursesCourseWork)

Parameters

string $courseId

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

array $optParams

Optional parameters.

Return Value

ListCourseWorkResponse

Exceptions

Exception

CourseWork modifyAssignees(string $courseId, string $id, ModifyCourseWorkAssigneesRequest $postBody, array $optParams = [])

Modifies assignee mode and options of a coursework. Only a teacher of the course that contains the coursework may call this method. 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 or course work does not exist.

(courseWork.modifyAssignees)

Parameters

string $courseId

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

string $id

Identifier of the coursework.

ModifyCourseWorkAssigneesRequest $postBody
array $optParams

Optional parameters.

Return Value

CourseWork

Exceptions

Exception

CourseWork patch(string $courseId, string $id, CourseWork $postBody, array $optParams = [])

Updates one or more fields of a course work. See google.classroom.v1.CourseWork for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the OAuth client ID used to create the corresponding course work item. This method returns the following error codes: PERMISSION_DENIED if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. INVALID_ARGUMENT if the request is malformed. FAILED_PRECONDITION if the requested course work has already been deleted. NOT_FOUND if the requested course or course work does not exist. (courseWork.patch)

Parameters

string $courseId

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

string $id

Identifier of the course work.

CourseWork $postBody
array $optParams

Optional parameters.

Return Value

CourseWork

Exceptions

Exception