class Courses extends Resource (View source)

The "courses" collection of methods.

Typical usage is:

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

Methods

create(Course $postBody, array $optParams = [])

Creates a course. The user specified in ownerId is the owner of the created course and added as a teacher. A non-admin requesting user can only create a course with themselves as the owner. Domain admins can create courses owned by any user within their domain. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to create courses or for access errors. NOT_FOUND if the primary teacher is not a valid user. FAILED_PRECONDITION if the course owner's account is disabled or for the following request errors: UserCannotOwnCourse UserGroupsMembershipLimitReached ALREADY_EXISTS if an alias was specified in the id and already exists. (courses.create)

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

Deletes a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to delete the requested course or for access errors. NOT_FOUND if no course exists with the requested ID. (courses.delete)

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

Returns a course. 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. NOT_FOUND if no course exists with the requested ID. (courses.get)

listCourses(array $optParams = [])

Returns a list of courses that the requesting user is permitted to view, restricted to those that match the request. Returned courses are ordered by creation time, with the most recently created coming first. This method returns the following error codes: PERMISSION_DENIED for access errors. INVALID_ARGUMENT if the query argument is malformed. * NOT_FOUND if any users specified in the query arguments do not exist. (courses.listCourses)

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

Updates one or more fields in a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to modify the requested course or for access errors. NOT_FOUND if no course exists with the requested ID. INVALID_ARGUMENT if invalid fields are specified in the update mask or if no update mask is supplied. FAILED_PRECONDITION for the following request errors: * CourseNotModifiable

  • InactiveCourseOwner * IneligibleOwner (courses.patch)

update(string $id, Course $postBody, array $optParams = [])

Updates a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to modify the requested course or for access errors. NOT_FOUND if no course exists with the requested ID. FAILED_PRECONDITION for the following request errors: CourseNotModifiable (courses.update)

Details

Course create(Course $postBody, array $optParams = [])

Creates a course. The user specified in ownerId is the owner of the created course and added as a teacher. A non-admin requesting user can only create a course with themselves as the owner. Domain admins can create courses owned by any user within their domain. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to create courses or for access errors. NOT_FOUND if the primary teacher is not a valid user. FAILED_PRECONDITION if the course owner's account is disabled or for the following request errors: UserCannotOwnCourse UserGroupsMembershipLimitReached ALREADY_EXISTS if an alias was specified in the id and already exists. (courses.create)

Parameters

Course $postBody
array $optParams

Optional parameters.

Return Value

Course

Exceptions

Exception

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

Deletes a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to delete the requested course or for access errors. NOT_FOUND if no course exists with the requested ID. (courses.delete)

Parameters

string $id

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

array $optParams

Optional parameters.

Return Value

ClassroomEmpty

Exceptions

Exception

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

Returns a course. 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. NOT_FOUND if no course exists with the requested ID. (courses.get)

Parameters

string $id

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

array $optParams

Optional parameters.

Return Value

Course

Exceptions

Exception

ListCoursesResponse listCourses(array $optParams = [])

Returns a list of courses that the requesting user is permitted to view, restricted to those that match the request. Returned courses are ordered by creation time, with the most recently created coming first. This method returns the following error codes: PERMISSION_DENIED for access errors. INVALID_ARGUMENT if the query argument is malformed. * NOT_FOUND if any users specified in the query arguments do not exist. (courses.listCourses)

Parameters

array $optParams

Optional parameters.

Return Value

ListCoursesResponse

Exceptions

Exception

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

Updates one or more fields in a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to modify the requested course or for access errors. NOT_FOUND if no course exists with the requested ID. INVALID_ARGUMENT if invalid fields are specified in the update mask or if no update mask is supplied. FAILED_PRECONDITION for the following request errors: * CourseNotModifiable

  • InactiveCourseOwner * IneligibleOwner (courses.patch)

Parameters

string $id

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

Course $postBody
array $optParams

Optional parameters.

Return Value

Course

Exceptions

Exception

Course update(string $id, Course $postBody, array $optParams = [])

Updates a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to modify the requested course or for access errors. NOT_FOUND if no course exists with the requested ID. FAILED_PRECONDITION for the following request errors: CourseNotModifiable (courses.update)

Parameters

string $id

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

Course $postBody
array $optParams

Optional parameters.

Return Value

Course

Exceptions

Exception