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\Registration;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "registrations" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $classroomService = new Google\Service\Classroom(...);
|
---|
28 | * $registrations = $classroomService->registrations;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Registrations extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Creates a `Registration`, causing Classroom to start sending notifications
|
---|
35 | * from the provided `feed` to the destination provided in `cloudPubSubTopic`.
|
---|
36 | * Returns the created `Registration`. Currently, this will be the same as the
|
---|
37 | * argument, but with server-assigned fields such as `expiry_time` and `id`
|
---|
38 | * filled in. Note that any value specified for the `expiry_time` or `id` fields
|
---|
39 | * will be ignored. While Classroom may validate the `cloudPubSubTopic` and
|
---|
40 | * return errors on a best effort basis, it is the caller's responsibility to
|
---|
41 | * ensure that it exists and that Classroom has permission to publish to it.
|
---|
42 | * This method may return the following error codes: * `PERMISSION_DENIED` if: *
|
---|
43 | * the authenticated user does not have permission to receive notifications from
|
---|
44 | * the requested field; or * the current user has not granted access to the
|
---|
45 | * current Cloud project with the appropriate scope for the requested feed. Note
|
---|
46 | * that domain-wide delegation of authority is not currently supported for this
|
---|
47 | * purpose. If the request has the appropriate scope, but no grant exists, a
|
---|
48 | * Request Errors is returned. * another access error is encountered. *
|
---|
49 | * `INVALID_ARGUMENT` if: * no `cloudPubsubTopic` is specified, or the specified
|
---|
50 | * `cloudPubsubTopic` is not valid; or * no `feed` is specified, or the
|
---|
51 | * specified `feed` is not valid. * `NOT_FOUND` if: * the specified `feed`
|
---|
52 | * cannot be located, or the requesting user does not have permission to
|
---|
53 | * determine whether or not it exists; or * the specified `cloudPubsubTopic`
|
---|
54 | * cannot be located, or Classroom has not been granted permission to publish to
|
---|
55 | * it. (registrations.create)
|
---|
56 | *
|
---|
57 | * @param Registration $postBody
|
---|
58 | * @param array $optParams Optional parameters.
|
---|
59 | * @return Registration
|
---|
60 | * @throws \Google\Service\Exception
|
---|
61 | */
|
---|
62 | public function create(Registration $postBody, $optParams = [])
|
---|
63 | {
|
---|
64 | $params = ['postBody' => $postBody];
|
---|
65 | $params = array_merge($params, $optParams);
|
---|
66 | return $this->call('create', [$params], Registration::class);
|
---|
67 | }
|
---|
68 | /**
|
---|
69 | * Deletes a `Registration`, causing Classroom to stop sending notifications for
|
---|
70 | * that `Registration`. (registrations.delete)
|
---|
71 | *
|
---|
72 | * @param string $registrationId The `registration_id` of the `Registration` to
|
---|
73 | * be deleted.
|
---|
74 | * @param array $optParams Optional parameters.
|
---|
75 | * @return ClassroomEmpty
|
---|
76 | * @throws \Google\Service\Exception
|
---|
77 | */
|
---|
78 | public function delete($registrationId, $optParams = [])
|
---|
79 | {
|
---|
80 | $params = ['registrationId' => $registrationId];
|
---|
81 | $params = array_merge($params, $optParams);
|
---|
82 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
87 | class_alias(Registrations::class, 'Google_Service_Classroom_Resource_Registrations');
|
---|