class CoursesAnnouncements extends Resource (View source)

The "announcements" collection of methods.

Typical usage is:

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

Methods

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

Creates an announcement. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course, create announcements 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 (announcements.create)

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

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

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

Returns an announcement. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course or announcement, or for access errors. INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if the requested course or announcement does not exist. (announcements.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. (announcements.getAddOnContext)

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

Returns a list of announcements that the requester is permitted to view.

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

Modifies assignee mode and options of an announcement. Only a teacher of the course that contains the announcement 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, Announcement $postBody, array $optParams = [])

Updates one or more fields of an announcement. This method returns the following error codes: PERMISSION_DENIED if the requesting developer project did not create the corresponding announcement or for access errors. INVALID_ARGUMENT if the request is malformed. FAILED_PRECONDITION if the requested announcement has already been deleted. NOT_FOUND if the requested course or announcement does not exist (announcements.patch)

Details

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

Creates an announcement. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course, create announcements 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 (announcements.create)

Parameters

string $courseId

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

Announcement $postBody
array $optParams

Optional parameters.

Return Value

Announcement

Exceptions

Exception

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

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

  • NOT_FOUND if no course exists with the requested ID. (announcements.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 announcement to delete. This identifier is a Classroom-assigned identifier.

array $optParams

Optional parameters.

Return Value

ClassroomEmpty

Exceptions

Exception

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

Returns an announcement. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to access the requested course or announcement, or for access errors. INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if the requested course or announcement does not exist. (announcements.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 announcement.

array $optParams

Optional parameters.

Return Value

Announcement

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. (announcements.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

ListAnnouncementsResponse listCoursesAnnouncements(string $courseId, array $optParams = [])

Returns a list of announcements that the requester is permitted to view.

Course students may only view PUBLISHED announcements. Course teachers and domain administrators may view all announcements. 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. (announcements.listCoursesAnnouncements)

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

ListAnnouncementsResponse

Exceptions

Exception

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

Modifies assignee mode and options of an announcement. Only a teacher of the course that contains the announcement 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.

(announcements.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 announcement.

ModifyAnnouncementAssigneesRequest $postBody
array $optParams

Optional parameters.

Return Value

Announcement

Exceptions

Exception

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

Updates one or more fields of an announcement. This method returns the following error codes: PERMISSION_DENIED if the requesting developer project did not create the corresponding announcement or for access errors. INVALID_ARGUMENT if the request is malformed. FAILED_PRECONDITION if the requested announcement has already been deleted. NOT_FOUND if the requested course or announcement does not exist (announcements.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 announcement.

Announcement $postBody
array $optParams

Optional parameters.

Return Value

Announcement

Exceptions

Exception