source: vendor/google/apiclient-services/src/Classroom/Resource/UserProfilesGuardianInvitations.php@ f9c482b

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

Upload new project files

  • Property mode set to 100644
File size: 9.4 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\GuardianInvitation;
21use Google\Service\Classroom\ListGuardianInvitationsResponse;
22
23/**
24 * The "guardianInvitations" collection of methods.
25 * Typical usage is:
26 * <code>
27 * $classroomService = new Google\Service\Classroom(...);
28 * $guardianInvitations = $classroomService->userProfiles_guardianInvitations;
29 * </code>
30 */
31class UserProfilesGuardianInvitations extends \Google\Service\Resource
32{
33 /**
34 * Creates a guardian invitation, and sends an email to the guardian asking them
35 * to confirm that they are the student's guardian. Once the guardian accepts
36 * the invitation, their `state` will change to `COMPLETED` and they will start
37 * receiving guardian notifications. A `Guardian` resource will also be created
38 * to represent the active guardian. The request object must have the
39 * `student_id` and `invited_email_address` fields set. Failing to set these
40 * fields, or setting any other fields in the request, will result in an error.
41 * This method returns the following error codes: * `PERMISSION_DENIED` if the
42 * current user does not have permission to manage guardians, if the guardian in
43 * question has already rejected too many requests for that student, if
44 * guardians are not enabled for the domain in question, or for other access
45 * errors. * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the
46 * guardian link limit. * `INVALID_ARGUMENT` if the guardian email address is
47 * not valid (for example, if it is too long), or if the format of the student
48 * ID provided cannot be recognized (it is not an email address, nor a `user_id`
49 * from this API). This error will also be returned if read-only fields are set,
50 * or if the `state` field is set to to a value other than `PENDING`. *
51 * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom
52 * has no record of that student. * `ALREADY_EXISTS` if there is already a
53 * pending guardian invitation for the student and `invited_email_address`
54 * provided, or if the provided `invited_email_address` matches the Google
55 * account of an existing `Guardian` for this user. (guardianInvitations.create)
56 *
57 * @param string $studentId ID of the student (in standard format)
58 * @param GuardianInvitation $postBody
59 * @param array $optParams Optional parameters.
60 * @return GuardianInvitation
61 * @throws \Google\Service\Exception
62 */
63 public function create($studentId, GuardianInvitation $postBody, $optParams = [])
64 {
65 $params = ['studentId' => $studentId, 'postBody' => $postBody];
66 $params = array_merge($params, $optParams);
67 return $this->call('create', [$params], GuardianInvitation::class);
68 }
69 /**
70 * Returns a specific guardian invitation. This method returns the following
71 * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
72 * view guardian invitations for the student identified by the `student_id`, if
73 * guardians are not enabled for the domain in question, or for other access
74 * errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
75 * cannot be recognized (it is not an email address, nor a `student_id` from the
76 * API, nor the literal string `me`). * `NOT_FOUND` if Classroom cannot find any
77 * record of the given student or `invitation_id`. May also be returned if the
78 * student exists, but the requesting user does not have access to see that
79 * student. (guardianInvitations.get)
80 *
81 * @param string $studentId The ID of the student whose guardian invitation is
82 * being requested.
83 * @param string $invitationId The `id` field of the `GuardianInvitation` being
84 * requested.
85 * @param array $optParams Optional parameters.
86 * @return GuardianInvitation
87 * @throws \Google\Service\Exception
88 */
89 public function get($studentId, $invitationId, $optParams = [])
90 {
91 $params = ['studentId' => $studentId, 'invitationId' => $invitationId];
92 $params = array_merge($params, $optParams);
93 return $this->call('get', [$params], GuardianInvitation::class);
94 }
95 /**
96 * Returns a list of guardian invitations that the requesting user is permitted
97 * to view, filtered by the parameters provided. This method returns the
98 * following error codes: * `PERMISSION_DENIED` if a `student_id` is specified,
99 * and the requesting user is not permitted to view guardian invitations for
100 * that student, if `"-"` is specified as the `student_id` and the user is not a
101 * domain administrator, if guardians are not enabled for the domain in
102 * question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id`
103 * is specified, but its format cannot be recognized (it is not an email
104 * address, nor a `student_id` from the API, nor the literal string `me`). May
105 * also be returned if an invalid `page_token` or `state` is provided. *
106 * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized,
107 * but Classroom has no record of that student.
108 * (guardianInvitations.listUserProfilesGuardianInvitations)
109 *
110 * @param string $studentId The ID of the student whose guardian invitations are
111 * to be returned. The identifier can be one of the following: * the numeric
112 * identifier for the user * the email address of the user * the string literal
113 * `"me"`, indicating the requesting user * the string literal `"-"`, indicating
114 * that results should be returned for all students that the requesting user is
115 * permitted to view guardian invitations.
116 * @param array $optParams Optional parameters.
117 *
118 * @opt_param string invitedEmailAddress If specified, only results with the
119 * specified `invited_email_address` are returned.
120 * @opt_param int pageSize Maximum number of items to return. Zero or
121 * unspecified indicates that the server may assign a maximum. The server may
122 * return fewer than the specified number of results.
123 * @opt_param string pageToken nextPageToken value returned from a previous list
124 * call, indicating that the subsequent page of results should be returned. The
125 * list request must be otherwise identical to the one that resulted in this
126 * token.
127 * @opt_param string states If specified, only results with the specified
128 * `state` values are returned. Otherwise, results with a `state` of `PENDING`
129 * are returned.
130 * @return ListGuardianInvitationsResponse
131 * @throws \Google\Service\Exception
132 */
133 public function listUserProfilesGuardianInvitations($studentId, $optParams = [])
134 {
135 $params = ['studentId' => $studentId];
136 $params = array_merge($params, $optParams);
137 return $this->call('list', [$params], ListGuardianInvitationsResponse::class);
138 }
139 /**
140 * Modifies a guardian invitation. Currently, the only valid modification is to
141 * change the `state` from `PENDING` to `COMPLETE`. This has the effect of
142 * withdrawing the invitation. This method returns the following error codes: *
143 * `PERMISSION_DENIED` if the current user does not have permission to manage
144 * guardians, if guardians are not enabled for the domain in question or for
145 * other access errors. * `FAILED_PRECONDITION` if the guardian link is not in
146 * the `PENDING` state. * `INVALID_ARGUMENT` if the format of the student ID
147 * provided cannot be recognized (it is not an email address, nor a `user_id`
148 * from this API), or if the passed `GuardianInvitation` has a `state` other
149 * than `COMPLETE`, or if it modifies fields other than `state`. * `NOT_FOUND`
150 * if the student ID provided is a valid student ID, but Classroom has no record
151 * of that student, or if the `id` field does not refer to a guardian invitation
152 * known to Classroom. (guardianInvitations.patch)
153 *
154 * @param string $studentId The ID of the student whose guardian invitation is
155 * to be modified.
156 * @param string $invitationId The `id` field of the `GuardianInvitation` to be
157 * modified.
158 * @param GuardianInvitation $postBody
159 * @param array $optParams Optional parameters.
160 *
161 * @opt_param string updateMask Mask that identifies which fields on the course
162 * to update. This field is required to do an update. The update fails if
163 * invalid fields are specified. The following fields are valid: * `state` When
164 * set in a query parameter, this field should be specified as
165 * `updateMask=,,...`
166 * @return GuardianInvitation
167 * @throws \Google\Service\Exception
168 */
169 public function patch($studentId, $invitationId, GuardianInvitation $postBody, $optParams = [])
170 {
171 $params = ['studentId' => $studentId, 'invitationId' => $invitationId, 'postBody' => $postBody];
172 $params = array_merge($params, $optParams);
173 return $this->call('patch', [$params], GuardianInvitation::class);
174 }
175}
176
177// Adding a class alias for backwards compatibility with the previous class name.
178class_alias(UserProfilesGuardianInvitations::class, 'Google_Service_Classroom_Resource_UserProfilesGuardianInvitations');
Note: See TracBrowser for help on using the repository browser.