google-apis-classroom_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2798 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module ClassroomV1
23
+ # Google Classroom API
24
+ #
25
+ # Manages classes, rosters, and invitations in Google Classroom.
26
+ #
27
+ # @example
28
+ # require 'google/apis/classroom_v1'
29
+ #
30
+ # Classroom = Google::Apis::ClassroomV1 # Alias the module
31
+ # service = Classroom::ClassroomService.new
32
+ #
33
+ # @see https://developers.google.com/classroom/
34
+ class ClassroomService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://classroom.googleapis.com/', '',
47
+ client_name: 'google-apis-classroom_v1',
48
+ client_version: Google::Apis::ClassroomV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Creates a course. The user specified in `ownerId` is the owner of the created
53
+ # course and added as a teacher. This method returns the following error codes: *
54
+ # `PERMISSION_DENIED` if the requesting user is not permitted to create courses
55
+ # or for access errors. * `NOT_FOUND` if the primary teacher is not a valid user.
56
+ # * `FAILED_PRECONDITION` if the course owner's account is disabled or for the
57
+ # following request errors: * UserGroupsMembershipLimitReached * `ALREADY_EXISTS`
58
+ # if an alias was specified in the `id` and already exists.
59
+ # @param [Google::Apis::ClassroomV1::Course] course_object
60
+ # @param [String] fields
61
+ # Selector specifying which fields to include in a partial response.
62
+ # @param [String] quota_user
63
+ # Available to use for quota purposes for server-side applications. Can be any
64
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
65
+ # @param [Google::Apis::RequestOptions] options
66
+ # Request-specific options
67
+ #
68
+ # @yield [result, err] Result & error if block supplied
69
+ # @yieldparam result [Google::Apis::ClassroomV1::Course] parsed result object
70
+ # @yieldparam err [StandardError] error object if request failed
71
+ #
72
+ # @return [Google::Apis::ClassroomV1::Course]
73
+ #
74
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
75
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
76
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
77
+ def create_course(course_object = nil, fields: nil, quota_user: nil, options: nil, &block)
78
+ command = make_simple_command(:post, 'v1/courses', options)
79
+ command.request_representation = Google::Apis::ClassroomV1::Course::Representation
80
+ command.request_object = course_object
81
+ command.response_representation = Google::Apis::ClassroomV1::Course::Representation
82
+ command.response_class = Google::Apis::ClassroomV1::Course
83
+ command.query['fields'] = fields unless fields.nil?
84
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
85
+ execute_or_queue_command(command, &block)
86
+ end
87
+
88
+ # Deletes a course. This method returns the following error codes: * `
89
+ # PERMISSION_DENIED` if the requesting user is not permitted to delete the
90
+ # requested course or for access errors. * `NOT_FOUND` if no course exists with
91
+ # the requested ID.
92
+ # @param [String] id
93
+ # Identifier of the course to delete. This identifier can be either the
94
+ # Classroom-assigned identifier or an alias.
95
+ # @param [String] fields
96
+ # Selector specifying which fields to include in a partial response.
97
+ # @param [String] quota_user
98
+ # Available to use for quota purposes for server-side applications. Can be any
99
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
100
+ # @param [Google::Apis::RequestOptions] options
101
+ # Request-specific options
102
+ #
103
+ # @yield [result, err] Result & error if block supplied
104
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
105
+ # @yieldparam err [StandardError] error object if request failed
106
+ #
107
+ # @return [Google::Apis::ClassroomV1::Empty]
108
+ #
109
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
110
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
111
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
112
+ def delete_course(id, fields: nil, quota_user: nil, options: nil, &block)
113
+ command = make_simple_command(:delete, 'v1/courses/{id}', options)
114
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
115
+ command.response_class = Google::Apis::ClassroomV1::Empty
116
+ command.params['id'] = id unless id.nil?
117
+ command.query['fields'] = fields unless fields.nil?
118
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
119
+ execute_or_queue_command(command, &block)
120
+ end
121
+
122
+ # Returns a course. This method returns the following error codes: * `
123
+ # PERMISSION_DENIED` if the requesting user is not permitted to access the
124
+ # requested course or for access errors. * `NOT_FOUND` if no course exists with
125
+ # the requested ID.
126
+ # @param [String] id
127
+ # Identifier of the course to return. This identifier can be either the
128
+ # Classroom-assigned identifier or an alias.
129
+ # @param [String] fields
130
+ # Selector specifying which fields to include in a partial response.
131
+ # @param [String] quota_user
132
+ # Available to use for quota purposes for server-side applications. Can be any
133
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
134
+ # @param [Google::Apis::RequestOptions] options
135
+ # Request-specific options
136
+ #
137
+ # @yield [result, err] Result & error if block supplied
138
+ # @yieldparam result [Google::Apis::ClassroomV1::Course] parsed result object
139
+ # @yieldparam err [StandardError] error object if request failed
140
+ #
141
+ # @return [Google::Apis::ClassroomV1::Course]
142
+ #
143
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
144
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
145
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
146
+ def get_course(id, fields: nil, quota_user: nil, options: nil, &block)
147
+ command = make_simple_command(:get, 'v1/courses/{id}', options)
148
+ command.response_representation = Google::Apis::ClassroomV1::Course::Representation
149
+ command.response_class = Google::Apis::ClassroomV1::Course
150
+ command.params['id'] = id unless id.nil?
151
+ command.query['fields'] = fields unless fields.nil?
152
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
153
+ execute_or_queue_command(command, &block)
154
+ end
155
+
156
+ # Returns a list of courses that the requesting user is permitted to view,
157
+ # restricted to those that match the request. Returned courses are ordered by
158
+ # creation time, with the most recently created coming first. This method
159
+ # returns the following error codes: * `PERMISSION_DENIED` for access errors. * `
160
+ # INVALID_ARGUMENT` if the query argument is malformed. * `NOT_FOUND` if any
161
+ # users specified in the query arguments do not exist.
162
+ # @param [Array<String>, String] course_states
163
+ # Restricts returned courses to those in one of the specified states The default
164
+ # value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.
165
+ # @param [Fixnum] page_size
166
+ # Maximum number of items to return. Zero or unspecified indicates that the
167
+ # server may assign a maximum. The server may return fewer than the specified
168
+ # number of results.
169
+ # @param [String] page_token
170
+ # nextPageToken value returned from a previous list call, indicating that the
171
+ # subsequent page of results should be returned. The list request must be
172
+ # otherwise identical to the one that resulted in this token.
173
+ # @param [String] student_id
174
+ # Restricts returned courses to those having a student with the specified
175
+ # identifier. The identifier can be one of the following: * the numeric
176
+ # identifier for the user * the email address of the user * the string literal `"
177
+ # me"`, indicating the requesting user
178
+ # @param [String] teacher_id
179
+ # Restricts returned courses to those having a teacher with the specified
180
+ # identifier. The identifier can be one of the following: * the numeric
181
+ # identifier for the user * the email address of the user * the string literal `"
182
+ # me"`, indicating the requesting user
183
+ # @param [String] fields
184
+ # Selector specifying which fields to include in a partial response.
185
+ # @param [String] quota_user
186
+ # Available to use for quota purposes for server-side applications. Can be any
187
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
188
+ # @param [Google::Apis::RequestOptions] options
189
+ # Request-specific options
190
+ #
191
+ # @yield [result, err] Result & error if block supplied
192
+ # @yieldparam result [Google::Apis::ClassroomV1::ListCoursesResponse] parsed result object
193
+ # @yieldparam err [StandardError] error object if request failed
194
+ #
195
+ # @return [Google::Apis::ClassroomV1::ListCoursesResponse]
196
+ #
197
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
198
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
199
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
200
+ def list_courses(course_states: nil, page_size: nil, page_token: nil, student_id: nil, teacher_id: nil, fields: nil, quota_user: nil, options: nil, &block)
201
+ command = make_simple_command(:get, 'v1/courses', options)
202
+ command.response_representation = Google::Apis::ClassroomV1::ListCoursesResponse::Representation
203
+ command.response_class = Google::Apis::ClassroomV1::ListCoursesResponse
204
+ command.query['courseStates'] = course_states unless course_states.nil?
205
+ command.query['pageSize'] = page_size unless page_size.nil?
206
+ command.query['pageToken'] = page_token unless page_token.nil?
207
+ command.query['studentId'] = student_id unless student_id.nil?
208
+ command.query['teacherId'] = teacher_id unless teacher_id.nil?
209
+ command.query['fields'] = fields unless fields.nil?
210
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
211
+ execute_or_queue_command(command, &block)
212
+ end
213
+
214
+ # Updates one or more fields in a course. This method returns the following
215
+ # error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
216
+ # modify the requested course or for access errors. * `NOT_FOUND` if no course
217
+ # exists with the requested ID. * `INVALID_ARGUMENT` if invalid fields are
218
+ # specified in the update mask or if no update mask is supplied. * `
219
+ # FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable
220
+ # @param [String] id
221
+ # Identifier of the course to update. This identifier can be either the
222
+ # Classroom-assigned identifier or an alias.
223
+ # @param [Google::Apis::ClassroomV1::Course] course_object
224
+ # @param [String] update_mask
225
+ # Mask that identifies which fields on the course to update. This field is
226
+ # required to do an update. The update will fail if invalid fields are specified.
227
+ # The following fields are valid: * `name` * `section` * `descriptionHeading` *
228
+ # `description` * `room` * `courseState` * `ownerId` Note: patches to ownerId
229
+ # are treated as being effective immediately, but in practice it may take some
230
+ # time for the ownership transfer of all affected resources to complete. When
231
+ # set in a query parameter, this field should be specified as `updateMask=,,...`
232
+ # @param [String] fields
233
+ # Selector specifying which fields to include in a partial response.
234
+ # @param [String] quota_user
235
+ # Available to use for quota purposes for server-side applications. Can be any
236
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
237
+ # @param [Google::Apis::RequestOptions] options
238
+ # Request-specific options
239
+ #
240
+ # @yield [result, err] Result & error if block supplied
241
+ # @yieldparam result [Google::Apis::ClassroomV1::Course] parsed result object
242
+ # @yieldparam err [StandardError] error object if request failed
243
+ #
244
+ # @return [Google::Apis::ClassroomV1::Course]
245
+ #
246
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
247
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
248
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
249
+ def patch_course(id, course_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
250
+ command = make_simple_command(:patch, 'v1/courses/{id}', options)
251
+ command.request_representation = Google::Apis::ClassroomV1::Course::Representation
252
+ command.request_object = course_object
253
+ command.response_representation = Google::Apis::ClassroomV1::Course::Representation
254
+ command.response_class = Google::Apis::ClassroomV1::Course
255
+ command.params['id'] = id unless id.nil?
256
+ command.query['updateMask'] = update_mask unless update_mask.nil?
257
+ command.query['fields'] = fields unless fields.nil?
258
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
259
+ execute_or_queue_command(command, &block)
260
+ end
261
+
262
+ # Updates a course. This method returns the following error codes: * `
263
+ # PERMISSION_DENIED` if the requesting user is not permitted to modify the
264
+ # requested course or for access errors. * `NOT_FOUND` if no course exists with
265
+ # the requested ID. * `FAILED_PRECONDITION` for the following request errors: *
266
+ # CourseNotModifiable
267
+ # @param [String] id
268
+ # Identifier of the course to update. This identifier can be either the
269
+ # Classroom-assigned identifier or an alias.
270
+ # @param [Google::Apis::ClassroomV1::Course] course_object
271
+ # @param [String] fields
272
+ # Selector specifying which fields to include in a partial response.
273
+ # @param [String] quota_user
274
+ # Available to use for quota purposes for server-side applications. Can be any
275
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
276
+ # @param [Google::Apis::RequestOptions] options
277
+ # Request-specific options
278
+ #
279
+ # @yield [result, err] Result & error if block supplied
280
+ # @yieldparam result [Google::Apis::ClassroomV1::Course] parsed result object
281
+ # @yieldparam err [StandardError] error object if request failed
282
+ #
283
+ # @return [Google::Apis::ClassroomV1::Course]
284
+ #
285
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
286
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
287
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
288
+ def update_course(id, course_object = nil, fields: nil, quota_user: nil, options: nil, &block)
289
+ command = make_simple_command(:put, 'v1/courses/{id}', options)
290
+ command.request_representation = Google::Apis::ClassroomV1::Course::Representation
291
+ command.request_object = course_object
292
+ command.response_representation = Google::Apis::ClassroomV1::Course::Representation
293
+ command.response_class = Google::Apis::ClassroomV1::Course
294
+ command.params['id'] = id unless id.nil?
295
+ command.query['fields'] = fields unless fields.nil?
296
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
297
+ execute_or_queue_command(command, &block)
298
+ end
299
+
300
+ # Creates an alias for a course. This method returns the following error codes: *
301
+ # `PERMISSION_DENIED` if the requesting user is not permitted to create the
302
+ # alias or for access errors. * `NOT_FOUND` if the course does not exist. * `
303
+ # ALREADY_EXISTS` if the alias already exists. * `FAILED_PRECONDITION` if the
304
+ # alias requested does not make sense for the requesting user or course (for
305
+ # example, if a user not in a domain attempts to access a domain-scoped alias).
306
+ # @param [String] course_id
307
+ # Identifier of the course to alias. This identifier can be either the Classroom-
308
+ # assigned identifier or an alias.
309
+ # @param [Google::Apis::ClassroomV1::CourseAlias] course_alias_object
310
+ # @param [String] fields
311
+ # Selector specifying which fields to include in a partial response.
312
+ # @param [String] quota_user
313
+ # Available to use for quota purposes for server-side applications. Can be any
314
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
315
+ # @param [Google::Apis::RequestOptions] options
316
+ # Request-specific options
317
+ #
318
+ # @yield [result, err] Result & error if block supplied
319
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseAlias] parsed result object
320
+ # @yieldparam err [StandardError] error object if request failed
321
+ #
322
+ # @return [Google::Apis::ClassroomV1::CourseAlias]
323
+ #
324
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
325
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
326
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
327
+ def create_course_alias(course_id, course_alias_object = nil, fields: nil, quota_user: nil, options: nil, &block)
328
+ command = make_simple_command(:post, 'v1/courses/{courseId}/aliases', options)
329
+ command.request_representation = Google::Apis::ClassroomV1::CourseAlias::Representation
330
+ command.request_object = course_alias_object
331
+ command.response_representation = Google::Apis::ClassroomV1::CourseAlias::Representation
332
+ command.response_class = Google::Apis::ClassroomV1::CourseAlias
333
+ command.params['courseId'] = course_id unless course_id.nil?
334
+ command.query['fields'] = fields unless fields.nil?
335
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
336
+ execute_or_queue_command(command, &block)
337
+ end
338
+
339
+ # Deletes an alias of a course. This method returns the following error codes: *
340
+ # `PERMISSION_DENIED` if the requesting user is not permitted to remove the
341
+ # alias or for access errors. * `NOT_FOUND` if the alias does not exist. * `
342
+ # FAILED_PRECONDITION` if the alias requested does not make sense for the
343
+ # requesting user or course (for example, if a user not in a domain attempts to
344
+ # delete a domain-scoped alias).
345
+ # @param [String] course_id
346
+ # Identifier of the course whose alias should be deleted. This identifier can be
347
+ # either the Classroom-assigned identifier or an alias.
348
+ # @param [String] alias_
349
+ # Alias to delete. This may not be the Classroom-assigned identifier.
350
+ # @param [String] fields
351
+ # Selector specifying which fields to include in a partial response.
352
+ # @param [String] quota_user
353
+ # Available to use for quota purposes for server-side applications. Can be any
354
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
355
+ # @param [Google::Apis::RequestOptions] options
356
+ # Request-specific options
357
+ #
358
+ # @yield [result, err] Result & error if block supplied
359
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
360
+ # @yieldparam err [StandardError] error object if request failed
361
+ #
362
+ # @return [Google::Apis::ClassroomV1::Empty]
363
+ #
364
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
365
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
366
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
367
+ def delete_course_alias(course_id, alias_, fields: nil, quota_user: nil, options: nil, &block)
368
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/aliases/{alias}', options)
369
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
370
+ command.response_class = Google::Apis::ClassroomV1::Empty
371
+ command.params['courseId'] = course_id unless course_id.nil?
372
+ command.params['alias'] = alias_ unless alias_.nil?
373
+ command.query['fields'] = fields unless fields.nil?
374
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
375
+ execute_or_queue_command(command, &block)
376
+ end
377
+
378
+ # Returns a list of aliases for a course. This method returns the following
379
+ # error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
380
+ # access the course or for access errors. * `NOT_FOUND` if the course does not
381
+ # exist.
382
+ # @param [String] course_id
383
+ # The identifier of the course. This identifier can be either the Classroom-
384
+ # assigned identifier or an alias.
385
+ # @param [Fixnum] page_size
386
+ # Maximum number of items to return. Zero or unspecified indicates that the
387
+ # server may assign a maximum. The server may return fewer than the specified
388
+ # number of results.
389
+ # @param [String] page_token
390
+ # nextPageToken value returned from a previous list call, indicating that the
391
+ # subsequent page of results should be returned. The list request must be
392
+ # otherwise identical to the one that resulted in this token.
393
+ # @param [String] fields
394
+ # Selector specifying which fields to include in a partial response.
395
+ # @param [String] quota_user
396
+ # Available to use for quota purposes for server-side applications. Can be any
397
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
398
+ # @param [Google::Apis::RequestOptions] options
399
+ # Request-specific options
400
+ #
401
+ # @yield [result, err] Result & error if block supplied
402
+ # @yieldparam result [Google::Apis::ClassroomV1::ListCourseAliasesResponse] parsed result object
403
+ # @yieldparam err [StandardError] error object if request failed
404
+ #
405
+ # @return [Google::Apis::ClassroomV1::ListCourseAliasesResponse]
406
+ #
407
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
408
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
409
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
410
+ def list_course_aliases(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
411
+ command = make_simple_command(:get, 'v1/courses/{courseId}/aliases', options)
412
+ command.response_representation = Google::Apis::ClassroomV1::ListCourseAliasesResponse::Representation
413
+ command.response_class = Google::Apis::ClassroomV1::ListCourseAliasesResponse
414
+ command.params['courseId'] = course_id unless course_id.nil?
415
+ command.query['pageSize'] = page_size unless page_size.nil?
416
+ command.query['pageToken'] = page_token unless page_token.nil?
417
+ command.query['fields'] = fields unless fields.nil?
418
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
419
+ execute_or_queue_command(command, &block)
420
+ end
421
+
422
+ # Creates an announcement. This method returns the following error codes: * `
423
+ # PERMISSION_DENIED` if the requesting user is not permitted to access the
424
+ # requested course, create announcements in the requested course, share a Drive
425
+ # attachment, or for access errors. * `INVALID_ARGUMENT` if the request is
426
+ # malformed. * `NOT_FOUND` if the requested course does not exist. * `
427
+ # FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible
428
+ # @param [String] course_id
429
+ # Identifier of the course. This identifier can be either the Classroom-assigned
430
+ # identifier or an alias.
431
+ # @param [Google::Apis::ClassroomV1::Announcement] announcement_object
432
+ # @param [String] fields
433
+ # Selector specifying which fields to include in a partial response.
434
+ # @param [String] quota_user
435
+ # Available to use for quota purposes for server-side applications. Can be any
436
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
437
+ # @param [Google::Apis::RequestOptions] options
438
+ # Request-specific options
439
+ #
440
+ # @yield [result, err] Result & error if block supplied
441
+ # @yieldparam result [Google::Apis::ClassroomV1::Announcement] parsed result object
442
+ # @yieldparam err [StandardError] error object if request failed
443
+ #
444
+ # @return [Google::Apis::ClassroomV1::Announcement]
445
+ #
446
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
447
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
448
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
449
+ def create_course_announcement(course_id, announcement_object = nil, fields: nil, quota_user: nil, options: nil, &block)
450
+ command = make_simple_command(:post, 'v1/courses/{courseId}/announcements', options)
451
+ command.request_representation = Google::Apis::ClassroomV1::Announcement::Representation
452
+ command.request_object = announcement_object
453
+ command.response_representation = Google::Apis::ClassroomV1::Announcement::Representation
454
+ command.response_class = Google::Apis::ClassroomV1::Announcement
455
+ command.params['courseId'] = course_id unless course_id.nil?
456
+ command.query['fields'] = fields unless fields.nil?
457
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
458
+ execute_or_queue_command(command, &block)
459
+ end
460
+
461
+ # Deletes an announcement. This request must be made by the Developer Console
462
+ # project of the [OAuth client ID](https://support.google.com/cloud/answer/
463
+ # 6158849) used to create the corresponding announcement item. This method
464
+ # returns the following error codes: * `PERMISSION_DENIED` if the requesting
465
+ # developer project did not create the corresponding announcement, if the
466
+ # requesting user is not permitted to delete the requested course or for access
467
+ # errors. * `FAILED_PRECONDITION` if the requested announcement has already been
468
+ # deleted. * `NOT_FOUND` if no course exists with the requested ID.
469
+ # @param [String] course_id
470
+ # Identifier of the course. This identifier can be either the Classroom-assigned
471
+ # identifier or an alias.
472
+ # @param [String] id
473
+ # Identifier of the announcement to delete. This identifier is a Classroom-
474
+ # assigned identifier.
475
+ # @param [String] fields
476
+ # Selector specifying which fields to include in a partial response.
477
+ # @param [String] quota_user
478
+ # Available to use for quota purposes for server-side applications. Can be any
479
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
480
+ # @param [Google::Apis::RequestOptions] options
481
+ # Request-specific options
482
+ #
483
+ # @yield [result, err] Result & error if block supplied
484
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
485
+ # @yieldparam err [StandardError] error object if request failed
486
+ #
487
+ # @return [Google::Apis::ClassroomV1::Empty]
488
+ #
489
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
490
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
491
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
492
+ def delete_course_announcement(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
493
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/announcements/{id}', options)
494
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
495
+ command.response_class = Google::Apis::ClassroomV1::Empty
496
+ command.params['courseId'] = course_id unless course_id.nil?
497
+ command.params['id'] = id unless id.nil?
498
+ command.query['fields'] = fields unless fields.nil?
499
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
500
+ execute_or_queue_command(command, &block)
501
+ end
502
+
503
+ # Returns an announcement. This method returns the following error codes: * `
504
+ # PERMISSION_DENIED` if the requesting user is not permitted to access the
505
+ # requested course or announcement, or for access errors. * `INVALID_ARGUMENT`
506
+ # if the request is malformed. * `NOT_FOUND` if the requested course or
507
+ # announcement does not exist.
508
+ # @param [String] course_id
509
+ # Identifier of the course. This identifier can be either the Classroom-assigned
510
+ # identifier or an alias.
511
+ # @param [String] id
512
+ # Identifier of the announcement.
513
+ # @param [String] fields
514
+ # Selector specifying which fields to include in a partial response.
515
+ # @param [String] quota_user
516
+ # Available to use for quota purposes for server-side applications. Can be any
517
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
518
+ # @param [Google::Apis::RequestOptions] options
519
+ # Request-specific options
520
+ #
521
+ # @yield [result, err] Result & error if block supplied
522
+ # @yieldparam result [Google::Apis::ClassroomV1::Announcement] parsed result object
523
+ # @yieldparam err [StandardError] error object if request failed
524
+ #
525
+ # @return [Google::Apis::ClassroomV1::Announcement]
526
+ #
527
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
528
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
529
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
530
+ def get_course_announcement(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
531
+ command = make_simple_command(:get, 'v1/courses/{courseId}/announcements/{id}', options)
532
+ command.response_representation = Google::Apis::ClassroomV1::Announcement::Representation
533
+ command.response_class = Google::Apis::ClassroomV1::Announcement
534
+ command.params['courseId'] = course_id unless course_id.nil?
535
+ command.params['id'] = id unless id.nil?
536
+ command.query['fields'] = fields unless fields.nil?
537
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
538
+ execute_or_queue_command(command, &block)
539
+ end
540
+
541
+ # Returns a list of announcements that the requester is permitted to view.
542
+ # Course students may only view `PUBLISHED` announcements. Course teachers and
543
+ # domain administrators may view all announcements. This method returns the
544
+ # following error codes: * `PERMISSION_DENIED` if the requesting user is not
545
+ # permitted to access the requested course or for access errors. * `
546
+ # INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested
547
+ # course does not exist.
548
+ # @param [String] course_id
549
+ # Identifier of the course. This identifier can be either the Classroom-assigned
550
+ # identifier or an alias.
551
+ # @param [Array<String>, String] announcement_states
552
+ # Restriction on the `state` of announcements returned. If this argument is left
553
+ # unspecified, the default value is `PUBLISHED`.
554
+ # @param [String] order_by
555
+ # Optional sort ordering for results. A comma-separated list of fields with an
556
+ # optional sort direction keyword. Supported field is `updateTime`. Supported
557
+ # direction keywords are `asc` and `desc`. If not specified, `updateTime desc`
558
+ # is the default behavior. Examples: `updateTime asc`, `updateTime`
559
+ # @param [Fixnum] page_size
560
+ # Maximum number of items to return. Zero or unspecified indicates that the
561
+ # server may assign a maximum. The server may return fewer than the specified
562
+ # number of results.
563
+ # @param [String] page_token
564
+ # nextPageToken value returned from a previous list call, indicating that the
565
+ # subsequent page of results should be returned. The list request must be
566
+ # otherwise identical to the one that resulted in this token.
567
+ # @param [String] fields
568
+ # Selector specifying which fields to include in a partial response.
569
+ # @param [String] quota_user
570
+ # Available to use for quota purposes for server-side applications. Can be any
571
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
572
+ # @param [Google::Apis::RequestOptions] options
573
+ # Request-specific options
574
+ #
575
+ # @yield [result, err] Result & error if block supplied
576
+ # @yieldparam result [Google::Apis::ClassroomV1::ListAnnouncementsResponse] parsed result object
577
+ # @yieldparam err [StandardError] error object if request failed
578
+ #
579
+ # @return [Google::Apis::ClassroomV1::ListAnnouncementsResponse]
580
+ #
581
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
582
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
583
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
584
+ def list_course_announcements(course_id, announcement_states: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
585
+ command = make_simple_command(:get, 'v1/courses/{courseId}/announcements', options)
586
+ command.response_representation = Google::Apis::ClassroomV1::ListAnnouncementsResponse::Representation
587
+ command.response_class = Google::Apis::ClassroomV1::ListAnnouncementsResponse
588
+ command.params['courseId'] = course_id unless course_id.nil?
589
+ command.query['announcementStates'] = announcement_states unless announcement_states.nil?
590
+ command.query['orderBy'] = order_by unless order_by.nil?
591
+ command.query['pageSize'] = page_size unless page_size.nil?
592
+ command.query['pageToken'] = page_token unless page_token.nil?
593
+ command.query['fields'] = fields unless fields.nil?
594
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
595
+ execute_or_queue_command(command, &block)
596
+ end
597
+
598
+ # Modifies assignee mode and options of an announcement. Only a teacher of the
599
+ # course that contains the announcement may call this method. This method
600
+ # returns the following error codes: * `PERMISSION_DENIED` if the requesting
601
+ # user is not permitted to access the requested course or course work or for
602
+ # access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND`
603
+ # if the requested course or course work does not exist.
604
+ # @param [String] course_id
605
+ # Identifier of the course. This identifier can be either the Classroom-assigned
606
+ # identifier or an alias.
607
+ # @param [String] id
608
+ # Identifier of the announcement.
609
+ # @param [Google::Apis::ClassroomV1::ModifyAnnouncementAssigneesRequest] modify_announcement_assignees_request_object
610
+ # @param [String] fields
611
+ # Selector specifying which fields to include in a partial response.
612
+ # @param [String] quota_user
613
+ # Available to use for quota purposes for server-side applications. Can be any
614
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
615
+ # @param [Google::Apis::RequestOptions] options
616
+ # Request-specific options
617
+ #
618
+ # @yield [result, err] Result & error if block supplied
619
+ # @yieldparam result [Google::Apis::ClassroomV1::Announcement] parsed result object
620
+ # @yieldparam err [StandardError] error object if request failed
621
+ #
622
+ # @return [Google::Apis::ClassroomV1::Announcement]
623
+ #
624
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
625
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
626
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
627
+ def modify_course_announcement_assignees(course_id, id, modify_announcement_assignees_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
628
+ command = make_simple_command(:post, 'v1/courses/{courseId}/announcements/{id}:modifyAssignees', options)
629
+ command.request_representation = Google::Apis::ClassroomV1::ModifyAnnouncementAssigneesRequest::Representation
630
+ command.request_object = modify_announcement_assignees_request_object
631
+ command.response_representation = Google::Apis::ClassroomV1::Announcement::Representation
632
+ command.response_class = Google::Apis::ClassroomV1::Announcement
633
+ command.params['courseId'] = course_id unless course_id.nil?
634
+ command.params['id'] = id unless id.nil?
635
+ command.query['fields'] = fields unless fields.nil?
636
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
637
+ execute_or_queue_command(command, &block)
638
+ end
639
+
640
+ # Updates one or more fields of an announcement. This method returns the
641
+ # following error codes: * `PERMISSION_DENIED` if the requesting developer
642
+ # project did not create the corresponding announcement or for access errors. * `
643
+ # INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the
644
+ # requested announcement has already been deleted. * `NOT_FOUND` if the
645
+ # requested course or announcement does not exist
646
+ # @param [String] course_id
647
+ # Identifier of the course. This identifier can be either the Classroom-assigned
648
+ # identifier or an alias.
649
+ # @param [String] id
650
+ # Identifier of the announcement.
651
+ # @param [Google::Apis::ClassroomV1::Announcement] announcement_object
652
+ # @param [String] update_mask
653
+ # Mask that identifies which fields on the announcement to update. This field is
654
+ # required to do an update. The update fails if invalid fields are specified. If
655
+ # a field supports empty values, it can be cleared by specifying it in the
656
+ # update mask and not in the Announcement object. If a field that does not
657
+ # support empty values is included in the update mask and not set in the
658
+ # Announcement object, an `INVALID_ARGUMENT` error is returned. The following
659
+ # fields may be specified by teachers: * `text` * `state` * `scheduled_time`
660
+ # @param [String] fields
661
+ # Selector specifying which fields to include in a partial response.
662
+ # @param [String] quota_user
663
+ # Available to use for quota purposes for server-side applications. Can be any
664
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
665
+ # @param [Google::Apis::RequestOptions] options
666
+ # Request-specific options
667
+ #
668
+ # @yield [result, err] Result & error if block supplied
669
+ # @yieldparam result [Google::Apis::ClassroomV1::Announcement] parsed result object
670
+ # @yieldparam err [StandardError] error object if request failed
671
+ #
672
+ # @return [Google::Apis::ClassroomV1::Announcement]
673
+ #
674
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
675
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
676
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
677
+ def patch_course_announcement(course_id, id, announcement_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
678
+ command = make_simple_command(:patch, 'v1/courses/{courseId}/announcements/{id}', options)
679
+ command.request_representation = Google::Apis::ClassroomV1::Announcement::Representation
680
+ command.request_object = announcement_object
681
+ command.response_representation = Google::Apis::ClassroomV1::Announcement::Representation
682
+ command.response_class = Google::Apis::ClassroomV1::Announcement
683
+ command.params['courseId'] = course_id unless course_id.nil?
684
+ command.params['id'] = id unless id.nil?
685
+ command.query['updateMask'] = update_mask unless update_mask.nil?
686
+ command.query['fields'] = fields unless fields.nil?
687
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
688
+ execute_or_queue_command(command, &block)
689
+ end
690
+
691
+ # Creates course work. The resulting course work (and corresponding student
692
+ # submissions) are associated with the Developer Console project of the [OAuth
693
+ # client ID](https://support.google.com/cloud/answer/6158849) used to make the
694
+ # request. Classroom API requests to modify course work and student submissions
695
+ # must be made with an OAuth client ID from the associated Developer Console
696
+ # project. This method returns the following error codes: * `PERMISSION_DENIED`
697
+ # if the requesting user is not permitted to access the requested course, create
698
+ # course work in the requested course, share a Drive attachment, or for access
699
+ # errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
700
+ # requested course does not exist. * `FAILED_PRECONDITION` for the following
701
+ # request error: * AttachmentNotVisible
702
+ # @param [String] course_id
703
+ # Identifier of the course. This identifier can be either the Classroom-assigned
704
+ # identifier or an alias.
705
+ # @param [Google::Apis::ClassroomV1::CourseWork] course_work_object
706
+ # @param [String] fields
707
+ # Selector specifying which fields to include in a partial response.
708
+ # @param [String] quota_user
709
+ # Available to use for quota purposes for server-side applications. Can be any
710
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
711
+ # @param [Google::Apis::RequestOptions] options
712
+ # Request-specific options
713
+ #
714
+ # @yield [result, err] Result & error if block supplied
715
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWork] parsed result object
716
+ # @yieldparam err [StandardError] error object if request failed
717
+ #
718
+ # @return [Google::Apis::ClassroomV1::CourseWork]
719
+ #
720
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
721
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
722
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
723
+ def create_course_work(course_id, course_work_object = nil, fields: nil, quota_user: nil, options: nil, &block)
724
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWork', options)
725
+ command.request_representation = Google::Apis::ClassroomV1::CourseWork::Representation
726
+ command.request_object = course_work_object
727
+ command.response_representation = Google::Apis::ClassroomV1::CourseWork::Representation
728
+ command.response_class = Google::Apis::ClassroomV1::CourseWork
729
+ command.params['courseId'] = course_id unless course_id.nil?
730
+ command.query['fields'] = fields unless fields.nil?
731
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
732
+ execute_or_queue_command(command, &block)
733
+ end
734
+
735
+ # Deletes a course work. This request must be made by the Developer Console
736
+ # project of the [OAuth client ID](https://support.google.com/cloud/answer/
737
+ # 6158849) used to create the corresponding course work item. This method
738
+ # returns the following error codes: * `PERMISSION_DENIED` if the requesting
739
+ # developer project did not create the corresponding course work, if the
740
+ # requesting user is not permitted to delete the requested course or for access
741
+ # errors. * `FAILED_PRECONDITION` if the requested course work has already been
742
+ # deleted. * `NOT_FOUND` if no course exists with the requested ID.
743
+ # @param [String] course_id
744
+ # Identifier of the course. This identifier can be either the Classroom-assigned
745
+ # identifier or an alias.
746
+ # @param [String] id
747
+ # Identifier of the course work to delete. This identifier is a Classroom-
748
+ # assigned identifier.
749
+ # @param [String] fields
750
+ # Selector specifying which fields to include in a partial response.
751
+ # @param [String] quota_user
752
+ # Available to use for quota purposes for server-side applications. Can be any
753
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
754
+ # @param [Google::Apis::RequestOptions] options
755
+ # Request-specific options
756
+ #
757
+ # @yield [result, err] Result & error if block supplied
758
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
759
+ # @yieldparam err [StandardError] error object if request failed
760
+ #
761
+ # @return [Google::Apis::ClassroomV1::Empty]
762
+ #
763
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
764
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
765
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
766
+ def delete_course_course_work(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
767
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/courseWork/{id}', options)
768
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
769
+ command.response_class = Google::Apis::ClassroomV1::Empty
770
+ command.params['courseId'] = course_id unless course_id.nil?
771
+ command.params['id'] = id unless id.nil?
772
+ command.query['fields'] = fields unless fields.nil?
773
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
774
+ execute_or_queue_command(command, &block)
775
+ end
776
+
777
+ # Returns course work. This method returns the following error codes: * `
778
+ # PERMISSION_DENIED` if the requesting user is not permitted to access the
779
+ # requested course or course work, or for access errors. * `INVALID_ARGUMENT` if
780
+ # the request is malformed. * `NOT_FOUND` if the requested course or course work
781
+ # does not exist.
782
+ # @param [String] course_id
783
+ # Identifier of the course. This identifier can be either the Classroom-assigned
784
+ # identifier or an alias.
785
+ # @param [String] id
786
+ # Identifier of the course work.
787
+ # @param [String] fields
788
+ # Selector specifying which fields to include in a partial response.
789
+ # @param [String] quota_user
790
+ # Available to use for quota purposes for server-side applications. Can be any
791
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
792
+ # @param [Google::Apis::RequestOptions] options
793
+ # Request-specific options
794
+ #
795
+ # @yield [result, err] Result & error if block supplied
796
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWork] parsed result object
797
+ # @yieldparam err [StandardError] error object if request failed
798
+ #
799
+ # @return [Google::Apis::ClassroomV1::CourseWork]
800
+ #
801
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
802
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
803
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
804
+ def get_course_work(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
805
+ command = make_simple_command(:get, 'v1/courses/{courseId}/courseWork/{id}', options)
806
+ command.response_representation = Google::Apis::ClassroomV1::CourseWork::Representation
807
+ command.response_class = Google::Apis::ClassroomV1::CourseWork
808
+ command.params['courseId'] = course_id unless course_id.nil?
809
+ command.params['id'] = id unless id.nil?
810
+ command.query['fields'] = fields unless fields.nil?
811
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
812
+ execute_or_queue_command(command, &block)
813
+ end
814
+
815
+ # Returns a list of course work that the requester is permitted to view. Course
816
+ # students may only view `PUBLISHED` course work. Course teachers and domain
817
+ # administrators may view all course work. This method returns the following
818
+ # error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
819
+ # access the requested course or for access errors. * `INVALID_ARGUMENT` if the
820
+ # request is malformed. * `NOT_FOUND` if the requested course does not exist.
821
+ # @param [String] course_id
822
+ # Identifier of the course. This identifier can be either the Classroom-assigned
823
+ # identifier or an alias.
824
+ # @param [Array<String>, String] course_work_states
825
+ # Restriction on the work status to return. Only courseWork that matches is
826
+ # returned. If unspecified, items with a work status of `PUBLISHED` is returned.
827
+ # @param [String] order_by
828
+ # Optional sort ordering for results. A comma-separated list of fields with an
829
+ # optional sort direction keyword. Supported fields are `updateTime` and `
830
+ # dueDate`. Supported direction keywords are `asc` and `desc`. If not specified,
831
+ # `updateTime desc` is the default behavior. Examples: `dueDate asc,updateTime
832
+ # desc`, `updateTime,dueDate desc`
833
+ # @param [Fixnum] page_size
834
+ # Maximum number of items to return. Zero or unspecified indicates that the
835
+ # server may assign a maximum. The server may return fewer than the specified
836
+ # number of results.
837
+ # @param [String] page_token
838
+ # nextPageToken value returned from a previous list call, indicating that the
839
+ # subsequent page of results should be returned. The list request must be
840
+ # otherwise identical to the one that resulted in this token.
841
+ # @param [String] fields
842
+ # Selector specifying which fields to include in a partial response.
843
+ # @param [String] quota_user
844
+ # Available to use for quota purposes for server-side applications. Can be any
845
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
846
+ # @param [Google::Apis::RequestOptions] options
847
+ # Request-specific options
848
+ #
849
+ # @yield [result, err] Result & error if block supplied
850
+ # @yieldparam result [Google::Apis::ClassroomV1::ListCourseWorkResponse] parsed result object
851
+ # @yieldparam err [StandardError] error object if request failed
852
+ #
853
+ # @return [Google::Apis::ClassroomV1::ListCourseWorkResponse]
854
+ #
855
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
856
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
857
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
858
+ def list_course_works(course_id, course_work_states: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
859
+ command = make_simple_command(:get, 'v1/courses/{courseId}/courseWork', options)
860
+ command.response_representation = Google::Apis::ClassroomV1::ListCourseWorkResponse::Representation
861
+ command.response_class = Google::Apis::ClassroomV1::ListCourseWorkResponse
862
+ command.params['courseId'] = course_id unless course_id.nil?
863
+ command.query['courseWorkStates'] = course_work_states unless course_work_states.nil?
864
+ command.query['orderBy'] = order_by unless order_by.nil?
865
+ command.query['pageSize'] = page_size unless page_size.nil?
866
+ command.query['pageToken'] = page_token unless page_token.nil?
867
+ command.query['fields'] = fields unless fields.nil?
868
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
869
+ execute_or_queue_command(command, &block)
870
+ end
871
+
872
+ # Modifies assignee mode and options of a coursework. Only a teacher of the
873
+ # course that contains the coursework may call this method. This method returns
874
+ # the following error codes: * `PERMISSION_DENIED` if the requesting user is not
875
+ # permitted to access the requested course or course work or for access errors. *
876
+ # `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
877
+ # requested course or course work does not exist.
878
+ # @param [String] course_id
879
+ # Identifier of the course. This identifier can be either the Classroom-assigned
880
+ # identifier or an alias.
881
+ # @param [String] id
882
+ # Identifier of the coursework.
883
+ # @param [Google::Apis::ClassroomV1::ModifyCourseWorkAssigneesRequest] modify_course_work_assignees_request_object
884
+ # @param [String] fields
885
+ # Selector specifying which fields to include in a partial response.
886
+ # @param [String] quota_user
887
+ # Available to use for quota purposes for server-side applications. Can be any
888
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
889
+ # @param [Google::Apis::RequestOptions] options
890
+ # Request-specific options
891
+ #
892
+ # @yield [result, err] Result & error if block supplied
893
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWork] parsed result object
894
+ # @yieldparam err [StandardError] error object if request failed
895
+ #
896
+ # @return [Google::Apis::ClassroomV1::CourseWork]
897
+ #
898
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
899
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
900
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
901
+ def modify_course_course_work_assignees(course_id, id, modify_course_work_assignees_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
902
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWork/{id}:modifyAssignees', options)
903
+ command.request_representation = Google::Apis::ClassroomV1::ModifyCourseWorkAssigneesRequest::Representation
904
+ command.request_object = modify_course_work_assignees_request_object
905
+ command.response_representation = Google::Apis::ClassroomV1::CourseWork::Representation
906
+ command.response_class = Google::Apis::ClassroomV1::CourseWork
907
+ command.params['courseId'] = course_id unless course_id.nil?
908
+ command.params['id'] = id unless id.nil?
909
+ command.query['fields'] = fields unless fields.nil?
910
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
911
+ execute_or_queue_command(command, &block)
912
+ end
913
+
914
+ # Updates one or more fields of a course work. See google.classroom.v1.
915
+ # CourseWork for details of which fields may be updated and who may change them.
916
+ # This request must be made by the Developer Console project of the [OAuth
917
+ # client ID](https://support.google.com/cloud/answer/6158849) used to create the
918
+ # corresponding course work item. This method returns the following error codes:
919
+ # * `PERMISSION_DENIED` if the requesting developer project did not create the
920
+ # corresponding course work, if the user is not permitted to make the requested
921
+ # modification to the student submission, or for access errors. * `
922
+ # INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the
923
+ # requested course work has already been deleted. * `NOT_FOUND` if the requested
924
+ # course, course work, or student submission does not exist.
925
+ # @param [String] course_id
926
+ # Identifier of the course. This identifier can be either the Classroom-assigned
927
+ # identifier or an alias.
928
+ # @param [String] id
929
+ # Identifier of the course work.
930
+ # @param [Google::Apis::ClassroomV1::CourseWork] course_work_object
931
+ # @param [String] update_mask
932
+ # Mask that identifies which fields on the course work to update. This field is
933
+ # required to do an update. The update fails if invalid fields are specified. If
934
+ # a field supports empty values, it can be cleared by specifying it in the
935
+ # update mask and not in the CourseWork object. If a field that does not support
936
+ # empty values is included in the update mask and not set in the CourseWork
937
+ # object, an `INVALID_ARGUMENT` error is returned. The following fields may be
938
+ # specified by teachers: * `title` * `description` * `state` * `due_date` * `
939
+ # due_time` * `max_points` * `scheduled_time` * `submission_modification_mode` *
940
+ # `topic_id`
941
+ # @param [String] fields
942
+ # Selector specifying which fields to include in a partial response.
943
+ # @param [String] quota_user
944
+ # Available to use for quota purposes for server-side applications. Can be any
945
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
946
+ # @param [Google::Apis::RequestOptions] options
947
+ # Request-specific options
948
+ #
949
+ # @yield [result, err] Result & error if block supplied
950
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWork] parsed result object
951
+ # @yieldparam err [StandardError] error object if request failed
952
+ #
953
+ # @return [Google::Apis::ClassroomV1::CourseWork]
954
+ #
955
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
956
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
957
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
958
+ def patch_course_course_work(course_id, id, course_work_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
959
+ command = make_simple_command(:patch, 'v1/courses/{courseId}/courseWork/{id}', options)
960
+ command.request_representation = Google::Apis::ClassroomV1::CourseWork::Representation
961
+ command.request_object = course_work_object
962
+ command.response_representation = Google::Apis::ClassroomV1::CourseWork::Representation
963
+ command.response_class = Google::Apis::ClassroomV1::CourseWork
964
+ command.params['courseId'] = course_id unless course_id.nil?
965
+ command.params['id'] = id unless id.nil?
966
+ command.query['updateMask'] = update_mask unless update_mask.nil?
967
+ command.query['fields'] = fields unless fields.nil?
968
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
969
+ execute_or_queue_command(command, &block)
970
+ end
971
+
972
+ # Returns a student submission. * `PERMISSION_DENIED` if the requesting user is
973
+ # not permitted to access the requested course, course work, or student
974
+ # submission or for access errors. * `INVALID_ARGUMENT` if the request is
975
+ # malformed. * `NOT_FOUND` if the requested course, course work, or student
976
+ # submission does not exist.
977
+ # @param [String] course_id
978
+ # Identifier of the course. This identifier can be either the Classroom-assigned
979
+ # identifier or an alias.
980
+ # @param [String] course_work_id
981
+ # Identifier of the course work.
982
+ # @param [String] id
983
+ # Identifier of the student submission.
984
+ # @param [String] fields
985
+ # Selector specifying which fields to include in a partial response.
986
+ # @param [String] quota_user
987
+ # Available to use for quota purposes for server-side applications. Can be any
988
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
989
+ # @param [Google::Apis::RequestOptions] options
990
+ # Request-specific options
991
+ #
992
+ # @yield [result, err] Result & error if block supplied
993
+ # @yieldparam result [Google::Apis::ClassroomV1::StudentSubmission] parsed result object
994
+ # @yieldparam err [StandardError] error object if request failed
995
+ #
996
+ # @return [Google::Apis::ClassroomV1::StudentSubmission]
997
+ #
998
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
999
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1000
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1001
+ def get_student_submission(course_id, course_work_id, id, fields: nil, quota_user: nil, options: nil, &block)
1002
+ command = make_simple_command(:get, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}', options)
1003
+ command.response_representation = Google::Apis::ClassroomV1::StudentSubmission::Representation
1004
+ command.response_class = Google::Apis::ClassroomV1::StudentSubmission
1005
+ command.params['courseId'] = course_id unless course_id.nil?
1006
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1007
+ command.params['id'] = id unless id.nil?
1008
+ command.query['fields'] = fields unless fields.nil?
1009
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1010
+ execute_or_queue_command(command, &block)
1011
+ end
1012
+
1013
+ # Returns a list of student submissions that the requester is permitted to view,
1014
+ # factoring in the OAuth scopes of the request. `-` may be specified as the `
1015
+ # course_work_id` to include student submissions for multiple course work items.
1016
+ # Course students may only view their own work. Course teachers and domain
1017
+ # administrators may view all student submissions. This method returns the
1018
+ # following error codes: * `PERMISSION_DENIED` if the requesting user is not
1019
+ # permitted to access the requested course or course work, or for access errors.
1020
+ # * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
1021
+ # requested course does not exist.
1022
+ # @param [String] course_id
1023
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1024
+ # identifier or an alias.
1025
+ # @param [String] course_work_id
1026
+ # Identifier of the student work to request. This may be set to the string
1027
+ # literal `"-"` to request student work for all course work in the specified
1028
+ # course.
1029
+ # @param [String] late
1030
+ # Requested lateness value. If specified, returned student submissions are
1031
+ # restricted by the requested value. If unspecified, submissions are returned
1032
+ # regardless of `late` value.
1033
+ # @param [Fixnum] page_size
1034
+ # Maximum number of items to return. Zero or unspecified indicates that the
1035
+ # server may assign a maximum. The server may return fewer than the specified
1036
+ # number of results.
1037
+ # @param [String] page_token
1038
+ # nextPageToken value returned from a previous list call, indicating that the
1039
+ # subsequent page of results should be returned. The list request must be
1040
+ # otherwise identical to the one that resulted in this token.
1041
+ # @param [Array<String>, String] states
1042
+ # Requested submission states. If specified, returned student submissions match
1043
+ # one of the specified submission states.
1044
+ # @param [String] user_id
1045
+ # Optional argument to restrict returned student work to those owned by the
1046
+ # student with the specified identifier. The identifier can be one of the
1047
+ # following: * the numeric identifier for the user * the email address of the
1048
+ # user * the string literal `"me"`, indicating the requesting user
1049
+ # @param [String] fields
1050
+ # Selector specifying which fields to include in a partial response.
1051
+ # @param [String] quota_user
1052
+ # Available to use for quota purposes for server-side applications. Can be any
1053
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1054
+ # @param [Google::Apis::RequestOptions] options
1055
+ # Request-specific options
1056
+ #
1057
+ # @yield [result, err] Result & error if block supplied
1058
+ # @yieldparam result [Google::Apis::ClassroomV1::ListStudentSubmissionsResponse] parsed result object
1059
+ # @yieldparam err [StandardError] error object if request failed
1060
+ #
1061
+ # @return [Google::Apis::ClassroomV1::ListStudentSubmissionsResponse]
1062
+ #
1063
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1064
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1065
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1066
+ def list_student_submissions(course_id, course_work_id, late: nil, page_size: nil, page_token: nil, states: nil, user_id: nil, fields: nil, quota_user: nil, options: nil, &block)
1067
+ command = make_simple_command(:get, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions', options)
1068
+ command.response_representation = Google::Apis::ClassroomV1::ListStudentSubmissionsResponse::Representation
1069
+ command.response_class = Google::Apis::ClassroomV1::ListStudentSubmissionsResponse
1070
+ command.params['courseId'] = course_id unless course_id.nil?
1071
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1072
+ command.query['late'] = late unless late.nil?
1073
+ command.query['pageSize'] = page_size unless page_size.nil?
1074
+ command.query['pageToken'] = page_token unless page_token.nil?
1075
+ command.query['states'] = states unless states.nil?
1076
+ command.query['userId'] = user_id unless user_id.nil?
1077
+ command.query['fields'] = fields unless fields.nil?
1078
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1079
+ execute_or_queue_command(command, &block)
1080
+ end
1081
+
1082
+ # Modifies attachments of student submission. Attachments may only be added to
1083
+ # student submissions belonging to course work objects with a `workType` of `
1084
+ # ASSIGNMENT`. This request must be made by the Developer Console project of the
1085
+ # [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to
1086
+ # create the corresponding course work item. This method returns the following
1087
+ # error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
1088
+ # access the requested course or course work, if the user is not permitted to
1089
+ # modify attachments on the requested student submission, or for access errors. *
1090
+ # `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
1091
+ # requested course, course work, or student submission does not exist.
1092
+ # @param [String] course_id
1093
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1094
+ # identifier or an alias.
1095
+ # @param [String] course_work_id
1096
+ # Identifier of the course work.
1097
+ # @param [String] id
1098
+ # Identifier of the student submission.
1099
+ # @param [Google::Apis::ClassroomV1::ModifyAttachmentsRequest] modify_attachments_request_object
1100
+ # @param [String] fields
1101
+ # Selector specifying which fields to include in a partial response.
1102
+ # @param [String] quota_user
1103
+ # Available to use for quota purposes for server-side applications. Can be any
1104
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1105
+ # @param [Google::Apis::RequestOptions] options
1106
+ # Request-specific options
1107
+ #
1108
+ # @yield [result, err] Result & error if block supplied
1109
+ # @yieldparam result [Google::Apis::ClassroomV1::StudentSubmission] parsed result object
1110
+ # @yieldparam err [StandardError] error object if request failed
1111
+ #
1112
+ # @return [Google::Apis::ClassroomV1::StudentSubmission]
1113
+ #
1114
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1115
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1116
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1117
+ def modify_student_submission_attachments(course_id, course_work_id, id, modify_attachments_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1118
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments', options)
1119
+ command.request_representation = Google::Apis::ClassroomV1::ModifyAttachmentsRequest::Representation
1120
+ command.request_object = modify_attachments_request_object
1121
+ command.response_representation = Google::Apis::ClassroomV1::StudentSubmission::Representation
1122
+ command.response_class = Google::Apis::ClassroomV1::StudentSubmission
1123
+ command.params['courseId'] = course_id unless course_id.nil?
1124
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1125
+ command.params['id'] = id unless id.nil?
1126
+ command.query['fields'] = fields unless fields.nil?
1127
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1128
+ execute_or_queue_command(command, &block)
1129
+ end
1130
+
1131
+ # Updates one or more fields of a student submission. See google.classroom.v1.
1132
+ # StudentSubmission for details of which fields may be updated and who may
1133
+ # change them. This request must be made by the Developer Console project of the
1134
+ # [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to
1135
+ # create the corresponding course work item. This method returns the following
1136
+ # error codes: * `PERMISSION_DENIED` if the requesting developer project did not
1137
+ # create the corresponding course work, if the user is not permitted to make the
1138
+ # requested modification to the student submission, or for access errors. * `
1139
+ # INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested
1140
+ # course, course work, or student submission does not exist.
1141
+ # @param [String] course_id
1142
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1143
+ # identifier or an alias.
1144
+ # @param [String] course_work_id
1145
+ # Identifier of the course work.
1146
+ # @param [String] id
1147
+ # Identifier of the student submission.
1148
+ # @param [Google::Apis::ClassroomV1::StudentSubmission] student_submission_object
1149
+ # @param [String] update_mask
1150
+ # Mask that identifies which fields on the student submission to update. This
1151
+ # field is required to do an update. The update fails if invalid fields are
1152
+ # specified. The following fields may be specified by teachers: * `draft_grade` *
1153
+ # `assigned_grade`
1154
+ # @param [String] fields
1155
+ # Selector specifying which fields to include in a partial response.
1156
+ # @param [String] quota_user
1157
+ # Available to use for quota purposes for server-side applications. Can be any
1158
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1159
+ # @param [Google::Apis::RequestOptions] options
1160
+ # Request-specific options
1161
+ #
1162
+ # @yield [result, err] Result & error if block supplied
1163
+ # @yieldparam result [Google::Apis::ClassroomV1::StudentSubmission] parsed result object
1164
+ # @yieldparam err [StandardError] error object if request failed
1165
+ #
1166
+ # @return [Google::Apis::ClassroomV1::StudentSubmission]
1167
+ #
1168
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1169
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1170
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1171
+ def patch_student_submission(course_id, course_work_id, id, student_submission_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
1172
+ command = make_simple_command(:patch, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}', options)
1173
+ command.request_representation = Google::Apis::ClassroomV1::StudentSubmission::Representation
1174
+ command.request_object = student_submission_object
1175
+ command.response_representation = Google::Apis::ClassroomV1::StudentSubmission::Representation
1176
+ command.response_class = Google::Apis::ClassroomV1::StudentSubmission
1177
+ command.params['courseId'] = course_id unless course_id.nil?
1178
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1179
+ command.params['id'] = id unless id.nil?
1180
+ command.query['updateMask'] = update_mask unless update_mask.nil?
1181
+ command.query['fields'] = fields unless fields.nil?
1182
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1183
+ execute_or_queue_command(command, &block)
1184
+ end
1185
+
1186
+ # Reclaims a student submission on behalf of the student that owns it.
1187
+ # Reclaiming a student submission transfers ownership of attached Drive files to
1188
+ # the student and updates the submission state. Only the student that owns the
1189
+ # requested student submission may call this method, and only for a student
1190
+ # submission that has been turned in. This request must be made by the Developer
1191
+ # Console project of the [OAuth client ID](https://support.google.com/cloud/
1192
+ # answer/6158849) used to create the corresponding course work item. This method
1193
+ # returns the following error codes: * `PERMISSION_DENIED` if the requesting
1194
+ # user is not permitted to access the requested course or course work, unsubmit
1195
+ # the requested student submission, or for access errors. * `FAILED_PRECONDITION`
1196
+ # if the student submission has not been turned in. * `INVALID_ARGUMENT` if the
1197
+ # request is malformed. * `NOT_FOUND` if the requested course, course work, or
1198
+ # student submission does not exist.
1199
+ # @param [String] course_id
1200
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1201
+ # identifier or an alias.
1202
+ # @param [String] course_work_id
1203
+ # Identifier of the course work.
1204
+ # @param [String] id
1205
+ # Identifier of the student submission.
1206
+ # @param [Google::Apis::ClassroomV1::ReclaimStudentSubmissionRequest] reclaim_student_submission_request_object
1207
+ # @param [String] fields
1208
+ # Selector specifying which fields to include in a partial response.
1209
+ # @param [String] quota_user
1210
+ # Available to use for quota purposes for server-side applications. Can be any
1211
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1212
+ # @param [Google::Apis::RequestOptions] options
1213
+ # Request-specific options
1214
+ #
1215
+ # @yield [result, err] Result & error if block supplied
1216
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1217
+ # @yieldparam err [StandardError] error object if request failed
1218
+ #
1219
+ # @return [Google::Apis::ClassroomV1::Empty]
1220
+ #
1221
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1222
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1223
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1224
+ def reclaim_student_submission(course_id, course_work_id, id, reclaim_student_submission_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1225
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim', options)
1226
+ command.request_representation = Google::Apis::ClassroomV1::ReclaimStudentSubmissionRequest::Representation
1227
+ command.request_object = reclaim_student_submission_request_object
1228
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1229
+ command.response_class = Google::Apis::ClassroomV1::Empty
1230
+ command.params['courseId'] = course_id unless course_id.nil?
1231
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1232
+ command.params['id'] = id unless id.nil?
1233
+ command.query['fields'] = fields unless fields.nil?
1234
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1235
+ execute_or_queue_command(command, &block)
1236
+ end
1237
+
1238
+ # Returns a student submission. Returning a student submission transfers
1239
+ # ownership of attached Drive files to the student and may also update the
1240
+ # submission state. Unlike the Classroom application, returning a student
1241
+ # submission does not set assignedGrade to the draftGrade value. Only a teacher
1242
+ # of the course that contains the requested student submission may call this
1243
+ # method. This request must be made by the Developer Console project of the [
1244
+ # OAuth client ID](https://support.google.com/cloud/answer/6158849) used to
1245
+ # create the corresponding course work item. This method returns the following
1246
+ # error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
1247
+ # access the requested course or course work, return the requested student
1248
+ # submission, or for access errors. * `INVALID_ARGUMENT` if the request is
1249
+ # malformed. * `NOT_FOUND` if the requested course, course work, or student
1250
+ # submission does not exist.
1251
+ # @param [String] course_id
1252
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1253
+ # identifier or an alias.
1254
+ # @param [String] course_work_id
1255
+ # Identifier of the course work.
1256
+ # @param [String] id
1257
+ # Identifier of the student submission.
1258
+ # @param [Google::Apis::ClassroomV1::ReturnStudentSubmissionRequest] return_student_submission_request_object
1259
+ # @param [String] fields
1260
+ # Selector specifying which fields to include in a partial response.
1261
+ # @param [String] quota_user
1262
+ # Available to use for quota purposes for server-side applications. Can be any
1263
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1264
+ # @param [Google::Apis::RequestOptions] options
1265
+ # Request-specific options
1266
+ #
1267
+ # @yield [result, err] Result & error if block supplied
1268
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1269
+ # @yieldparam err [StandardError] error object if request failed
1270
+ #
1271
+ # @return [Google::Apis::ClassroomV1::Empty]
1272
+ #
1273
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1274
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1275
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1276
+ def return_student_submission(course_id, course_work_id, id, return_student_submission_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1277
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return', options)
1278
+ command.request_representation = Google::Apis::ClassroomV1::ReturnStudentSubmissionRequest::Representation
1279
+ command.request_object = return_student_submission_request_object
1280
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1281
+ command.response_class = Google::Apis::ClassroomV1::Empty
1282
+ command.params['courseId'] = course_id unless course_id.nil?
1283
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1284
+ command.params['id'] = id unless id.nil?
1285
+ command.query['fields'] = fields unless fields.nil?
1286
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1287
+ execute_or_queue_command(command, &block)
1288
+ end
1289
+
1290
+ # Turns in a student submission. Turning in a student submission transfers
1291
+ # ownership of attached Drive files to the teacher and may also update the
1292
+ # submission state. This may only be called by the student that owns the
1293
+ # specified student submission. This request must be made by the Developer
1294
+ # Console project of the [OAuth client ID](https://support.google.com/cloud/
1295
+ # answer/6158849) used to create the corresponding course work item. This method
1296
+ # returns the following error codes: * `PERMISSION_DENIED` if the requesting
1297
+ # user is not permitted to access the requested course or course work, turn in
1298
+ # the requested student submission, or for access errors. * `INVALID_ARGUMENT`
1299
+ # if the request is malformed. * `NOT_FOUND` if the requested course, course
1300
+ # work, or student submission does not exist.
1301
+ # @param [String] course_id
1302
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1303
+ # identifier or an alias.
1304
+ # @param [String] course_work_id
1305
+ # Identifier of the course work.
1306
+ # @param [String] id
1307
+ # Identifier of the student submission.
1308
+ # @param [Google::Apis::ClassroomV1::TurnInStudentSubmissionRequest] turn_in_student_submission_request_object
1309
+ # @param [String] fields
1310
+ # Selector specifying which fields to include in a partial response.
1311
+ # @param [String] quota_user
1312
+ # Available to use for quota purposes for server-side applications. Can be any
1313
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1314
+ # @param [Google::Apis::RequestOptions] options
1315
+ # Request-specific options
1316
+ #
1317
+ # @yield [result, err] Result & error if block supplied
1318
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1319
+ # @yieldparam err [StandardError] error object if request failed
1320
+ #
1321
+ # @return [Google::Apis::ClassroomV1::Empty]
1322
+ #
1323
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1324
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1325
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1326
+ def turn_in_student_submission(course_id, course_work_id, id, turn_in_student_submission_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1327
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn', options)
1328
+ command.request_representation = Google::Apis::ClassroomV1::TurnInStudentSubmissionRequest::Representation
1329
+ command.request_object = turn_in_student_submission_request_object
1330
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1331
+ command.response_class = Google::Apis::ClassroomV1::Empty
1332
+ command.params['courseId'] = course_id unless course_id.nil?
1333
+ command.params['courseWorkId'] = course_work_id unless course_work_id.nil?
1334
+ command.params['id'] = id unless id.nil?
1335
+ command.query['fields'] = fields unless fields.nil?
1336
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1337
+ execute_or_queue_command(command, &block)
1338
+ end
1339
+
1340
+ # Creates a course work material. This method returns the following error codes:
1341
+ # * `PERMISSION_DENIED` if the requesting user is not permitted to access the
1342
+ # requested course, create course work material in the requested course, share a
1343
+ # Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is
1344
+ # malformed or if more than 20 * materials are provided. * `NOT_FOUND` if the
1345
+ # requested course does not exist. * `FAILED_PRECONDITION` for the following
1346
+ # request error: * AttachmentNotVisible
1347
+ # @param [String] course_id
1348
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1349
+ # identifier or an alias.
1350
+ # @param [Google::Apis::ClassroomV1::CourseWorkMaterial] course_work_material_object
1351
+ # @param [String] fields
1352
+ # Selector specifying which fields to include in a partial response.
1353
+ # @param [String] quota_user
1354
+ # Available to use for quota purposes for server-side applications. Can be any
1355
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1356
+ # @param [Google::Apis::RequestOptions] options
1357
+ # Request-specific options
1358
+ #
1359
+ # @yield [result, err] Result & error if block supplied
1360
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWorkMaterial] parsed result object
1361
+ # @yieldparam err [StandardError] error object if request failed
1362
+ #
1363
+ # @return [Google::Apis::ClassroomV1::CourseWorkMaterial]
1364
+ #
1365
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1366
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1367
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1368
+ def create_course_course_work_material(course_id, course_work_material_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1369
+ command = make_simple_command(:post, 'v1/courses/{courseId}/courseWorkMaterials', options)
1370
+ command.request_representation = Google::Apis::ClassroomV1::CourseWorkMaterial::Representation
1371
+ command.request_object = course_work_material_object
1372
+ command.response_representation = Google::Apis::ClassroomV1::CourseWorkMaterial::Representation
1373
+ command.response_class = Google::Apis::ClassroomV1::CourseWorkMaterial
1374
+ command.params['courseId'] = course_id unless course_id.nil?
1375
+ command.query['fields'] = fields unless fields.nil?
1376
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1377
+ execute_or_queue_command(command, &block)
1378
+ end
1379
+
1380
+ # Deletes a course work material. This request must be made by the Developer
1381
+ # Console project of the [OAuth client ID](https://support.google.com/cloud/
1382
+ # answer/6158849) used to create the corresponding course work material item.
1383
+ # This method returns the following error codes: * `PERMISSION_DENIED` if the
1384
+ # requesting developer project did not create the corresponding course work
1385
+ # material, if the requesting user is not permitted to delete the requested
1386
+ # course or for access errors. * `FAILED_PRECONDITION` if the requested course
1387
+ # work material has already been deleted. * `NOT_FOUND` if no course exists with
1388
+ # the requested ID.
1389
+ # @param [String] course_id
1390
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1391
+ # identifier or an alias.
1392
+ # @param [String] id
1393
+ # Identifier of the course work material to delete. This identifier is a
1394
+ # Classroom-assigned identifier.
1395
+ # @param [String] fields
1396
+ # Selector specifying which fields to include in a partial response.
1397
+ # @param [String] quota_user
1398
+ # Available to use for quota purposes for server-side applications. Can be any
1399
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1400
+ # @param [Google::Apis::RequestOptions] options
1401
+ # Request-specific options
1402
+ #
1403
+ # @yield [result, err] Result & error if block supplied
1404
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1405
+ # @yieldparam err [StandardError] error object if request failed
1406
+ #
1407
+ # @return [Google::Apis::ClassroomV1::Empty]
1408
+ #
1409
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1410
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1411
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1412
+ def delete_course_course_work_material(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
1413
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/courseWorkMaterials/{id}', options)
1414
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1415
+ command.response_class = Google::Apis::ClassroomV1::Empty
1416
+ command.params['courseId'] = course_id unless course_id.nil?
1417
+ command.params['id'] = id unless id.nil?
1418
+ command.query['fields'] = fields unless fields.nil?
1419
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1420
+ execute_or_queue_command(command, &block)
1421
+ end
1422
+
1423
+ # Returns a course work material. This method returns the following error codes:
1424
+ # * `PERMISSION_DENIED` if the requesting user is not permitted to access the
1425
+ # requested course or course work material, or for access errors. * `
1426
+ # INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested
1427
+ # course or course work material does not exist.
1428
+ # @param [String] course_id
1429
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1430
+ # identifier or an alias.
1431
+ # @param [String] id
1432
+ # Identifier of the course work material.
1433
+ # @param [String] fields
1434
+ # Selector specifying which fields to include in a partial response.
1435
+ # @param [String] quota_user
1436
+ # Available to use for quota purposes for server-side applications. Can be any
1437
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1438
+ # @param [Google::Apis::RequestOptions] options
1439
+ # Request-specific options
1440
+ #
1441
+ # @yield [result, err] Result & error if block supplied
1442
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWorkMaterial] parsed result object
1443
+ # @yieldparam err [StandardError] error object if request failed
1444
+ #
1445
+ # @return [Google::Apis::ClassroomV1::CourseWorkMaterial]
1446
+ #
1447
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1448
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1449
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1450
+ def get_course_course_work_material(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
1451
+ command = make_simple_command(:get, 'v1/courses/{courseId}/courseWorkMaterials/{id}', options)
1452
+ command.response_representation = Google::Apis::ClassroomV1::CourseWorkMaterial::Representation
1453
+ command.response_class = Google::Apis::ClassroomV1::CourseWorkMaterial
1454
+ command.params['courseId'] = course_id unless course_id.nil?
1455
+ command.params['id'] = id unless id.nil?
1456
+ command.query['fields'] = fields unless fields.nil?
1457
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1458
+ execute_or_queue_command(command, &block)
1459
+ end
1460
+
1461
+ # Returns a list of course work material that the requester is permitted to view.
1462
+ # Course students may only view `PUBLISHED` course work material. Course
1463
+ # teachers and domain administrators may view all course work material. This
1464
+ # method returns the following error codes: * `PERMISSION_DENIED` if the
1465
+ # requesting user is not permitted to access the requested course or for access
1466
+ # errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
1467
+ # requested course does not exist.
1468
+ # @param [String] course_id
1469
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1470
+ # identifier or an alias.
1471
+ # @param [Array<String>, String] course_work_material_states
1472
+ # Restriction on the work status to return. Only course work material that
1473
+ # matches is returned. If unspecified, items with a work status of `PUBLISHED`
1474
+ # is returned.
1475
+ # @param [String] material_drive_id
1476
+ # Optional filtering for course work material with at least one Drive material
1477
+ # whose ID matches the provided string. If `material_link` is also specified,
1478
+ # course work material must have materials matching both filters.
1479
+ # @param [String] material_link
1480
+ # Optional filtering for course work material with at least one link material
1481
+ # whose URL partially matches the provided string.
1482
+ # @param [String] order_by
1483
+ # Optional sort ordering for results. A comma-separated list of fields with an
1484
+ # optional sort direction keyword. Supported field is `updateTime`. Supported
1485
+ # direction keywords are `asc` and `desc`. If not specified, `updateTime desc`
1486
+ # is the default behavior. Examples: `updateTime asc`, `updateTime`
1487
+ # @param [Fixnum] page_size
1488
+ # Maximum number of items to return. Zero or unspecified indicates that the
1489
+ # server may assign a maximum. The server may return fewer than the specified
1490
+ # number of results.
1491
+ # @param [String] page_token
1492
+ # nextPageToken value returned from a previous list call, indicating that the
1493
+ # subsequent page of results should be returned. The list request must be
1494
+ # otherwise identical to the one that resulted in this token.
1495
+ # @param [String] fields
1496
+ # Selector specifying which fields to include in a partial response.
1497
+ # @param [String] quota_user
1498
+ # Available to use for quota purposes for server-side applications. Can be any
1499
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1500
+ # @param [Google::Apis::RequestOptions] options
1501
+ # Request-specific options
1502
+ #
1503
+ # @yield [result, err] Result & error if block supplied
1504
+ # @yieldparam result [Google::Apis::ClassroomV1::ListCourseWorkMaterialResponse] parsed result object
1505
+ # @yieldparam err [StandardError] error object if request failed
1506
+ #
1507
+ # @return [Google::Apis::ClassroomV1::ListCourseWorkMaterialResponse]
1508
+ #
1509
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1510
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1511
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1512
+ def list_course_course_work_materials(course_id, course_work_material_states: nil, material_drive_id: nil, material_link: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1513
+ command = make_simple_command(:get, 'v1/courses/{courseId}/courseWorkMaterials', options)
1514
+ command.response_representation = Google::Apis::ClassroomV1::ListCourseWorkMaterialResponse::Representation
1515
+ command.response_class = Google::Apis::ClassroomV1::ListCourseWorkMaterialResponse
1516
+ command.params['courseId'] = course_id unless course_id.nil?
1517
+ command.query['courseWorkMaterialStates'] = course_work_material_states unless course_work_material_states.nil?
1518
+ command.query['materialDriveId'] = material_drive_id unless material_drive_id.nil?
1519
+ command.query['materialLink'] = material_link unless material_link.nil?
1520
+ command.query['orderBy'] = order_by unless order_by.nil?
1521
+ command.query['pageSize'] = page_size unless page_size.nil?
1522
+ command.query['pageToken'] = page_token unless page_token.nil?
1523
+ command.query['fields'] = fields unless fields.nil?
1524
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1525
+ execute_or_queue_command(command, &block)
1526
+ end
1527
+
1528
+ # Updates one or more fields of a course work material. This method returns the
1529
+ # following error codes: * `PERMISSION_DENIED` if the requesting developer
1530
+ # project for access errors. * `INVALID_ARGUMENT` if the request is malformed. *
1531
+ # `FAILED_PRECONDITION` if the requested course work material has already been
1532
+ # deleted. * `NOT_FOUND` if the requested course or course work material does
1533
+ # not exist
1534
+ # @param [String] course_id
1535
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1536
+ # identifier or an alias.
1537
+ # @param [String] id
1538
+ # Identifier of the course work material.
1539
+ # @param [Google::Apis::ClassroomV1::CourseWorkMaterial] course_work_material_object
1540
+ # @param [String] update_mask
1541
+ # Mask that identifies which fields on the course work material to update. This
1542
+ # field is required to do an update. The update fails if invalid fields are
1543
+ # specified. If a field supports empty values, it can be cleared by specifying
1544
+ # it in the update mask and not in the course work material object. If a field
1545
+ # that does not support empty values is included in the update mask and not set
1546
+ # in the course work material object, an `INVALID_ARGUMENT` error is returned.
1547
+ # The following fields may be specified by teachers: * `title` * `description` *
1548
+ # `state` * `scheduled_time` * `topic_id`
1549
+ # @param [String] fields
1550
+ # Selector specifying which fields to include in a partial response.
1551
+ # @param [String] quota_user
1552
+ # Available to use for quota purposes for server-side applications. Can be any
1553
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1554
+ # @param [Google::Apis::RequestOptions] options
1555
+ # Request-specific options
1556
+ #
1557
+ # @yield [result, err] Result & error if block supplied
1558
+ # @yieldparam result [Google::Apis::ClassroomV1::CourseWorkMaterial] parsed result object
1559
+ # @yieldparam err [StandardError] error object if request failed
1560
+ #
1561
+ # @return [Google::Apis::ClassroomV1::CourseWorkMaterial]
1562
+ #
1563
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1564
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1565
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1566
+ def patch_course_course_work_material(course_id, id, course_work_material_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
1567
+ command = make_simple_command(:patch, 'v1/courses/{courseId}/courseWorkMaterials/{id}', options)
1568
+ command.request_representation = Google::Apis::ClassroomV1::CourseWorkMaterial::Representation
1569
+ command.request_object = course_work_material_object
1570
+ command.response_representation = Google::Apis::ClassroomV1::CourseWorkMaterial::Representation
1571
+ command.response_class = Google::Apis::ClassroomV1::CourseWorkMaterial
1572
+ command.params['courseId'] = course_id unless course_id.nil?
1573
+ command.params['id'] = id unless id.nil?
1574
+ command.query['updateMask'] = update_mask unless update_mask.nil?
1575
+ command.query['fields'] = fields unless fields.nil?
1576
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1577
+ execute_or_queue_command(command, &block)
1578
+ end
1579
+
1580
+ # Adds a user as a student of a course. This method returns the following error
1581
+ # codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create
1582
+ # students in this course or for access errors. * `NOT_FOUND` if the requested
1583
+ # course ID does not exist. * `FAILED_PRECONDITION` if the requested user's
1584
+ # account is disabled, for the following request errors: *
1585
+ # CourseMemberLimitReached * CourseNotModifiable *
1586
+ # UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a
1587
+ # student or teacher in the course.
1588
+ # @param [String] course_id
1589
+ # Identifier of the course to create the student in. This identifier can be
1590
+ # either the Classroom-assigned identifier or an alias.
1591
+ # @param [Google::Apis::ClassroomV1::Student] student_object
1592
+ # @param [String] enrollment_code
1593
+ # Enrollment code of the course to create the student in. This code is required
1594
+ # if userId corresponds to the requesting user; it may be omitted if the
1595
+ # requesting user has administrative permissions to create students for any user.
1596
+ # @param [String] fields
1597
+ # Selector specifying which fields to include in a partial response.
1598
+ # @param [String] quota_user
1599
+ # Available to use for quota purposes for server-side applications. Can be any
1600
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1601
+ # @param [Google::Apis::RequestOptions] options
1602
+ # Request-specific options
1603
+ #
1604
+ # @yield [result, err] Result & error if block supplied
1605
+ # @yieldparam result [Google::Apis::ClassroomV1::Student] parsed result object
1606
+ # @yieldparam err [StandardError] error object if request failed
1607
+ #
1608
+ # @return [Google::Apis::ClassroomV1::Student]
1609
+ #
1610
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1611
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1612
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1613
+ def create_course_student(course_id, student_object = nil, enrollment_code: nil, fields: nil, quota_user: nil, options: nil, &block)
1614
+ command = make_simple_command(:post, 'v1/courses/{courseId}/students', options)
1615
+ command.request_representation = Google::Apis::ClassroomV1::Student::Representation
1616
+ command.request_object = student_object
1617
+ command.response_representation = Google::Apis::ClassroomV1::Student::Representation
1618
+ command.response_class = Google::Apis::ClassroomV1::Student
1619
+ command.params['courseId'] = course_id unless course_id.nil?
1620
+ command.query['enrollmentCode'] = enrollment_code unless enrollment_code.nil?
1621
+ command.query['fields'] = fields unless fields.nil?
1622
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1623
+ execute_or_queue_command(command, &block)
1624
+ end
1625
+
1626
+ # Deletes a student of a course. This method returns the following error codes: *
1627
+ # `PERMISSION_DENIED` if the requesting user is not permitted to delete
1628
+ # students of this course or for access errors. * `NOT_FOUND` if no student of
1629
+ # this course has the requested ID or if the course does not exist.
1630
+ # @param [String] course_id
1631
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1632
+ # identifier or an alias.
1633
+ # @param [String] user_id
1634
+ # Identifier of the student to delete. The identifier can be one of the
1635
+ # following: * the numeric identifier for the user * the email address of the
1636
+ # user * the string literal `"me"`, indicating the requesting user
1637
+ # @param [String] fields
1638
+ # Selector specifying which fields to include in a partial response.
1639
+ # @param [String] quota_user
1640
+ # Available to use for quota purposes for server-side applications. Can be any
1641
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1642
+ # @param [Google::Apis::RequestOptions] options
1643
+ # Request-specific options
1644
+ #
1645
+ # @yield [result, err] Result & error if block supplied
1646
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1647
+ # @yieldparam err [StandardError] error object if request failed
1648
+ #
1649
+ # @return [Google::Apis::ClassroomV1::Empty]
1650
+ #
1651
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1652
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1653
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1654
+ def delete_course_student(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
1655
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/students/{userId}', options)
1656
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1657
+ command.response_class = Google::Apis::ClassroomV1::Empty
1658
+ command.params['courseId'] = course_id unless course_id.nil?
1659
+ command.params['userId'] = user_id unless user_id.nil?
1660
+ command.query['fields'] = fields unless fields.nil?
1661
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1662
+ execute_or_queue_command(command, &block)
1663
+ end
1664
+
1665
+ # Returns a student of a course. This method returns the following error codes: *
1666
+ # `PERMISSION_DENIED` if the requesting user is not permitted to view students
1667
+ # of this course or for access errors. * `NOT_FOUND` if no student of this
1668
+ # course has the requested ID or if the course does not exist.
1669
+ # @param [String] course_id
1670
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1671
+ # identifier or an alias.
1672
+ # @param [String] user_id
1673
+ # Identifier of the student to return. The identifier can be one of the
1674
+ # following: * the numeric identifier for the user * the email address of the
1675
+ # user * the string literal `"me"`, indicating the requesting user
1676
+ # @param [String] fields
1677
+ # Selector specifying which fields to include in a partial response.
1678
+ # @param [String] quota_user
1679
+ # Available to use for quota purposes for server-side applications. Can be any
1680
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1681
+ # @param [Google::Apis::RequestOptions] options
1682
+ # Request-specific options
1683
+ #
1684
+ # @yield [result, err] Result & error if block supplied
1685
+ # @yieldparam result [Google::Apis::ClassroomV1::Student] parsed result object
1686
+ # @yieldparam err [StandardError] error object if request failed
1687
+ #
1688
+ # @return [Google::Apis::ClassroomV1::Student]
1689
+ #
1690
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1691
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1692
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1693
+ def get_course_student(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
1694
+ command = make_simple_command(:get, 'v1/courses/{courseId}/students/{userId}', options)
1695
+ command.response_representation = Google::Apis::ClassroomV1::Student::Representation
1696
+ command.response_class = Google::Apis::ClassroomV1::Student
1697
+ command.params['courseId'] = course_id unless course_id.nil?
1698
+ command.params['userId'] = user_id unless user_id.nil?
1699
+ command.query['fields'] = fields unless fields.nil?
1700
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1701
+ execute_or_queue_command(command, &block)
1702
+ end
1703
+
1704
+ # Returns a list of students of this course that the requester is permitted to
1705
+ # view. This method returns the following error codes: * `NOT_FOUND` if the
1706
+ # course does not exist. * `PERMISSION_DENIED` for access errors.
1707
+ # @param [String] course_id
1708
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1709
+ # identifier or an alias.
1710
+ # @param [Fixnum] page_size
1711
+ # Maximum number of items to return. The default is 30 if unspecified or `0`.
1712
+ # The server may return fewer than the specified number of results.
1713
+ # @param [String] page_token
1714
+ # nextPageToken value returned from a previous list call, indicating that the
1715
+ # subsequent page of results should be returned. The list request must be
1716
+ # otherwise identical to the one that resulted in this token.
1717
+ # @param [String] fields
1718
+ # Selector specifying which fields to include in a partial response.
1719
+ # @param [String] quota_user
1720
+ # Available to use for quota purposes for server-side applications. Can be any
1721
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1722
+ # @param [Google::Apis::RequestOptions] options
1723
+ # Request-specific options
1724
+ #
1725
+ # @yield [result, err] Result & error if block supplied
1726
+ # @yieldparam result [Google::Apis::ClassroomV1::ListStudentsResponse] parsed result object
1727
+ # @yieldparam err [StandardError] error object if request failed
1728
+ #
1729
+ # @return [Google::Apis::ClassroomV1::ListStudentsResponse]
1730
+ #
1731
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1732
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1733
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1734
+ def list_course_students(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1735
+ command = make_simple_command(:get, 'v1/courses/{courseId}/students', options)
1736
+ command.response_representation = Google::Apis::ClassroomV1::ListStudentsResponse::Representation
1737
+ command.response_class = Google::Apis::ClassroomV1::ListStudentsResponse
1738
+ command.params['courseId'] = course_id unless course_id.nil?
1739
+ command.query['pageSize'] = page_size unless page_size.nil?
1740
+ command.query['pageToken'] = page_token unless page_token.nil?
1741
+ command.query['fields'] = fields unless fields.nil?
1742
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1743
+ execute_or_queue_command(command, &block)
1744
+ end
1745
+
1746
+ # Creates a teacher of a course. This method returns the following error codes: *
1747
+ # `PERMISSION_DENIED` if the requesting user is not permitted to create
1748
+ # teachers in this course or for access errors. * `NOT_FOUND` if the requested
1749
+ # course ID does not exist. * `FAILED_PRECONDITION` if the requested user's
1750
+ # account is disabled, for the following request errors: *
1751
+ # CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached *
1752
+ # UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a
1753
+ # teacher or student in the course.
1754
+ # @param [String] course_id
1755
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1756
+ # identifier or an alias.
1757
+ # @param [Google::Apis::ClassroomV1::Teacher] teacher_object
1758
+ # @param [String] fields
1759
+ # Selector specifying which fields to include in a partial response.
1760
+ # @param [String] quota_user
1761
+ # Available to use for quota purposes for server-side applications. Can be any
1762
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1763
+ # @param [Google::Apis::RequestOptions] options
1764
+ # Request-specific options
1765
+ #
1766
+ # @yield [result, err] Result & error if block supplied
1767
+ # @yieldparam result [Google::Apis::ClassroomV1::Teacher] parsed result object
1768
+ # @yieldparam err [StandardError] error object if request failed
1769
+ #
1770
+ # @return [Google::Apis::ClassroomV1::Teacher]
1771
+ #
1772
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1773
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1774
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1775
+ def create_course_teacher(course_id, teacher_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1776
+ command = make_simple_command(:post, 'v1/courses/{courseId}/teachers', options)
1777
+ command.request_representation = Google::Apis::ClassroomV1::Teacher::Representation
1778
+ command.request_object = teacher_object
1779
+ command.response_representation = Google::Apis::ClassroomV1::Teacher::Representation
1780
+ command.response_class = Google::Apis::ClassroomV1::Teacher
1781
+ command.params['courseId'] = course_id unless course_id.nil?
1782
+ command.query['fields'] = fields unless fields.nil?
1783
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1784
+ execute_or_queue_command(command, &block)
1785
+ end
1786
+
1787
+ # Deletes a teacher of a course. This method returns the following error codes: *
1788
+ # `PERMISSION_DENIED` if the requesting user is not permitted to delete
1789
+ # teachers of this course or for access errors. * `NOT_FOUND` if no teacher of
1790
+ # this course has the requested ID or if the course does not exist. * `
1791
+ # FAILED_PRECONDITION` if the requested ID belongs to the primary teacher of
1792
+ # this course.
1793
+ # @param [String] course_id
1794
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1795
+ # identifier or an alias.
1796
+ # @param [String] user_id
1797
+ # Identifier of the teacher to delete. The identifier can be one of the
1798
+ # following: * the numeric identifier for the user * the email address of the
1799
+ # user * the string literal `"me"`, indicating the requesting user
1800
+ # @param [String] fields
1801
+ # Selector specifying which fields to include in a partial response.
1802
+ # @param [String] quota_user
1803
+ # Available to use for quota purposes for server-side applications. Can be any
1804
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1805
+ # @param [Google::Apis::RequestOptions] options
1806
+ # Request-specific options
1807
+ #
1808
+ # @yield [result, err] Result & error if block supplied
1809
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1810
+ # @yieldparam err [StandardError] error object if request failed
1811
+ #
1812
+ # @return [Google::Apis::ClassroomV1::Empty]
1813
+ #
1814
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1815
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1816
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1817
+ def delete_course_teacher(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
1818
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/teachers/{userId}', options)
1819
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1820
+ command.response_class = Google::Apis::ClassroomV1::Empty
1821
+ command.params['courseId'] = course_id unless course_id.nil?
1822
+ command.params['userId'] = user_id unless user_id.nil?
1823
+ command.query['fields'] = fields unless fields.nil?
1824
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1825
+ execute_or_queue_command(command, &block)
1826
+ end
1827
+
1828
+ # Returns a teacher of a course. This method returns the following error codes: *
1829
+ # `PERMISSION_DENIED` if the requesting user is not permitted to view teachers
1830
+ # of this course or for access errors. * `NOT_FOUND` if no teacher of this
1831
+ # course has the requested ID or if the course does not exist.
1832
+ # @param [String] course_id
1833
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1834
+ # identifier or an alias.
1835
+ # @param [String] user_id
1836
+ # Identifier of the teacher to return. The identifier can be one of the
1837
+ # following: * the numeric identifier for the user * the email address of the
1838
+ # user * the string literal `"me"`, indicating the requesting user
1839
+ # @param [String] fields
1840
+ # Selector specifying which fields to include in a partial response.
1841
+ # @param [String] quota_user
1842
+ # Available to use for quota purposes for server-side applications. Can be any
1843
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1844
+ # @param [Google::Apis::RequestOptions] options
1845
+ # Request-specific options
1846
+ #
1847
+ # @yield [result, err] Result & error if block supplied
1848
+ # @yieldparam result [Google::Apis::ClassroomV1::Teacher] parsed result object
1849
+ # @yieldparam err [StandardError] error object if request failed
1850
+ #
1851
+ # @return [Google::Apis::ClassroomV1::Teacher]
1852
+ #
1853
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1854
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1855
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1856
+ def get_course_teacher(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
1857
+ command = make_simple_command(:get, 'v1/courses/{courseId}/teachers/{userId}', options)
1858
+ command.response_representation = Google::Apis::ClassroomV1::Teacher::Representation
1859
+ command.response_class = Google::Apis::ClassroomV1::Teacher
1860
+ command.params['courseId'] = course_id unless course_id.nil?
1861
+ command.params['userId'] = user_id unless user_id.nil?
1862
+ command.query['fields'] = fields unless fields.nil?
1863
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1864
+ execute_or_queue_command(command, &block)
1865
+ end
1866
+
1867
+ # Returns a list of teachers of this course that the requester is permitted to
1868
+ # view. This method returns the following error codes: * `NOT_FOUND` if the
1869
+ # course does not exist. * `PERMISSION_DENIED` for access errors.
1870
+ # @param [String] course_id
1871
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1872
+ # identifier or an alias.
1873
+ # @param [Fixnum] page_size
1874
+ # Maximum number of items to return. The default is 30 if unspecified or `0`.
1875
+ # The server may return fewer than the specified number of results.
1876
+ # @param [String] page_token
1877
+ # nextPageToken value returned from a previous list call, indicating that the
1878
+ # subsequent page of results should be returned. The list request must be
1879
+ # otherwise identical to the one that resulted in this token.
1880
+ # @param [String] fields
1881
+ # Selector specifying which fields to include in a partial response.
1882
+ # @param [String] quota_user
1883
+ # Available to use for quota purposes for server-side applications. Can be any
1884
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1885
+ # @param [Google::Apis::RequestOptions] options
1886
+ # Request-specific options
1887
+ #
1888
+ # @yield [result, err] Result & error if block supplied
1889
+ # @yieldparam result [Google::Apis::ClassroomV1::ListTeachersResponse] parsed result object
1890
+ # @yieldparam err [StandardError] error object if request failed
1891
+ #
1892
+ # @return [Google::Apis::ClassroomV1::ListTeachersResponse]
1893
+ #
1894
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1895
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1896
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1897
+ def list_course_teachers(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1898
+ command = make_simple_command(:get, 'v1/courses/{courseId}/teachers', options)
1899
+ command.response_representation = Google::Apis::ClassroomV1::ListTeachersResponse::Representation
1900
+ command.response_class = Google::Apis::ClassroomV1::ListTeachersResponse
1901
+ command.params['courseId'] = course_id unless course_id.nil?
1902
+ command.query['pageSize'] = page_size unless page_size.nil?
1903
+ command.query['pageToken'] = page_token unless page_token.nil?
1904
+ command.query['fields'] = fields unless fields.nil?
1905
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1906
+ execute_or_queue_command(command, &block)
1907
+ end
1908
+
1909
+ # Creates a topic. This method returns the following error codes: * `
1910
+ # PERMISSION_DENIED` if the requesting user is not permitted to access the
1911
+ # requested course, create a topic in the requested course, or for access errors.
1912
+ # * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
1913
+ # requested course does not exist.
1914
+ # @param [String] course_id
1915
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1916
+ # identifier or an alias.
1917
+ # @param [Google::Apis::ClassroomV1::Topic] topic_object
1918
+ # @param [String] fields
1919
+ # Selector specifying which fields to include in a partial response.
1920
+ # @param [String] quota_user
1921
+ # Available to use for quota purposes for server-side applications. Can be any
1922
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1923
+ # @param [Google::Apis::RequestOptions] options
1924
+ # Request-specific options
1925
+ #
1926
+ # @yield [result, err] Result & error if block supplied
1927
+ # @yieldparam result [Google::Apis::ClassroomV1::Topic] parsed result object
1928
+ # @yieldparam err [StandardError] error object if request failed
1929
+ #
1930
+ # @return [Google::Apis::ClassroomV1::Topic]
1931
+ #
1932
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1933
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1934
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1935
+ def create_course_topic(course_id, topic_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1936
+ command = make_simple_command(:post, 'v1/courses/{courseId}/topics', options)
1937
+ command.request_representation = Google::Apis::ClassroomV1::Topic::Representation
1938
+ command.request_object = topic_object
1939
+ command.response_representation = Google::Apis::ClassroomV1::Topic::Representation
1940
+ command.response_class = Google::Apis::ClassroomV1::Topic
1941
+ command.params['courseId'] = course_id unless course_id.nil?
1942
+ command.query['fields'] = fields unless fields.nil?
1943
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1944
+ execute_or_queue_command(command, &block)
1945
+ end
1946
+
1947
+ # Deletes a topic. This method returns the following error codes: * `
1948
+ # PERMISSION_DENIED` if the requesting user is not allowed to delete the
1949
+ # requested topic or for access errors. * `FAILED_PRECONDITION` if the requested
1950
+ # topic has already been deleted. * `NOT_FOUND` if no course or topic exists
1951
+ # with the requested ID.
1952
+ # @param [String] course_id
1953
+ # Identifier of the course. This identifier can be either the Classroom-assigned
1954
+ # identifier or an alias.
1955
+ # @param [String] id
1956
+ # Identifier of the topic to delete.
1957
+ # @param [String] fields
1958
+ # Selector specifying which fields to include in a partial response.
1959
+ # @param [String] quota_user
1960
+ # Available to use for quota purposes for server-side applications. Can be any
1961
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1962
+ # @param [Google::Apis::RequestOptions] options
1963
+ # Request-specific options
1964
+ #
1965
+ # @yield [result, err] Result & error if block supplied
1966
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
1967
+ # @yieldparam err [StandardError] error object if request failed
1968
+ #
1969
+ # @return [Google::Apis::ClassroomV1::Empty]
1970
+ #
1971
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1972
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1973
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1974
+ def delete_course_topic(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
1975
+ command = make_simple_command(:delete, 'v1/courses/{courseId}/topics/{id}', options)
1976
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
1977
+ command.response_class = Google::Apis::ClassroomV1::Empty
1978
+ command.params['courseId'] = course_id unless course_id.nil?
1979
+ command.params['id'] = id unless id.nil?
1980
+ command.query['fields'] = fields unless fields.nil?
1981
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1982
+ execute_or_queue_command(command, &block)
1983
+ end
1984
+
1985
+ # Returns a topic. This method returns the following error codes: * `
1986
+ # PERMISSION_DENIED` if the requesting user is not permitted to access the
1987
+ # requested course or topic, or for access errors. * `INVALID_ARGUMENT` if the
1988
+ # request is malformed. * `NOT_FOUND` if the requested course or topic does not
1989
+ # exist.
1990
+ # @param [String] course_id
1991
+ # Identifier of the course.
1992
+ # @param [String] id
1993
+ # Identifier of the topic.
1994
+ # @param [String] fields
1995
+ # Selector specifying which fields to include in a partial response.
1996
+ # @param [String] quota_user
1997
+ # Available to use for quota purposes for server-side applications. Can be any
1998
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1999
+ # @param [Google::Apis::RequestOptions] options
2000
+ # Request-specific options
2001
+ #
2002
+ # @yield [result, err] Result & error if block supplied
2003
+ # @yieldparam result [Google::Apis::ClassroomV1::Topic] parsed result object
2004
+ # @yieldparam err [StandardError] error object if request failed
2005
+ #
2006
+ # @return [Google::Apis::ClassroomV1::Topic]
2007
+ #
2008
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2009
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2010
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2011
+ def get_course_topic(course_id, id, fields: nil, quota_user: nil, options: nil, &block)
2012
+ command = make_simple_command(:get, 'v1/courses/{courseId}/topics/{id}', options)
2013
+ command.response_representation = Google::Apis::ClassroomV1::Topic::Representation
2014
+ command.response_class = Google::Apis::ClassroomV1::Topic
2015
+ command.params['courseId'] = course_id unless course_id.nil?
2016
+ command.params['id'] = id unless id.nil?
2017
+ command.query['fields'] = fields unless fields.nil?
2018
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2019
+ execute_or_queue_command(command, &block)
2020
+ end
2021
+
2022
+ # Returns the list of topics that the requester is permitted to view. This
2023
+ # method returns the following error codes: * `PERMISSION_DENIED` if the
2024
+ # requesting user is not permitted to access the requested course or for access
2025
+ # errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
2026
+ # requested course does not exist.
2027
+ # @param [String] course_id
2028
+ # Identifier of the course. This identifier can be either the Classroom-assigned
2029
+ # identifier or an alias.
2030
+ # @param [Fixnum] page_size
2031
+ # Maximum number of items to return. Zero or unspecified indicates that the
2032
+ # server may assign a maximum. The server may return fewer than the specified
2033
+ # number of results.
2034
+ # @param [String] page_token
2035
+ # nextPageToken value returned from a previous list call, indicating that the
2036
+ # subsequent page of results should be returned. The list request must be
2037
+ # otherwise identical to the one that resulted in this token.
2038
+ # @param [String] fields
2039
+ # Selector specifying which fields to include in a partial response.
2040
+ # @param [String] quota_user
2041
+ # Available to use for quota purposes for server-side applications. Can be any
2042
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2043
+ # @param [Google::Apis::RequestOptions] options
2044
+ # Request-specific options
2045
+ #
2046
+ # @yield [result, err] Result & error if block supplied
2047
+ # @yieldparam result [Google::Apis::ClassroomV1::ListTopicResponse] parsed result object
2048
+ # @yieldparam err [StandardError] error object if request failed
2049
+ #
2050
+ # @return [Google::Apis::ClassroomV1::ListTopicResponse]
2051
+ #
2052
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2053
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2054
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2055
+ def list_course_topics(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
2056
+ command = make_simple_command(:get, 'v1/courses/{courseId}/topics', options)
2057
+ command.response_representation = Google::Apis::ClassroomV1::ListTopicResponse::Representation
2058
+ command.response_class = Google::Apis::ClassroomV1::ListTopicResponse
2059
+ command.params['courseId'] = course_id unless course_id.nil?
2060
+ command.query['pageSize'] = page_size unless page_size.nil?
2061
+ command.query['pageToken'] = page_token unless page_token.nil?
2062
+ command.query['fields'] = fields unless fields.nil?
2063
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2064
+ execute_or_queue_command(command, &block)
2065
+ end
2066
+
2067
+ # Updates one or more fields of a topic. This method returns the following error
2068
+ # codes: * `PERMISSION_DENIED` if the requesting developer project did not
2069
+ # create the corresponding topic or for access errors. * `INVALID_ARGUMENT` if
2070
+ # the request is malformed. * `NOT_FOUND` if the requested course or topic does
2071
+ # not exist
2072
+ # @param [String] course_id
2073
+ # Identifier of the course. This identifier can be either the Classroom-assigned
2074
+ # identifier or an alias.
2075
+ # @param [String] id
2076
+ # Identifier of the topic.
2077
+ # @param [Google::Apis::ClassroomV1::Topic] topic_object
2078
+ # @param [String] update_mask
2079
+ # Mask that identifies which fields on the topic to update. This field is
2080
+ # required to do an update. The update fails if invalid fields are specified. If
2081
+ # a field supports empty values, it can be cleared by specifying it in the
2082
+ # update mask and not in the Topic object. If a field that does not support
2083
+ # empty values is included in the update mask and not set in the Topic object,
2084
+ # an `INVALID_ARGUMENT` error is returned. The following fields may be specified:
2085
+ # * `name`
2086
+ # @param [String] fields
2087
+ # Selector specifying which fields to include in a partial response.
2088
+ # @param [String] quota_user
2089
+ # Available to use for quota purposes for server-side applications. Can be any
2090
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2091
+ # @param [Google::Apis::RequestOptions] options
2092
+ # Request-specific options
2093
+ #
2094
+ # @yield [result, err] Result & error if block supplied
2095
+ # @yieldparam result [Google::Apis::ClassroomV1::Topic] parsed result object
2096
+ # @yieldparam err [StandardError] error object if request failed
2097
+ #
2098
+ # @return [Google::Apis::ClassroomV1::Topic]
2099
+ #
2100
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2101
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2102
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2103
+ def patch_course_topic(course_id, id, topic_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
2104
+ command = make_simple_command(:patch, 'v1/courses/{courseId}/topics/{id}', options)
2105
+ command.request_representation = Google::Apis::ClassroomV1::Topic::Representation
2106
+ command.request_object = topic_object
2107
+ command.response_representation = Google::Apis::ClassroomV1::Topic::Representation
2108
+ command.response_class = Google::Apis::ClassroomV1::Topic
2109
+ command.params['courseId'] = course_id unless course_id.nil?
2110
+ command.params['id'] = id unless id.nil?
2111
+ command.query['updateMask'] = update_mask unless update_mask.nil?
2112
+ command.query['fields'] = fields unless fields.nil?
2113
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2114
+ execute_or_queue_command(command, &block)
2115
+ end
2116
+
2117
+ # Accepts an invitation, removing it and adding the invited user to the teachers
2118
+ # or students (as appropriate) of the specified course. Only the invited user
2119
+ # may accept an invitation. This method returns the following error codes: * `
2120
+ # PERMISSION_DENIED` if the requesting user is not permitted to accept the
2121
+ # requested invitation or for access errors. * `FAILED_PRECONDITION` for the
2122
+ # following request errors: * CourseMemberLimitReached * CourseNotModifiable *
2123
+ # CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `NOT_FOUND` if
2124
+ # no invitation exists with the requested ID.
2125
+ # @param [String] id
2126
+ # Identifier of the invitation to accept.
2127
+ # @param [String] fields
2128
+ # Selector specifying which fields to include in a partial response.
2129
+ # @param [String] quota_user
2130
+ # Available to use for quota purposes for server-side applications. Can be any
2131
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2132
+ # @param [Google::Apis::RequestOptions] options
2133
+ # Request-specific options
2134
+ #
2135
+ # @yield [result, err] Result & error if block supplied
2136
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
2137
+ # @yieldparam err [StandardError] error object if request failed
2138
+ #
2139
+ # @return [Google::Apis::ClassroomV1::Empty]
2140
+ #
2141
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2142
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2143
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2144
+ def accept_invitation(id, fields: nil, quota_user: nil, options: nil, &block)
2145
+ command = make_simple_command(:post, 'v1/invitations/{id}:accept', options)
2146
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
2147
+ command.response_class = Google::Apis::ClassroomV1::Empty
2148
+ command.params['id'] = id unless id.nil?
2149
+ command.query['fields'] = fields unless fields.nil?
2150
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2151
+ execute_or_queue_command(command, &block)
2152
+ end
2153
+
2154
+ # Creates an invitation. Only one invitation for a user and course may exist at
2155
+ # a time. Delete and re-create an invitation to make changes. This method
2156
+ # returns the following error codes: * `PERMISSION_DENIED` if the requesting
2157
+ # user is not permitted to create invitations for this course or for access
2158
+ # errors. * `NOT_FOUND` if the course or the user does not exist. * `
2159
+ # FAILED_PRECONDITION` if the requested user's account is disabled or if the
2160
+ # user already has this role or a role with greater permissions. * `
2161
+ # ALREADY_EXISTS` if an invitation for the specified user and course already
2162
+ # exists.
2163
+ # @param [Google::Apis::ClassroomV1::Invitation] invitation_object
2164
+ # @param [String] fields
2165
+ # Selector specifying which fields to include in a partial response.
2166
+ # @param [String] quota_user
2167
+ # Available to use for quota purposes for server-side applications. Can be any
2168
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2169
+ # @param [Google::Apis::RequestOptions] options
2170
+ # Request-specific options
2171
+ #
2172
+ # @yield [result, err] Result & error if block supplied
2173
+ # @yieldparam result [Google::Apis::ClassroomV1::Invitation] parsed result object
2174
+ # @yieldparam err [StandardError] error object if request failed
2175
+ #
2176
+ # @return [Google::Apis::ClassroomV1::Invitation]
2177
+ #
2178
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2179
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2180
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2181
+ def create_invitation(invitation_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2182
+ command = make_simple_command(:post, 'v1/invitations', options)
2183
+ command.request_representation = Google::Apis::ClassroomV1::Invitation::Representation
2184
+ command.request_object = invitation_object
2185
+ command.response_representation = Google::Apis::ClassroomV1::Invitation::Representation
2186
+ command.response_class = Google::Apis::ClassroomV1::Invitation
2187
+ command.query['fields'] = fields unless fields.nil?
2188
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2189
+ execute_or_queue_command(command, &block)
2190
+ end
2191
+
2192
+ # Deletes an invitation. This method returns the following error codes: * `
2193
+ # PERMISSION_DENIED` if the requesting user is not permitted to delete the
2194
+ # requested invitation or for access errors. * `NOT_FOUND` if no invitation
2195
+ # exists with the requested ID.
2196
+ # @param [String] id
2197
+ # Identifier of the invitation to delete.
2198
+ # @param [String] fields
2199
+ # Selector specifying which fields to include in a partial response.
2200
+ # @param [String] quota_user
2201
+ # Available to use for quota purposes for server-side applications. Can be any
2202
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2203
+ # @param [Google::Apis::RequestOptions] options
2204
+ # Request-specific options
2205
+ #
2206
+ # @yield [result, err] Result & error if block supplied
2207
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
2208
+ # @yieldparam err [StandardError] error object if request failed
2209
+ #
2210
+ # @return [Google::Apis::ClassroomV1::Empty]
2211
+ #
2212
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2213
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2214
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2215
+ def delete_invitation(id, fields: nil, quota_user: nil, options: nil, &block)
2216
+ command = make_simple_command(:delete, 'v1/invitations/{id}', options)
2217
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
2218
+ command.response_class = Google::Apis::ClassroomV1::Empty
2219
+ command.params['id'] = id unless id.nil?
2220
+ command.query['fields'] = fields unless fields.nil?
2221
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2222
+ execute_or_queue_command(command, &block)
2223
+ end
2224
+
2225
+ # Returns an invitation. This method returns the following error codes: * `
2226
+ # PERMISSION_DENIED` if the requesting user is not permitted to view the
2227
+ # requested invitation or for access errors. * `NOT_FOUND` if no invitation
2228
+ # exists with the requested ID.
2229
+ # @param [String] id
2230
+ # Identifier of the invitation to return.
2231
+ # @param [String] fields
2232
+ # Selector specifying which fields to include in a partial response.
2233
+ # @param [String] quota_user
2234
+ # Available to use for quota purposes for server-side applications. Can be any
2235
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2236
+ # @param [Google::Apis::RequestOptions] options
2237
+ # Request-specific options
2238
+ #
2239
+ # @yield [result, err] Result & error if block supplied
2240
+ # @yieldparam result [Google::Apis::ClassroomV1::Invitation] parsed result object
2241
+ # @yieldparam err [StandardError] error object if request failed
2242
+ #
2243
+ # @return [Google::Apis::ClassroomV1::Invitation]
2244
+ #
2245
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2246
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2247
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2248
+ def get_invitation(id, fields: nil, quota_user: nil, options: nil, &block)
2249
+ command = make_simple_command(:get, 'v1/invitations/{id}', options)
2250
+ command.response_representation = Google::Apis::ClassroomV1::Invitation::Representation
2251
+ command.response_class = Google::Apis::ClassroomV1::Invitation
2252
+ command.params['id'] = id unless id.nil?
2253
+ command.query['fields'] = fields unless fields.nil?
2254
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2255
+ execute_or_queue_command(command, &block)
2256
+ end
2257
+
2258
+ # Returns a list of invitations that the requesting user is permitted to view,
2259
+ # restricted to those that match the list request. *Note:* At least one of `
2260
+ # user_id` or `course_id` must be supplied. Both fields can be supplied. This
2261
+ # method returns the following error codes: * `PERMISSION_DENIED` for access
2262
+ # errors.
2263
+ # @param [String] course_id
2264
+ # Restricts returned invitations to those for a course with the specified
2265
+ # identifier.
2266
+ # @param [Fixnum] page_size
2267
+ # Maximum number of items to return. The default is 500 if unspecified or `0`.
2268
+ # The server may return fewer than the specified number of results.
2269
+ # @param [String] page_token
2270
+ # nextPageToken value returned from a previous list call, indicating that the
2271
+ # subsequent page of results should be returned. The list request must be
2272
+ # otherwise identical to the one that resulted in this token.
2273
+ # @param [String] user_id
2274
+ # Restricts returned invitations to those for a specific user. The identifier
2275
+ # can be one of the following: * the numeric identifier for the user * the email
2276
+ # address of the user * the string literal `"me"`, indicating the requesting
2277
+ # user
2278
+ # @param [String] fields
2279
+ # Selector specifying which fields to include in a partial response.
2280
+ # @param [String] quota_user
2281
+ # Available to use for quota purposes for server-side applications. Can be any
2282
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2283
+ # @param [Google::Apis::RequestOptions] options
2284
+ # Request-specific options
2285
+ #
2286
+ # @yield [result, err] Result & error if block supplied
2287
+ # @yieldparam result [Google::Apis::ClassroomV1::ListInvitationsResponse] parsed result object
2288
+ # @yieldparam err [StandardError] error object if request failed
2289
+ #
2290
+ # @return [Google::Apis::ClassroomV1::ListInvitationsResponse]
2291
+ #
2292
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2293
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2294
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2295
+ def list_invitations(course_id: nil, page_size: nil, page_token: nil, user_id: nil, fields: nil, quota_user: nil, options: nil, &block)
2296
+ command = make_simple_command(:get, 'v1/invitations', options)
2297
+ command.response_representation = Google::Apis::ClassroomV1::ListInvitationsResponse::Representation
2298
+ command.response_class = Google::Apis::ClassroomV1::ListInvitationsResponse
2299
+ command.query['courseId'] = course_id unless course_id.nil?
2300
+ command.query['pageSize'] = page_size unless page_size.nil?
2301
+ command.query['pageToken'] = page_token unless page_token.nil?
2302
+ command.query['userId'] = user_id unless user_id.nil?
2303
+ command.query['fields'] = fields unless fields.nil?
2304
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2305
+ execute_or_queue_command(command, &block)
2306
+ end
2307
+
2308
+ # Creates a `Registration`, causing Classroom to start sending notifications
2309
+ # from the provided `feed` to the destination provided in `cloudPubSubTopic`.
2310
+ # Returns the created `Registration`. Currently, this will be the same as the
2311
+ # argument, but with server-assigned fields such as `expiry_time` and `id`
2312
+ # filled in. Note that any value specified for the `expiry_time` or `id` fields
2313
+ # will be ignored. While Classroom may validate the `cloudPubSubTopic` and
2314
+ # return errors on a best effort basis, it is the caller's responsibility to
2315
+ # ensure that it exists and that Classroom has permission to publish to it. This
2316
+ # method may return the following error codes: * `PERMISSION_DENIED` if: * the
2317
+ # authenticated user does not have permission to receive notifications from the
2318
+ # requested field; or * the current user has not granted access to the current
2319
+ # Cloud project with the appropriate scope for the requested feed. Note that
2320
+ # domain-wide delegation of authority is not currently supported for this
2321
+ # purpose. If the request has the appropriate scope, but no grant exists, a
2322
+ # Request Errors is returned. * another access error is encountered. * `
2323
+ # INVALID_ARGUMENT` if: * no `cloudPubsubTopic` is specified, or the specified `
2324
+ # cloudPubsubTopic` is not valid; or * no `feed` is specified, or the specified `
2325
+ # feed` is not valid. * `NOT_FOUND` if: * the specified `feed` cannot be located,
2326
+ # or the requesting user does not have permission to determine whether or not
2327
+ # it exists; or * the specified `cloudPubsubTopic` cannot be located, or
2328
+ # Classroom has not been granted permission to publish to it.
2329
+ # @param [Google::Apis::ClassroomV1::Registration] registration_object
2330
+ # @param [String] fields
2331
+ # Selector specifying which fields to include in a partial response.
2332
+ # @param [String] quota_user
2333
+ # Available to use for quota purposes for server-side applications. Can be any
2334
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2335
+ # @param [Google::Apis::RequestOptions] options
2336
+ # Request-specific options
2337
+ #
2338
+ # @yield [result, err] Result & error if block supplied
2339
+ # @yieldparam result [Google::Apis::ClassroomV1::Registration] parsed result object
2340
+ # @yieldparam err [StandardError] error object if request failed
2341
+ #
2342
+ # @return [Google::Apis::ClassroomV1::Registration]
2343
+ #
2344
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2345
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2346
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2347
+ def create_registration(registration_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2348
+ command = make_simple_command(:post, 'v1/registrations', options)
2349
+ command.request_representation = Google::Apis::ClassroomV1::Registration::Representation
2350
+ command.request_object = registration_object
2351
+ command.response_representation = Google::Apis::ClassroomV1::Registration::Representation
2352
+ command.response_class = Google::Apis::ClassroomV1::Registration
2353
+ command.query['fields'] = fields unless fields.nil?
2354
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2355
+ execute_or_queue_command(command, &block)
2356
+ end
2357
+
2358
+ # Deletes a `Registration`, causing Classroom to stop sending notifications for
2359
+ # that `Registration`.
2360
+ # @param [String] registration_id
2361
+ # The `registration_id` of the `Registration` to be deleted.
2362
+ # @param [String] fields
2363
+ # Selector specifying which fields to include in a partial response.
2364
+ # @param [String] quota_user
2365
+ # Available to use for quota purposes for server-side applications. Can be any
2366
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2367
+ # @param [Google::Apis::RequestOptions] options
2368
+ # Request-specific options
2369
+ #
2370
+ # @yield [result, err] Result & error if block supplied
2371
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
2372
+ # @yieldparam err [StandardError] error object if request failed
2373
+ #
2374
+ # @return [Google::Apis::ClassroomV1::Empty]
2375
+ #
2376
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2377
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2378
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2379
+ def delete_registration(registration_id, fields: nil, quota_user: nil, options: nil, &block)
2380
+ command = make_simple_command(:delete, 'v1/registrations/{registrationId}', options)
2381
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
2382
+ command.response_class = Google::Apis::ClassroomV1::Empty
2383
+ command.params['registrationId'] = registration_id unless registration_id.nil?
2384
+ command.query['fields'] = fields unless fields.nil?
2385
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2386
+ execute_or_queue_command(command, &block)
2387
+ end
2388
+
2389
+ # Returns a user profile. This method returns the following error codes: * `
2390
+ # PERMISSION_DENIED` if the requesting user is not permitted to access this user
2391
+ # profile, if no profile exists with the requested ID, or for access errors.
2392
+ # @param [String] user_id
2393
+ # Identifier of the profile to return. The identifier can be one of the
2394
+ # following: * the numeric identifier for the user * the email address of the
2395
+ # user * the string literal `"me"`, indicating the requesting user
2396
+ # @param [String] fields
2397
+ # Selector specifying which fields to include in a partial response.
2398
+ # @param [String] quota_user
2399
+ # Available to use for quota purposes for server-side applications. Can be any
2400
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2401
+ # @param [Google::Apis::RequestOptions] options
2402
+ # Request-specific options
2403
+ #
2404
+ # @yield [result, err] Result & error if block supplied
2405
+ # @yieldparam result [Google::Apis::ClassroomV1::UserProfile] parsed result object
2406
+ # @yieldparam err [StandardError] error object if request failed
2407
+ #
2408
+ # @return [Google::Apis::ClassroomV1::UserProfile]
2409
+ #
2410
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2411
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2412
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2413
+ def get_user_profile(user_id, fields: nil, quota_user: nil, options: nil, &block)
2414
+ command = make_simple_command(:get, 'v1/userProfiles/{userId}', options)
2415
+ command.response_representation = Google::Apis::ClassroomV1::UserProfile::Representation
2416
+ command.response_class = Google::Apis::ClassroomV1::UserProfile
2417
+ command.params['userId'] = user_id unless user_id.nil?
2418
+ command.query['fields'] = fields unless fields.nil?
2419
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2420
+ execute_or_queue_command(command, &block)
2421
+ end
2422
+
2423
+ # Creates a guardian invitation, and sends an email to the guardian asking them
2424
+ # to confirm that they are the student's guardian. Once the guardian accepts the
2425
+ # invitation, their `state` will change to `COMPLETED` and they will start
2426
+ # receiving guardian notifications. A `Guardian` resource will also be created
2427
+ # to represent the active guardian. The request object must have the `student_id`
2428
+ # and `invited_email_address` fields set. Failing to set these fields, or
2429
+ # setting any other fields in the request, will result in an error. This method
2430
+ # returns the following error codes: * `PERMISSION_DENIED` if the current user
2431
+ # does not have permission to manage guardians, if the guardian in question has
2432
+ # already rejected too many requests for that student, if guardians are not
2433
+ # enabled for the domain in question, or for other access errors. * `
2434
+ # RESOURCE_EXHAUSTED` if the student or guardian has exceeded the guardian link
2435
+ # limit. * `INVALID_ARGUMENT` if the guardian email address is not valid (for
2436
+ # example, if it is too long), or if the format of the student ID provided
2437
+ # cannot be recognized (it is not an email address, nor a `user_id` from this
2438
+ # API). This error will also be returned if read-only fields are set, or if the `
2439
+ # state` field is set to to a value other than `PENDING`. * `NOT_FOUND` if the
2440
+ # student ID provided is a valid student ID, but Classroom has no record of that
2441
+ # student. * `ALREADY_EXISTS` if there is already a pending guardian invitation
2442
+ # for the student and `invited_email_address` provided, or if the provided `
2443
+ # invited_email_address` matches the Google account of an existing `Guardian`
2444
+ # for this user.
2445
+ # @param [String] student_id
2446
+ # ID of the student (in standard format)
2447
+ # @param [Google::Apis::ClassroomV1::GuardianInvitation] guardian_invitation_object
2448
+ # @param [String] fields
2449
+ # Selector specifying which fields to include in a partial response.
2450
+ # @param [String] quota_user
2451
+ # Available to use for quota purposes for server-side applications. Can be any
2452
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2453
+ # @param [Google::Apis::RequestOptions] options
2454
+ # Request-specific options
2455
+ #
2456
+ # @yield [result, err] Result & error if block supplied
2457
+ # @yieldparam result [Google::Apis::ClassroomV1::GuardianInvitation] parsed result object
2458
+ # @yieldparam err [StandardError] error object if request failed
2459
+ #
2460
+ # @return [Google::Apis::ClassroomV1::GuardianInvitation]
2461
+ #
2462
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2463
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2464
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2465
+ def create_user_profile_guardian_invitation(student_id, guardian_invitation_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2466
+ command = make_simple_command(:post, 'v1/userProfiles/{studentId}/guardianInvitations', options)
2467
+ command.request_representation = Google::Apis::ClassroomV1::GuardianInvitation::Representation
2468
+ command.request_object = guardian_invitation_object
2469
+ command.response_representation = Google::Apis::ClassroomV1::GuardianInvitation::Representation
2470
+ command.response_class = Google::Apis::ClassroomV1::GuardianInvitation
2471
+ command.params['studentId'] = student_id unless student_id.nil?
2472
+ command.query['fields'] = fields unless fields.nil?
2473
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2474
+ execute_or_queue_command(command, &block)
2475
+ end
2476
+
2477
+ # Returns a specific guardian invitation. This method returns the following
2478
+ # error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
2479
+ # view guardian invitations for the student identified by the `student_id`, if
2480
+ # guardians are not enabled for the domain in question, or for other access
2481
+ # errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
2482
+ # cannot be recognized (it is not an email address, nor a `student_id` from the
2483
+ # API, nor the literal string `me`). * `NOT_FOUND` if Classroom cannot find any
2484
+ # record of the given student or `invitation_id`. May also be returned if the
2485
+ # student exists, but the requesting user does not have access to see that
2486
+ # student.
2487
+ # @param [String] student_id
2488
+ # The ID of the student whose guardian invitation is being requested.
2489
+ # @param [String] invitation_id
2490
+ # The `id` field of the `GuardianInvitation` being requested.
2491
+ # @param [String] fields
2492
+ # Selector specifying which fields to include in a partial response.
2493
+ # @param [String] quota_user
2494
+ # Available to use for quota purposes for server-side applications. Can be any
2495
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2496
+ # @param [Google::Apis::RequestOptions] options
2497
+ # Request-specific options
2498
+ #
2499
+ # @yield [result, err] Result & error if block supplied
2500
+ # @yieldparam result [Google::Apis::ClassroomV1::GuardianInvitation] parsed result object
2501
+ # @yieldparam err [StandardError] error object if request failed
2502
+ #
2503
+ # @return [Google::Apis::ClassroomV1::GuardianInvitation]
2504
+ #
2505
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2506
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2507
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2508
+ def get_user_profile_guardian_invitation(student_id, invitation_id, fields: nil, quota_user: nil, options: nil, &block)
2509
+ command = make_simple_command(:get, 'v1/userProfiles/{studentId}/guardianInvitations/{invitationId}', options)
2510
+ command.response_representation = Google::Apis::ClassroomV1::GuardianInvitation::Representation
2511
+ command.response_class = Google::Apis::ClassroomV1::GuardianInvitation
2512
+ command.params['studentId'] = student_id unless student_id.nil?
2513
+ command.params['invitationId'] = invitation_id unless invitation_id.nil?
2514
+ command.query['fields'] = fields unless fields.nil?
2515
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2516
+ execute_or_queue_command(command, &block)
2517
+ end
2518
+
2519
+ # Returns a list of guardian invitations that the requesting user is permitted
2520
+ # to view, filtered by the parameters provided. This method returns the
2521
+ # following error codes: * `PERMISSION_DENIED` if a `student_id` is specified,
2522
+ # and the requesting user is not permitted to view guardian invitations for that
2523
+ # student, if `"-"` is specified as the `student_id` and the user is not a
2524
+ # domain administrator, if guardians are not enabled for the domain in question,
2525
+ # or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is
2526
+ # specified, but its format cannot be recognized (it is not an email address,
2527
+ # nor a `student_id` from the API, nor the literal string `me`). May also be
2528
+ # returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a
2529
+ # `student_id` is specified, and its format can be recognized, but Classroom has
2530
+ # no record of that student.
2531
+ # @param [String] student_id
2532
+ # The ID of the student whose guardian invitations are to be returned. The
2533
+ # identifier can be one of the following: * the numeric identifier for the user *
2534
+ # the email address of the user * the string literal `"me"`, indicating the
2535
+ # requesting user * the string literal `"-"`, indicating that results should be
2536
+ # returned for all students that the requesting user is permitted to view
2537
+ # guardian invitations.
2538
+ # @param [String] invited_email_address
2539
+ # If specified, only results with the specified `invited_email_address` are
2540
+ # returned.
2541
+ # @param [Fixnum] page_size
2542
+ # Maximum number of items to return. Zero or unspecified indicates that the
2543
+ # server may assign a maximum. The server may return fewer than the specified
2544
+ # number of results.
2545
+ # @param [String] page_token
2546
+ # nextPageToken value returned from a previous list call, indicating that the
2547
+ # subsequent page of results should be returned. The list request must be
2548
+ # otherwise identical to the one that resulted in this token.
2549
+ # @param [Array<String>, String] states
2550
+ # If specified, only results with the specified `state` values are returned.
2551
+ # Otherwise, results with a `state` of `PENDING` are returned.
2552
+ # @param [String] fields
2553
+ # Selector specifying which fields to include in a partial response.
2554
+ # @param [String] quota_user
2555
+ # Available to use for quota purposes for server-side applications. Can be any
2556
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2557
+ # @param [Google::Apis::RequestOptions] options
2558
+ # Request-specific options
2559
+ #
2560
+ # @yield [result, err] Result & error if block supplied
2561
+ # @yieldparam result [Google::Apis::ClassroomV1::ListGuardianInvitationsResponse] parsed result object
2562
+ # @yieldparam err [StandardError] error object if request failed
2563
+ #
2564
+ # @return [Google::Apis::ClassroomV1::ListGuardianInvitationsResponse]
2565
+ #
2566
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2567
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2568
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2569
+ def list_user_profile_guardian_invitations(student_id, invited_email_address: nil, page_size: nil, page_token: nil, states: nil, fields: nil, quota_user: nil, options: nil, &block)
2570
+ command = make_simple_command(:get, 'v1/userProfiles/{studentId}/guardianInvitations', options)
2571
+ command.response_representation = Google::Apis::ClassroomV1::ListGuardianInvitationsResponse::Representation
2572
+ command.response_class = Google::Apis::ClassroomV1::ListGuardianInvitationsResponse
2573
+ command.params['studentId'] = student_id unless student_id.nil?
2574
+ command.query['invitedEmailAddress'] = invited_email_address unless invited_email_address.nil?
2575
+ command.query['pageSize'] = page_size unless page_size.nil?
2576
+ command.query['pageToken'] = page_token unless page_token.nil?
2577
+ command.query['states'] = states unless states.nil?
2578
+ command.query['fields'] = fields unless fields.nil?
2579
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2580
+ execute_or_queue_command(command, &block)
2581
+ end
2582
+
2583
+ # Modifies a guardian invitation. Currently, the only valid modification is to
2584
+ # change the `state` from `PENDING` to `COMPLETE`. This has the effect of
2585
+ # withdrawing the invitation. This method returns the following error codes: * `
2586
+ # PERMISSION_DENIED` if the current user does not have permission to manage
2587
+ # guardians, if guardians are not enabled for the domain in question or for
2588
+ # other access errors. * `FAILED_PRECONDITION` if the guardian link is not in
2589
+ # the `PENDING` state. * `INVALID_ARGUMENT` if the format of the student ID
2590
+ # provided cannot be recognized (it is not an email address, nor a `user_id`
2591
+ # from this API), or if the passed `GuardianInvitation` has a `state` other than
2592
+ # `COMPLETE`, or if it modifies fields other than `state`. * `NOT_FOUND` if the
2593
+ # student ID provided is a valid student ID, but Classroom has no record of that
2594
+ # student, or if the `id` field does not refer to a guardian invitation known to
2595
+ # Classroom.
2596
+ # @param [String] student_id
2597
+ # The ID of the student whose guardian invitation is to be modified.
2598
+ # @param [String] invitation_id
2599
+ # The `id` field of the `GuardianInvitation` to be modified.
2600
+ # @param [Google::Apis::ClassroomV1::GuardianInvitation] guardian_invitation_object
2601
+ # @param [String] update_mask
2602
+ # Mask that identifies which fields on the course to update. This field is
2603
+ # required to do an update. The update fails if invalid fields are specified.
2604
+ # The following fields are valid: * `state` When set in a query parameter, this
2605
+ # field should be specified as `updateMask=,,...`
2606
+ # @param [String] fields
2607
+ # Selector specifying which fields to include in a partial response.
2608
+ # @param [String] quota_user
2609
+ # Available to use for quota purposes for server-side applications. Can be any
2610
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2611
+ # @param [Google::Apis::RequestOptions] options
2612
+ # Request-specific options
2613
+ #
2614
+ # @yield [result, err] Result & error if block supplied
2615
+ # @yieldparam result [Google::Apis::ClassroomV1::GuardianInvitation] parsed result object
2616
+ # @yieldparam err [StandardError] error object if request failed
2617
+ #
2618
+ # @return [Google::Apis::ClassroomV1::GuardianInvitation]
2619
+ #
2620
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2621
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2622
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2623
+ def patch_user_profile_guardian_invitation(student_id, invitation_id, guardian_invitation_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
2624
+ command = make_simple_command(:patch, 'v1/userProfiles/{studentId}/guardianInvitations/{invitationId}', options)
2625
+ command.request_representation = Google::Apis::ClassroomV1::GuardianInvitation::Representation
2626
+ command.request_object = guardian_invitation_object
2627
+ command.response_representation = Google::Apis::ClassroomV1::GuardianInvitation::Representation
2628
+ command.response_class = Google::Apis::ClassroomV1::GuardianInvitation
2629
+ command.params['studentId'] = student_id unless student_id.nil?
2630
+ command.params['invitationId'] = invitation_id unless invitation_id.nil?
2631
+ command.query['updateMask'] = update_mask unless update_mask.nil?
2632
+ command.query['fields'] = fields unless fields.nil?
2633
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2634
+ execute_or_queue_command(command, &block)
2635
+ end
2636
+
2637
+ # Deletes a guardian. The guardian will no longer receive guardian notifications
2638
+ # and the guardian will no longer be accessible via the API. This method returns
2639
+ # the following error codes: * `PERMISSION_DENIED` if no user that matches the
2640
+ # provided `student_id` is visible to the requesting user, if the requesting
2641
+ # user is not permitted to manage guardians for the student identified by the `
2642
+ # student_id`, if guardians are not enabled for the domain in question, or for
2643
+ # other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but
2644
+ # its format cannot be recognized (it is not an email address, nor a `student_id`
2645
+ # from the API). * `NOT_FOUND` if the requesting user is permitted to modify
2646
+ # guardians for the requested `student_id`, but no `Guardian` record exists for
2647
+ # that student with the provided `guardian_id`.
2648
+ # @param [String] student_id
2649
+ # The student whose guardian is to be deleted. One of the following: * the
2650
+ # numeric identifier for the user * the email address of the user * the string
2651
+ # literal `"me"`, indicating the requesting user
2652
+ # @param [String] guardian_id
2653
+ # The `id` field from a `Guardian`.
2654
+ # @param [String] fields
2655
+ # Selector specifying which fields to include in a partial response.
2656
+ # @param [String] quota_user
2657
+ # Available to use for quota purposes for server-side applications. Can be any
2658
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2659
+ # @param [Google::Apis::RequestOptions] options
2660
+ # Request-specific options
2661
+ #
2662
+ # @yield [result, err] Result & error if block supplied
2663
+ # @yieldparam result [Google::Apis::ClassroomV1::Empty] parsed result object
2664
+ # @yieldparam err [StandardError] error object if request failed
2665
+ #
2666
+ # @return [Google::Apis::ClassroomV1::Empty]
2667
+ #
2668
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2669
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2670
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2671
+ def delete_user_profile_guardian(student_id, guardian_id, fields: nil, quota_user: nil, options: nil, &block)
2672
+ command = make_simple_command(:delete, 'v1/userProfiles/{studentId}/guardians/{guardianId}', options)
2673
+ command.response_representation = Google::Apis::ClassroomV1::Empty::Representation
2674
+ command.response_class = Google::Apis::ClassroomV1::Empty
2675
+ command.params['studentId'] = student_id unless student_id.nil?
2676
+ command.params['guardianId'] = guardian_id unless guardian_id.nil?
2677
+ command.query['fields'] = fields unless fields.nil?
2678
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2679
+ execute_or_queue_command(command, &block)
2680
+ end
2681
+
2682
+ # Returns a specific guardian. This method returns the following error codes: * `
2683
+ # PERMISSION_DENIED` if no user that matches the provided `student_id` is
2684
+ # visible to the requesting user, if the requesting user is not permitted to
2685
+ # view guardian information for the student identified by the `student_id`, if
2686
+ # guardians are not enabled for the domain in question, or for other access
2687
+ # errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
2688
+ # cannot be recognized (it is not an email address, nor a `student_id` from the
2689
+ # API, nor the literal string `me`). * `NOT_FOUND` if the requesting user is
2690
+ # permitted to view guardians for the requested `student_id`, but no `Guardian`
2691
+ # record exists for that student that matches the provided `guardian_id`.
2692
+ # @param [String] student_id
2693
+ # The student whose guardian is being requested. One of the following: * the
2694
+ # numeric identifier for the user * the email address of the user * the string
2695
+ # literal `"me"`, indicating the requesting user
2696
+ # @param [String] guardian_id
2697
+ # The `id` field from a `Guardian`.
2698
+ # @param [String] fields
2699
+ # Selector specifying which fields to include in a partial response.
2700
+ # @param [String] quota_user
2701
+ # Available to use for quota purposes for server-side applications. Can be any
2702
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2703
+ # @param [Google::Apis::RequestOptions] options
2704
+ # Request-specific options
2705
+ #
2706
+ # @yield [result, err] Result & error if block supplied
2707
+ # @yieldparam result [Google::Apis::ClassroomV1::Guardian] parsed result object
2708
+ # @yieldparam err [StandardError] error object if request failed
2709
+ #
2710
+ # @return [Google::Apis::ClassroomV1::Guardian]
2711
+ #
2712
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2713
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2714
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2715
+ def get_user_profile_guardian(student_id, guardian_id, fields: nil, quota_user: nil, options: nil, &block)
2716
+ command = make_simple_command(:get, 'v1/userProfiles/{studentId}/guardians/{guardianId}', options)
2717
+ command.response_representation = Google::Apis::ClassroomV1::Guardian::Representation
2718
+ command.response_class = Google::Apis::ClassroomV1::Guardian
2719
+ command.params['studentId'] = student_id unless student_id.nil?
2720
+ command.params['guardianId'] = guardian_id unless guardian_id.nil?
2721
+ command.query['fields'] = fields unless fields.nil?
2722
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2723
+ execute_or_queue_command(command, &block)
2724
+ end
2725
+
2726
+ # Returns a list of guardians that the requesting user is permitted to view,
2727
+ # restricted to those that match the request. To list guardians for any student
2728
+ # that the requesting user may view guardians for, use the literal character `-`
2729
+ # for the student ID. This method returns the following error codes: * `
2730
+ # PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is
2731
+ # not permitted to view guardian information for that student, if `"-"` is
2732
+ # specified as the `student_id` and the user is not a domain administrator, if
2733
+ # guardians are not enabled for the domain in question, if the `
2734
+ # invited_email_address` filter is set by a user who is not a domain
2735
+ # administrator, or for other access errors. * `INVALID_ARGUMENT` if a `
2736
+ # student_id` is specified, but its format cannot be recognized (it is not an
2737
+ # email address, nor a `student_id` from the API, nor the literal string `me`).
2738
+ # May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if
2739
+ # a `student_id` is specified, and its format can be recognized, but Classroom
2740
+ # has no record of that student.
2741
+ # @param [String] student_id
2742
+ # Filter results by the student who the guardian is linked to. The identifier
2743
+ # can be one of the following: * the numeric identifier for the user * the email
2744
+ # address of the user * the string literal `"me"`, indicating the requesting
2745
+ # user * the string literal `"-"`, indicating that results should be returned
2746
+ # for all students that the requesting user has access to view.
2747
+ # @param [String] invited_email_address
2748
+ # Filter results by the email address that the original invitation was sent to,
2749
+ # resulting in this guardian link. This filter can only be used by domain
2750
+ # administrators.
2751
+ # @param [Fixnum] page_size
2752
+ # Maximum number of items to return. Zero or unspecified indicates that the
2753
+ # server may assign a maximum. The server may return fewer than the specified
2754
+ # number of results.
2755
+ # @param [String] page_token
2756
+ # nextPageToken value returned from a previous list call, indicating that the
2757
+ # subsequent page of results should be returned. The list request must be
2758
+ # otherwise identical to the one that resulted in this token.
2759
+ # @param [String] fields
2760
+ # Selector specifying which fields to include in a partial response.
2761
+ # @param [String] quota_user
2762
+ # Available to use for quota purposes for server-side applications. Can be any
2763
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2764
+ # @param [Google::Apis::RequestOptions] options
2765
+ # Request-specific options
2766
+ #
2767
+ # @yield [result, err] Result & error if block supplied
2768
+ # @yieldparam result [Google::Apis::ClassroomV1::ListGuardiansResponse] parsed result object
2769
+ # @yieldparam err [StandardError] error object if request failed
2770
+ #
2771
+ # @return [Google::Apis::ClassroomV1::ListGuardiansResponse]
2772
+ #
2773
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2774
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2775
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2776
+ def list_user_profile_guardians(student_id, invited_email_address: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
2777
+ command = make_simple_command(:get, 'v1/userProfiles/{studentId}/guardians', options)
2778
+ command.response_representation = Google::Apis::ClassroomV1::ListGuardiansResponse::Representation
2779
+ command.response_class = Google::Apis::ClassroomV1::ListGuardiansResponse
2780
+ command.params['studentId'] = student_id unless student_id.nil?
2781
+ command.query['invitedEmailAddress'] = invited_email_address unless invited_email_address.nil?
2782
+ command.query['pageSize'] = page_size unless page_size.nil?
2783
+ command.query['pageToken'] = page_token unless page_token.nil?
2784
+ command.query['fields'] = fields unless fields.nil?
2785
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2786
+ execute_or_queue_command(command, &block)
2787
+ end
2788
+
2789
+ protected
2790
+
2791
+ def apply_command_defaults(command)
2792
+ command.query['key'] = key unless key.nil?
2793
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2794
+ end
2795
+ end
2796
+ end
2797
+ end
2798
+ end