source: vendor/google/apiclient-services/src/Classroom/Resource/CoursesStudents.php

Last change on this file was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 10 days ago

Upload project files

  • Property mode set to 100644
File size: 6.2 KB
Line 
1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Classroom\Resource;
19
20use Google\Service\Classroom\ClassroomEmpty;
21use Google\Service\Classroom\ListStudentsResponse;
22use Google\Service\Classroom\Student;
23
24/**
25 * The "students" collection of methods.
26 * Typical usage is:
27 * <code>
28 * $classroomService = new Google\Service\Classroom(...);
29 * $students = $classroomService->courses_students;
30 * </code>
31 */
32class CoursesStudents extends \Google\Service\Resource
33{
34 /**
35 * Adds a user as a student of a course. Domain administrators are permitted to
36 * [directly add](https://developers.google.com/classroom/guides/manage-users)
37 * users within their domain as students to courses within their domain.
38 * Students are permitted to add themselves to a course using an enrollment
39 * code. This method returns the following error codes: * `PERMISSION_DENIED` if
40 * the requesting user is not permitted to create students in this course or for
41 * access errors. * `NOT_FOUND` if the requested course ID does not exist. *
42 * `FAILED_PRECONDITION` if the requested user's account is disabled, for the
43 * following request errors: * CourseMemberLimitReached * CourseNotModifiable *
44 * UserGroupsMembershipLimitReached * InactiveCourseOwner * `ALREADY_EXISTS` if
45 * the user is already a student or teacher in the course. (students.create)
46 *
47 * @param string $courseId Identifier of the course to create the student in.
48 * This identifier can be either the Classroom-assigned identifier or an alias.
49 * @param Student $postBody
50 * @param array $optParams Optional parameters.
51 *
52 * @opt_param string enrollmentCode Enrollment code of the course to create the
53 * student in. This code is required if userId corresponds to the requesting
54 * user; it may be omitted if the requesting user has administrative permissions
55 * to create students for any user.
56 * @return Student
57 * @throws \Google\Service\Exception
58 */
59 public function create($courseId, Student $postBody, $optParams = [])
60 {
61 $params = ['courseId' => $courseId, 'postBody' => $postBody];
62 $params = array_merge($params, $optParams);
63 return $this->call('create', [$params], Student::class);
64 }
65 /**
66 * Deletes a student of a course. This method returns the following error codes:
67 * * `PERMISSION_DENIED` if the requesting user is not permitted to delete
68 * students of this course or for access errors. * `NOT_FOUND` if no student of
69 * this course has the requested ID or if the course does not exist.
70 * (students.delete)
71 *
72 * @param string $courseId Identifier of the course. This identifier can be
73 * either the Classroom-assigned identifier or an alias.
74 * @param string $userId Identifier of the student to delete. The identifier can
75 * be one of the following: * the numeric identifier for the user * the email
76 * address of the user * the string literal `"me"`, indicating the requesting
77 * user
78 * @param array $optParams Optional parameters.
79 * @return ClassroomEmpty
80 * @throws \Google\Service\Exception
81 */
82 public function delete($courseId, $userId, $optParams = [])
83 {
84 $params = ['courseId' => $courseId, 'userId' => $userId];
85 $params = array_merge($params, $optParams);
86 return $this->call('delete', [$params], ClassroomEmpty::class);
87 }
88 /**
89 * Returns a student of a course. This method returns the following error codes:
90 * * `PERMISSION_DENIED` if the requesting user is not permitted to view
91 * students of this course or for access errors. * `NOT_FOUND` if no student of
92 * this course has the requested ID or if the course does not exist.
93 * (students.get)
94 *
95 * @param string $courseId Identifier of the course. This identifier can be
96 * either the Classroom-assigned identifier or an alias.
97 * @param string $userId Identifier of the student to return. The identifier can
98 * be one of the following: * the numeric identifier for the user * the email
99 * address of the user * the string literal `"me"`, indicating the requesting
100 * user
101 * @param array $optParams Optional parameters.
102 * @return Student
103 * @throws \Google\Service\Exception
104 */
105 public function get($courseId, $userId, $optParams = [])
106 {
107 $params = ['courseId' => $courseId, 'userId' => $userId];
108 $params = array_merge($params, $optParams);
109 return $this->call('get', [$params], Student::class);
110 }
111 /**
112 * Returns a list of students of this course that the requester is permitted to
113 * view. This method returns the following error codes: * `NOT_FOUND` if the
114 * course does not exist. * `PERMISSION_DENIED` for access errors.
115 * (students.listCoursesStudents)
116 *
117 * @param string $courseId Identifier of the course. This identifier can be
118 * either the Classroom-assigned identifier or an alias.
119 * @param array $optParams Optional parameters.
120 *
121 * @opt_param int pageSize Maximum number of items to return. The default is 30
122 * if unspecified or `0`. The server may return fewer than the specified number
123 * of results.
124 * @opt_param string pageToken nextPageToken value returned from a previous list
125 * call, indicating that the subsequent page of results should be returned. The
126 * list request must be otherwise identical to the one that resulted in this
127 * token.
128 * @return ListStudentsResponse
129 * @throws \Google\Service\Exception
130 */
131 public function listCoursesStudents($courseId, $optParams = [])
132 {
133 $params = ['courseId' => $courseId];
134 $params = array_merge($params, $optParams);
135 return $this->call('list', [$params], ListStudentsResponse::class);
136 }
137}
138
139// Adding a class alias for backwards compatibility with the previous class name.
140class_alias(CoursesStudents::class, 'Google_Service_Classroom_Resource_CoursesStudents');
Note: See TracBrowser for help on using the repository browser.