source: vendor/google/apiclient-services/src/Classroom/Resource/Courses.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: 8.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\Course;
22use Google\Service\Classroom\ListCoursesResponse;
23
24/**
25 * The "courses" collection of methods.
26 * Typical usage is:
27 * <code>
28 * $classroomService = new Google\Service\Classroom(...);
29 * $courses = $classroomService->courses;
30 * </code>
31 */
32class Courses extends \Google\Service\Resource
33{
34 /**
35 * Creates a course. The user specified in `ownerId` is the owner of the created
36 * course and added as a teacher. A non-admin requesting user can only create a
37 * course with themselves as the owner. Domain admins can create courses owned
38 * by any user within their domain. This method returns the following error
39 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
40 * create courses or for access errors. * `NOT_FOUND` if the primary teacher is
41 * not a valid user. * `FAILED_PRECONDITION` if the course owner's account is
42 * disabled or for the following request errors: * UserCannotOwnCourse *
43 * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if an alias was specified
44 * in the `id` and already exists. (courses.create)
45 *
46 * @param Course $postBody
47 * @param array $optParams Optional parameters.
48 * @return Course
49 * @throws \Google\Service\Exception
50 */
51 public function create(Course $postBody, $optParams = [])
52 {
53 $params = ['postBody' => $postBody];
54 $params = array_merge($params, $optParams);
55 return $this->call('create', [$params], Course::class);
56 }
57 /**
58 * Deletes a course. This method returns the following error codes: *
59 * `PERMISSION_DENIED` if the requesting user is not permitted to delete the
60 * requested course or for access errors. * `NOT_FOUND` if no course exists with
61 * the requested ID. (courses.delete)
62 *
63 * @param string $id Identifier of the course to delete. This identifier can be
64 * either the Classroom-assigned identifier or an alias.
65 * @param array $optParams Optional parameters.
66 * @return ClassroomEmpty
67 * @throws \Google\Service\Exception
68 */
69 public function delete($id, $optParams = [])
70 {
71 $params = ['id' => $id];
72 $params = array_merge($params, $optParams);
73 return $this->call('delete', [$params], ClassroomEmpty::class);
74 }
75 /**
76 * Returns a course. This method returns the following error codes: *
77 * `PERMISSION_DENIED` if the requesting user is not permitted to access the
78 * requested course or for access errors. * `NOT_FOUND` if no course exists with
79 * the requested ID. (courses.get)
80 *
81 * @param string $id Identifier of the course to return. This identifier can be
82 * either the Classroom-assigned identifier or an alias.
83 * @param array $optParams Optional parameters.
84 * @return Course
85 * @throws \Google\Service\Exception
86 */
87 public function get($id, $optParams = [])
88 {
89 $params = ['id' => $id];
90 $params = array_merge($params, $optParams);
91 return $this->call('get', [$params], Course::class);
92 }
93 /**
94 * Returns a list of courses that the requesting user is permitted to view,
95 * restricted to those that match the request. Returned courses are ordered by
96 * creation time, with the most recently created coming first. This method
97 * returns the following error codes: * `PERMISSION_DENIED` for access errors. *
98 * `INVALID_ARGUMENT` if the query argument is malformed. * `NOT_FOUND` if any
99 * users specified in the query arguments do not exist. (courses.listCourses)
100 *
101 * @param array $optParams Optional parameters.
102 *
103 * @opt_param string courseStates Restricts returned courses to those in one of
104 * the specified states The default value is ACTIVE, ARCHIVED, PROVISIONED,
105 * DECLINED.
106 * @opt_param int pageSize Maximum number of items to return. Zero or
107 * unspecified indicates that the server may assign a maximum. The server may
108 * return fewer than the specified number of results.
109 * @opt_param string pageToken nextPageToken value returned from a previous list
110 * call, indicating that the subsequent page of results should be returned. The
111 * list request must be otherwise identical to the one that resulted in this
112 * token.
113 * @opt_param string studentId Restricts returned courses to those having a
114 * student with the specified identifier. The identifier can be one of the
115 * following: * the numeric identifier for the user * the email address of the
116 * user * the string literal `"me"`, indicating the requesting user
117 * @opt_param string teacherId Restricts returned courses to those having a
118 * teacher with the specified identifier. The identifier can be one of the
119 * following: * the numeric identifier for the user * the email address of the
120 * user * the string literal `"me"`, indicating the requesting user
121 * @return ListCoursesResponse
122 * @throws \Google\Service\Exception
123 */
124 public function listCourses($optParams = [])
125 {
126 $params = [];
127 $params = array_merge($params, $optParams);
128 return $this->call('list', [$params], ListCoursesResponse::class);
129 }
130 /**
131 * Updates one or more fields in a course. This method returns the following
132 * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
133 * modify the requested course or for access errors. * `NOT_FOUND` if no course
134 * exists with the requested ID. * `INVALID_ARGUMENT` if invalid fields are
135 * specified in the update mask or if no update mask is supplied. *
136 * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable
137 * * InactiveCourseOwner * IneligibleOwner (courses.patch)
138 *
139 * @param string $id Identifier of the course to update. This identifier can be
140 * either the Classroom-assigned identifier or an alias.
141 * @param Course $postBody
142 * @param array $optParams Optional parameters.
143 *
144 * @opt_param string updateMask Mask that identifies which fields on the course
145 * to update. This field is required to do an update. The update will fail if
146 * invalid fields are specified. The following fields are valid: * `name` *
147 * `section` * `descriptionHeading` * `description` * `room` * `courseState` *
148 * `ownerId` Note: patches to ownerId are treated as being effective
149 * immediately, but in practice it may take some time for the ownership transfer
150 * of all affected resources to complete. When set in a query parameter, this
151 * field should be specified as `updateMask=,,...`
152 * @return Course
153 * @throws \Google\Service\Exception
154 */
155 public function patch($id, Course $postBody, $optParams = [])
156 {
157 $params = ['id' => $id, 'postBody' => $postBody];
158 $params = array_merge($params, $optParams);
159 return $this->call('patch', [$params], Course::class);
160 }
161 /**
162 * Updates a course. This method returns the following error codes: *
163 * `PERMISSION_DENIED` if the requesting user is not permitted to modify the
164 * requested course or for access errors. * `NOT_FOUND` if no course exists with
165 * the requested ID. * `FAILED_PRECONDITION` for the following request errors: *
166 * CourseNotModifiable (courses.update)
167 *
168 * @param string $id Identifier of the course to update. This identifier can be
169 * either the Classroom-assigned identifier or an alias.
170 * @param Course $postBody
171 * @param array $optParams Optional parameters.
172 * @return Course
173 * @throws \Google\Service\Exception
174 */
175 public function update($id, Course $postBody, $optParams = [])
176 {
177 $params = ['id' => $id, 'postBody' => $postBody];
178 $params = array_merge($params, $optParams);
179 return $this->call('update', [$params], Course::class);
180 }
181}
182
183// Adding a class alias for backwards compatibility with the previous class name.
184class_alias(Courses::class, 'Google_Service_Classroom_Resource_Courses');
Note: See TracBrowser for help on using the repository browser.