classroom (v1)
PREREQUISITE: Read ../gws-shared/SKILL.md for auth, global flags, and security rules. If missing, run gws generate-skills to create it.
CODEBLOCK0
API Resources
courses
- create — 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.
- delete — 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.
- get — 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.
- getGradingPeriodSettings — Returns the grading period settings in a course. This method returns the following error codes: PERMISSION_DENIED if the requesting user isn't permitted to access the grading period settings in the requested course or for access errors. NOT_FOUND if the requested course does not exist.
- list — 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.
- patch — 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.
- update — 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 * CourseTitleCannotContainUrl
- updateGradingPeriodSettings — Updates grading period settings of a course. Individual grading periods can be added, removed, or modified using this method. The requesting user and course owner must be eligible to modify Grading Periods. For details, see licensing requirements.
- aliases — Operations on the 'aliases' resource
- announcements — Operations on the 'announcements' resource
- courseWork — Operations on the 'courseWork' resource
- courseWorkMaterials — Operations on the 'courseWorkMaterials' resource
- posts — Operations on the 'posts' resource
- studentGroups — Operations on the 'studentGroups' resource
- students — Operations on the 'students' resource
- teachers — Operations on the 'teachers' resource
- topics — Operations on the 'topics' resource
invitations
- accept — Accepts an invitation, removing it and adding the invited user to the teachers or students (as appropriate) of the specified course. Only the invited user may accept an invitation. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to accept the requested invitation or for access errors.
- create — Creates an invitation. Only one invitation for a user and course may exist at a time. Delete and re-create an invitation to make changes. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to create invitations for this course or for access errors. NOT_FOUND if the course or the user does not exist. FAILED_PRECONDITION: if the requested user's account is disabled.
- delete — Deletes an invitation. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to delete the requested invitation or for access errors. NOT_FOUND if no invitation exists with the requested ID.
- get — Returns an invitation. This method returns the following error codes: PERMISSION_DENIED if the requesting user is not permitted to view the requested invitation or for access errors. NOT_FOUND if no invitation exists with the requested ID.
- list — Returns a list of invitations that the requesting user is permitted to view, restricted to those that match the list request. Note: At least one of user_id or course_id must be supplied. Both fields can be supplied. This method returns the following error codes: * PERMISSION_DENIED for access errors.
registrations
- create — Creates a Registration, causing Classroom to start sending notifications from the provided feed to the destination provided in cloudPubSubTopic. Returns the created Registration. Currently, this will be the same as the argument, but with server-assigned fields such as expiry_time and id filled in. Note that any value specified for the expiry_time or id fields will be ignored.
- delete — Deletes a Registration, causing Classroom to stop sending notifications for that Registration.
userProfiles
- get — Returns a user profile. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to access this user profile, if no profile exists with the requested ID, or for access errors.
- guardianInvitations — Operations on the 'guardianInvitations' resource
- guardians — Operations on the 'guardians' resource
Discovering Commands
Before calling any API method, inspect it:
CODEBLOCK1
Use gws schema output to build your --params and --json flags.
技能名称: gws-classroom
详细描述:
classroom (v1)
前置条件: 请阅读 ../gws-shared/SKILL.md 了解认证、全局标志和安全规则。如果该文件缺失,请运行 gws generate-skills 创建。
bash
gws classroom <资源> <方法> [标志]
API 资源
courses
- create — 创建课程。ownerId 中指定的用户将成为所创建课程的所有者,并被添加为教师。非管理员请求用户只能创建以自己为所有者的课程。域管理员可以为域内任何用户创建课程。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权创建课程或存在访问错误。 NOTFOUND:主教师不是有效用户。
- delete — 删除课程。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权删除所请求的课程或存在访问错误。 NOTFOUND:不存在具有所请求 ID 的课程。
- get — 返回课程。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权访问所请求的课程或存在访问错误。 NOTFOUND:不存在具有所请求 ID 的课程。
- getGradingPeriodSettings — 返回课程中的评分周期设置。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权访问所请求课程中的评分周期设置或存在访问错误。 NOTFOUND:所请求的课程不存在。
- list — 返回请求用户有权查看的课程列表,仅限于与请求匹配的课程。返回的课程按创建时间排序,最近创建的排在前面。此方法返回以下错误代码: PERMISSIONDENIED:访问错误。 INVALIDARGUMENT:查询参数格式错误。* NOT_FOUND:查询参数中指定的任何用户不存在。
- patch — 更新课程中的一个或多个字段。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权修改所请求的课程或存在访问错误。 NOTFOUND:不存在具有所请求 ID 的课程。* INVALID_ARGUMENT:更新掩码中指定了无效字段,或未提供更新掩码。
- update — 更新课程。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权修改所请求的课程或存在访问错误。 NOTFOUND:不存在具有所请求 ID 的课程。 FAILED_PRECONDITION:出现以下请求错误: CourseNotModifiable * CourseTitleCannotContainUrl
- updateGradingPeriodSettings — 更新课程的评分周期设置。可以使用此方法添加、移除或修改单个评分周期。请求用户和课程所有者必须符合修改评分周期的资格。详情请参阅许可要求。
- aliases — 对 aliases 资源的操作
- announcements — 对 announcements 资源的操作
- courseWork — 对 courseWork 资源的操作
- courseWorkMaterials — 对 courseWorkMaterials 资源的操作
- posts — 对 posts 资源的操作
- studentGroups — 对 studentGroups 资源的操作
- students — 对 students 资源的操作
- teachers — 对 teachers 资源的操作
- topics — 对 topics 资源的操作
invitations
- accept — 接受邀请,移除邀请并将被邀请用户添加到指定课程的教师或学生(视情况而定)中。只有被邀请用户才能接受邀请。此方法返回以下错误代码:* PERMISSION_DENIED:请求用户无权接受所请求的邀请或存在访问错误。
- create — 创建邀请。一个用户和课程同时只能存在一个邀请。如需更改,请删除并重新创建邀请。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权为此课程创建邀请或存在访问错误。 NOTFOUND:课程或用户不存在。 FAILED_PRECONDITION: 如果请求用户的帐户已被禁用。
- delete — 删除邀请。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权删除所请求的邀请或存在访问错误。 NOTFOUND:不存在具有所请求 ID 的邀请。
- get — 返回邀请。此方法返回以下错误代码: PERMISSIONDENIED:请求用户无权查看所请求的邀请或存在访问错误。 NOTFOUND:不存在具有所请求 ID 的邀请。
- list — 返回请求用户有权查看的邀请列表,仅限于与列表请求匹配的邀请。注意: 必须至少提供 userid 或 courseid 中的一个。两个字段都可以提供。此方法返回以下错误代码:* PERMISSION_DENIED:访问错误。
registrations
- create — 创建一个 Registration,使 Classroom 开始从提供的 feed 向 cloudPubSubTopic 中指定的目标发送通知。返回创建的 Registration。目前,这将与参数相同,但会填充服务器分配的字段,如 expirytime 和 id。请注意,为 expirytime 或 id 字段指定的任何值都将被忽略。
- delete — 删除一个 Registration,使 Classroom 停止发送该 Registration 的通知。
userProfiles
- get — 返回用户个人资料。此方法返回以下错误代码:* PERMISSION_DENIED:请求用户无权访问此用户个人资料、不存在具有所请求 ID 的个人资料或存在访问错误。
- guardianInvitations — 对 guardianInvitations 资源的操作
- guardians — 对 guardians 资源的操作
发现命令
在调用任何 API 方法之前,请先检查它:
bash
浏览资源和方法
gws classroom --help
检查方法的必需参数、类型和默认值
gws schema classroom.<资源>.<方法>
使用 gws schema 输出来构建你的 --params 和 --json 标志。