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 |
|
---|
18 | namespace Google\Service\Classroom\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Classroom\ClassroomEmpty;
|
---|
21 | use Google\Service\Classroom\CourseAlias;
|
---|
22 | use Google\Service\Classroom\ListCourseAliasesResponse;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "aliases" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $classroomService = new Google\Service\Classroom(...);
|
---|
29 | * $aliases = $classroomService->courses_aliases;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class CoursesAliases extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates an alias for a course. This method returns the following error codes:
|
---|
36 | * * `PERMISSION_DENIED` if the requesting user is not permitted to create the
|
---|
37 | * alias or for access errors. * `NOT_FOUND` if the course does not exist. *
|
---|
38 | * `ALREADY_EXISTS` if the alias already exists. * `FAILED_PRECONDITION` if the
|
---|
39 | * alias requested does not make sense for the requesting user or course (for
|
---|
40 | * example, if a user not in a domain attempts to access a domain-scoped alias).
|
---|
41 | * (aliases.create)
|
---|
42 | *
|
---|
43 | * @param string $courseId Identifier of the course to alias. This identifier
|
---|
44 | * can be either the Classroom-assigned identifier or an alias.
|
---|
45 | * @param CourseAlias $postBody
|
---|
46 | * @param array $optParams Optional parameters.
|
---|
47 | * @return CourseAlias
|
---|
48 | * @throws \Google\Service\Exception
|
---|
49 | */
|
---|
50 | public function create($courseId, CourseAlias $postBody, $optParams = [])
|
---|
51 | {
|
---|
52 | $params = ['courseId' => $courseId, 'postBody' => $postBody];
|
---|
53 | $params = array_merge($params, $optParams);
|
---|
54 | return $this->call('create', [$params], CourseAlias::class);
|
---|
55 | }
|
---|
56 | /**
|
---|
57 | * Deletes an alias of a course. This method returns the following error codes:
|
---|
58 | * * `PERMISSION_DENIED` if the requesting user is not permitted to remove the
|
---|
59 | * alias or for access errors. * `NOT_FOUND` if the alias does not exist. *
|
---|
60 | * `FAILED_PRECONDITION` if the alias requested does not make sense for the
|
---|
61 | * requesting user or course (for example, if a user not in a domain attempts to
|
---|
62 | * delete a domain-scoped alias). (aliases.delete)
|
---|
63 | *
|
---|
64 | * @param string $courseId Identifier of the course whose alias should be
|
---|
65 | * deleted. This identifier can be either the Classroom-assigned identifier or
|
---|
66 | * an alias.
|
---|
67 | * @param string $alias Alias to delete. This may not be the Classroom-assigned
|
---|
68 | * identifier.
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | * @return ClassroomEmpty
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function delete($courseId, $alias, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['courseId' => $courseId, 'alias' => $alias];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Returns a list of aliases for a course. This method returns the following
|
---|
81 | * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
|
---|
82 | * access the course or for access errors. * `NOT_FOUND` if the course does not
|
---|
83 | * exist. (aliases.listCoursesAliases)
|
---|
84 | *
|
---|
85 | * @param string $courseId The identifier of the course. This identifier can be
|
---|
86 | * either the Classroom-assigned identifier or an alias.
|
---|
87 | * @param array $optParams Optional parameters.
|
---|
88 | *
|
---|
89 | * @opt_param int pageSize Maximum number of items to return. Zero or
|
---|
90 | * unspecified indicates that the server may assign a maximum. The server may
|
---|
91 | * return fewer than the specified number of results.
|
---|
92 | * @opt_param string pageToken nextPageToken value returned from a previous list
|
---|
93 | * call, indicating that the subsequent page of results should be returned. The
|
---|
94 | * list request must be otherwise identical to the one that resulted in this
|
---|
95 | * token.
|
---|
96 | * @return ListCourseAliasesResponse
|
---|
97 | * @throws \Google\Service\Exception
|
---|
98 | */
|
---|
99 | public function listCoursesAliases($courseId, $optParams = [])
|
---|
100 | {
|
---|
101 | $params = ['courseId' => $courseId];
|
---|
102 | $params = array_merge($params, $optParams);
|
---|
103 | return $this->call('list', [$params], ListCourseAliasesResponse::class);
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
108 | class_alias(CoursesAliases::class, 'Google_Service_Classroom_Resource_CoursesAliases');
|
---|