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