1// Copyright 2021 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package classroom provides access to the Google Classroom API. 8// 9// For product documentation, see: https://developers.google.com/classroom/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/classroom/v1" 16// ... 17// ctx := context.Background() 18// classroomService, err := classroom.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// classroomService, err := classroom.NewService(ctx, option.WithScopes(classroom.ClassroomTopicsReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// classroomService, err := classroom.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// classroomService, err := classroom.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package classroom // import "google.golang.org/api/classroom/v1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "classroom:v1" 79const apiName = "classroom" 80const apiVersion = "v1" 81const basePath = "https://classroom.googleapis.com/" 82const mtlsBasePath = "https://classroom.mtls.googleapis.com/" 83 84// OAuth2 scopes used by this API. 85const ( 86 // View and manage announcements in Google Classroom 87 ClassroomAnnouncementsScope = "https://www.googleapis.com/auth/classroom.announcements" 88 89 // View announcements in Google Classroom 90 ClassroomAnnouncementsReadonlyScope = "https://www.googleapis.com/auth/classroom.announcements.readonly" 91 92 // See, edit, create, and permanently delete your Google Classroom 93 // classes 94 ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses" 95 96 // View your Google Classroom classes 97 ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly" 98 99 // See, create and edit coursework items including assignments, 100 // questions, and grades 101 ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me" 102 103 // View your course work and grades in Google Classroom 104 ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly" 105 106 // Manage course work and grades for students in the Google Classroom 107 // classes you teach and view the course work and grades for classes you 108 // administer 109 ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students" 110 111 // View course work and grades for students in the Google Classroom 112 // classes you teach or administer 113 ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 114 115 // See, edit, and create classwork materials in Google Classroom 116 ClassroomCourseworkmaterialsScope = "https://www.googleapis.com/auth/classroom.courseworkmaterials" 117 118 // See all classwork materials for your Google Classroom classes 119 ClassroomCourseworkmaterialsReadonlyScope = "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly" 120 121 // View your Google Classroom guardians 122 ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly" 123 124 // View and manage guardians for students in your Google Classroom 125 // classes 126 ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students" 127 128 // View guardians for students in your Google Classroom classes 129 ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 130 131 // View the email addresses of people in your classes 132 ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails" 133 134 // View the profile photos of people in your classes 135 ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos" 136 137 // Receive notifications about your Google Classroom data 138 ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications" 139 140 // Manage your Google Classroom class rosters 141 ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters" 142 143 // View your Google Classroom class rosters 144 ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly" 145 146 // View your course work and grades in Google Classroom 147 ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly" 148 149 // View course work and grades for students in the Google Classroom 150 // classes you teach or administer 151 ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 152 153 // See, create, and edit topics in Google Classroom 154 ClassroomTopicsScope = "https://www.googleapis.com/auth/classroom.topics" 155 156 // View topics in Google Classroom 157 ClassroomTopicsReadonlyScope = "https://www.googleapis.com/auth/classroom.topics.readonly" 158) 159 160// NewService creates a new Service. 161func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 162 scopesOption := option.WithScopes( 163 "https://www.googleapis.com/auth/classroom.announcements", 164 "https://www.googleapis.com/auth/classroom.announcements.readonly", 165 "https://www.googleapis.com/auth/classroom.courses", 166 "https://www.googleapis.com/auth/classroom.courses.readonly", 167 "https://www.googleapis.com/auth/classroom.coursework.me", 168 "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 169 "https://www.googleapis.com/auth/classroom.coursework.students", 170 "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 171 "https://www.googleapis.com/auth/classroom.courseworkmaterials", 172 "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly", 173 "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 174 "https://www.googleapis.com/auth/classroom.guardianlinks.students", 175 "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly", 176 "https://www.googleapis.com/auth/classroom.profile.emails", 177 "https://www.googleapis.com/auth/classroom.profile.photos", 178 "https://www.googleapis.com/auth/classroom.push-notifications", 179 "https://www.googleapis.com/auth/classroom.rosters", 180 "https://www.googleapis.com/auth/classroom.rosters.readonly", 181 "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 182 "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly", 183 "https://www.googleapis.com/auth/classroom.topics", 184 "https://www.googleapis.com/auth/classroom.topics.readonly", 185 ) 186 // NOTE: prepend, so we don't override user-specified scopes. 187 opts = append([]option.ClientOption{scopesOption}, opts...) 188 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 189 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 190 client, endpoint, err := htransport.NewClient(ctx, opts...) 191 if err != nil { 192 return nil, err 193 } 194 s, err := New(client) 195 if err != nil { 196 return nil, err 197 } 198 if endpoint != "" { 199 s.BasePath = endpoint 200 } 201 return s, nil 202} 203 204// New creates a new Service. It uses the provided http.Client for requests. 205// 206// Deprecated: please use NewService instead. 207// To provide a custom HTTP client, use option.WithHTTPClient. 208// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 209func New(client *http.Client) (*Service, error) { 210 if client == nil { 211 return nil, errors.New("client is nil") 212 } 213 s := &Service{client: client, BasePath: basePath} 214 s.Courses = NewCoursesService(s) 215 s.Invitations = NewInvitationsService(s) 216 s.Registrations = NewRegistrationsService(s) 217 s.UserProfiles = NewUserProfilesService(s) 218 return s, nil 219} 220 221type Service struct { 222 client *http.Client 223 BasePath string // API endpoint base URL 224 UserAgent string // optional additional User-Agent fragment 225 226 Courses *CoursesService 227 228 Invitations *InvitationsService 229 230 Registrations *RegistrationsService 231 232 UserProfiles *UserProfilesService 233} 234 235func (s *Service) userAgent() string { 236 if s.UserAgent == "" { 237 return googleapi.UserAgent 238 } 239 return googleapi.UserAgent + " " + s.UserAgent 240} 241 242func NewCoursesService(s *Service) *CoursesService { 243 rs := &CoursesService{s: s} 244 rs.Aliases = NewCoursesAliasesService(s) 245 rs.Announcements = NewCoursesAnnouncementsService(s) 246 rs.CourseWork = NewCoursesCourseWorkService(s) 247 rs.CourseWorkMaterials = NewCoursesCourseWorkMaterialsService(s) 248 rs.Students = NewCoursesStudentsService(s) 249 rs.Teachers = NewCoursesTeachersService(s) 250 rs.Topics = NewCoursesTopicsService(s) 251 return rs 252} 253 254type CoursesService struct { 255 s *Service 256 257 Aliases *CoursesAliasesService 258 259 Announcements *CoursesAnnouncementsService 260 261 CourseWork *CoursesCourseWorkService 262 263 CourseWorkMaterials *CoursesCourseWorkMaterialsService 264 265 Students *CoursesStudentsService 266 267 Teachers *CoursesTeachersService 268 269 Topics *CoursesTopicsService 270} 271 272func NewCoursesAliasesService(s *Service) *CoursesAliasesService { 273 rs := &CoursesAliasesService{s: s} 274 return rs 275} 276 277type CoursesAliasesService struct { 278 s *Service 279} 280 281func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService { 282 rs := &CoursesAnnouncementsService{s: s} 283 return rs 284} 285 286type CoursesAnnouncementsService struct { 287 s *Service 288} 289 290func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService { 291 rs := &CoursesCourseWorkService{s: s} 292 rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s) 293 return rs 294} 295 296type CoursesCourseWorkService struct { 297 s *Service 298 299 StudentSubmissions *CoursesCourseWorkStudentSubmissionsService 300} 301 302func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService { 303 rs := &CoursesCourseWorkStudentSubmissionsService{s: s} 304 return rs 305} 306 307type CoursesCourseWorkStudentSubmissionsService struct { 308 s *Service 309} 310 311func NewCoursesCourseWorkMaterialsService(s *Service) *CoursesCourseWorkMaterialsService { 312 rs := &CoursesCourseWorkMaterialsService{s: s} 313 return rs 314} 315 316type CoursesCourseWorkMaterialsService struct { 317 s *Service 318} 319 320func NewCoursesStudentsService(s *Service) *CoursesStudentsService { 321 rs := &CoursesStudentsService{s: s} 322 return rs 323} 324 325type CoursesStudentsService struct { 326 s *Service 327} 328 329func NewCoursesTeachersService(s *Service) *CoursesTeachersService { 330 rs := &CoursesTeachersService{s: s} 331 return rs 332} 333 334type CoursesTeachersService struct { 335 s *Service 336} 337 338func NewCoursesTopicsService(s *Service) *CoursesTopicsService { 339 rs := &CoursesTopicsService{s: s} 340 return rs 341} 342 343type CoursesTopicsService struct { 344 s *Service 345} 346 347func NewInvitationsService(s *Service) *InvitationsService { 348 rs := &InvitationsService{s: s} 349 return rs 350} 351 352type InvitationsService struct { 353 s *Service 354} 355 356func NewRegistrationsService(s *Service) *RegistrationsService { 357 rs := &RegistrationsService{s: s} 358 return rs 359} 360 361type RegistrationsService struct { 362 s *Service 363} 364 365func NewUserProfilesService(s *Service) *UserProfilesService { 366 rs := &UserProfilesService{s: s} 367 rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s) 368 rs.Guardians = NewUserProfilesGuardiansService(s) 369 return rs 370} 371 372type UserProfilesService struct { 373 s *Service 374 375 GuardianInvitations *UserProfilesGuardianInvitationsService 376 377 Guardians *UserProfilesGuardiansService 378} 379 380func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService { 381 rs := &UserProfilesGuardianInvitationsService{s: s} 382 return rs 383} 384 385type UserProfilesGuardianInvitationsService struct { 386 s *Service 387} 388 389func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService { 390 rs := &UserProfilesGuardiansService{s: s} 391 return rs 392} 393 394type UserProfilesGuardiansService struct { 395 s *Service 396} 397 398// Announcement: Announcement created by a teacher for students of the 399// course 400type Announcement struct { 401 // AlternateLink: Absolute link to this announcement in the Classroom 402 // web UI. This is only populated if `state` is `PUBLISHED`. Read-only. 403 AlternateLink string `json:"alternateLink,omitempty"` 404 405 // AssigneeMode: Assignee mode of the announcement. If unspecified, the 406 // default value is `ALL_STUDENTS`. 407 // 408 // Possible values: 409 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 410 // returned. 411 // "ALL_STUDENTS" - All students can see the item. This is the default 412 // state. 413 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 414 AssigneeMode string `json:"assigneeMode,omitempty"` 415 416 // CourseId: Identifier of the course. Read-only. 417 CourseId string `json:"courseId,omitempty"` 418 419 // CreationTime: Timestamp when this announcement was created. 420 // Read-only. 421 CreationTime string `json:"creationTime,omitempty"` 422 423 // CreatorUserId: Identifier for the user that created the announcement. 424 // Read-only. 425 CreatorUserId string `json:"creatorUserId,omitempty"` 426 427 // Id: Classroom-assigned identifier of this announcement, unique per 428 // course. Read-only. 429 Id string `json:"id,omitempty"` 430 431 // IndividualStudentsOptions: Identifiers of students with access to the 432 // announcement. This field is set only if `assigneeMode` is 433 // `INDIVIDUAL_STUDENTS`. If the `assigneeMode` is 434 // `INDIVIDUAL_STUDENTS`, then only students specified in this field can 435 // see the announcement. 436 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 437 438 // Materials: Additional materials. Announcements must have no more than 439 // 20 material items. 440 Materials []*Material `json:"materials,omitempty"` 441 442 // ScheduledTime: Optional timestamp when this announcement is scheduled 443 // to be published. 444 ScheduledTime string `json:"scheduledTime,omitempty"` 445 446 // State: Status of this announcement. If unspecified, the default state 447 // is `DRAFT`. 448 // 449 // Possible values: 450 // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 451 // never returned. 452 // "PUBLISHED" - Status for announcement that has been published. This 453 // is the default state. 454 // "DRAFT" - Status for an announcement that is not yet published. 455 // Announcement in this state is visible only to course teachers and 456 // domain administrators. 457 // "DELETED" - Status for announcement that was published but is now 458 // deleted. Announcement in this state is visible only to course 459 // teachers and domain administrators. Announcement in this state is 460 // deleted after some time. 461 State string `json:"state,omitempty"` 462 463 // Text: Description of this announcement. The text must be a valid 464 // UTF-8 string containing no more than 30,000 characters. 465 Text string `json:"text,omitempty"` 466 467 // UpdateTime: Timestamp of the most recent change to this announcement. 468 // Read-only. 469 UpdateTime string `json:"updateTime,omitempty"` 470 471 // ServerResponse contains the HTTP response code and headers from the 472 // server. 473 googleapi.ServerResponse `json:"-"` 474 475 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 476 // unconditionally include in API requests. By default, fields with 477 // empty values are omitted from API requests. However, any non-pointer, 478 // non-interface field appearing in ForceSendFields will be sent to the 479 // server regardless of whether the field is empty or not. This may be 480 // used to include empty fields in Patch requests. 481 ForceSendFields []string `json:"-"` 482 483 // NullFields is a list of field names (e.g. "AlternateLink") to include 484 // in API requests with the JSON null value. By default, fields with 485 // empty values are omitted from API requests. However, any field with 486 // an empty value appearing in NullFields will be sent to the server as 487 // null. It is an error if a field in this list has a non-empty value. 488 // This may be used to include null fields in Patch requests. 489 NullFields []string `json:"-"` 490} 491 492func (s *Announcement) MarshalJSON() ([]byte, error) { 493 type NoMethod Announcement 494 raw := NoMethod(*s) 495 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 496} 497 498// Assignment: Additional details for assignments. 499type Assignment struct { 500 // StudentWorkFolder: Drive folder where attachments from student 501 // submissions are placed. This is only populated for course teachers 502 // and administrators. 503 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 504 505 // ForceSendFields is a list of field names (e.g. "StudentWorkFolder") 506 // to unconditionally include in API requests. By default, fields with 507 // empty values are omitted from API requests. However, any non-pointer, 508 // non-interface field appearing in ForceSendFields will be sent to the 509 // server regardless of whether the field is empty or not. This may be 510 // used to include empty fields in Patch requests. 511 ForceSendFields []string `json:"-"` 512 513 // NullFields is a list of field names (e.g. "StudentWorkFolder") to 514 // include in API requests with the JSON null value. By default, fields 515 // with empty values are omitted from API requests. However, any field 516 // with an empty value appearing in NullFields will be sent to the 517 // server as null. It is an error if a field in this list has a 518 // non-empty value. This may be used to include null fields in Patch 519 // requests. 520 NullFields []string `json:"-"` 521} 522 523func (s *Assignment) MarshalJSON() ([]byte, error) { 524 type NoMethod Assignment 525 raw := NoMethod(*s) 526 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 527} 528 529// AssignmentSubmission: Student work for an assignment. 530type AssignmentSubmission struct { 531 // Attachments: Attachments added by the student. Drive files that 532 // correspond to materials with a share mode of STUDENT_COPY may not 533 // exist yet if the student has not accessed the assignment in 534 // Classroom. Some attachment metadata is only populated if the 535 // requesting user has permission to access it. Identifier and 536 // alternate_link fields are always available, but others (for example, 537 // title) may not be. 538 Attachments []*Attachment `json:"attachments,omitempty"` 539 540 // ForceSendFields is a list of field names (e.g. "Attachments") to 541 // unconditionally include in API requests. By default, fields with 542 // empty values are omitted from API requests. However, any non-pointer, 543 // non-interface field appearing in ForceSendFields will be sent to the 544 // server regardless of whether the field is empty or not. This may be 545 // used to include empty fields in Patch requests. 546 ForceSendFields []string `json:"-"` 547 548 // NullFields is a list of field names (e.g. "Attachments") to include 549 // in API requests with the JSON null value. By default, fields with 550 // empty values are omitted from API requests. However, any field with 551 // an empty value appearing in NullFields will be sent to the server as 552 // null. It is an error if a field in this list has a non-empty value. 553 // This may be used to include null fields in Patch requests. 554 NullFields []string `json:"-"` 555} 556 557func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) { 558 type NoMethod AssignmentSubmission 559 raw := NoMethod(*s) 560 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 561} 562 563// Attachment: Attachment added to student assignment work. When 564// creating attachments, setting the `form` field is not supported. 565type Attachment struct { 566 // DriveFile: Google Drive file attachment. 567 DriveFile *DriveFile `json:"driveFile,omitempty"` 568 569 // Form: Google Forms attachment. 570 Form *Form `json:"form,omitempty"` 571 572 // Link: Link attachment. 573 Link *Link `json:"link,omitempty"` 574 575 // YouTubeVideo: Youtube video attachment. 576 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 577 578 // ForceSendFields is a list of field names (e.g. "DriveFile") to 579 // unconditionally include in API requests. By default, fields with 580 // empty values are omitted from API requests. However, any non-pointer, 581 // non-interface field appearing in ForceSendFields will be sent to the 582 // server regardless of whether the field is empty or not. This may be 583 // used to include empty fields in Patch requests. 584 ForceSendFields []string `json:"-"` 585 586 // NullFields is a list of field names (e.g. "DriveFile") to include in 587 // API requests with the JSON null value. By default, fields with empty 588 // values are omitted from API requests. However, any field with an 589 // empty value appearing in NullFields will be sent to the server as 590 // null. It is an error if a field in this list has a non-empty value. 591 // This may be used to include null fields in Patch requests. 592 NullFields []string `json:"-"` 593} 594 595func (s *Attachment) MarshalJSON() ([]byte, error) { 596 type NoMethod Attachment 597 raw := NoMethod(*s) 598 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 599} 600 601// CloudPubsubTopic: A reference to a Cloud Pub/Sub topic. To register 602// for notifications, the owner of the topic must grant 603// `classroom-notifications@system.gserviceaccount.com` the 604// `projects.topics.publish` permission. 605type CloudPubsubTopic struct { 606 // TopicName: The `name` field of a Cloud Pub/Sub Topic 607 // (https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#Topic). 608 TopicName string `json:"topicName,omitempty"` 609 610 // ForceSendFields is a list of field names (e.g. "TopicName") to 611 // unconditionally include in API requests. By default, fields with 612 // empty values are omitted from API requests. However, any non-pointer, 613 // non-interface field appearing in ForceSendFields will be sent to the 614 // server regardless of whether the field is empty or not. This may be 615 // used to include empty fields in Patch requests. 616 ForceSendFields []string `json:"-"` 617 618 // NullFields is a list of field names (e.g. "TopicName") to include in 619 // API requests with the JSON null value. By default, fields with empty 620 // values are omitted from API requests. However, any field with an 621 // empty value appearing in NullFields will be sent to the server as 622 // null. It is an error if a field in this list has a non-empty value. 623 // This may be used to include null fields in Patch requests. 624 NullFields []string `json:"-"` 625} 626 627func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) { 628 type NoMethod CloudPubsubTopic 629 raw := NoMethod(*s) 630 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 631} 632 633// Course: A Course in Classroom. 634type Course struct { 635 // AlternateLink: Absolute link to this course in the Classroom web UI. 636 // Read-only. 637 AlternateLink string `json:"alternateLink,omitempty"` 638 639 // CalendarId: The Calendar ID for a calendar that all course members 640 // can see, to which Classroom adds events for course work and 641 // announcements in the course. Read-only. 642 CalendarId string `json:"calendarId,omitempty"` 643 644 // CourseGroupEmail: The email address of a Google group containing all 645 // members of the course. This group does not accept email and can only 646 // be used for permissions. Read-only. 647 CourseGroupEmail string `json:"courseGroupEmail,omitempty"` 648 649 // CourseMaterialSets: Sets of materials that appear on the "about" page 650 // of this course. Read-only. 651 CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"` 652 653 // CourseState: State of the course. If unspecified, the default state 654 // is `PROVISIONED`. 655 // 656 // Possible values: 657 // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 658 // message will use this value. 659 // "ACTIVE" - The course is active. 660 // "ARCHIVED" - The course has been archived. You cannot modify it 661 // except to change it to a different state. 662 // "PROVISIONED" - The course has been created, but not yet activated. 663 // It is accessible by the primary teacher and domain administrators, 664 // who may modify it or change it to the `ACTIVE` or `DECLINED` states. 665 // A course may only be changed to `PROVISIONED` if it is in the 666 // `DECLINED` state. 667 // "DECLINED" - The course has been created, but declined. It is 668 // accessible by the course owner and domain administrators, though it 669 // will not be displayed in the web UI. You cannot modify the course 670 // except to change it to the `PROVISIONED` state. A course may only be 671 // changed to `DECLINED` if it is in the `PROVISIONED` state. 672 // "SUSPENDED" - The course has been suspended. You cannot modify the 673 // course, and only the user identified by the `owner_id` can view the 674 // course. A course may be placed in this state if it potentially 675 // violates the Terms of Service. 676 CourseState string `json:"courseState,omitempty"` 677 678 // CreationTime: Creation time of the course. Specifying this field in a 679 // course update mask results in an error. Read-only. 680 CreationTime string `json:"creationTime,omitempty"` 681 682 // Description: Optional description. For example, "We'll be learning 683 // about the structure of living creatures from a combination of 684 // textbooks, guest lectures, and lab work. Expect to be excited!" If 685 // set, this field must be a valid UTF-8 string and no longer than 686 // 30,000 characters. 687 Description string `json:"description,omitempty"` 688 689 // DescriptionHeading: Optional heading for the description. For 690 // example, "Welcome to 10th Grade Biology." If set, this field must be 691 // a valid UTF-8 string and no longer than 3600 characters. 692 DescriptionHeading string `json:"descriptionHeading,omitempty"` 693 694 // EnrollmentCode: Enrollment code to use when joining this course. 695 // Specifying this field in a course update mask results in an error. 696 // Read-only. 697 EnrollmentCode string `json:"enrollmentCode,omitempty"` 698 699 // GuardiansEnabled: Whether or not guardian notifications are enabled 700 // for this course. Read-only. 701 GuardiansEnabled bool `json:"guardiansEnabled,omitempty"` 702 703 // Id: Identifier for this course assigned by Classroom. When creating a 704 // course, you may optionally set this identifier to an alias string in 705 // the request to create a corresponding alias. The `id` is still 706 // assigned by Classroom and cannot be updated after the course is 707 // created. Specifying this field in a course update mask results in an 708 // error. 709 Id string `json:"id,omitempty"` 710 711 // Name: Name of the course. For example, "10th Grade Biology". The name 712 // is required. It must be between 1 and 750 characters and a valid 713 // UTF-8 string. 714 Name string `json:"name,omitempty"` 715 716 // OwnerId: The identifier of the owner of a course. When specified as a 717 // parameter of a create course request, this field is required. The 718 // identifier can be one of the following: * the numeric identifier for 719 // the user * the email address of the user * the string literal "me", 720 // indicating the requesting user This must be set in a create request. 721 // Admins can also specify this field in a patch course request to 722 // transfer ownership. In other contexts, it is read-only. 723 OwnerId string `json:"ownerId,omitempty"` 724 725 // Room: Optional room location. For example, "301". If set, this field 726 // must be a valid UTF-8 string and no longer than 650 characters. 727 Room string `json:"room,omitempty"` 728 729 // Section: Section of the course. For example, "Period 2". If set, this 730 // field must be a valid UTF-8 string and no longer than 2800 731 // characters. 732 Section string `json:"section,omitempty"` 733 734 // TeacherFolder: Information about a Drive Folder that is shared with 735 // all teachers of the course. This field will only be set for teachers 736 // of the course and domain administrators. Read-only. 737 TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"` 738 739 // TeacherGroupEmail: The email address of a Google group containing all 740 // teachers of the course. This group does not accept email and can only 741 // be used for permissions. Read-only. 742 TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"` 743 744 // UpdateTime: Time of the most recent update to this course. Specifying 745 // this field in a course update mask results in an error. Read-only. 746 UpdateTime string `json:"updateTime,omitempty"` 747 748 // ServerResponse contains the HTTP response code and headers from the 749 // server. 750 googleapi.ServerResponse `json:"-"` 751 752 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 753 // unconditionally include in API requests. By default, fields with 754 // empty values are omitted from API requests. However, any non-pointer, 755 // non-interface field appearing in ForceSendFields will be sent to the 756 // server regardless of whether the field is empty or not. This may be 757 // used to include empty fields in Patch requests. 758 ForceSendFields []string `json:"-"` 759 760 // NullFields is a list of field names (e.g. "AlternateLink") to include 761 // in API requests with the JSON null value. By default, fields with 762 // empty values are omitted from API requests. However, any field with 763 // an empty value appearing in NullFields will be sent to the server as 764 // null. It is an error if a field in this list has a non-empty value. 765 // This may be used to include null fields in Patch requests. 766 NullFields []string `json:"-"` 767} 768 769func (s *Course) MarshalJSON() ([]byte, error) { 770 type NoMethod Course 771 raw := NoMethod(*s) 772 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 773} 774 775// CourseAlias: Alternative identifier for a course. An alias uniquely 776// identifies a course. It must be unique within one of the following 777// scopes: * domain: A domain-scoped alias is visible to all users 778// within the alias creator's domain and can be created only by a domain 779// admin. A domain-scoped alias is often used when a course has an 780// identifier external to Classroom. * project: A project-scoped alias 781// is visible to any request from an application using the Developer 782// Console project ID that created the alias and can be created by any 783// project. A project-scoped alias is often used when an application has 784// alternative identifiers. A random value can also be used to avoid 785// duplicate courses in the event of transmission failures, as retrying 786// a request will return `ALREADY_EXISTS` if a previous one has 787// succeeded. 788type CourseAlias struct { 789 // Alias: Alias string. The format of the string indicates the desired 790 // alias scoping. * `d:` indicates a domain-scoped alias. Example: 791 // `d:math_101` * `p:` indicates a project-scoped alias. Example: 792 // `p:abc123` This field has a maximum length of 256 characters. 793 Alias string `json:"alias,omitempty"` 794 795 // ServerResponse contains the HTTP response code and headers from the 796 // server. 797 googleapi.ServerResponse `json:"-"` 798 799 // ForceSendFields is a list of field names (e.g. "Alias") to 800 // unconditionally include in API requests. By default, fields with 801 // empty values are omitted from API requests. However, any non-pointer, 802 // non-interface field appearing in ForceSendFields will be sent to the 803 // server regardless of whether the field is empty or not. This may be 804 // used to include empty fields in Patch requests. 805 ForceSendFields []string `json:"-"` 806 807 // NullFields is a list of field names (e.g. "Alias") to include in API 808 // requests with the JSON null value. By default, fields with empty 809 // values are omitted from API requests. However, any field with an 810 // empty value appearing in NullFields will be sent to the server as 811 // null. It is an error if a field in this list has a non-empty value. 812 // This may be used to include null fields in Patch requests. 813 NullFields []string `json:"-"` 814} 815 816func (s *CourseAlias) MarshalJSON() ([]byte, error) { 817 type NoMethod CourseAlias 818 raw := NoMethod(*s) 819 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 820} 821 822// CourseMaterial: A material attached to a course as part of a material 823// set. 824type CourseMaterial struct { 825 // DriveFile: Google Drive file attachment. 826 DriveFile *DriveFile `json:"driveFile,omitempty"` 827 828 // Form: Google Forms attachment. 829 Form *Form `json:"form,omitempty"` 830 831 // Link: Link atatchment. 832 Link *Link `json:"link,omitempty"` 833 834 // YouTubeVideo: Youtube video attachment. 835 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 836 837 // ForceSendFields is a list of field names (e.g. "DriveFile") to 838 // unconditionally include in API requests. By default, fields with 839 // empty values are omitted from API requests. However, any non-pointer, 840 // non-interface field appearing in ForceSendFields will be sent to the 841 // server regardless of whether the field is empty or not. This may be 842 // used to include empty fields in Patch requests. 843 ForceSendFields []string `json:"-"` 844 845 // NullFields is a list of field names (e.g. "DriveFile") to include in 846 // API requests with the JSON null value. By default, fields with empty 847 // values are omitted from API requests. However, any field with an 848 // empty value appearing in NullFields will be sent to the server as 849 // null. It is an error if a field in this list has a non-empty value. 850 // This may be used to include null fields in Patch requests. 851 NullFields []string `json:"-"` 852} 853 854func (s *CourseMaterial) MarshalJSON() ([]byte, error) { 855 type NoMethod CourseMaterial 856 raw := NoMethod(*s) 857 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 858} 859 860// CourseMaterialSet: A set of materials that appears on the "About" 861// page of the course. These materials might include a syllabus, 862// schedule, or other background information relating to the course as a 863// whole. 864type CourseMaterialSet struct { 865 // Materials: Materials attached to this set. 866 Materials []*CourseMaterial `json:"materials,omitempty"` 867 868 // Title: Title for this set. 869 Title string `json:"title,omitempty"` 870 871 // ForceSendFields is a list of field names (e.g. "Materials") to 872 // unconditionally include in API requests. By default, fields with 873 // empty values are omitted from API requests. However, any non-pointer, 874 // non-interface field appearing in ForceSendFields will be sent to the 875 // server regardless of whether the field is empty or not. This may be 876 // used to include empty fields in Patch requests. 877 ForceSendFields []string `json:"-"` 878 879 // NullFields is a list of field names (e.g. "Materials") to include in 880 // API requests with the JSON null value. By default, fields with empty 881 // values are omitted from API requests. However, any field with an 882 // empty value appearing in NullFields will be sent to the server as 883 // null. It is an error if a field in this list has a non-empty value. 884 // This may be used to include null fields in Patch requests. 885 NullFields []string `json:"-"` 886} 887 888func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) { 889 type NoMethod CourseMaterialSet 890 raw := NoMethod(*s) 891 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 892} 893 894// CourseRosterChangesInfo: Information about a `Feed` with a 895// `feed_type` of `COURSE_ROSTER_CHANGES`. 896type CourseRosterChangesInfo struct { 897 // CourseId: The `course_id` of the course to subscribe to roster 898 // changes for. 899 CourseId string `json:"courseId,omitempty"` 900 901 // ForceSendFields is a list of field names (e.g. "CourseId") to 902 // unconditionally include in API requests. By default, fields with 903 // empty values are omitted from API requests. However, any non-pointer, 904 // non-interface field appearing in ForceSendFields will be sent to the 905 // server regardless of whether the field is empty or not. This may be 906 // used to include empty fields in Patch requests. 907 ForceSendFields []string `json:"-"` 908 909 // NullFields is a list of field names (e.g. "CourseId") to include in 910 // API requests with the JSON null value. By default, fields with empty 911 // values are omitted from API requests. However, any field with an 912 // empty value appearing in NullFields will be sent to the server as 913 // null. It is an error if a field in this list has a non-empty value. 914 // This may be used to include null fields in Patch requests. 915 NullFields []string `json:"-"` 916} 917 918func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) { 919 type NoMethod CourseRosterChangesInfo 920 raw := NoMethod(*s) 921 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 922} 923 924// CourseWork: Course work created by a teacher for students of the 925// course. 926type CourseWork struct { 927 // AlternateLink: Absolute link to this course work in the Classroom web 928 // UI. This is only populated if `state` is `PUBLISHED`. Read-only. 929 AlternateLink string `json:"alternateLink,omitempty"` 930 931 // AssigneeMode: Assignee mode of the coursework. If unspecified, the 932 // default value is `ALL_STUDENTS`. 933 // 934 // Possible values: 935 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 936 // returned. 937 // "ALL_STUDENTS" - All students can see the item. This is the default 938 // state. 939 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 940 AssigneeMode string `json:"assigneeMode,omitempty"` 941 942 // Assignment: Assignment details. This is populated only when 943 // `work_type` is `ASSIGNMENT`. Read-only. 944 Assignment *Assignment `json:"assignment,omitempty"` 945 946 // AssociatedWithDeveloper: Whether this course work item is associated 947 // with the Developer Console project making the request. See 948 // CreateCourseWork for more details. Read-only. 949 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 950 951 // CourseId: Identifier of the course. Read-only. 952 CourseId string `json:"courseId,omitempty"` 953 954 // CreationTime: Timestamp when this course work was created. Read-only. 955 CreationTime string `json:"creationTime,omitempty"` 956 957 // CreatorUserId: Identifier for the user that created the coursework. 958 // Read-only. 959 CreatorUserId string `json:"creatorUserId,omitempty"` 960 961 // Description: Optional description of this course work. If set, the 962 // description must be a valid UTF-8 string containing no more than 963 // 30,000 characters. 964 Description string `json:"description,omitempty"` 965 966 // DueDate: Optional date, in UTC, that submissions for this course work 967 // are due. This must be specified if `due_time` is specified. 968 DueDate *Date `json:"dueDate,omitempty"` 969 970 // DueTime: Optional time of day, in UTC, that submissions for this 971 // course work are due. This must be specified if `due_date` is 972 // specified. 973 DueTime *TimeOfDay `json:"dueTime,omitempty"` 974 975 // Id: Classroom-assigned identifier of this course work, unique per 976 // course. Read-only. 977 Id string `json:"id,omitempty"` 978 979 // IndividualStudentsOptions: Identifiers of students with access to the 980 // coursework. This field is set only if `assigneeMode` is 981 // `INDIVIDUAL_STUDENTS`. If the `assigneeMode` is 982 // `INDIVIDUAL_STUDENTS`, then only students specified in this field are 983 // assigned the coursework. 984 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 985 986 // Materials: Additional materials. CourseWork must have no more than 20 987 // material items. 988 Materials []*Material `json:"materials,omitempty"` 989 990 // MaxPoints: Maximum grade for this course work. If zero or 991 // unspecified, this assignment is considered ungraded. This must be a 992 // non-negative integer value. 993 MaxPoints float64 `json:"maxPoints,omitempty"` 994 995 // MultipleChoiceQuestion: Multiple choice question details. For read 996 // operations, this field is populated only when `work_type` is 997 // `MULTIPLE_CHOICE_QUESTION`. For write operations, this field must be 998 // specified when creating course work with a `work_type` of 999 // `MULTIPLE_CHOICE_QUESTION`, and it must not be set otherwise. 1000 MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"` 1001 1002 // ScheduledTime: Optional timestamp when this course work is scheduled 1003 // to be published. 1004 ScheduledTime string `json:"scheduledTime,omitempty"` 1005 1006 // State: Status of this course work. If unspecified, the default state 1007 // is `DRAFT`. 1008 // 1009 // Possible values: 1010 // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 1011 // returned. 1012 // "PUBLISHED" - Status for work that has been published. This is the 1013 // default state. 1014 // "DRAFT" - Status for work that is not yet published. Work in this 1015 // state is visible only to course teachers and domain administrators. 1016 // "DELETED" - Status for work that was published but is now deleted. 1017 // Work in this state is visible only to course teachers and domain 1018 // administrators. Work in this state is deleted after some time. 1019 State string `json:"state,omitempty"` 1020 1021 // SubmissionModificationMode: Setting to determine when students are 1022 // allowed to modify submissions. If unspecified, the default value is 1023 // `MODIFIABLE_UNTIL_TURNED_IN`. 1024 // 1025 // Possible values: 1026 // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode 1027 // specified. This is never returned. 1028 // "MODIFIABLE_UNTIL_TURNED_IN" - Submissions can be modified before 1029 // being turned in. 1030 // "MODIFIABLE" - Submissions can be modified at any time. 1031 SubmissionModificationMode string `json:"submissionModificationMode,omitempty"` 1032 1033 // Title: Title of this course work. The title must be a valid UTF-8 1034 // string containing between 1 and 3000 characters. 1035 Title string `json:"title,omitempty"` 1036 1037 // TopicId: Identifier for the topic that this coursework is associated 1038 // with. Must match an existing topic in the course. 1039 TopicId string `json:"topicId,omitempty"` 1040 1041 // UpdateTime: Timestamp of the most recent change to this course work. 1042 // Read-only. 1043 UpdateTime string `json:"updateTime,omitempty"` 1044 1045 // WorkType: Type of this course work. The type is set when the course 1046 // work is created and cannot be changed. 1047 // 1048 // Possible values: 1049 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 1050 // never returned. 1051 // "ASSIGNMENT" - An assignment. 1052 // "SHORT_ANSWER_QUESTION" - A short answer question. 1053 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 1054 WorkType string `json:"workType,omitempty"` 1055 1056 // ServerResponse contains the HTTP response code and headers from the 1057 // server. 1058 googleapi.ServerResponse `json:"-"` 1059 1060 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1061 // unconditionally include in API requests. By default, fields with 1062 // empty values are omitted from API requests. However, any non-pointer, 1063 // non-interface field appearing in ForceSendFields will be sent to the 1064 // server regardless of whether the field is empty or not. This may be 1065 // used to include empty fields in Patch requests. 1066 ForceSendFields []string `json:"-"` 1067 1068 // NullFields is a list of field names (e.g. "AlternateLink") to include 1069 // in API requests with the JSON null value. By default, fields with 1070 // empty values are omitted from API requests. However, any field with 1071 // an empty value appearing in NullFields will be sent to the server as 1072 // null. It is an error if a field in this list has a non-empty value. 1073 // This may be used to include null fields in Patch requests. 1074 NullFields []string `json:"-"` 1075} 1076 1077func (s *CourseWork) MarshalJSON() ([]byte, error) { 1078 type NoMethod CourseWork 1079 raw := NoMethod(*s) 1080 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1081} 1082 1083func (s *CourseWork) UnmarshalJSON(data []byte) error { 1084 type NoMethod CourseWork 1085 var s1 struct { 1086 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1087 *NoMethod 1088 } 1089 s1.NoMethod = (*NoMethod)(s) 1090 if err := json.Unmarshal(data, &s1); err != nil { 1091 return err 1092 } 1093 s.MaxPoints = float64(s1.MaxPoints) 1094 return nil 1095} 1096 1097// CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1098// of `COURSE_WORK_CHANGES`. 1099type CourseWorkChangesInfo struct { 1100 // CourseId: The `course_id` of the course to subscribe to work changes 1101 // for. 1102 CourseId string `json:"courseId,omitempty"` 1103 1104 // ForceSendFields is a list of field names (e.g. "CourseId") to 1105 // unconditionally include in API requests. By default, fields with 1106 // empty values are omitted from API requests. However, any non-pointer, 1107 // non-interface field appearing in ForceSendFields will be sent to the 1108 // server regardless of whether the field is empty or not. This may be 1109 // used to include empty fields in Patch requests. 1110 ForceSendFields []string `json:"-"` 1111 1112 // NullFields is a list of field names (e.g. "CourseId") to include in 1113 // API requests with the JSON null value. By default, fields with empty 1114 // values are omitted from API requests. However, any field with an 1115 // empty value appearing in NullFields will be sent to the server as 1116 // null. It is an error if a field in this list has a non-empty value. 1117 // This may be used to include null fields in Patch requests. 1118 NullFields []string `json:"-"` 1119} 1120 1121func (s *CourseWorkChangesInfo) MarshalJSON() ([]byte, error) { 1122 type NoMethod CourseWorkChangesInfo 1123 raw := NoMethod(*s) 1124 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1125} 1126 1127// CourseWorkMaterial: Course work material created by a teacher for 1128// students of the course 1129type CourseWorkMaterial struct { 1130 // AlternateLink: Absolute link to this course work material in the 1131 // Classroom web UI. This is only populated if `state` is `PUBLISHED`. 1132 // Read-only. 1133 AlternateLink string `json:"alternateLink,omitempty"` 1134 1135 // AssigneeMode: Assignee mode of the course work material. If 1136 // unspecified, the default value is `ALL_STUDENTS`. 1137 // 1138 // Possible values: 1139 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 1140 // returned. 1141 // "ALL_STUDENTS" - All students can see the item. This is the default 1142 // state. 1143 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 1144 AssigneeMode string `json:"assigneeMode,omitempty"` 1145 1146 // CourseId: Identifier of the course. Read-only. 1147 CourseId string `json:"courseId,omitempty"` 1148 1149 // CreationTime: Timestamp when this course work material was created. 1150 // Read-only. 1151 CreationTime string `json:"creationTime,omitempty"` 1152 1153 // CreatorUserId: Identifier for the user that created the course work 1154 // material. Read-only. 1155 CreatorUserId string `json:"creatorUserId,omitempty"` 1156 1157 // Description: Optional description of this course work material. The 1158 // text must be a valid UTF-8 string containing no more than 30,000 1159 // characters. 1160 Description string `json:"description,omitempty"` 1161 1162 // Id: Classroom-assigned identifier of this course work material, 1163 // unique per course. Read-only. 1164 Id string `json:"id,omitempty"` 1165 1166 // IndividualStudentsOptions: Identifiers of students with access to the 1167 // course work material. This field is set only if `assigneeMode` is 1168 // `INDIVIDUAL_STUDENTS`. If the `assigneeMode` is 1169 // `INDIVIDUAL_STUDENTS`, then only students specified in this field can 1170 // see the course work material. 1171 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 1172 1173 // Materials: Additional materials. A course work material must have no 1174 // more than 20 material items. 1175 Materials []*Material `json:"materials,omitempty"` 1176 1177 // ScheduledTime: Optional timestamp when this course work material is 1178 // scheduled to be published. 1179 ScheduledTime string `json:"scheduledTime,omitempty"` 1180 1181 // State: Status of this course work material. If unspecified, the 1182 // default state is `DRAFT`. 1183 // 1184 // Possible values: 1185 // "COURSEWORK_MATERIAL_STATE_UNSPECIFIED" - No state specified. This 1186 // is never returned. 1187 // "PUBLISHED" - Status for course work material that has been 1188 // published. This is the default state. 1189 // "DRAFT" - Status for an course work material that is not yet 1190 // published. Course work material in this state is visible only to 1191 // course teachers and domain administrators. 1192 // "DELETED" - Status for course work material that was published but 1193 // is now deleted. Course work material in this state is visible only to 1194 // course teachers and domain administrators. Course work material in 1195 // this state is deleted after some time. 1196 State string `json:"state,omitempty"` 1197 1198 // Title: Title of this course work material. The title must be a valid 1199 // UTF-8 string containing between 1 and 3000 characters. 1200 Title string `json:"title,omitempty"` 1201 1202 // TopicId: Identifier for the topic that this course work material is 1203 // associated with. Must match an existing topic in the course. 1204 TopicId string `json:"topicId,omitempty"` 1205 1206 // UpdateTime: Timestamp of the most recent change to this course work 1207 // material. Read-only. 1208 UpdateTime string `json:"updateTime,omitempty"` 1209 1210 // ServerResponse contains the HTTP response code and headers from the 1211 // server. 1212 googleapi.ServerResponse `json:"-"` 1213 1214 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1215 // unconditionally include in API requests. By default, fields with 1216 // empty values are omitted from API requests. However, any non-pointer, 1217 // non-interface field appearing in ForceSendFields will be sent to the 1218 // server regardless of whether the field is empty or not. This may be 1219 // used to include empty fields in Patch requests. 1220 ForceSendFields []string `json:"-"` 1221 1222 // NullFields is a list of field names (e.g. "AlternateLink") to include 1223 // in API requests with the JSON null value. By default, fields with 1224 // empty values are omitted from API requests. However, any field with 1225 // an empty value appearing in NullFields will be sent to the server as 1226 // null. It is an error if a field in this list has a non-empty value. 1227 // This may be used to include null fields in Patch requests. 1228 NullFields []string `json:"-"` 1229} 1230 1231func (s *CourseWorkMaterial) MarshalJSON() ([]byte, error) { 1232 type NoMethod CourseWorkMaterial 1233 raw := NoMethod(*s) 1234 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1235} 1236 1237// Date: Represents a whole or partial calendar date, such as a 1238// birthday. The time of day and time zone are either specified 1239// elsewhere or are insignificant. The date is relative to the Gregorian 1240// Calendar. This can represent one of the following: * A full date, 1241// with non-zero year, month, and day values * A month and day value, 1242// with a zero year, such as an anniversary * A year on its own, with 1243// zero month and day values * A year and month value, with a zero day, 1244// such as a credit card expiration date Related types are 1245// google.type.TimeOfDay and `google.protobuf.Timestamp`. 1246type Date struct { 1247 // Day: Day of a month. Must be from 1 to 31 and valid for the year and 1248 // month, or 0 to specify a year by itself or a year and month where the 1249 // day isn't significant. 1250 Day int64 `json:"day,omitempty"` 1251 1252 // Month: Month of a year. Must be from 1 to 12, or 0 to specify a year 1253 // without a month and day. 1254 Month int64 `json:"month,omitempty"` 1255 1256 // Year: Year of the date. Must be from 1 to 9999, or 0 to specify a 1257 // date without a year. 1258 Year int64 `json:"year,omitempty"` 1259 1260 // ForceSendFields is a list of field names (e.g. "Day") to 1261 // unconditionally include in API requests. By default, fields with 1262 // empty values are omitted from API requests. However, any non-pointer, 1263 // non-interface field appearing in ForceSendFields will be sent to the 1264 // server regardless of whether the field is empty or not. This may be 1265 // used to include empty fields in Patch requests. 1266 ForceSendFields []string `json:"-"` 1267 1268 // NullFields is a list of field names (e.g. "Day") to include in API 1269 // requests with the JSON null value. By default, fields with empty 1270 // values are omitted from API requests. However, any field with an 1271 // empty value appearing in NullFields will be sent to the server as 1272 // null. It is an error if a field in this list has a non-empty value. 1273 // This may be used to include null fields in Patch requests. 1274 NullFields []string `json:"-"` 1275} 1276 1277func (s *Date) MarshalJSON() ([]byte, error) { 1278 type NoMethod Date 1279 raw := NoMethod(*s) 1280 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1281} 1282 1283// DriveFile: Representation of a Google Drive file. 1284type DriveFile struct { 1285 // AlternateLink: URL that can be used to access the Drive item. 1286 // Read-only. 1287 AlternateLink string `json:"alternateLink,omitempty"` 1288 1289 // Id: Drive API resource ID. 1290 Id string `json:"id,omitempty"` 1291 1292 // ThumbnailUrl: URL of a thumbnail image of the Drive item. Read-only. 1293 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1294 1295 // Title: Title of the Drive item. Read-only. 1296 Title string `json:"title,omitempty"` 1297 1298 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1299 // unconditionally include in API requests. By default, fields with 1300 // empty values are omitted from API requests. However, any non-pointer, 1301 // non-interface field appearing in ForceSendFields will be sent to the 1302 // server regardless of whether the field is empty or not. This may be 1303 // used to include empty fields in Patch requests. 1304 ForceSendFields []string `json:"-"` 1305 1306 // NullFields is a list of field names (e.g. "AlternateLink") to include 1307 // in API requests with the JSON null value. By default, fields with 1308 // empty values are omitted from API requests. However, any field with 1309 // an empty value appearing in NullFields will be sent to the server as 1310 // null. It is an error if a field in this list has a non-empty value. 1311 // This may be used to include null fields in Patch requests. 1312 NullFields []string `json:"-"` 1313} 1314 1315func (s *DriveFile) MarshalJSON() ([]byte, error) { 1316 type NoMethod DriveFile 1317 raw := NoMethod(*s) 1318 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1319} 1320 1321// DriveFolder: Representation of a Google Drive folder. 1322type DriveFolder struct { 1323 // AlternateLink: URL that can be used to access the Drive folder. 1324 // Read-only. 1325 AlternateLink string `json:"alternateLink,omitempty"` 1326 1327 // Id: Drive API resource ID. 1328 Id string `json:"id,omitempty"` 1329 1330 // Title: Title of the Drive folder. Read-only. 1331 Title string `json:"title,omitempty"` 1332 1333 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1334 // unconditionally include in API requests. By default, fields with 1335 // empty values are omitted from API requests. However, any non-pointer, 1336 // non-interface field appearing in ForceSendFields will be sent to the 1337 // server regardless of whether the field is empty or not. This may be 1338 // used to include empty fields in Patch requests. 1339 ForceSendFields []string `json:"-"` 1340 1341 // NullFields is a list of field names (e.g. "AlternateLink") to include 1342 // in API requests with the JSON null value. By default, fields with 1343 // empty values are omitted from API requests. However, any field with 1344 // an empty value appearing in NullFields will be sent to the server as 1345 // null. It is an error if a field in this list has a non-empty value. 1346 // This may be used to include null fields in Patch requests. 1347 NullFields []string `json:"-"` 1348} 1349 1350func (s *DriveFolder) MarshalJSON() ([]byte, error) { 1351 type NoMethod DriveFolder 1352 raw := NoMethod(*s) 1353 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1354} 1355 1356// Empty: A generic empty message that you can re-use to avoid defining 1357// duplicated empty messages in your APIs. A typical example is to use 1358// it as the request or the response type of an API method. For 1359// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 1360// (google.protobuf.Empty); } The JSON representation for `Empty` is 1361// empty JSON object `{}`. 1362type Empty struct { 1363 // ServerResponse contains the HTTP response code and headers from the 1364 // server. 1365 googleapi.ServerResponse `json:"-"` 1366} 1367 1368// Feed: A class of notifications that an application can register to 1369// receive. For example: "all roster changes for a domain". 1370type Feed struct { 1371 // CourseRosterChangesInfo: Information about a `Feed` with a 1372 // `feed_type` of `COURSE_ROSTER_CHANGES`. This field must be specified 1373 // if `feed_type` is `COURSE_ROSTER_CHANGES`. 1374 CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"` 1375 1376 // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1377 // of `COURSE_WORK_CHANGES`. This field must be specified if `feed_type` 1378 // is `COURSE_WORK_CHANGES`. 1379 CourseWorkChangesInfo *CourseWorkChangesInfo `json:"courseWorkChangesInfo,omitempty"` 1380 1381 // FeedType: The type of feed. 1382 // 1383 // Possible values: 1384 // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided. 1385 // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular 1386 // domain. Notifications will be generated whenever a user joins or 1387 // leaves a course. No notifications will be generated when an 1388 // invitation is created or deleted, but notifications will be generated 1389 // when a user joins a course by accepting an invitation. 1390 // "COURSE_ROSTER_CHANGES" - All roster changes for a particular 1391 // course. Notifications will be generated whenever a user joins or 1392 // leaves a course. No notifications will be generated when an 1393 // invitation is created or deleted, but notifications will be generated 1394 // when a user joins a course by accepting an invitation. 1395 // "COURSE_WORK_CHANGES" - All course work activity for a particular 1396 // course. Notifications will be generated when a CourseWork or 1397 // StudentSubmission object is created or modified. No notification will 1398 // be generated when a StudentSubmission object is created in connection 1399 // with the creation or modification of its parent CourseWork object 1400 // (but a notification will be generated for that CourseWork object's 1401 // creation or modification). 1402 FeedType string `json:"feedType,omitempty"` 1403 1404 // ForceSendFields is a list of field names (e.g. 1405 // "CourseRosterChangesInfo") to unconditionally include in API 1406 // requests. By default, fields with empty values are omitted from API 1407 // requests. However, any non-pointer, non-interface field appearing in 1408 // ForceSendFields will be sent to the server regardless of whether the 1409 // field is empty or not. This may be used to include empty fields in 1410 // Patch requests. 1411 ForceSendFields []string `json:"-"` 1412 1413 // NullFields is a list of field names (e.g. "CourseRosterChangesInfo") 1414 // to include in API requests with the JSON null value. By default, 1415 // fields with empty values are omitted from API requests. However, any 1416 // field with an empty value appearing in NullFields will be sent to the 1417 // server as null. It is an error if a field in this list has a 1418 // non-empty value. This may be used to include null fields in Patch 1419 // requests. 1420 NullFields []string `json:"-"` 1421} 1422 1423func (s *Feed) MarshalJSON() ([]byte, error) { 1424 type NoMethod Feed 1425 raw := NoMethod(*s) 1426 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1427} 1428 1429// Form: Google Forms item. 1430type Form struct { 1431 // FormUrl: URL of the form. 1432 FormUrl string `json:"formUrl,omitempty"` 1433 1434 // ResponseUrl: URL of the form responses document. Only set if 1435 // respsonses have been recorded and only when the requesting user is an 1436 // editor of the form. Read-only. 1437 ResponseUrl string `json:"responseUrl,omitempty"` 1438 1439 // ThumbnailUrl: URL of a thumbnail image of the Form. Read-only. 1440 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1441 1442 // Title: Title of the Form. Read-only. 1443 Title string `json:"title,omitempty"` 1444 1445 // ForceSendFields is a list of field names (e.g. "FormUrl") to 1446 // unconditionally include in API requests. By default, fields with 1447 // empty values are omitted from API requests. However, any non-pointer, 1448 // non-interface field appearing in ForceSendFields will be sent to the 1449 // server regardless of whether the field is empty or not. This may be 1450 // used to include empty fields in Patch requests. 1451 ForceSendFields []string `json:"-"` 1452 1453 // NullFields is a list of field names (e.g. "FormUrl") to include in 1454 // API requests with the JSON null value. By default, fields with empty 1455 // values are omitted from API requests. However, any field with an 1456 // empty value appearing in NullFields will be sent to the server as 1457 // null. It is an error if a field in this list has a non-empty value. 1458 // This may be used to include null fields in Patch requests. 1459 NullFields []string `json:"-"` 1460} 1461 1462func (s *Form) MarshalJSON() ([]byte, error) { 1463 type NoMethod Form 1464 raw := NoMethod(*s) 1465 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1466} 1467 1468// GlobalPermission: Global user permission description. 1469type GlobalPermission struct { 1470 // Permission: Permission value. 1471 // 1472 // Possible values: 1473 // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not 1474 // returned and is not a valid value. 1475 // "CREATE_COURSE" - User is permitted to create a course. 1476 Permission string `json:"permission,omitempty"` 1477 1478 // ForceSendFields is a list of field names (e.g. "Permission") to 1479 // unconditionally include in API requests. By default, fields with 1480 // empty values are omitted from API requests. However, any non-pointer, 1481 // non-interface field appearing in ForceSendFields will be sent to the 1482 // server regardless of whether the field is empty or not. This may be 1483 // used to include empty fields in Patch requests. 1484 ForceSendFields []string `json:"-"` 1485 1486 // NullFields is a list of field names (e.g. "Permission") to include in 1487 // API requests with the JSON null value. By default, fields with empty 1488 // values are omitted from API requests. However, any field with an 1489 // empty value appearing in NullFields will be sent to the server as 1490 // null. It is an error if a field in this list has a non-empty value. 1491 // This may be used to include null fields in Patch requests. 1492 NullFields []string `json:"-"` 1493} 1494 1495func (s *GlobalPermission) MarshalJSON() ([]byte, error) { 1496 type NoMethod GlobalPermission 1497 raw := NoMethod(*s) 1498 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1499} 1500 1501// GradeHistory: The history of each grade on this submission. 1502type GradeHistory struct { 1503 // ActorUserId: The teacher who made the grade change. 1504 ActorUserId string `json:"actorUserId,omitempty"` 1505 1506 // GradeChangeType: The type of grade change at this time in the 1507 // submission grade history. 1508 // 1509 // Possible values: 1510 // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This 1511 // should never be returned. 1512 // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of 1513 // the draft grade. 1514 // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator 1515 // of the assigned grade. 1516 // "MAX_POINTS_CHANGE" - A change in the denominator of the grade. 1517 GradeChangeType string `json:"gradeChangeType,omitempty"` 1518 1519 // GradeTimestamp: When the grade of the submission was changed. 1520 GradeTimestamp string `json:"gradeTimestamp,omitempty"` 1521 1522 // MaxPoints: The denominator of the grade at this time in the 1523 // submission grade history. 1524 MaxPoints float64 `json:"maxPoints,omitempty"` 1525 1526 // PointsEarned: The numerator of the grade at this time in the 1527 // submission grade history. 1528 PointsEarned float64 `json:"pointsEarned,omitempty"` 1529 1530 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 1531 // unconditionally include in API requests. By default, fields with 1532 // empty values are omitted from API requests. However, any non-pointer, 1533 // non-interface field appearing in ForceSendFields will be sent to the 1534 // server regardless of whether the field is empty or not. This may be 1535 // used to include empty fields in Patch requests. 1536 ForceSendFields []string `json:"-"` 1537 1538 // NullFields is a list of field names (e.g. "ActorUserId") to include 1539 // in API requests with the JSON null value. By default, fields with 1540 // empty values are omitted from API requests. However, any field with 1541 // an empty value appearing in NullFields will be sent to the server as 1542 // null. It is an error if a field in this list has a non-empty value. 1543 // This may be used to include null fields in Patch requests. 1544 NullFields []string `json:"-"` 1545} 1546 1547func (s *GradeHistory) MarshalJSON() ([]byte, error) { 1548 type NoMethod GradeHistory 1549 raw := NoMethod(*s) 1550 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1551} 1552 1553func (s *GradeHistory) UnmarshalJSON(data []byte) error { 1554 type NoMethod GradeHistory 1555 var s1 struct { 1556 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1557 PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"` 1558 *NoMethod 1559 } 1560 s1.NoMethod = (*NoMethod)(s) 1561 if err := json.Unmarshal(data, &s1); err != nil { 1562 return err 1563 } 1564 s.MaxPoints = float64(s1.MaxPoints) 1565 s.PointsEarned = float64(s1.PointsEarned) 1566 return nil 1567} 1568 1569// Guardian: Association between a student and a guardian of that 1570// student. The guardian may receive information about the student's 1571// course work. 1572type Guardian struct { 1573 // GuardianId: Identifier for the guardian. 1574 GuardianId string `json:"guardianId,omitempty"` 1575 1576 // GuardianProfile: User profile for the guardian. 1577 GuardianProfile *UserProfile `json:"guardianProfile,omitempty"` 1578 1579 // InvitedEmailAddress: The email address to which the initial guardian 1580 // invitation was sent. This field is only visible to domain 1581 // administrators. 1582 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1583 1584 // StudentId: Identifier for the student to whom the guardian 1585 // relationship applies. 1586 StudentId string `json:"studentId,omitempty"` 1587 1588 // ServerResponse contains the HTTP response code and headers from the 1589 // server. 1590 googleapi.ServerResponse `json:"-"` 1591 1592 // ForceSendFields is a list of field names (e.g. "GuardianId") to 1593 // unconditionally include in API requests. By default, fields with 1594 // empty values are omitted from API requests. However, any non-pointer, 1595 // non-interface field appearing in ForceSendFields will be sent to the 1596 // server regardless of whether the field is empty or not. This may be 1597 // used to include empty fields in Patch requests. 1598 ForceSendFields []string `json:"-"` 1599 1600 // NullFields is a list of field names (e.g. "GuardianId") to include in 1601 // API requests with the JSON null value. By default, fields with empty 1602 // values are omitted from API requests. However, any field with an 1603 // empty value appearing in NullFields will be sent to the server as 1604 // null. It is an error if a field in this list has a non-empty value. 1605 // This may be used to include null fields in Patch requests. 1606 NullFields []string `json:"-"` 1607} 1608 1609func (s *Guardian) MarshalJSON() ([]byte, error) { 1610 type NoMethod Guardian 1611 raw := NoMethod(*s) 1612 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1613} 1614 1615// GuardianInvitation: An invitation to become the guardian of a 1616// specified user, sent to a specified email address. 1617type GuardianInvitation struct { 1618 // CreationTime: The time that this invitation was created. Read-only. 1619 CreationTime string `json:"creationTime,omitempty"` 1620 1621 // InvitationId: Unique identifier for this invitation. Read-only. 1622 InvitationId string `json:"invitationId,omitempty"` 1623 1624 // InvitedEmailAddress: Email address that the invitation was sent to. 1625 // This field is only visible to domain administrators. 1626 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1627 1628 // State: The state that this invitation is in. 1629 // 1630 // Possible values: 1631 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 1632 // "PENDING" - The invitation is active and awaiting a response. 1633 // "COMPLETE" - The invitation is no longer active. It may have been 1634 // accepted, declined, withdrawn or it may have expired. 1635 State string `json:"state,omitempty"` 1636 1637 // StudentId: ID of the student (in standard format) 1638 StudentId string `json:"studentId,omitempty"` 1639 1640 // ServerResponse contains the HTTP response code and headers from the 1641 // server. 1642 googleapi.ServerResponse `json:"-"` 1643 1644 // ForceSendFields is a list of field names (e.g. "CreationTime") to 1645 // unconditionally include in API requests. By default, fields with 1646 // empty values are omitted from API requests. However, any non-pointer, 1647 // non-interface field appearing in ForceSendFields will be sent to the 1648 // server regardless of whether the field is empty or not. This may be 1649 // used to include empty fields in Patch requests. 1650 ForceSendFields []string `json:"-"` 1651 1652 // NullFields is a list of field names (e.g. "CreationTime") to include 1653 // in API requests with the JSON null value. By default, fields with 1654 // empty values are omitted from API requests. However, any field with 1655 // an empty value appearing in NullFields will be sent to the server as 1656 // null. It is an error if a field in this list has a non-empty value. 1657 // This may be used to include null fields in Patch requests. 1658 NullFields []string `json:"-"` 1659} 1660 1661func (s *GuardianInvitation) MarshalJSON() ([]byte, error) { 1662 type NoMethod GuardianInvitation 1663 raw := NoMethod(*s) 1664 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1665} 1666 1667// IndividualStudentsOptions: Assignee details about a 1668// coursework/announcement. This field is set if and only if 1669// `assigneeMode` is `INDIVIDUAL_STUDENTS`. 1670type IndividualStudentsOptions struct { 1671 // StudentIds: Identifiers for the students that have access to the 1672 // coursework/announcement. 1673 StudentIds []string `json:"studentIds,omitempty"` 1674 1675 // ForceSendFields is a list of field names (e.g. "StudentIds") to 1676 // unconditionally include in API requests. By default, fields with 1677 // empty values are omitted from API requests. However, any non-pointer, 1678 // non-interface field appearing in ForceSendFields will be sent to the 1679 // server regardless of whether the field is empty or not. This may be 1680 // used to include empty fields in Patch requests. 1681 ForceSendFields []string `json:"-"` 1682 1683 // NullFields is a list of field names (e.g. "StudentIds") to include in 1684 // API requests with the JSON null value. By default, fields with empty 1685 // values are omitted from API requests. However, any field with an 1686 // empty value appearing in NullFields will be sent to the server as 1687 // null. It is an error if a field in this list has a non-empty value. 1688 // This may be used to include null fields in Patch requests. 1689 NullFields []string `json:"-"` 1690} 1691 1692func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) { 1693 type NoMethod IndividualStudentsOptions 1694 raw := NoMethod(*s) 1695 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1696} 1697 1698// Invitation: An invitation to join a course. 1699type Invitation struct { 1700 // CourseId: Identifier of the course to invite the user to. 1701 CourseId string `json:"courseId,omitempty"` 1702 1703 // Id: Identifier assigned by Classroom. Read-only. 1704 Id string `json:"id,omitempty"` 1705 1706 // Role: Role to invite the user to have. Must not be 1707 // `COURSE_ROLE_UNSPECIFIED`. 1708 // 1709 // Possible values: 1710 // "COURSE_ROLE_UNSPECIFIED" - No course role. 1711 // "STUDENT" - Student in the course. 1712 // "TEACHER" - Teacher of the course. 1713 // "OWNER" - Owner of the course. 1714 Role string `json:"role,omitempty"` 1715 1716 // UserId: Identifier of the invited user. When specified as a parameter 1717 // of a request, this identifier can be set to one of the following: * 1718 // the numeric identifier for the user * the email address of the user * 1719 // the string literal "me", indicating the requesting user 1720 UserId string `json:"userId,omitempty"` 1721 1722 // ServerResponse contains the HTTP response code and headers from the 1723 // server. 1724 googleapi.ServerResponse `json:"-"` 1725 1726 // ForceSendFields is a list of field names (e.g. "CourseId") to 1727 // unconditionally include in API requests. By default, fields with 1728 // empty values are omitted from API requests. However, any non-pointer, 1729 // non-interface field appearing in ForceSendFields will be sent to the 1730 // server regardless of whether the field is empty or not. This may be 1731 // used to include empty fields in Patch requests. 1732 ForceSendFields []string `json:"-"` 1733 1734 // NullFields is a list of field names (e.g. "CourseId") to include in 1735 // API requests with the JSON null value. By default, fields with empty 1736 // values are omitted from API requests. However, any field with an 1737 // empty value appearing in NullFields will be sent to the server as 1738 // null. It is an error if a field in this list has a non-empty value. 1739 // This may be used to include null fields in Patch requests. 1740 NullFields []string `json:"-"` 1741} 1742 1743func (s *Invitation) MarshalJSON() ([]byte, error) { 1744 type NoMethod Invitation 1745 raw := NoMethod(*s) 1746 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1747} 1748 1749// Link: URL item. 1750type Link struct { 1751 // ThumbnailUrl: URL of a thumbnail image of the target URL. Read-only. 1752 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1753 1754 // Title: Title of the target of the URL. Read-only. 1755 Title string `json:"title,omitempty"` 1756 1757 // Url: URL to link to. This must be a valid UTF-8 string containing 1758 // between 1 and 2024 characters. 1759 Url string `json:"url,omitempty"` 1760 1761 // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to 1762 // unconditionally include in API requests. By default, fields with 1763 // empty values are omitted from API requests. However, any non-pointer, 1764 // non-interface field appearing in ForceSendFields will be sent to the 1765 // server regardless of whether the field is empty or not. This may be 1766 // used to include empty fields in Patch requests. 1767 ForceSendFields []string `json:"-"` 1768 1769 // NullFields is a list of field names (e.g. "ThumbnailUrl") to include 1770 // in API requests with the JSON null value. By default, fields with 1771 // empty values are omitted from API requests. However, any field with 1772 // an empty value appearing in NullFields will be sent to the server as 1773 // null. It is an error if a field in this list has a non-empty value. 1774 // This may be used to include null fields in Patch requests. 1775 NullFields []string `json:"-"` 1776} 1777 1778func (s *Link) MarshalJSON() ([]byte, error) { 1779 type NoMethod Link 1780 raw := NoMethod(*s) 1781 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1782} 1783 1784// ListAnnouncementsResponse: Response when listing course work. 1785type ListAnnouncementsResponse struct { 1786 // Announcements: Announcement items that match the request. 1787 Announcements []*Announcement `json:"announcements,omitempty"` 1788 1789 // NextPageToken: Token identifying the next page of results to return. 1790 // If empty, no further results are available. 1791 NextPageToken string `json:"nextPageToken,omitempty"` 1792 1793 // ServerResponse contains the HTTP response code and headers from the 1794 // server. 1795 googleapi.ServerResponse `json:"-"` 1796 1797 // ForceSendFields is a list of field names (e.g. "Announcements") to 1798 // unconditionally include in API requests. By default, fields with 1799 // empty values are omitted from API requests. However, any non-pointer, 1800 // non-interface field appearing in ForceSendFields will be sent to the 1801 // server regardless of whether the field is empty or not. This may be 1802 // used to include empty fields in Patch requests. 1803 ForceSendFields []string `json:"-"` 1804 1805 // NullFields is a list of field names (e.g. "Announcements") to include 1806 // in API requests with the JSON null value. By default, fields with 1807 // empty values are omitted from API requests. However, any field with 1808 // an empty value appearing in NullFields will be sent to the server as 1809 // null. It is an error if a field in this list has a non-empty value. 1810 // This may be used to include null fields in Patch requests. 1811 NullFields []string `json:"-"` 1812} 1813 1814func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) { 1815 type NoMethod ListAnnouncementsResponse 1816 raw := NoMethod(*s) 1817 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1818} 1819 1820// ListCourseAliasesResponse: Response when listing course aliases. 1821type ListCourseAliasesResponse struct { 1822 // Aliases: The course aliases. 1823 Aliases []*CourseAlias `json:"aliases,omitempty"` 1824 1825 // NextPageToken: Token identifying the next page of results to return. 1826 // If empty, no further results are available. 1827 NextPageToken string `json:"nextPageToken,omitempty"` 1828 1829 // ServerResponse contains the HTTP response code and headers from the 1830 // server. 1831 googleapi.ServerResponse `json:"-"` 1832 1833 // ForceSendFields is a list of field names (e.g. "Aliases") to 1834 // unconditionally include in API requests. By default, fields with 1835 // empty values are omitted from API requests. However, any non-pointer, 1836 // non-interface field appearing in ForceSendFields will be sent to the 1837 // server regardless of whether the field is empty or not. This may be 1838 // used to include empty fields in Patch requests. 1839 ForceSendFields []string `json:"-"` 1840 1841 // NullFields is a list of field names (e.g. "Aliases") to include in 1842 // API requests with the JSON null value. By default, fields with empty 1843 // values are omitted from API requests. However, any field with an 1844 // empty value appearing in NullFields will be sent to the server as 1845 // null. It is an error if a field in this list has a non-empty value. 1846 // This may be used to include null fields in Patch requests. 1847 NullFields []string `json:"-"` 1848} 1849 1850func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) { 1851 type NoMethod ListCourseAliasesResponse 1852 raw := NoMethod(*s) 1853 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1854} 1855 1856// ListCourseWorkMaterialResponse: Response when listing course work 1857// material. 1858type ListCourseWorkMaterialResponse struct { 1859 // CourseWorkMaterial: Course work material items that match the 1860 // request. 1861 CourseWorkMaterial []*CourseWorkMaterial `json:"courseWorkMaterial,omitempty"` 1862 1863 // NextPageToken: Token identifying the next page of results to return. 1864 // If empty, no further results are available. 1865 NextPageToken string `json:"nextPageToken,omitempty"` 1866 1867 // ServerResponse contains the HTTP response code and headers from the 1868 // server. 1869 googleapi.ServerResponse `json:"-"` 1870 1871 // ForceSendFields is a list of field names (e.g. "CourseWorkMaterial") 1872 // to unconditionally include in API requests. By default, fields with 1873 // empty values are omitted from API requests. However, any non-pointer, 1874 // non-interface field appearing in ForceSendFields will be sent to the 1875 // server regardless of whether the field is empty or not. This may be 1876 // used to include empty fields in Patch requests. 1877 ForceSendFields []string `json:"-"` 1878 1879 // NullFields is a list of field names (e.g. "CourseWorkMaterial") to 1880 // include in API requests with the JSON null value. By default, fields 1881 // with empty values are omitted from API requests. However, any field 1882 // with an empty value appearing in NullFields will be sent to the 1883 // server as null. It is an error if a field in this list has a 1884 // non-empty value. This may be used to include null fields in Patch 1885 // requests. 1886 NullFields []string `json:"-"` 1887} 1888 1889func (s *ListCourseWorkMaterialResponse) MarshalJSON() ([]byte, error) { 1890 type NoMethod ListCourseWorkMaterialResponse 1891 raw := NoMethod(*s) 1892 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1893} 1894 1895// ListCourseWorkResponse: Response when listing course work. 1896type ListCourseWorkResponse struct { 1897 // CourseWork: Course work items that match the request. 1898 CourseWork []*CourseWork `json:"courseWork,omitempty"` 1899 1900 // NextPageToken: Token identifying the next page of results to return. 1901 // If empty, no further results are available. 1902 NextPageToken string `json:"nextPageToken,omitempty"` 1903 1904 // ServerResponse contains the HTTP response code and headers from the 1905 // server. 1906 googleapi.ServerResponse `json:"-"` 1907 1908 // ForceSendFields is a list of field names (e.g. "CourseWork") to 1909 // unconditionally include in API requests. By default, fields with 1910 // empty values are omitted from API requests. However, any non-pointer, 1911 // non-interface field appearing in ForceSendFields will be sent to the 1912 // server regardless of whether the field is empty or not. This may be 1913 // used to include empty fields in Patch requests. 1914 ForceSendFields []string `json:"-"` 1915 1916 // NullFields is a list of field names (e.g. "CourseWork") to include in 1917 // API requests with the JSON null value. By default, fields with empty 1918 // values are omitted from API requests. However, any field with an 1919 // empty value appearing in NullFields will be sent to the server as 1920 // null. It is an error if a field in this list has a non-empty value. 1921 // This may be used to include null fields in Patch requests. 1922 NullFields []string `json:"-"` 1923} 1924 1925func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) { 1926 type NoMethod ListCourseWorkResponse 1927 raw := NoMethod(*s) 1928 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1929} 1930 1931// ListCoursesResponse: Response when listing courses. 1932type ListCoursesResponse struct { 1933 // Courses: Courses that match the list request. 1934 Courses []*Course `json:"courses,omitempty"` 1935 1936 // NextPageToken: Token identifying the next page of results to return. 1937 // If empty, no further results are available. 1938 NextPageToken string `json:"nextPageToken,omitempty"` 1939 1940 // ServerResponse contains the HTTP response code and headers from the 1941 // server. 1942 googleapi.ServerResponse `json:"-"` 1943 1944 // ForceSendFields is a list of field names (e.g. "Courses") to 1945 // unconditionally include in API requests. By default, fields with 1946 // empty values are omitted from API requests. However, any non-pointer, 1947 // non-interface field appearing in ForceSendFields will be sent to the 1948 // server regardless of whether the field is empty or not. This may be 1949 // used to include empty fields in Patch requests. 1950 ForceSendFields []string `json:"-"` 1951 1952 // NullFields is a list of field names (e.g. "Courses") to include in 1953 // API requests with the JSON null value. By default, fields with empty 1954 // values are omitted from API requests. However, any field with an 1955 // empty value appearing in NullFields will be sent to the server as 1956 // null. It is an error if a field in this list has a non-empty value. 1957 // This may be used to include null fields in Patch requests. 1958 NullFields []string `json:"-"` 1959} 1960 1961func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) { 1962 type NoMethod ListCoursesResponse 1963 raw := NoMethod(*s) 1964 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1965} 1966 1967// ListGuardianInvitationsResponse: Response when listing guardian 1968// invitations. 1969type ListGuardianInvitationsResponse struct { 1970 // GuardianInvitations: Guardian invitations that matched the list 1971 // request. 1972 GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"` 1973 1974 // NextPageToken: Token identifying the next page of results to return. 1975 // If empty, no further results are available. 1976 NextPageToken string `json:"nextPageToken,omitempty"` 1977 1978 // ServerResponse contains the HTTP response code and headers from the 1979 // server. 1980 googleapi.ServerResponse `json:"-"` 1981 1982 // ForceSendFields is a list of field names (e.g. "GuardianInvitations") 1983 // to unconditionally include in API requests. By default, fields with 1984 // empty values are omitted from API requests. However, any non-pointer, 1985 // non-interface field appearing in ForceSendFields will be sent to the 1986 // server regardless of whether the field is empty or not. This may be 1987 // used to include empty fields in Patch requests. 1988 ForceSendFields []string `json:"-"` 1989 1990 // NullFields is a list of field names (e.g. "GuardianInvitations") to 1991 // include in API requests with the JSON null value. By default, fields 1992 // with empty values are omitted from API requests. However, any field 1993 // with an empty value appearing in NullFields will be sent to the 1994 // server as null. It is an error if a field in this list has a 1995 // non-empty value. This may be used to include null fields in Patch 1996 // requests. 1997 NullFields []string `json:"-"` 1998} 1999 2000func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) { 2001 type NoMethod ListGuardianInvitationsResponse 2002 raw := NoMethod(*s) 2003 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2004} 2005 2006// ListGuardiansResponse: Response when listing guardians. 2007type ListGuardiansResponse struct { 2008 // Guardians: Guardians on this page of results that met the criteria 2009 // specified in the request. 2010 Guardians []*Guardian `json:"guardians,omitempty"` 2011 2012 // NextPageToken: Token identifying the next page of results to return. 2013 // If empty, no further results are available. 2014 NextPageToken string `json:"nextPageToken,omitempty"` 2015 2016 // ServerResponse contains the HTTP response code and headers from the 2017 // server. 2018 googleapi.ServerResponse `json:"-"` 2019 2020 // ForceSendFields is a list of field names (e.g. "Guardians") to 2021 // unconditionally include in API requests. By default, fields with 2022 // empty values are omitted from API requests. However, any non-pointer, 2023 // non-interface field appearing in ForceSendFields will be sent to the 2024 // server regardless of whether the field is empty or not. This may be 2025 // used to include empty fields in Patch requests. 2026 ForceSendFields []string `json:"-"` 2027 2028 // NullFields is a list of field names (e.g. "Guardians") to include in 2029 // API requests with the JSON null value. By default, fields with empty 2030 // values are omitted from API requests. However, any field with an 2031 // empty value appearing in NullFields will be sent to the server as 2032 // null. It is an error if a field in this list has a non-empty value. 2033 // This may be used to include null fields in Patch requests. 2034 NullFields []string `json:"-"` 2035} 2036 2037func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) { 2038 type NoMethod ListGuardiansResponse 2039 raw := NoMethod(*s) 2040 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2041} 2042 2043// ListInvitationsResponse: Response when listing invitations. 2044type ListInvitationsResponse struct { 2045 // Invitations: Invitations that match the list request. 2046 Invitations []*Invitation `json:"invitations,omitempty"` 2047 2048 // NextPageToken: Token identifying the next page of results to return. 2049 // If empty, no further results are available. 2050 NextPageToken string `json:"nextPageToken,omitempty"` 2051 2052 // ServerResponse contains the HTTP response code and headers from the 2053 // server. 2054 googleapi.ServerResponse `json:"-"` 2055 2056 // ForceSendFields is a list of field names (e.g. "Invitations") to 2057 // unconditionally include in API requests. By default, fields with 2058 // empty values are omitted from API requests. However, any non-pointer, 2059 // non-interface field appearing in ForceSendFields will be sent to the 2060 // server regardless of whether the field is empty or not. This may be 2061 // used to include empty fields in Patch requests. 2062 ForceSendFields []string `json:"-"` 2063 2064 // NullFields is a list of field names (e.g. "Invitations") to include 2065 // in API requests with the JSON null value. By default, fields with 2066 // empty values are omitted from API requests. However, any field with 2067 // an empty value appearing in NullFields will be sent to the server as 2068 // null. It is an error if a field in this list has a non-empty value. 2069 // This may be used to include null fields in Patch requests. 2070 NullFields []string `json:"-"` 2071} 2072 2073func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) { 2074 type NoMethod ListInvitationsResponse 2075 raw := NoMethod(*s) 2076 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2077} 2078 2079// ListStudentSubmissionsResponse: Response when listing student 2080// submissions. 2081type ListStudentSubmissionsResponse struct { 2082 // NextPageToken: Token identifying the next page of results to return. 2083 // If empty, no further results are available. 2084 NextPageToken string `json:"nextPageToken,omitempty"` 2085 2086 // StudentSubmissions: Student work that matches the request. 2087 StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"` 2088 2089 // ServerResponse contains the HTTP response code and headers from the 2090 // server. 2091 googleapi.ServerResponse `json:"-"` 2092 2093 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2094 // unconditionally include in API requests. By default, fields with 2095 // empty values are omitted from API requests. However, any non-pointer, 2096 // non-interface field appearing in ForceSendFields will be sent to the 2097 // server regardless of whether the field is empty or not. This may be 2098 // used to include empty fields in Patch requests. 2099 ForceSendFields []string `json:"-"` 2100 2101 // NullFields is a list of field names (e.g. "NextPageToken") to include 2102 // in API requests with the JSON null value. By default, fields with 2103 // empty values are omitted from API requests. However, any field with 2104 // an empty value appearing in NullFields will be sent to the server as 2105 // null. It is an error if a field in this list has a non-empty value. 2106 // This may be used to include null fields in Patch requests. 2107 NullFields []string `json:"-"` 2108} 2109 2110func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) { 2111 type NoMethod ListStudentSubmissionsResponse 2112 raw := NoMethod(*s) 2113 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2114} 2115 2116// ListStudentsResponse: Response when listing students. 2117type ListStudentsResponse struct { 2118 // NextPageToken: Token identifying the next page of results to return. 2119 // If empty, no further results are available. 2120 NextPageToken string `json:"nextPageToken,omitempty"` 2121 2122 // Students: Students who match the list request. 2123 Students []*Student `json:"students,omitempty"` 2124 2125 // ServerResponse contains the HTTP response code and headers from the 2126 // server. 2127 googleapi.ServerResponse `json:"-"` 2128 2129 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2130 // unconditionally include in API requests. By default, fields with 2131 // empty values are omitted from API requests. However, any non-pointer, 2132 // non-interface field appearing in ForceSendFields will be sent to the 2133 // server regardless of whether the field is empty or not. This may be 2134 // used to include empty fields in Patch requests. 2135 ForceSendFields []string `json:"-"` 2136 2137 // NullFields is a list of field names (e.g. "NextPageToken") to include 2138 // in API requests with the JSON null value. By default, fields with 2139 // empty values are omitted from API requests. However, any field with 2140 // an empty value appearing in NullFields will be sent to the server as 2141 // null. It is an error if a field in this list has a non-empty value. 2142 // This may be used to include null fields in Patch requests. 2143 NullFields []string `json:"-"` 2144} 2145 2146func (s *ListStudentsResponse) MarshalJSON() ([]byte, error) { 2147 type NoMethod ListStudentsResponse 2148 raw := NoMethod(*s) 2149 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2150} 2151 2152// ListTeachersResponse: Response when listing teachers. 2153type ListTeachersResponse struct { 2154 // NextPageToken: Token identifying the next page of results to return. 2155 // If empty, no further results are available. 2156 NextPageToken string `json:"nextPageToken,omitempty"` 2157 2158 // Teachers: Teachers who match the list request. 2159 Teachers []*Teacher `json:"teachers,omitempty"` 2160 2161 // ServerResponse contains the HTTP response code and headers from the 2162 // server. 2163 googleapi.ServerResponse `json:"-"` 2164 2165 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2166 // unconditionally include in API requests. By default, fields with 2167 // empty values are omitted from API requests. However, any non-pointer, 2168 // non-interface field appearing in ForceSendFields will be sent to the 2169 // server regardless of whether the field is empty or not. This may be 2170 // used to include empty fields in Patch requests. 2171 ForceSendFields []string `json:"-"` 2172 2173 // NullFields is a list of field names (e.g. "NextPageToken") to include 2174 // in API requests with the JSON null value. By default, fields with 2175 // empty values are omitted from API requests. However, any field with 2176 // an empty value appearing in NullFields will be sent to the server as 2177 // null. It is an error if a field in this list has a non-empty value. 2178 // This may be used to include null fields in Patch requests. 2179 NullFields []string `json:"-"` 2180} 2181 2182func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) { 2183 type NoMethod ListTeachersResponse 2184 raw := NoMethod(*s) 2185 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2186} 2187 2188// ListTopicResponse: Response when listing topics. 2189type ListTopicResponse struct { 2190 // NextPageToken: Token identifying the next page of results to return. 2191 // If empty, no further results are available. 2192 NextPageToken string `json:"nextPageToken,omitempty"` 2193 2194 // Topic: Topic items that match the request. 2195 Topic []*Topic `json:"topic,omitempty"` 2196 2197 // ServerResponse contains the HTTP response code and headers from the 2198 // server. 2199 googleapi.ServerResponse `json:"-"` 2200 2201 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2202 // unconditionally include in API requests. By default, fields with 2203 // empty values are omitted from API requests. However, any non-pointer, 2204 // non-interface field appearing in ForceSendFields will be sent to the 2205 // server regardless of whether the field is empty or not. This may be 2206 // used to include empty fields in Patch requests. 2207 ForceSendFields []string `json:"-"` 2208 2209 // NullFields is a list of field names (e.g. "NextPageToken") to include 2210 // in API requests with the JSON null value. By default, fields with 2211 // empty values are omitted from API requests. However, any field with 2212 // an empty value appearing in NullFields will be sent to the server as 2213 // null. It is an error if a field in this list has a non-empty value. 2214 // This may be used to include null fields in Patch requests. 2215 NullFields []string `json:"-"` 2216} 2217 2218func (s *ListTopicResponse) MarshalJSON() ([]byte, error) { 2219 type NoMethod ListTopicResponse 2220 raw := NoMethod(*s) 2221 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2222} 2223 2224// Material: Material attached to course work. When creating 2225// attachments, setting the `form` field is not supported. 2226type Material struct { 2227 // DriveFile: Google Drive file material. 2228 DriveFile *SharedDriveFile `json:"driveFile,omitempty"` 2229 2230 // Form: Google Forms material. 2231 Form *Form `json:"form,omitempty"` 2232 2233 // Link: Link material. On creation, this is upgraded to a more 2234 // appropriate type if possible, and this is reflected in the response. 2235 Link *Link `json:"link,omitempty"` 2236 2237 // YoutubeVideo: YouTube video material. 2238 YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"` 2239 2240 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2241 // unconditionally include in API requests. By default, fields with 2242 // empty values are omitted from API requests. However, any non-pointer, 2243 // non-interface field appearing in ForceSendFields will be sent to the 2244 // server regardless of whether the field is empty or not. This may be 2245 // used to include empty fields in Patch requests. 2246 ForceSendFields []string `json:"-"` 2247 2248 // NullFields is a list of field names (e.g. "DriveFile") to include in 2249 // API requests with the JSON null value. By default, fields with empty 2250 // values are omitted from API requests. However, any field with an 2251 // empty value appearing in NullFields will be sent to the server as 2252 // null. It is an error if a field in this list has a non-empty value. 2253 // This may be used to include null fields in Patch requests. 2254 NullFields []string `json:"-"` 2255} 2256 2257func (s *Material) MarshalJSON() ([]byte, error) { 2258 type NoMethod Material 2259 raw := NoMethod(*s) 2260 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2261} 2262 2263// ModifyAnnouncementAssigneesRequest: Request to modify assignee mode 2264// and options of an announcement. 2265type ModifyAnnouncementAssigneesRequest struct { 2266 // AssigneeMode: Mode of the announcement describing whether it is 2267 // accessible by all students or specified individual students. 2268 // 2269 // Possible values: 2270 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2271 // returned. 2272 // "ALL_STUDENTS" - All students can see the item. This is the default 2273 // state. 2274 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2275 AssigneeMode string `json:"assigneeMode,omitempty"` 2276 2277 // ModifyIndividualStudentsOptions: Set which students can view or 2278 // cannot view the announcement. Must be specified only when 2279 // `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2280 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2281 2282 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2283 // unconditionally include in API requests. By default, fields with 2284 // empty values are omitted from API requests. However, any non-pointer, 2285 // non-interface field appearing in ForceSendFields will be sent to the 2286 // server regardless of whether the field is empty or not. This may be 2287 // used to include empty fields in Patch requests. 2288 ForceSendFields []string `json:"-"` 2289 2290 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2291 // in API requests with the JSON null value. By default, fields with 2292 // empty values are omitted from API requests. However, any field with 2293 // an empty value appearing in NullFields will be sent to the server as 2294 // null. It is an error if a field in this list has a non-empty value. 2295 // This may be used to include null fields in Patch requests. 2296 NullFields []string `json:"-"` 2297} 2298 2299func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) { 2300 type NoMethod ModifyAnnouncementAssigneesRequest 2301 raw := NoMethod(*s) 2302 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2303} 2304 2305// ModifyAttachmentsRequest: Request to modify the attachments of a 2306// student submission. 2307type ModifyAttachmentsRequest struct { 2308 // AddAttachments: Attachments to add. A student submission may not have 2309 // more than 20 attachments. Form attachments are not supported. 2310 AddAttachments []*Attachment `json:"addAttachments,omitempty"` 2311 2312 // ForceSendFields is a list of field names (e.g. "AddAttachments") to 2313 // unconditionally include in API requests. By default, fields with 2314 // empty values are omitted from API requests. However, any non-pointer, 2315 // non-interface field appearing in ForceSendFields will be sent to the 2316 // server regardless of whether the field is empty or not. This may be 2317 // used to include empty fields in Patch requests. 2318 ForceSendFields []string `json:"-"` 2319 2320 // NullFields is a list of field names (e.g. "AddAttachments") to 2321 // include in API requests with the JSON null value. By default, fields 2322 // with empty values are omitted from API requests. However, any field 2323 // with an empty value appearing in NullFields will be sent to the 2324 // server as null. It is an error if a field in this list has a 2325 // non-empty value. This may be used to include null fields in Patch 2326 // requests. 2327 NullFields []string `json:"-"` 2328} 2329 2330func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) { 2331 type NoMethod ModifyAttachmentsRequest 2332 raw := NoMethod(*s) 2333 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2334} 2335 2336// ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and 2337// options of a coursework. 2338type ModifyCourseWorkAssigneesRequest struct { 2339 // AssigneeMode: Mode of the coursework describing whether it will be 2340 // assigned to all students or specified individual students. 2341 // 2342 // Possible values: 2343 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2344 // returned. 2345 // "ALL_STUDENTS" - All students can see the item. This is the default 2346 // state. 2347 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2348 AssigneeMode string `json:"assigneeMode,omitempty"` 2349 2350 // ModifyIndividualStudentsOptions: Set which students are assigned or 2351 // not assigned to the coursework. Must be specified only when 2352 // `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2353 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2354 2355 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2356 // unconditionally include in API requests. By default, fields with 2357 // empty values are omitted from API requests. However, any non-pointer, 2358 // non-interface field appearing in ForceSendFields will be sent to the 2359 // server regardless of whether the field is empty or not. This may be 2360 // used to include empty fields in Patch requests. 2361 ForceSendFields []string `json:"-"` 2362 2363 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2364 // in API requests with the JSON null value. By default, fields with 2365 // empty values are omitted from API requests. However, any field with 2366 // an empty value appearing in NullFields will be sent to the server as 2367 // null. It is an error if a field in this list has a non-empty value. 2368 // This may be used to include null fields in Patch requests. 2369 NullFields []string `json:"-"` 2370} 2371 2372func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) { 2373 type NoMethod ModifyCourseWorkAssigneesRequest 2374 raw := NoMethod(*s) 2375 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2376} 2377 2378// ModifyIndividualStudentsOptions: Contains fields to add or remove 2379// students from a course work or announcement where the `assigneeMode` 2380// is set to `INDIVIDUAL_STUDENTS`. 2381type ModifyIndividualStudentsOptions struct { 2382 // AddStudentIds: IDs of students to be added as having access to this 2383 // coursework/announcement. 2384 AddStudentIds []string `json:"addStudentIds,omitempty"` 2385 2386 // RemoveStudentIds: IDs of students to be removed from having access to 2387 // this coursework/announcement. 2388 RemoveStudentIds []string `json:"removeStudentIds,omitempty"` 2389 2390 // ForceSendFields is a list of field names (e.g. "AddStudentIds") to 2391 // unconditionally include in API requests. By default, fields with 2392 // empty values are omitted from API requests. However, any non-pointer, 2393 // non-interface field appearing in ForceSendFields will be sent to the 2394 // server regardless of whether the field is empty or not. This may be 2395 // used to include empty fields in Patch requests. 2396 ForceSendFields []string `json:"-"` 2397 2398 // NullFields is a list of field names (e.g. "AddStudentIds") to include 2399 // in API requests with the JSON null value. By default, fields with 2400 // empty values are omitted from API requests. However, any field with 2401 // an empty value appearing in NullFields will be sent to the server as 2402 // null. It is an error if a field in this list has a non-empty value. 2403 // This may be used to include null fields in Patch requests. 2404 NullFields []string `json:"-"` 2405} 2406 2407func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) { 2408 type NoMethod ModifyIndividualStudentsOptions 2409 raw := NoMethod(*s) 2410 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2411} 2412 2413// MultipleChoiceQuestion: Additional details for multiple-choice 2414// questions. 2415type MultipleChoiceQuestion struct { 2416 // Choices: Possible choices. 2417 Choices []string `json:"choices,omitempty"` 2418 2419 // ForceSendFields is a list of field names (e.g. "Choices") to 2420 // unconditionally include in API requests. By default, fields with 2421 // empty values are omitted from API requests. However, any non-pointer, 2422 // non-interface field appearing in ForceSendFields will be sent to the 2423 // server regardless of whether the field is empty or not. This may be 2424 // used to include empty fields in Patch requests. 2425 ForceSendFields []string `json:"-"` 2426 2427 // NullFields is a list of field names (e.g. "Choices") to include in 2428 // API requests with the JSON null value. By default, fields with empty 2429 // values are omitted from API requests. However, any field with an 2430 // empty value appearing in NullFields will be sent to the server as 2431 // null. It is an error if a field in this list has a non-empty value. 2432 // This may be used to include null fields in Patch requests. 2433 NullFields []string `json:"-"` 2434} 2435 2436func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) { 2437 type NoMethod MultipleChoiceQuestion 2438 raw := NoMethod(*s) 2439 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2440} 2441 2442// MultipleChoiceSubmission: Student work for a multiple-choice 2443// question. 2444type MultipleChoiceSubmission struct { 2445 // Answer: Student's select choice. 2446 Answer string `json:"answer,omitempty"` 2447 2448 // ForceSendFields is a list of field names (e.g. "Answer") to 2449 // unconditionally include in API requests. By default, fields with 2450 // empty values are omitted from API requests. However, any non-pointer, 2451 // non-interface field appearing in ForceSendFields will be sent to the 2452 // server regardless of whether the field is empty or not. This may be 2453 // used to include empty fields in Patch requests. 2454 ForceSendFields []string `json:"-"` 2455 2456 // NullFields is a list of field names (e.g. "Answer") to include in API 2457 // requests with the JSON null value. By default, fields with empty 2458 // values are omitted from API requests. However, any field with an 2459 // empty value appearing in NullFields will be sent to the server as 2460 // null. It is an error if a field in this list has a non-empty value. 2461 // This may be used to include null fields in Patch requests. 2462 NullFields []string `json:"-"` 2463} 2464 2465func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) { 2466 type NoMethod MultipleChoiceSubmission 2467 raw := NoMethod(*s) 2468 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2469} 2470 2471// Name: Details of the user's name. 2472type Name struct { 2473 // FamilyName: The user's last name. Read-only. 2474 FamilyName string `json:"familyName,omitempty"` 2475 2476 // FullName: The user's full name formed by concatenating the first and 2477 // last name values. Read-only. 2478 FullName string `json:"fullName,omitempty"` 2479 2480 // GivenName: The user's first name. Read-only. 2481 GivenName string `json:"givenName,omitempty"` 2482 2483 // ForceSendFields is a list of field names (e.g. "FamilyName") to 2484 // unconditionally include in API requests. By default, fields with 2485 // empty values are omitted from API requests. However, any non-pointer, 2486 // non-interface field appearing in ForceSendFields will be sent to the 2487 // server regardless of whether the field is empty or not. This may be 2488 // used to include empty fields in Patch requests. 2489 ForceSendFields []string `json:"-"` 2490 2491 // NullFields is a list of field names (e.g. "FamilyName") to include in 2492 // API requests with the JSON null value. By default, fields with empty 2493 // values are omitted from API requests. However, any field with an 2494 // empty value appearing in NullFields will be sent to the server as 2495 // null. It is an error if a field in this list has a non-empty value. 2496 // This may be used to include null fields in Patch requests. 2497 NullFields []string `json:"-"` 2498} 2499 2500func (s *Name) MarshalJSON() ([]byte, error) { 2501 type NoMethod Name 2502 raw := NoMethod(*s) 2503 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2504} 2505 2506// ReclaimStudentSubmissionRequest: Request to reclaim a student 2507// submission. 2508type ReclaimStudentSubmissionRequest struct { 2509} 2510 2511// Registration: An instruction to Classroom to send notifications from 2512// the `feed` to the provided destination. 2513type Registration struct { 2514 // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to 2515 // be sent to. 2516 CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"` 2517 2518 // ExpiryTime: The time until which the `Registration` is effective. 2519 // This is a read-only field assigned by the server. 2520 ExpiryTime string `json:"expiryTime,omitempty"` 2521 2522 // Feed: Specification for the class of notifications that Classroom 2523 // should deliver to the destination. 2524 Feed *Feed `json:"feed,omitempty"` 2525 2526 // RegistrationId: A server-generated unique identifier for this 2527 // `Registration`. Read-only. 2528 RegistrationId string `json:"registrationId,omitempty"` 2529 2530 // ServerResponse contains the HTTP response code and headers from the 2531 // server. 2532 googleapi.ServerResponse `json:"-"` 2533 2534 // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to 2535 // unconditionally include in API requests. By default, fields with 2536 // empty values are omitted from API requests. However, any non-pointer, 2537 // non-interface field appearing in ForceSendFields will be sent to the 2538 // server regardless of whether the field is empty or not. This may be 2539 // used to include empty fields in Patch requests. 2540 ForceSendFields []string `json:"-"` 2541 2542 // NullFields is a list of field names (e.g. "CloudPubsubTopic") to 2543 // include in API requests with the JSON null value. By default, fields 2544 // with empty values are omitted from API requests. However, any field 2545 // with an empty value appearing in NullFields will be sent to the 2546 // server as null. It is an error if a field in this list has a 2547 // non-empty value. This may be used to include null fields in Patch 2548 // requests. 2549 NullFields []string `json:"-"` 2550} 2551 2552func (s *Registration) MarshalJSON() ([]byte, error) { 2553 type NoMethod Registration 2554 raw := NoMethod(*s) 2555 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2556} 2557 2558// ReturnStudentSubmissionRequest: Request to return a student 2559// submission. 2560type ReturnStudentSubmissionRequest struct { 2561} 2562 2563// SharedDriveFile: Drive file that is used as material for course work. 2564type SharedDriveFile struct { 2565 // DriveFile: Drive file details. 2566 DriveFile *DriveFile `json:"driveFile,omitempty"` 2567 2568 // ShareMode: Mechanism by which students access the Drive item. 2569 // 2570 // Possible values: 2571 // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never 2572 // be returned. 2573 // "VIEW" - Students can view the shared file. 2574 // "EDIT" - Students can edit the shared file. 2575 // "STUDENT_COPY" - Students have a personal copy of the shared file. 2576 ShareMode string `json:"shareMode,omitempty"` 2577 2578 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2579 // unconditionally include in API requests. By default, fields with 2580 // empty values are omitted from API requests. However, any non-pointer, 2581 // non-interface field appearing in ForceSendFields will be sent to the 2582 // server regardless of whether the field is empty or not. This may be 2583 // used to include empty fields in Patch requests. 2584 ForceSendFields []string `json:"-"` 2585 2586 // NullFields is a list of field names (e.g. "DriveFile") to include in 2587 // API requests with the JSON null value. By default, fields with empty 2588 // values are omitted from API requests. However, any field with an 2589 // empty value appearing in NullFields will be sent to the server as 2590 // null. It is an error if a field in this list has a non-empty value. 2591 // This may be used to include null fields in Patch requests. 2592 NullFields []string `json:"-"` 2593} 2594 2595func (s *SharedDriveFile) MarshalJSON() ([]byte, error) { 2596 type NoMethod SharedDriveFile 2597 raw := NoMethod(*s) 2598 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2599} 2600 2601// ShortAnswerSubmission: Student work for a short answer question. 2602type ShortAnswerSubmission struct { 2603 // Answer: Student response to a short-answer question. 2604 Answer string `json:"answer,omitempty"` 2605 2606 // ForceSendFields is a list of field names (e.g. "Answer") to 2607 // unconditionally include in API requests. By default, fields with 2608 // empty values are omitted from API requests. However, any non-pointer, 2609 // non-interface field appearing in ForceSendFields will be sent to the 2610 // server regardless of whether the field is empty or not. This may be 2611 // used to include empty fields in Patch requests. 2612 ForceSendFields []string `json:"-"` 2613 2614 // NullFields is a list of field names (e.g. "Answer") to include in API 2615 // requests with the JSON null value. By default, fields with empty 2616 // values are omitted from API requests. However, any field with an 2617 // empty value appearing in NullFields will be sent to the server as 2618 // null. It is an error if a field in this list has a non-empty value. 2619 // This may be used to include null fields in Patch requests. 2620 NullFields []string `json:"-"` 2621} 2622 2623func (s *ShortAnswerSubmission) MarshalJSON() ([]byte, error) { 2624 type NoMethod ShortAnswerSubmission 2625 raw := NoMethod(*s) 2626 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2627} 2628 2629// StateHistory: The history of each state this submission has been in. 2630type StateHistory struct { 2631 // ActorUserId: The teacher or student who made the change. 2632 ActorUserId string `json:"actorUserId,omitempty"` 2633 2634 // State: The workflow pipeline stage. 2635 // 2636 // Possible values: 2637 // "STATE_UNSPECIFIED" - No state specified. This should never be 2638 // returned. 2639 // "CREATED" - The Submission has been created. 2640 // "TURNED_IN" - The student has turned in an assigned document, which 2641 // may or may not be a template. 2642 // "RETURNED" - The teacher has returned the assigned document to the 2643 // student. 2644 // "RECLAIMED_BY_STUDENT" - The student turned in the assigned 2645 // document, and then chose to "unsubmit" the assignment, giving the 2646 // student control again as the owner. 2647 // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their 2648 // submission after turning it in. Currently, only used by Questions, 2649 // when the student edits their answer. 2650 State string `json:"state,omitempty"` 2651 2652 // StateTimestamp: When the submission entered this state. 2653 StateTimestamp string `json:"stateTimestamp,omitempty"` 2654 2655 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 2656 // unconditionally include in API requests. By default, fields with 2657 // empty values are omitted from API requests. However, any non-pointer, 2658 // non-interface field appearing in ForceSendFields will be sent to the 2659 // server regardless of whether the field is empty or not. This may be 2660 // used to include empty fields in Patch requests. 2661 ForceSendFields []string `json:"-"` 2662 2663 // NullFields is a list of field names (e.g. "ActorUserId") to include 2664 // in API requests with the JSON null value. By default, fields with 2665 // empty values are omitted from API requests. However, any field with 2666 // an empty value appearing in NullFields will be sent to the server as 2667 // null. It is an error if a field in this list has a non-empty value. 2668 // This may be used to include null fields in Patch requests. 2669 NullFields []string `json:"-"` 2670} 2671 2672func (s *StateHistory) MarshalJSON() ([]byte, error) { 2673 type NoMethod StateHistory 2674 raw := NoMethod(*s) 2675 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2676} 2677 2678// Student: Student in a course. 2679type Student struct { 2680 // CourseId: Identifier of the course. Read-only. 2681 CourseId string `json:"courseId,omitempty"` 2682 2683 // Profile: Global user information for the student. Read-only. 2684 Profile *UserProfile `json:"profile,omitempty"` 2685 2686 // StudentWorkFolder: Information about a Drive Folder for this 2687 // student's work in this course. Only visible to the student and domain 2688 // administrators. Read-only. 2689 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 2690 2691 // UserId: Identifier of the user. When specified as a parameter of a 2692 // request, this identifier can be one of the following: * the numeric 2693 // identifier for the user * the email address of the user * the string 2694 // literal "me", indicating the requesting user 2695 UserId string `json:"userId,omitempty"` 2696 2697 // ServerResponse contains the HTTP response code and headers from the 2698 // server. 2699 googleapi.ServerResponse `json:"-"` 2700 2701 // ForceSendFields is a list of field names (e.g. "CourseId") to 2702 // unconditionally include in API requests. By default, fields with 2703 // empty values are omitted from API requests. However, any non-pointer, 2704 // non-interface field appearing in ForceSendFields will be sent to the 2705 // server regardless of whether the field is empty or not. This may be 2706 // used to include empty fields in Patch requests. 2707 ForceSendFields []string `json:"-"` 2708 2709 // NullFields is a list of field names (e.g. "CourseId") to include in 2710 // API requests with the JSON null value. By default, fields with empty 2711 // values are omitted from API requests. However, any field with an 2712 // empty value appearing in NullFields will be sent to the server as 2713 // null. It is an error if a field in this list has a non-empty value. 2714 // This may be used to include null fields in Patch requests. 2715 NullFields []string `json:"-"` 2716} 2717 2718func (s *Student) MarshalJSON() ([]byte, error) { 2719 type NoMethod Student 2720 raw := NoMethod(*s) 2721 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2722} 2723 2724// StudentSubmission: Student submission for course work. 2725// StudentSubmission items are generated when a CourseWork item is 2726// created. StudentSubmissions that have never been accessed (i.e. with 2727// `state` = NEW) may not have a creation time or update time. 2728type StudentSubmission struct { 2729 // AlternateLink: Absolute link to the submission in the Classroom web 2730 // UI. Read-only. 2731 AlternateLink string `json:"alternateLink,omitempty"` 2732 2733 // AssignedGrade: Optional grade. If unset, no grade was set. This value 2734 // must be non-negative. Decimal (that is, non-integer) values are 2735 // allowed, but are rounded to two decimal places. This may be modified 2736 // only by course teachers. 2737 AssignedGrade float64 `json:"assignedGrade,omitempty"` 2738 2739 // AssignmentSubmission: Submission content when course_work_type is 2740 // ASSIGNMENT. Students can modify this content using ModifyAttachments. 2741 AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"` 2742 2743 // AssociatedWithDeveloper: Whether this student submission is 2744 // associated with the Developer Console project making the request. See 2745 // CreateCourseWork for more details. Read-only. 2746 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 2747 2748 // CourseId: Identifier of the course. Read-only. 2749 CourseId string `json:"courseId,omitempty"` 2750 2751 // CourseWorkId: Identifier for the course work this corresponds to. 2752 // Read-only. 2753 CourseWorkId string `json:"courseWorkId,omitempty"` 2754 2755 // CourseWorkType: Type of course work this submission is for. 2756 // Read-only. 2757 // 2758 // Possible values: 2759 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 2760 // never returned. 2761 // "ASSIGNMENT" - An assignment. 2762 // "SHORT_ANSWER_QUESTION" - A short answer question. 2763 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 2764 CourseWorkType string `json:"courseWorkType,omitempty"` 2765 2766 // CreationTime: Creation time of this submission. This may be unset if 2767 // the student has not accessed this item. Read-only. 2768 CreationTime string `json:"creationTime,omitempty"` 2769 2770 // DraftGrade: Optional pending grade. If unset, no grade was set. This 2771 // value must be non-negative. Decimal (that is, non-integer) values are 2772 // allowed, but are rounded to two decimal places. This is only visible 2773 // to and modifiable by course teachers. 2774 DraftGrade float64 `json:"draftGrade,omitempty"` 2775 2776 // Id: Classroom-assigned Identifier for the student submission. This is 2777 // unique among submissions for the relevant course work. Read-only. 2778 Id string `json:"id,omitempty"` 2779 2780 // Late: Whether this submission is late. Read-only. 2781 Late bool `json:"late,omitempty"` 2782 2783 // MultipleChoiceSubmission: Submission content when course_work_type is 2784 // MULTIPLE_CHOICE_QUESTION. 2785 MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"` 2786 2787 // ShortAnswerSubmission: Submission content when course_work_type is 2788 // SHORT_ANSWER_QUESTION. 2789 ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"` 2790 2791 // State: State of this submission. Read-only. 2792 // 2793 // Possible values: 2794 // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 2795 // never be returned. 2796 // "NEW" - The student has never accessed this submission. Attachments 2797 // are not returned and timestamps is not set. 2798 // "CREATED" - Has been created. 2799 // "TURNED_IN" - Has been turned in to the teacher. 2800 // "RETURNED" - Has been returned to the student. 2801 // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 2802 // assignment. 2803 State string `json:"state,omitempty"` 2804 2805 // SubmissionHistory: The history of the submission (includes state and 2806 // grade histories). Read-only. 2807 SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"` 2808 2809 // UpdateTime: Last update time of this submission. This may be unset if 2810 // the student has not accessed this item. Read-only. 2811 UpdateTime string `json:"updateTime,omitempty"` 2812 2813 // UserId: Identifier for the student that owns this submission. 2814 // Read-only. 2815 UserId string `json:"userId,omitempty"` 2816 2817 // ServerResponse contains the HTTP response code and headers from the 2818 // server. 2819 googleapi.ServerResponse `json:"-"` 2820 2821 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 2822 // unconditionally include in API requests. By default, fields with 2823 // empty values are omitted from API requests. However, any non-pointer, 2824 // non-interface field appearing in ForceSendFields will be sent to the 2825 // server regardless of whether the field is empty or not. This may be 2826 // used to include empty fields in Patch requests. 2827 ForceSendFields []string `json:"-"` 2828 2829 // NullFields is a list of field names (e.g. "AlternateLink") to include 2830 // in API requests with the JSON null value. By default, fields with 2831 // empty values are omitted from API requests. However, any field with 2832 // an empty value appearing in NullFields will be sent to the server as 2833 // null. It is an error if a field in this list has a non-empty value. 2834 // This may be used to include null fields in Patch requests. 2835 NullFields []string `json:"-"` 2836} 2837 2838func (s *StudentSubmission) MarshalJSON() ([]byte, error) { 2839 type NoMethod StudentSubmission 2840 raw := NoMethod(*s) 2841 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2842} 2843 2844func (s *StudentSubmission) UnmarshalJSON(data []byte) error { 2845 type NoMethod StudentSubmission 2846 var s1 struct { 2847 AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"` 2848 DraftGrade gensupport.JSONFloat64 `json:"draftGrade"` 2849 *NoMethod 2850 } 2851 s1.NoMethod = (*NoMethod)(s) 2852 if err := json.Unmarshal(data, &s1); err != nil { 2853 return err 2854 } 2855 s.AssignedGrade = float64(s1.AssignedGrade) 2856 s.DraftGrade = float64(s1.DraftGrade) 2857 return nil 2858} 2859 2860// SubmissionHistory: The history of the submission. This currently 2861// includes state and grade histories. 2862type SubmissionHistory struct { 2863 // GradeHistory: The grade history information of the submission, if 2864 // present. 2865 GradeHistory *GradeHistory `json:"gradeHistory,omitempty"` 2866 2867 // StateHistory: The state history information of the submission, if 2868 // present. 2869 StateHistory *StateHistory `json:"stateHistory,omitempty"` 2870 2871 // ForceSendFields is a list of field names (e.g. "GradeHistory") to 2872 // unconditionally include in API requests. By default, fields with 2873 // empty values are omitted from API requests. However, any non-pointer, 2874 // non-interface field appearing in ForceSendFields will be sent to the 2875 // server regardless of whether the field is empty or not. This may be 2876 // used to include empty fields in Patch requests. 2877 ForceSendFields []string `json:"-"` 2878 2879 // NullFields is a list of field names (e.g. "GradeHistory") to include 2880 // in API requests with the JSON null value. By default, fields with 2881 // empty values are omitted from API requests. However, any field with 2882 // an empty value appearing in NullFields will be sent to the server as 2883 // null. It is an error if a field in this list has a non-empty value. 2884 // This may be used to include null fields in Patch requests. 2885 NullFields []string `json:"-"` 2886} 2887 2888func (s *SubmissionHistory) MarshalJSON() ([]byte, error) { 2889 type NoMethod SubmissionHistory 2890 raw := NoMethod(*s) 2891 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2892} 2893 2894// Teacher: Teacher of a course. 2895type Teacher struct { 2896 // CourseId: Identifier of the course. Read-only. 2897 CourseId string `json:"courseId,omitempty"` 2898 2899 // Profile: Global user information for the teacher. Read-only. 2900 Profile *UserProfile `json:"profile,omitempty"` 2901 2902 // UserId: Identifier of the user. When specified as a parameter of a 2903 // request, this identifier can be one of the following: * the numeric 2904 // identifier for the user * the email address of the user * the string 2905 // literal "me", indicating the requesting user 2906 UserId string `json:"userId,omitempty"` 2907 2908 // ServerResponse contains the HTTP response code and headers from the 2909 // server. 2910 googleapi.ServerResponse `json:"-"` 2911 2912 // ForceSendFields is a list of field names (e.g. "CourseId") to 2913 // unconditionally include in API requests. By default, fields with 2914 // empty values are omitted from API requests. However, any non-pointer, 2915 // non-interface field appearing in ForceSendFields will be sent to the 2916 // server regardless of whether the field is empty or not. This may be 2917 // used to include empty fields in Patch requests. 2918 ForceSendFields []string `json:"-"` 2919 2920 // NullFields is a list of field names (e.g. "CourseId") to include in 2921 // API requests with the JSON null value. By default, fields with empty 2922 // values are omitted from API requests. However, any field with an 2923 // empty value appearing in NullFields will be sent to the server as 2924 // null. It is an error if a field in this list has a non-empty value. 2925 // This may be used to include null fields in Patch requests. 2926 NullFields []string `json:"-"` 2927} 2928 2929func (s *Teacher) MarshalJSON() ([]byte, error) { 2930 type NoMethod Teacher 2931 raw := NoMethod(*s) 2932 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2933} 2934 2935// TimeOfDay: Represents a time of day. The date and time zone are 2936// either not significant or are specified elsewhere. An API may choose 2937// to allow leap seconds. Related types are google.type.Date and 2938// `google.protobuf.Timestamp`. 2939type TimeOfDay struct { 2940 // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API 2941 // may choose to allow the value "24:00:00" for scenarios like business 2942 // closing time. 2943 Hours int64 `json:"hours,omitempty"` 2944 2945 // Minutes: Minutes of hour of day. Must be from 0 to 59. 2946 Minutes int64 `json:"minutes,omitempty"` 2947 2948 // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to 2949 // 999,999,999. 2950 Nanos int64 `json:"nanos,omitempty"` 2951 2952 // Seconds: Seconds of minutes of the time. Must normally be from 0 to 2953 // 59. An API may allow the value 60 if it allows leap-seconds. 2954 Seconds int64 `json:"seconds,omitempty"` 2955 2956 // ForceSendFields is a list of field names (e.g. "Hours") to 2957 // unconditionally include in API requests. By default, fields with 2958 // empty values are omitted from API requests. However, any non-pointer, 2959 // non-interface field appearing in ForceSendFields will be sent to the 2960 // server regardless of whether the field is empty or not. This may be 2961 // used to include empty fields in Patch requests. 2962 ForceSendFields []string `json:"-"` 2963 2964 // NullFields is a list of field names (e.g. "Hours") to include in API 2965 // requests with the JSON null value. By default, fields with empty 2966 // values are omitted from API requests. However, any field with an 2967 // empty value appearing in NullFields will be sent to the server as 2968 // null. It is an error if a field in this list has a non-empty value. 2969 // This may be used to include null fields in Patch requests. 2970 NullFields []string `json:"-"` 2971} 2972 2973func (s *TimeOfDay) MarshalJSON() ([]byte, error) { 2974 type NoMethod TimeOfDay 2975 raw := NoMethod(*s) 2976 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2977} 2978 2979// Topic: Topic created by a teacher for the course 2980type Topic struct { 2981 // CourseId: Identifier of the course. Read-only. 2982 CourseId string `json:"courseId,omitempty"` 2983 2984 // Name: The name of the topic, generated by the user. Leading and 2985 // trailing whitespaces, if any, are trimmed. Also, multiple consecutive 2986 // whitespaces are collapsed into one inside the name. The result must 2987 // be a non-empty string. Topic names are case sensitive, and must be no 2988 // longer than 100 characters. 2989 Name string `json:"name,omitempty"` 2990 2991 // TopicId: Unique identifier for the topic. Read-only. 2992 TopicId string `json:"topicId,omitempty"` 2993 2994 // UpdateTime: The time the topic was last updated by the system. 2995 // Read-only. 2996 UpdateTime string `json:"updateTime,omitempty"` 2997 2998 // ServerResponse contains the HTTP response code and headers from the 2999 // server. 3000 googleapi.ServerResponse `json:"-"` 3001 3002 // ForceSendFields is a list of field names (e.g. "CourseId") to 3003 // unconditionally include in API requests. By default, fields with 3004 // empty values are omitted from API requests. However, any non-pointer, 3005 // non-interface field appearing in ForceSendFields will be sent to the 3006 // server regardless of whether the field is empty or not. This may be 3007 // used to include empty fields in Patch requests. 3008 ForceSendFields []string `json:"-"` 3009 3010 // NullFields is a list of field names (e.g. "CourseId") to include in 3011 // API requests with the JSON null value. By default, fields with empty 3012 // values are omitted from API requests. However, any field with an 3013 // empty value appearing in NullFields will be sent to the server as 3014 // null. It is an error if a field in this list has a non-empty value. 3015 // This may be used to include null fields in Patch requests. 3016 NullFields []string `json:"-"` 3017} 3018 3019func (s *Topic) MarshalJSON() ([]byte, error) { 3020 type NoMethod Topic 3021 raw := NoMethod(*s) 3022 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3023} 3024 3025// TurnInStudentSubmissionRequest: Request to turn in a student 3026// submission. 3027type TurnInStudentSubmissionRequest struct { 3028} 3029 3030// UserProfile: Global information for a user. 3031type UserProfile struct { 3032 // EmailAddress: Email address of the user. Read-only. 3033 EmailAddress string `json:"emailAddress,omitempty"` 3034 3035 // Id: Identifier of the user. Read-only. 3036 Id string `json:"id,omitempty"` 3037 3038 // Name: Name of the user. Read-only. 3039 Name *Name `json:"name,omitempty"` 3040 3041 // Permissions: Global permissions of the user. Read-only. 3042 Permissions []*GlobalPermission `json:"permissions,omitempty"` 3043 3044 // PhotoUrl: URL of user's profile photo. Read-only. 3045 PhotoUrl string `json:"photoUrl,omitempty"` 3046 3047 // VerifiedTeacher: Represents whether a G Suite for Education user's 3048 // domain administrator has explicitly verified them as being a teacher. 3049 // If the user is not a member of a G Suite for Education domain, than 3050 // this field is always false. Read-only 3051 VerifiedTeacher bool `json:"verifiedTeacher,omitempty"` 3052 3053 // ServerResponse contains the HTTP response code and headers from the 3054 // server. 3055 googleapi.ServerResponse `json:"-"` 3056 3057 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 3058 // unconditionally include in API requests. By default, fields with 3059 // empty values are omitted from API requests. However, any non-pointer, 3060 // non-interface field appearing in ForceSendFields will be sent to the 3061 // server regardless of whether the field is empty or not. This may be 3062 // used to include empty fields in Patch requests. 3063 ForceSendFields []string `json:"-"` 3064 3065 // NullFields is a list of field names (e.g. "EmailAddress") to include 3066 // in API requests with the JSON null value. By default, fields with 3067 // empty values are omitted from API requests. However, any field with 3068 // an empty value appearing in NullFields will be sent to the server as 3069 // null. It is an error if a field in this list has a non-empty value. 3070 // This may be used to include null fields in Patch requests. 3071 NullFields []string `json:"-"` 3072} 3073 3074func (s *UserProfile) MarshalJSON() ([]byte, error) { 3075 type NoMethod UserProfile 3076 raw := NoMethod(*s) 3077 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3078} 3079 3080// YouTubeVideo: YouTube video item. 3081type YouTubeVideo struct { 3082 // AlternateLink: URL that can be used to view the YouTube video. 3083 // Read-only. 3084 AlternateLink string `json:"alternateLink,omitempty"` 3085 3086 // Id: YouTube API resource ID. 3087 Id string `json:"id,omitempty"` 3088 3089 // ThumbnailUrl: URL of a thumbnail image of the YouTube video. 3090 // Read-only. 3091 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 3092 3093 // Title: Title of the YouTube video. Read-only. 3094 Title string `json:"title,omitempty"` 3095 3096 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 3097 // unconditionally include in API requests. By default, fields with 3098 // empty values are omitted from API requests. However, any non-pointer, 3099 // non-interface field appearing in ForceSendFields will be sent to the 3100 // server regardless of whether the field is empty or not. This may be 3101 // used to include empty fields in Patch requests. 3102 ForceSendFields []string `json:"-"` 3103 3104 // NullFields is a list of field names (e.g. "AlternateLink") to include 3105 // in API requests with the JSON null value. By default, fields with 3106 // empty values are omitted from API requests. However, any field with 3107 // an empty value appearing in NullFields will be sent to the server as 3108 // null. It is an error if a field in this list has a non-empty value. 3109 // This may be used to include null fields in Patch requests. 3110 NullFields []string `json:"-"` 3111} 3112 3113func (s *YouTubeVideo) MarshalJSON() ([]byte, error) { 3114 type NoMethod YouTubeVideo 3115 raw := NoMethod(*s) 3116 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3117} 3118 3119// method id "classroom.courses.create": 3120 3121type CoursesCreateCall struct { 3122 s *Service 3123 course *Course 3124 urlParams_ gensupport.URLParams 3125 ctx_ context.Context 3126 header_ http.Header 3127} 3128 3129// Create: Creates a course. The user specified in `ownerId` is the 3130// owner of the created course and added as a teacher. This method 3131// returns the following error codes: * `PERMISSION_DENIED` if the 3132// requesting user is not permitted to create courses or for access 3133// errors. * `NOT_FOUND` if the primary teacher is not a valid user. * 3134// `FAILED_PRECONDITION` if the course owner's account is disabled or 3135// for the following request errors: * UserGroupsMembershipLimitReached 3136// * `ALREADY_EXISTS` if an alias was specified in the `id` and already 3137// exists. 3138func (r *CoursesService) Create(course *Course) *CoursesCreateCall { 3139 c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3140 c.course = course 3141 return c 3142} 3143 3144// Fields allows partial responses to be retrieved. See 3145// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3146// for more information. 3147func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall { 3148 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3149 return c 3150} 3151 3152// Context sets the context to be used in this call's Do method. Any 3153// pending HTTP request will be aborted if the provided context is 3154// canceled. 3155func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall { 3156 c.ctx_ = ctx 3157 return c 3158} 3159 3160// Header returns an http.Header that can be modified by the caller to 3161// add HTTP headers to the request. 3162func (c *CoursesCreateCall) Header() http.Header { 3163 if c.header_ == nil { 3164 c.header_ = make(http.Header) 3165 } 3166 return c.header_ 3167} 3168 3169func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) { 3170 reqHeaders := make(http.Header) 3171 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3172 for k, v := range c.header_ { 3173 reqHeaders[k] = v 3174 } 3175 reqHeaders.Set("User-Agent", c.s.userAgent()) 3176 var body io.Reader = nil 3177 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3178 if err != nil { 3179 return nil, err 3180 } 3181 reqHeaders.Set("Content-Type", "application/json") 3182 c.urlParams_.Set("alt", alt) 3183 c.urlParams_.Set("prettyPrint", "false") 3184 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3185 urls += "?" + c.urlParams_.Encode() 3186 req, err := http.NewRequest("POST", urls, body) 3187 if err != nil { 3188 return nil, err 3189 } 3190 req.Header = reqHeaders 3191 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3192} 3193 3194// Do executes the "classroom.courses.create" call. 3195// Exactly one of *Course or error will be non-nil. Any non-2xx status 3196// code is an error. Response headers are in either 3197// *Course.ServerResponse.Header or (if a response was returned at all) 3198// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3199// check whether the returned error was because http.StatusNotModified 3200// was returned. 3201func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3202 gensupport.SetOptions(c.urlParams_, opts...) 3203 res, err := c.doRequest("json") 3204 if res != nil && res.StatusCode == http.StatusNotModified { 3205 if res.Body != nil { 3206 res.Body.Close() 3207 } 3208 return nil, &googleapi.Error{ 3209 Code: res.StatusCode, 3210 Header: res.Header, 3211 } 3212 } 3213 if err != nil { 3214 return nil, err 3215 } 3216 defer googleapi.CloseBody(res) 3217 if err := googleapi.CheckResponse(res); err != nil { 3218 return nil, err 3219 } 3220 ret := &Course{ 3221 ServerResponse: googleapi.ServerResponse{ 3222 Header: res.Header, 3223 HTTPStatusCode: res.StatusCode, 3224 }, 3225 } 3226 target := &ret 3227 if err := gensupport.DecodeResponse(target, res); err != nil { 3228 return nil, err 3229 } 3230 return ret, nil 3231 // { 3232 // "description": "Creates a course. The user specified in `ownerId` is the owner of the created course and added as a teacher. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create courses or for access errors. * `NOT_FOUND` if the primary teacher is not a valid user. * `FAILED_PRECONDITION` if the course owner's account is disabled or for the following request errors: * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if an alias was specified in the `id` and already exists.", 3233 // "flatPath": "v1/courses", 3234 // "httpMethod": "POST", 3235 // "id": "classroom.courses.create", 3236 // "parameterOrder": [], 3237 // "parameters": {}, 3238 // "path": "v1/courses", 3239 // "request": { 3240 // "$ref": "Course" 3241 // }, 3242 // "response": { 3243 // "$ref": "Course" 3244 // }, 3245 // "scopes": [ 3246 // "https://www.googleapis.com/auth/classroom.courses" 3247 // ] 3248 // } 3249 3250} 3251 3252// method id "classroom.courses.delete": 3253 3254type CoursesDeleteCall struct { 3255 s *Service 3256 id string 3257 urlParams_ gensupport.URLParams 3258 ctx_ context.Context 3259 header_ http.Header 3260} 3261 3262// Delete: Deletes a course. This method returns the following error 3263// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 3264// to delete the requested course or for access errors. * `NOT_FOUND` if 3265// no course exists with the requested ID. 3266// 3267// - id: Identifier of the course to delete. This identifier can be 3268// either the Classroom-assigned identifier or an alias. 3269func (r *CoursesService) Delete(id string) *CoursesDeleteCall { 3270 c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3271 c.id = id 3272 return c 3273} 3274 3275// Fields allows partial responses to be retrieved. See 3276// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3277// for more information. 3278func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall { 3279 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3280 return c 3281} 3282 3283// Context sets the context to be used in this call's Do method. Any 3284// pending HTTP request will be aborted if the provided context is 3285// canceled. 3286func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall { 3287 c.ctx_ = ctx 3288 return c 3289} 3290 3291// Header returns an http.Header that can be modified by the caller to 3292// add HTTP headers to the request. 3293func (c *CoursesDeleteCall) Header() http.Header { 3294 if c.header_ == nil { 3295 c.header_ = make(http.Header) 3296 } 3297 return c.header_ 3298} 3299 3300func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) { 3301 reqHeaders := make(http.Header) 3302 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3303 for k, v := range c.header_ { 3304 reqHeaders[k] = v 3305 } 3306 reqHeaders.Set("User-Agent", c.s.userAgent()) 3307 var body io.Reader = nil 3308 c.urlParams_.Set("alt", alt) 3309 c.urlParams_.Set("prettyPrint", "false") 3310 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3311 urls += "?" + c.urlParams_.Encode() 3312 req, err := http.NewRequest("DELETE", urls, body) 3313 if err != nil { 3314 return nil, err 3315 } 3316 req.Header = reqHeaders 3317 googleapi.Expand(req.URL, map[string]string{ 3318 "id": c.id, 3319 }) 3320 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3321} 3322 3323// Do executes the "classroom.courses.delete" call. 3324// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3325// code is an error. Response headers are in either 3326// *Empty.ServerResponse.Header or (if a response was returned at all) 3327// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3328// check whether the returned error was because http.StatusNotModified 3329// was returned. 3330func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3331 gensupport.SetOptions(c.urlParams_, opts...) 3332 res, err := c.doRequest("json") 3333 if res != nil && res.StatusCode == http.StatusNotModified { 3334 if res.Body != nil { 3335 res.Body.Close() 3336 } 3337 return nil, &googleapi.Error{ 3338 Code: res.StatusCode, 3339 Header: res.Header, 3340 } 3341 } 3342 if err != nil { 3343 return nil, err 3344 } 3345 defer googleapi.CloseBody(res) 3346 if err := googleapi.CheckResponse(res); err != nil { 3347 return nil, err 3348 } 3349 ret := &Empty{ 3350 ServerResponse: googleapi.ServerResponse{ 3351 Header: res.Header, 3352 HTTPStatusCode: res.StatusCode, 3353 }, 3354 } 3355 target := &ret 3356 if err := gensupport.DecodeResponse(target, res); err != nil { 3357 return nil, err 3358 } 3359 return ret, nil 3360 // { 3361 // "description": "Deletes a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID.", 3362 // "flatPath": "v1/courses/{id}", 3363 // "httpMethod": "DELETE", 3364 // "id": "classroom.courses.delete", 3365 // "parameterOrder": [ 3366 // "id" 3367 // ], 3368 // "parameters": { 3369 // "id": { 3370 // "description": "Identifier of the course to delete. This identifier can be either the Classroom-assigned identifier or an alias.", 3371 // "location": "path", 3372 // "required": true, 3373 // "type": "string" 3374 // } 3375 // }, 3376 // "path": "v1/courses/{id}", 3377 // "response": { 3378 // "$ref": "Empty" 3379 // }, 3380 // "scopes": [ 3381 // "https://www.googleapis.com/auth/classroom.courses" 3382 // ] 3383 // } 3384 3385} 3386 3387// method id "classroom.courses.get": 3388 3389type CoursesGetCall struct { 3390 s *Service 3391 id string 3392 urlParams_ gensupport.URLParams 3393 ifNoneMatch_ string 3394 ctx_ context.Context 3395 header_ http.Header 3396} 3397 3398// Get: Returns a course. This method returns the following error codes: 3399// * `PERMISSION_DENIED` if the requesting user is not permitted to 3400// access the requested course or for access errors. * `NOT_FOUND` if no 3401// course exists with the requested ID. 3402// 3403// - id: Identifier of the course to return. This identifier can be 3404// either the Classroom-assigned identifier or an alias. 3405func (r *CoursesService) Get(id string) *CoursesGetCall { 3406 c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3407 c.id = id 3408 return c 3409} 3410 3411// Fields allows partial responses to be retrieved. See 3412// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3413// for more information. 3414func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall { 3415 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3416 return c 3417} 3418 3419// IfNoneMatch sets the optional parameter which makes the operation 3420// fail if the object's ETag matches the given value. This is useful for 3421// getting updates only after the object has changed since the last 3422// request. Use googleapi.IsNotModified to check whether the response 3423// error from Do is the result of In-None-Match. 3424func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall { 3425 c.ifNoneMatch_ = entityTag 3426 return c 3427} 3428 3429// Context sets the context to be used in this call's Do method. Any 3430// pending HTTP request will be aborted if the provided context is 3431// canceled. 3432func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall { 3433 c.ctx_ = ctx 3434 return c 3435} 3436 3437// Header returns an http.Header that can be modified by the caller to 3438// add HTTP headers to the request. 3439func (c *CoursesGetCall) Header() http.Header { 3440 if c.header_ == nil { 3441 c.header_ = make(http.Header) 3442 } 3443 return c.header_ 3444} 3445 3446func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) { 3447 reqHeaders := make(http.Header) 3448 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3449 for k, v := range c.header_ { 3450 reqHeaders[k] = v 3451 } 3452 reqHeaders.Set("User-Agent", c.s.userAgent()) 3453 if c.ifNoneMatch_ != "" { 3454 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3455 } 3456 var body io.Reader = nil 3457 c.urlParams_.Set("alt", alt) 3458 c.urlParams_.Set("prettyPrint", "false") 3459 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3460 urls += "?" + c.urlParams_.Encode() 3461 req, err := http.NewRequest("GET", urls, body) 3462 if err != nil { 3463 return nil, err 3464 } 3465 req.Header = reqHeaders 3466 googleapi.Expand(req.URL, map[string]string{ 3467 "id": c.id, 3468 }) 3469 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3470} 3471 3472// Do executes the "classroom.courses.get" call. 3473// Exactly one of *Course or error will be non-nil. Any non-2xx status 3474// code is an error. Response headers are in either 3475// *Course.ServerResponse.Header or (if a response was returned at all) 3476// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3477// check whether the returned error was because http.StatusNotModified 3478// was returned. 3479func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3480 gensupport.SetOptions(c.urlParams_, opts...) 3481 res, err := c.doRequest("json") 3482 if res != nil && res.StatusCode == http.StatusNotModified { 3483 if res.Body != nil { 3484 res.Body.Close() 3485 } 3486 return nil, &googleapi.Error{ 3487 Code: res.StatusCode, 3488 Header: res.Header, 3489 } 3490 } 3491 if err != nil { 3492 return nil, err 3493 } 3494 defer googleapi.CloseBody(res) 3495 if err := googleapi.CheckResponse(res); err != nil { 3496 return nil, err 3497 } 3498 ret := &Course{ 3499 ServerResponse: googleapi.ServerResponse{ 3500 Header: res.Header, 3501 HTTPStatusCode: res.StatusCode, 3502 }, 3503 } 3504 target := &ret 3505 if err := gensupport.DecodeResponse(target, res); err != nil { 3506 return nil, err 3507 } 3508 return ret, nil 3509 // { 3510 // "description": "Returns a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID.", 3511 // "flatPath": "v1/courses/{id}", 3512 // "httpMethod": "GET", 3513 // "id": "classroom.courses.get", 3514 // "parameterOrder": [ 3515 // "id" 3516 // ], 3517 // "parameters": { 3518 // "id": { 3519 // "description": "Identifier of the course to return. This identifier can be either the Classroom-assigned identifier or an alias.", 3520 // "location": "path", 3521 // "required": true, 3522 // "type": "string" 3523 // } 3524 // }, 3525 // "path": "v1/courses/{id}", 3526 // "response": { 3527 // "$ref": "Course" 3528 // }, 3529 // "scopes": [ 3530 // "https://www.googleapis.com/auth/classroom.courses", 3531 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3532 // ] 3533 // } 3534 3535} 3536 3537// method id "classroom.courses.list": 3538 3539type CoursesListCall struct { 3540 s *Service 3541 urlParams_ gensupport.URLParams 3542 ifNoneMatch_ string 3543 ctx_ context.Context 3544 header_ http.Header 3545} 3546 3547// List: Returns a list of courses that the requesting user is permitted 3548// to view, restricted to those that match the request. Returned courses 3549// are ordered by creation time, with the most recently created coming 3550// first. This method returns the following error codes: * 3551// `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the 3552// query argument is malformed. * `NOT_FOUND` if any users specified in 3553// the query arguments do not exist. 3554func (r *CoursesService) List() *CoursesListCall { 3555 c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3556 return c 3557} 3558 3559// CourseStates sets the optional parameter "courseStates": Restricts 3560// returned courses to those in one of the specified states The default 3561// value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED. 3562// 3563// Possible values: 3564// "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 3565// message will use this value. 3566// "ACTIVE" - The course is active. 3567// "ARCHIVED" - The course has been archived. You cannot modify it 3568// except to change it to a different state. 3569// "PROVISIONED" - The course has been created, but not yet activated. 3570// It is accessible by the primary teacher and domain administrators, 3571// who may modify it or change it to the `ACTIVE` or `DECLINED` states. 3572// A course may only be changed to `PROVISIONED` if it is in the 3573// `DECLINED` state. 3574// "DECLINED" - The course has been created, but declined. It is 3575// accessible by the course owner and domain administrators, though it 3576// will not be displayed in the web UI. You cannot modify the course 3577// except to change it to the `PROVISIONED` state. A course may only be 3578// changed to `DECLINED` if it is in the `PROVISIONED` state. 3579// "SUSPENDED" - The course has been suspended. You cannot modify the 3580// course, and only the user identified by the `owner_id` can view the 3581// course. A course may be placed in this state if it potentially 3582// violates the Terms of Service. 3583func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall { 3584 c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...)) 3585 return c 3586} 3587 3588// PageSize sets the optional parameter "pageSize": Maximum number of 3589// items to return. Zero or unspecified indicates that the server may 3590// assign a maximum. The server may return fewer than the specified 3591// number of results. 3592func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall { 3593 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3594 return c 3595} 3596 3597// PageToken sets the optional parameter "pageToken": nextPageToken 3598// value returned from a previous list call, indicating that the 3599// subsequent page of results should be returned. The list request must 3600// be otherwise identical to the one that resulted in this token. 3601func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall { 3602 c.urlParams_.Set("pageToken", pageToken) 3603 return c 3604} 3605 3606// StudentId sets the optional parameter "studentId": Restricts returned 3607// courses to those having a student with the specified identifier. The 3608// identifier can be one of the following: * the numeric identifier for 3609// the user * the email address of the user * the string literal "me", 3610// indicating the requesting user 3611func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall { 3612 c.urlParams_.Set("studentId", studentId) 3613 return c 3614} 3615 3616// TeacherId sets the optional parameter "teacherId": Restricts returned 3617// courses to those having a teacher with the specified identifier. The 3618// identifier can be one of the following: * the numeric identifier for 3619// the user * the email address of the user * the string literal "me", 3620// indicating the requesting user 3621func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall { 3622 c.urlParams_.Set("teacherId", teacherId) 3623 return c 3624} 3625 3626// Fields allows partial responses to be retrieved. See 3627// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3628// for more information. 3629func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall { 3630 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3631 return c 3632} 3633 3634// IfNoneMatch sets the optional parameter which makes the operation 3635// fail if the object's ETag matches the given value. This is useful for 3636// getting updates only after the object has changed since the last 3637// request. Use googleapi.IsNotModified to check whether the response 3638// error from Do is the result of In-None-Match. 3639func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall { 3640 c.ifNoneMatch_ = entityTag 3641 return c 3642} 3643 3644// Context sets the context to be used in this call's Do method. Any 3645// pending HTTP request will be aborted if the provided context is 3646// canceled. 3647func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall { 3648 c.ctx_ = ctx 3649 return c 3650} 3651 3652// Header returns an http.Header that can be modified by the caller to 3653// add HTTP headers to the request. 3654func (c *CoursesListCall) Header() http.Header { 3655 if c.header_ == nil { 3656 c.header_ = make(http.Header) 3657 } 3658 return c.header_ 3659} 3660 3661func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) { 3662 reqHeaders := make(http.Header) 3663 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3664 for k, v := range c.header_ { 3665 reqHeaders[k] = v 3666 } 3667 reqHeaders.Set("User-Agent", c.s.userAgent()) 3668 if c.ifNoneMatch_ != "" { 3669 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3670 } 3671 var body io.Reader = nil 3672 c.urlParams_.Set("alt", alt) 3673 c.urlParams_.Set("prettyPrint", "false") 3674 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3675 urls += "?" + c.urlParams_.Encode() 3676 req, err := http.NewRequest("GET", urls, body) 3677 if err != nil { 3678 return nil, err 3679 } 3680 req.Header = reqHeaders 3681 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3682} 3683 3684// Do executes the "classroom.courses.list" call. 3685// Exactly one of *ListCoursesResponse or error will be non-nil. Any 3686// non-2xx status code is an error. Response headers are in either 3687// *ListCoursesResponse.ServerResponse.Header or (if a response was 3688// returned at all) in error.(*googleapi.Error).Header. Use 3689// googleapi.IsNotModified to check whether the returned error was 3690// because http.StatusNotModified was returned. 3691func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) { 3692 gensupport.SetOptions(c.urlParams_, opts...) 3693 res, err := c.doRequest("json") 3694 if res != nil && res.StatusCode == http.StatusNotModified { 3695 if res.Body != nil { 3696 res.Body.Close() 3697 } 3698 return nil, &googleapi.Error{ 3699 Code: res.StatusCode, 3700 Header: res.Header, 3701 } 3702 } 3703 if err != nil { 3704 return nil, err 3705 } 3706 defer googleapi.CloseBody(res) 3707 if err := googleapi.CheckResponse(res); err != nil { 3708 return nil, err 3709 } 3710 ret := &ListCoursesResponse{ 3711 ServerResponse: googleapi.ServerResponse{ 3712 Header: res.Header, 3713 HTTPStatusCode: res.StatusCode, 3714 }, 3715 } 3716 target := &ret 3717 if err := gensupport.DecodeResponse(target, res); err != nil { 3718 return nil, err 3719 } 3720 return ret, nil 3721 // { 3722 // "description": "Returns a list of courses that the requesting user is permitted to view, restricted to those that match the request. Returned courses are ordered by creation time, with the most recently created coming first. This method returns the following error codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the query argument is malformed. * `NOT_FOUND` if any users specified in the query arguments do not exist.", 3723 // "flatPath": "v1/courses", 3724 // "httpMethod": "GET", 3725 // "id": "classroom.courses.list", 3726 // "parameterOrder": [], 3727 // "parameters": { 3728 // "courseStates": { 3729 // "description": "Restricts returned courses to those in one of the specified states The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.", 3730 // "enum": [ 3731 // "COURSE_STATE_UNSPECIFIED", 3732 // "ACTIVE", 3733 // "ARCHIVED", 3734 // "PROVISIONED", 3735 // "DECLINED", 3736 // "SUSPENDED" 3737 // ], 3738 // "enumDescriptions": [ 3739 // "No course state. No returned Course message will use this value.", 3740 // "The course is active.", 3741 // "The course has been archived. You cannot modify it except to change it to a different state.", 3742 // "The course has been created, but not yet activated. It is accessible by the primary teacher and domain administrators, who may modify it or change it to the `ACTIVE` or `DECLINED` states. A course may only be changed to `PROVISIONED` if it is in the `DECLINED` state.", 3743 // "The course has been created, but declined. It is accessible by the course owner and domain administrators, though it will not be displayed in the web UI. You cannot modify the course except to change it to the `PROVISIONED` state. A course may only be changed to `DECLINED` if it is in the `PROVISIONED` state.", 3744 // "The course has been suspended. You cannot modify the course, and only the user identified by the `owner_id` can view the course. A course may be placed in this state if it potentially violates the Terms of Service." 3745 // ], 3746 // "location": "query", 3747 // "repeated": true, 3748 // "type": "string" 3749 // }, 3750 // "pageSize": { 3751 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 3752 // "format": "int32", 3753 // "location": "query", 3754 // "type": "integer" 3755 // }, 3756 // "pageToken": { 3757 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 3758 // "location": "query", 3759 // "type": "string" 3760 // }, 3761 // "studentId": { 3762 // "description": "Restricts returned courses to those having a student with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 3763 // "location": "query", 3764 // "type": "string" 3765 // }, 3766 // "teacherId": { 3767 // "description": "Restricts returned courses to those having a teacher with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 3768 // "location": "query", 3769 // "type": "string" 3770 // } 3771 // }, 3772 // "path": "v1/courses", 3773 // "response": { 3774 // "$ref": "ListCoursesResponse" 3775 // }, 3776 // "scopes": [ 3777 // "https://www.googleapis.com/auth/classroom.courses", 3778 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3779 // ] 3780 // } 3781 3782} 3783 3784// Pages invokes f for each page of results. 3785// A non-nil error returned from f will halt the iteration. 3786// The provided context supersedes any context provided to the Context method. 3787func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error { 3788 c.ctx_ = ctx 3789 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3790 for { 3791 x, err := c.Do() 3792 if err != nil { 3793 return err 3794 } 3795 if err := f(x); err != nil { 3796 return err 3797 } 3798 if x.NextPageToken == "" { 3799 return nil 3800 } 3801 c.PageToken(x.NextPageToken) 3802 } 3803} 3804 3805// method id "classroom.courses.patch": 3806 3807type CoursesPatchCall struct { 3808 s *Service 3809 id string 3810 course *Course 3811 urlParams_ gensupport.URLParams 3812 ctx_ context.Context 3813 header_ http.Header 3814} 3815 3816// Patch: Updates one or more fields in a course. This method returns 3817// the following error codes: * `PERMISSION_DENIED` if the requesting 3818// user is not permitted to modify the requested course or for access 3819// errors. * `NOT_FOUND` if no course exists with the requested ID. * 3820// `INVALID_ARGUMENT` if invalid fields are specified in the update mask 3821// or if no update mask is supplied. * `FAILED_PRECONDITION` for the 3822// following request errors: * CourseNotModifiable 3823// 3824// - id: Identifier of the course to update. This identifier can be 3825// either the Classroom-assigned identifier or an alias. 3826func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall { 3827 c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3828 c.id = id 3829 c.course = course 3830 return c 3831} 3832 3833// UpdateMask sets the optional parameter "updateMask": Mask that 3834// identifies which fields on the course to update. This field is 3835// required to do an update. The update will fail if invalid fields are 3836// specified. The following fields are valid: * `name` * `section` * 3837// `descriptionHeading` * `description` * `room` * `courseState` * 3838// `ownerId` Note: patches to ownerId are treated as being effective 3839// immediately, but in practice it may take some time for the ownership 3840// transfer of all affected resources to complete. When set in a query 3841// parameter, this field should be specified as `updateMask=,,...` 3842func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall { 3843 c.urlParams_.Set("updateMask", updateMask) 3844 return c 3845} 3846 3847// Fields allows partial responses to be retrieved. See 3848// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3849// for more information. 3850func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall { 3851 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3852 return c 3853} 3854 3855// Context sets the context to be used in this call's Do method. Any 3856// pending HTTP request will be aborted if the provided context is 3857// canceled. 3858func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall { 3859 c.ctx_ = ctx 3860 return c 3861} 3862 3863// Header returns an http.Header that can be modified by the caller to 3864// add HTTP headers to the request. 3865func (c *CoursesPatchCall) Header() http.Header { 3866 if c.header_ == nil { 3867 c.header_ = make(http.Header) 3868 } 3869 return c.header_ 3870} 3871 3872func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) { 3873 reqHeaders := make(http.Header) 3874 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3875 for k, v := range c.header_ { 3876 reqHeaders[k] = v 3877 } 3878 reqHeaders.Set("User-Agent", c.s.userAgent()) 3879 var body io.Reader = nil 3880 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3881 if err != nil { 3882 return nil, err 3883 } 3884 reqHeaders.Set("Content-Type", "application/json") 3885 c.urlParams_.Set("alt", alt) 3886 c.urlParams_.Set("prettyPrint", "false") 3887 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3888 urls += "?" + c.urlParams_.Encode() 3889 req, err := http.NewRequest("PATCH", urls, body) 3890 if err != nil { 3891 return nil, err 3892 } 3893 req.Header = reqHeaders 3894 googleapi.Expand(req.URL, map[string]string{ 3895 "id": c.id, 3896 }) 3897 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3898} 3899 3900// Do executes the "classroom.courses.patch" call. 3901// Exactly one of *Course or error will be non-nil. Any non-2xx status 3902// code is an error. Response headers are in either 3903// *Course.ServerResponse.Header or (if a response was returned at all) 3904// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3905// check whether the returned error was because http.StatusNotModified 3906// was returned. 3907func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3908 gensupport.SetOptions(c.urlParams_, opts...) 3909 res, err := c.doRequest("json") 3910 if res != nil && res.StatusCode == http.StatusNotModified { 3911 if res.Body != nil { 3912 res.Body.Close() 3913 } 3914 return nil, &googleapi.Error{ 3915 Code: res.StatusCode, 3916 Header: res.Header, 3917 } 3918 } 3919 if err != nil { 3920 return nil, err 3921 } 3922 defer googleapi.CloseBody(res) 3923 if err := googleapi.CheckResponse(res); err != nil { 3924 return nil, err 3925 } 3926 ret := &Course{ 3927 ServerResponse: googleapi.ServerResponse{ 3928 Header: res.Header, 3929 HTTPStatusCode: res.StatusCode, 3930 }, 3931 } 3932 target := &ret 3933 if err := gensupport.DecodeResponse(target, res); err != nil { 3934 return nil, err 3935 } 3936 return ret, nil 3937 // { 3938 // "description": "Updates one or more fields in a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to modify the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID. * `INVALID_ARGUMENT` if invalid fields are specified in the update mask or if no update mask is supplied. * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable", 3939 // "flatPath": "v1/courses/{id}", 3940 // "httpMethod": "PATCH", 3941 // "id": "classroom.courses.patch", 3942 // "parameterOrder": [ 3943 // "id" 3944 // ], 3945 // "parameters": { 3946 // "id": { 3947 // "description": "Identifier of the course to update. This identifier can be either the Classroom-assigned identifier or an alias.", 3948 // "location": "path", 3949 // "required": true, 3950 // "type": "string" 3951 // }, 3952 // "updateMask": { 3953 // "description": "Mask that identifies which fields on the course to update. This field is required to do an update. The update will fail if invalid fields are specified. The following fields are valid: * `name` * `section` * `descriptionHeading` * `description` * `room` * `courseState` * `ownerId` Note: patches to ownerId are treated as being effective immediately, but in practice it may take some time for the ownership transfer of all affected resources to complete. When set in a query parameter, this field should be specified as `updateMask=,,...`", 3954 // "format": "google-fieldmask", 3955 // "location": "query", 3956 // "type": "string" 3957 // } 3958 // }, 3959 // "path": "v1/courses/{id}", 3960 // "request": { 3961 // "$ref": "Course" 3962 // }, 3963 // "response": { 3964 // "$ref": "Course" 3965 // }, 3966 // "scopes": [ 3967 // "https://www.googleapis.com/auth/classroom.courses" 3968 // ] 3969 // } 3970 3971} 3972 3973// method id "classroom.courses.update": 3974 3975type CoursesUpdateCall struct { 3976 s *Service 3977 id string 3978 course *Course 3979 urlParams_ gensupport.URLParams 3980 ctx_ context.Context 3981 header_ http.Header 3982} 3983 3984// Update: Updates a course. This method returns the following error 3985// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 3986// to modify the requested course or for access errors. * `NOT_FOUND` if 3987// no course exists with the requested ID. * `FAILED_PRECONDITION` for 3988// the following request errors: * CourseNotModifiable 3989// 3990// - id: Identifier of the course to update. This identifier can be 3991// either the Classroom-assigned identifier or an alias. 3992func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall { 3993 c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3994 c.id = id 3995 c.course = course 3996 return c 3997} 3998 3999// Fields allows partial responses to be retrieved. See 4000// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4001// for more information. 4002func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall { 4003 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4004 return c 4005} 4006 4007// Context sets the context to be used in this call's Do method. Any 4008// pending HTTP request will be aborted if the provided context is 4009// canceled. 4010func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall { 4011 c.ctx_ = ctx 4012 return c 4013} 4014 4015// Header returns an http.Header that can be modified by the caller to 4016// add HTTP headers to the request. 4017func (c *CoursesUpdateCall) Header() http.Header { 4018 if c.header_ == nil { 4019 c.header_ = make(http.Header) 4020 } 4021 return c.header_ 4022} 4023 4024func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) { 4025 reqHeaders := make(http.Header) 4026 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4027 for k, v := range c.header_ { 4028 reqHeaders[k] = v 4029 } 4030 reqHeaders.Set("User-Agent", c.s.userAgent()) 4031 var body io.Reader = nil 4032 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4033 if err != nil { 4034 return nil, err 4035 } 4036 reqHeaders.Set("Content-Type", "application/json") 4037 c.urlParams_.Set("alt", alt) 4038 c.urlParams_.Set("prettyPrint", "false") 4039 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4040 urls += "?" + c.urlParams_.Encode() 4041 req, err := http.NewRequest("PUT", urls, body) 4042 if err != nil { 4043 return nil, err 4044 } 4045 req.Header = reqHeaders 4046 googleapi.Expand(req.URL, map[string]string{ 4047 "id": c.id, 4048 }) 4049 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4050} 4051 4052// Do executes the "classroom.courses.update" call. 4053// Exactly one of *Course or error will be non-nil. Any non-2xx status 4054// code is an error. Response headers are in either 4055// *Course.ServerResponse.Header or (if a response was returned at all) 4056// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4057// check whether the returned error was because http.StatusNotModified 4058// was returned. 4059func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4060 gensupport.SetOptions(c.urlParams_, opts...) 4061 res, err := c.doRequest("json") 4062 if res != nil && res.StatusCode == http.StatusNotModified { 4063 if res.Body != nil { 4064 res.Body.Close() 4065 } 4066 return nil, &googleapi.Error{ 4067 Code: res.StatusCode, 4068 Header: res.Header, 4069 } 4070 } 4071 if err != nil { 4072 return nil, err 4073 } 4074 defer googleapi.CloseBody(res) 4075 if err := googleapi.CheckResponse(res); err != nil { 4076 return nil, err 4077 } 4078 ret := &Course{ 4079 ServerResponse: googleapi.ServerResponse{ 4080 Header: res.Header, 4081 HTTPStatusCode: res.StatusCode, 4082 }, 4083 } 4084 target := &ret 4085 if err := gensupport.DecodeResponse(target, res); err != nil { 4086 return nil, err 4087 } 4088 return ret, nil 4089 // { 4090 // "description": "Updates a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to modify the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID. * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable", 4091 // "flatPath": "v1/courses/{id}", 4092 // "httpMethod": "PUT", 4093 // "id": "classroom.courses.update", 4094 // "parameterOrder": [ 4095 // "id" 4096 // ], 4097 // "parameters": { 4098 // "id": { 4099 // "description": "Identifier of the course to update. This identifier can be either the Classroom-assigned identifier or an alias.", 4100 // "location": "path", 4101 // "required": true, 4102 // "type": "string" 4103 // } 4104 // }, 4105 // "path": "v1/courses/{id}", 4106 // "request": { 4107 // "$ref": "Course" 4108 // }, 4109 // "response": { 4110 // "$ref": "Course" 4111 // }, 4112 // "scopes": [ 4113 // "https://www.googleapis.com/auth/classroom.courses" 4114 // ] 4115 // } 4116 4117} 4118 4119// method id "classroom.courses.aliases.create": 4120 4121type CoursesAliasesCreateCall struct { 4122 s *Service 4123 courseId string 4124 coursealias *CourseAlias 4125 urlParams_ gensupport.URLParams 4126 ctx_ context.Context 4127 header_ http.Header 4128} 4129 4130// Create: Creates an alias for a course. This method returns the 4131// following error codes: * `PERMISSION_DENIED` if the requesting user 4132// is not permitted to create the alias or for access errors. * 4133// `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the 4134// alias already exists. * `FAILED_PRECONDITION` if the alias requested 4135// does not make sense for the requesting user or course (for example, 4136// if a user not in a domain attempts to access a domain-scoped alias). 4137// 4138// - courseId: Identifier of the course to alias. This identifier can be 4139// either the Classroom-assigned identifier or an alias. 4140func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall { 4141 c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4142 c.courseId = courseId 4143 c.coursealias = coursealias 4144 return c 4145} 4146 4147// Fields allows partial responses to be retrieved. See 4148// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4149// for more information. 4150func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall { 4151 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4152 return c 4153} 4154 4155// Context sets the context to be used in this call's Do method. Any 4156// pending HTTP request will be aborted if the provided context is 4157// canceled. 4158func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall { 4159 c.ctx_ = ctx 4160 return c 4161} 4162 4163// Header returns an http.Header that can be modified by the caller to 4164// add HTTP headers to the request. 4165func (c *CoursesAliasesCreateCall) Header() http.Header { 4166 if c.header_ == nil { 4167 c.header_ = make(http.Header) 4168 } 4169 return c.header_ 4170} 4171 4172func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) { 4173 reqHeaders := make(http.Header) 4174 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4175 for k, v := range c.header_ { 4176 reqHeaders[k] = v 4177 } 4178 reqHeaders.Set("User-Agent", c.s.userAgent()) 4179 var body io.Reader = nil 4180 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias) 4181 if err != nil { 4182 return nil, err 4183 } 4184 reqHeaders.Set("Content-Type", "application/json") 4185 c.urlParams_.Set("alt", alt) 4186 c.urlParams_.Set("prettyPrint", "false") 4187 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4188 urls += "?" + c.urlParams_.Encode() 4189 req, err := http.NewRequest("POST", urls, body) 4190 if err != nil { 4191 return nil, err 4192 } 4193 req.Header = reqHeaders 4194 googleapi.Expand(req.URL, map[string]string{ 4195 "courseId": c.courseId, 4196 }) 4197 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4198} 4199 4200// Do executes the "classroom.courses.aliases.create" call. 4201// Exactly one of *CourseAlias or error will be non-nil. Any non-2xx 4202// status code is an error. Response headers are in either 4203// *CourseAlias.ServerResponse.Header or (if a response was returned at 4204// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4205// to check whether the returned error was because 4206// http.StatusNotModified was returned. 4207func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) { 4208 gensupport.SetOptions(c.urlParams_, opts...) 4209 res, err := c.doRequest("json") 4210 if res != nil && res.StatusCode == http.StatusNotModified { 4211 if res.Body != nil { 4212 res.Body.Close() 4213 } 4214 return nil, &googleapi.Error{ 4215 Code: res.StatusCode, 4216 Header: res.Header, 4217 } 4218 } 4219 if err != nil { 4220 return nil, err 4221 } 4222 defer googleapi.CloseBody(res) 4223 if err := googleapi.CheckResponse(res); err != nil { 4224 return nil, err 4225 } 4226 ret := &CourseAlias{ 4227 ServerResponse: googleapi.ServerResponse{ 4228 Header: res.Header, 4229 HTTPStatusCode: res.StatusCode, 4230 }, 4231 } 4232 target := &ret 4233 if err := gensupport.DecodeResponse(target, res); err != nil { 4234 return nil, err 4235 } 4236 return ret, nil 4237 // { 4238 // "description": "Creates an alias for a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create the alias or for access errors. * `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the alias already exists. * `FAILED_PRECONDITION` if the alias requested does not make sense for the requesting user or course (for example, if a user not in a domain attempts to access a domain-scoped alias).", 4239 // "flatPath": "v1/courses/{courseId}/aliases", 4240 // "httpMethod": "POST", 4241 // "id": "classroom.courses.aliases.create", 4242 // "parameterOrder": [ 4243 // "courseId" 4244 // ], 4245 // "parameters": { 4246 // "courseId": { 4247 // "description": "Identifier of the course to alias. This identifier can be either the Classroom-assigned identifier or an alias.", 4248 // "location": "path", 4249 // "required": true, 4250 // "type": "string" 4251 // } 4252 // }, 4253 // "path": "v1/courses/{courseId}/aliases", 4254 // "request": { 4255 // "$ref": "CourseAlias" 4256 // }, 4257 // "response": { 4258 // "$ref": "CourseAlias" 4259 // }, 4260 // "scopes": [ 4261 // "https://www.googleapis.com/auth/classroom.courses" 4262 // ] 4263 // } 4264 4265} 4266 4267// method id "classroom.courses.aliases.delete": 4268 4269type CoursesAliasesDeleteCall struct { 4270 s *Service 4271 courseId string 4272 aliasid string 4273 urlParams_ gensupport.URLParams 4274 ctx_ context.Context 4275 header_ http.Header 4276} 4277 4278// Delete: Deletes an alias of a course. This method returns the 4279// following error codes: * `PERMISSION_DENIED` if the requesting user 4280// is not permitted to remove the alias or for access errors. * 4281// `NOT_FOUND` if the alias does not exist. * `FAILED_PRECONDITION` if 4282// the alias requested does not make sense for the requesting user or 4283// course (for example, if a user not in a domain attempts to delete a 4284// domain-scoped alias). 4285// 4286// - alias: Alias to delete. This may not be the Classroom-assigned 4287// identifier. 4288// - courseId: Identifier of the course whose alias should be deleted. 4289// This identifier can be either the Classroom-assigned identifier or 4290// an alias. 4291func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall { 4292 c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4293 c.courseId = courseId 4294 c.aliasid = aliasid 4295 return c 4296} 4297 4298// Fields allows partial responses to be retrieved. See 4299// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4300// for more information. 4301func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall { 4302 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4303 return c 4304} 4305 4306// Context sets the context to be used in this call's Do method. Any 4307// pending HTTP request will be aborted if the provided context is 4308// canceled. 4309func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall { 4310 c.ctx_ = ctx 4311 return c 4312} 4313 4314// Header returns an http.Header that can be modified by the caller to 4315// add HTTP headers to the request. 4316func (c *CoursesAliasesDeleteCall) Header() http.Header { 4317 if c.header_ == nil { 4318 c.header_ = make(http.Header) 4319 } 4320 return c.header_ 4321} 4322 4323func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) { 4324 reqHeaders := make(http.Header) 4325 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4326 for k, v := range c.header_ { 4327 reqHeaders[k] = v 4328 } 4329 reqHeaders.Set("User-Agent", c.s.userAgent()) 4330 var body io.Reader = nil 4331 c.urlParams_.Set("alt", alt) 4332 c.urlParams_.Set("prettyPrint", "false") 4333 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}") 4334 urls += "?" + c.urlParams_.Encode() 4335 req, err := http.NewRequest("DELETE", urls, body) 4336 if err != nil { 4337 return nil, err 4338 } 4339 req.Header = reqHeaders 4340 googleapi.Expand(req.URL, map[string]string{ 4341 "courseId": c.courseId, 4342 "alias": c.aliasid, 4343 }) 4344 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4345} 4346 4347// Do executes the "classroom.courses.aliases.delete" call. 4348// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4349// code is an error. Response headers are in either 4350// *Empty.ServerResponse.Header or (if a response was returned at all) 4351// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4352// check whether the returned error was because http.StatusNotModified 4353// was returned. 4354func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4355 gensupport.SetOptions(c.urlParams_, opts...) 4356 res, err := c.doRequest("json") 4357 if res != nil && res.StatusCode == http.StatusNotModified { 4358 if res.Body != nil { 4359 res.Body.Close() 4360 } 4361 return nil, &googleapi.Error{ 4362 Code: res.StatusCode, 4363 Header: res.Header, 4364 } 4365 } 4366 if err != nil { 4367 return nil, err 4368 } 4369 defer googleapi.CloseBody(res) 4370 if err := googleapi.CheckResponse(res); err != nil { 4371 return nil, err 4372 } 4373 ret := &Empty{ 4374 ServerResponse: googleapi.ServerResponse{ 4375 Header: res.Header, 4376 HTTPStatusCode: res.StatusCode, 4377 }, 4378 } 4379 target := &ret 4380 if err := gensupport.DecodeResponse(target, res); err != nil { 4381 return nil, err 4382 } 4383 return ret, nil 4384 // { 4385 // "description": "Deletes an alias of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to remove the alias or for access errors. * `NOT_FOUND` if the alias does not exist. * `FAILED_PRECONDITION` if the alias requested does not make sense for the requesting user or course (for example, if a user not in a domain attempts to delete a domain-scoped alias).", 4386 // "flatPath": "v1/courses/{courseId}/aliases/{alias}", 4387 // "httpMethod": "DELETE", 4388 // "id": "classroom.courses.aliases.delete", 4389 // "parameterOrder": [ 4390 // "courseId", 4391 // "alias" 4392 // ], 4393 // "parameters": { 4394 // "alias": { 4395 // "description": "Alias to delete. This may not be the Classroom-assigned identifier.", 4396 // "location": "path", 4397 // "required": true, 4398 // "type": "string" 4399 // }, 4400 // "courseId": { 4401 // "description": "Identifier of the course whose alias should be deleted. This identifier can be either the Classroom-assigned identifier or an alias.", 4402 // "location": "path", 4403 // "required": true, 4404 // "type": "string" 4405 // } 4406 // }, 4407 // "path": "v1/courses/{courseId}/aliases/{alias}", 4408 // "response": { 4409 // "$ref": "Empty" 4410 // }, 4411 // "scopes": [ 4412 // "https://www.googleapis.com/auth/classroom.courses" 4413 // ] 4414 // } 4415 4416} 4417 4418// method id "classroom.courses.aliases.list": 4419 4420type CoursesAliasesListCall struct { 4421 s *Service 4422 courseId string 4423 urlParams_ gensupport.URLParams 4424 ifNoneMatch_ string 4425 ctx_ context.Context 4426 header_ http.Header 4427} 4428 4429// List: Returns a list of aliases for a course. This method returns the 4430// following error codes: * `PERMISSION_DENIED` if the requesting user 4431// is not permitted to access the course or for access errors. * 4432// `NOT_FOUND` if the course does not exist. 4433// 4434// - courseId: The identifier of the course. This identifier can be 4435// either the Classroom-assigned identifier or an alias. 4436func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall { 4437 c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4438 c.courseId = courseId 4439 return c 4440} 4441 4442// PageSize sets the optional parameter "pageSize": Maximum number of 4443// items to return. Zero or unspecified indicates that the server may 4444// assign a maximum. The server may return fewer than the specified 4445// number of results. 4446func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall { 4447 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4448 return c 4449} 4450 4451// PageToken sets the optional parameter "pageToken": nextPageToken 4452// value returned from a previous list call, indicating that the 4453// subsequent page of results should be returned. The list request must 4454// be otherwise identical to the one that resulted in this token. 4455func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall { 4456 c.urlParams_.Set("pageToken", pageToken) 4457 return c 4458} 4459 4460// Fields allows partial responses to be retrieved. See 4461// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4462// for more information. 4463func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall { 4464 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4465 return c 4466} 4467 4468// IfNoneMatch sets the optional parameter which makes the operation 4469// fail if the object's ETag matches the given value. This is useful for 4470// getting updates only after the object has changed since the last 4471// request. Use googleapi.IsNotModified to check whether the response 4472// error from Do is the result of In-None-Match. 4473func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall { 4474 c.ifNoneMatch_ = entityTag 4475 return c 4476} 4477 4478// Context sets the context to be used in this call's Do method. Any 4479// pending HTTP request will be aborted if the provided context is 4480// canceled. 4481func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall { 4482 c.ctx_ = ctx 4483 return c 4484} 4485 4486// Header returns an http.Header that can be modified by the caller to 4487// add HTTP headers to the request. 4488func (c *CoursesAliasesListCall) Header() http.Header { 4489 if c.header_ == nil { 4490 c.header_ = make(http.Header) 4491 } 4492 return c.header_ 4493} 4494 4495func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) { 4496 reqHeaders := make(http.Header) 4497 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4498 for k, v := range c.header_ { 4499 reqHeaders[k] = v 4500 } 4501 reqHeaders.Set("User-Agent", c.s.userAgent()) 4502 if c.ifNoneMatch_ != "" { 4503 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4504 } 4505 var body io.Reader = nil 4506 c.urlParams_.Set("alt", alt) 4507 c.urlParams_.Set("prettyPrint", "false") 4508 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4509 urls += "?" + c.urlParams_.Encode() 4510 req, err := http.NewRequest("GET", urls, body) 4511 if err != nil { 4512 return nil, err 4513 } 4514 req.Header = reqHeaders 4515 googleapi.Expand(req.URL, map[string]string{ 4516 "courseId": c.courseId, 4517 }) 4518 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4519} 4520 4521// Do executes the "classroom.courses.aliases.list" call. 4522// Exactly one of *ListCourseAliasesResponse or error will be non-nil. 4523// Any non-2xx status code is an error. Response headers are in either 4524// *ListCourseAliasesResponse.ServerResponse.Header or (if a response 4525// was returned at all) in error.(*googleapi.Error).Header. Use 4526// googleapi.IsNotModified to check whether the returned error was 4527// because http.StatusNotModified was returned. 4528func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) { 4529 gensupport.SetOptions(c.urlParams_, opts...) 4530 res, err := c.doRequest("json") 4531 if res != nil && res.StatusCode == http.StatusNotModified { 4532 if res.Body != nil { 4533 res.Body.Close() 4534 } 4535 return nil, &googleapi.Error{ 4536 Code: res.StatusCode, 4537 Header: res.Header, 4538 } 4539 } 4540 if err != nil { 4541 return nil, err 4542 } 4543 defer googleapi.CloseBody(res) 4544 if err := googleapi.CheckResponse(res); err != nil { 4545 return nil, err 4546 } 4547 ret := &ListCourseAliasesResponse{ 4548 ServerResponse: googleapi.ServerResponse{ 4549 Header: res.Header, 4550 HTTPStatusCode: res.StatusCode, 4551 }, 4552 } 4553 target := &ret 4554 if err := gensupport.DecodeResponse(target, res); err != nil { 4555 return nil, err 4556 } 4557 return ret, nil 4558 // { 4559 // "description": "Returns a list of aliases for a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the course or for access errors. * `NOT_FOUND` if the course does not exist.", 4560 // "flatPath": "v1/courses/{courseId}/aliases", 4561 // "httpMethod": "GET", 4562 // "id": "classroom.courses.aliases.list", 4563 // "parameterOrder": [ 4564 // "courseId" 4565 // ], 4566 // "parameters": { 4567 // "courseId": { 4568 // "description": "The identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 4569 // "location": "path", 4570 // "required": true, 4571 // "type": "string" 4572 // }, 4573 // "pageSize": { 4574 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 4575 // "format": "int32", 4576 // "location": "query", 4577 // "type": "integer" 4578 // }, 4579 // "pageToken": { 4580 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 4581 // "location": "query", 4582 // "type": "string" 4583 // } 4584 // }, 4585 // "path": "v1/courses/{courseId}/aliases", 4586 // "response": { 4587 // "$ref": "ListCourseAliasesResponse" 4588 // }, 4589 // "scopes": [ 4590 // "https://www.googleapis.com/auth/classroom.courses", 4591 // "https://www.googleapis.com/auth/classroom.courses.readonly" 4592 // ] 4593 // } 4594 4595} 4596 4597// Pages invokes f for each page of results. 4598// A non-nil error returned from f will halt the iteration. 4599// The provided context supersedes any context provided to the Context method. 4600func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error { 4601 c.ctx_ = ctx 4602 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4603 for { 4604 x, err := c.Do() 4605 if err != nil { 4606 return err 4607 } 4608 if err := f(x); err != nil { 4609 return err 4610 } 4611 if x.NextPageToken == "" { 4612 return nil 4613 } 4614 c.PageToken(x.NextPageToken) 4615 } 4616} 4617 4618// method id "classroom.courses.announcements.create": 4619 4620type CoursesAnnouncementsCreateCall struct { 4621 s *Service 4622 courseId string 4623 announcement *Announcement 4624 urlParams_ gensupport.URLParams 4625 ctx_ context.Context 4626 header_ http.Header 4627} 4628 4629// Create: Creates an announcement. This method returns the following 4630// error codes: * `PERMISSION_DENIED` if the requesting user is not 4631// permitted to access the requested course, create announcements in the 4632// requested course, share a Drive attachment, or for access errors. * 4633// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 4634// requested course does not exist. * `FAILED_PRECONDITION` for the 4635// following request error: * AttachmentNotVisible 4636// 4637// - courseId: Identifier of the course. This identifier can be either 4638// the Classroom-assigned identifier or an alias. 4639func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall { 4640 c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4641 c.courseId = courseId 4642 c.announcement = announcement 4643 return c 4644} 4645 4646// Fields allows partial responses to be retrieved. See 4647// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4648// for more information. 4649func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall { 4650 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4651 return c 4652} 4653 4654// Context sets the context to be used in this call's Do method. Any 4655// pending HTTP request will be aborted if the provided context is 4656// canceled. 4657func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall { 4658 c.ctx_ = ctx 4659 return c 4660} 4661 4662// Header returns an http.Header that can be modified by the caller to 4663// add HTTP headers to the request. 4664func (c *CoursesAnnouncementsCreateCall) Header() http.Header { 4665 if c.header_ == nil { 4666 c.header_ = make(http.Header) 4667 } 4668 return c.header_ 4669} 4670 4671func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) { 4672 reqHeaders := make(http.Header) 4673 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4674 for k, v := range c.header_ { 4675 reqHeaders[k] = v 4676 } 4677 reqHeaders.Set("User-Agent", c.s.userAgent()) 4678 var body io.Reader = nil 4679 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 4680 if err != nil { 4681 return nil, err 4682 } 4683 reqHeaders.Set("Content-Type", "application/json") 4684 c.urlParams_.Set("alt", alt) 4685 c.urlParams_.Set("prettyPrint", "false") 4686 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 4687 urls += "?" + c.urlParams_.Encode() 4688 req, err := http.NewRequest("POST", urls, body) 4689 if err != nil { 4690 return nil, err 4691 } 4692 req.Header = reqHeaders 4693 googleapi.Expand(req.URL, map[string]string{ 4694 "courseId": c.courseId, 4695 }) 4696 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4697} 4698 4699// Do executes the "classroom.courses.announcements.create" call. 4700// Exactly one of *Announcement or error will be non-nil. Any non-2xx 4701// status code is an error. Response headers are in either 4702// *Announcement.ServerResponse.Header or (if a response was returned at 4703// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4704// to check whether the returned error was because 4705// http.StatusNotModified was returned. 4706func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 4707 gensupport.SetOptions(c.urlParams_, opts...) 4708 res, err := c.doRequest("json") 4709 if res != nil && res.StatusCode == http.StatusNotModified { 4710 if res.Body != nil { 4711 res.Body.Close() 4712 } 4713 return nil, &googleapi.Error{ 4714 Code: res.StatusCode, 4715 Header: res.Header, 4716 } 4717 } 4718 if err != nil { 4719 return nil, err 4720 } 4721 defer googleapi.CloseBody(res) 4722 if err := googleapi.CheckResponse(res); err != nil { 4723 return nil, err 4724 } 4725 ret := &Announcement{ 4726 ServerResponse: googleapi.ServerResponse{ 4727 Header: res.Header, 4728 HTTPStatusCode: res.StatusCode, 4729 }, 4730 } 4731 target := &ret 4732 if err := gensupport.DecodeResponse(target, res); err != nil { 4733 return nil, err 4734 } 4735 return ret, nil 4736 // { 4737 // "description": "Creates an announcement. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create announcements in the requested course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible", 4738 // "flatPath": "v1/courses/{courseId}/announcements", 4739 // "httpMethod": "POST", 4740 // "id": "classroom.courses.announcements.create", 4741 // "parameterOrder": [ 4742 // "courseId" 4743 // ], 4744 // "parameters": { 4745 // "courseId": { 4746 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 4747 // "location": "path", 4748 // "required": true, 4749 // "type": "string" 4750 // } 4751 // }, 4752 // "path": "v1/courses/{courseId}/announcements", 4753 // "request": { 4754 // "$ref": "Announcement" 4755 // }, 4756 // "response": { 4757 // "$ref": "Announcement" 4758 // }, 4759 // "scopes": [ 4760 // "https://www.googleapis.com/auth/classroom.announcements" 4761 // ] 4762 // } 4763 4764} 4765 4766// method id "classroom.courses.announcements.delete": 4767 4768type CoursesAnnouncementsDeleteCall struct { 4769 s *Service 4770 courseId string 4771 id string 4772 urlParams_ gensupport.URLParams 4773 ctx_ context.Context 4774 header_ http.Header 4775} 4776 4777// Delete: Deletes an announcement. This request must be made by the 4778// Developer Console project of the OAuth client ID 4779// (https://support.google.com/cloud/answer/6158849) used to create the 4780// corresponding announcement item. This method returns the following 4781// error codes: * `PERMISSION_DENIED` if the requesting developer 4782// project did not create the corresponding announcement, if the 4783// requesting user is not permitted to delete the requested course or 4784// for access errors. * `FAILED_PRECONDITION` if the requested 4785// announcement has already been deleted. * `NOT_FOUND` if no course 4786// exists with the requested ID. 4787// 4788// - courseId: Identifier of the course. This identifier can be either 4789// the Classroom-assigned identifier or an alias. 4790// - id: Identifier of the announcement to delete. This identifier is a 4791// Classroom-assigned identifier. 4792func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall { 4793 c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4794 c.courseId = courseId 4795 c.id = id 4796 return c 4797} 4798 4799// Fields allows partial responses to be retrieved. See 4800// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4801// for more information. 4802func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall { 4803 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4804 return c 4805} 4806 4807// Context sets the context to be used in this call's Do method. Any 4808// pending HTTP request will be aborted if the provided context is 4809// canceled. 4810func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall { 4811 c.ctx_ = ctx 4812 return c 4813} 4814 4815// Header returns an http.Header that can be modified by the caller to 4816// add HTTP headers to the request. 4817func (c *CoursesAnnouncementsDeleteCall) Header() http.Header { 4818 if c.header_ == nil { 4819 c.header_ = make(http.Header) 4820 } 4821 return c.header_ 4822} 4823 4824func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) { 4825 reqHeaders := make(http.Header) 4826 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4827 for k, v := range c.header_ { 4828 reqHeaders[k] = v 4829 } 4830 reqHeaders.Set("User-Agent", c.s.userAgent()) 4831 var body io.Reader = nil 4832 c.urlParams_.Set("alt", alt) 4833 c.urlParams_.Set("prettyPrint", "false") 4834 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 4835 urls += "?" + c.urlParams_.Encode() 4836 req, err := http.NewRequest("DELETE", urls, body) 4837 if err != nil { 4838 return nil, err 4839 } 4840 req.Header = reqHeaders 4841 googleapi.Expand(req.URL, map[string]string{ 4842 "courseId": c.courseId, 4843 "id": c.id, 4844 }) 4845 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4846} 4847 4848// Do executes the "classroom.courses.announcements.delete" call. 4849// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4850// code is an error. Response headers are in either 4851// *Empty.ServerResponse.Header or (if a response was returned at all) 4852// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4853// check whether the returned error was because http.StatusNotModified 4854// was returned. 4855func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4856 gensupport.SetOptions(c.urlParams_, opts...) 4857 res, err := c.doRequest("json") 4858 if res != nil && res.StatusCode == http.StatusNotModified { 4859 if res.Body != nil { 4860 res.Body.Close() 4861 } 4862 return nil, &googleapi.Error{ 4863 Code: res.StatusCode, 4864 Header: res.Header, 4865 } 4866 } 4867 if err != nil { 4868 return nil, err 4869 } 4870 defer googleapi.CloseBody(res) 4871 if err := googleapi.CheckResponse(res); err != nil { 4872 return nil, err 4873 } 4874 ret := &Empty{ 4875 ServerResponse: googleapi.ServerResponse{ 4876 Header: res.Header, 4877 HTTPStatusCode: res.StatusCode, 4878 }, 4879 } 4880 target := &ret 4881 if err := gensupport.DecodeResponse(target, res); err != nil { 4882 return nil, err 4883 } 4884 return ret, nil 4885 // { 4886 // "description": "Deletes an announcement. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding announcement item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding announcement, if the requesting user is not permitted to delete the requested course or for access errors. * `FAILED_PRECONDITION` if the requested announcement has already been deleted. * `NOT_FOUND` if no course exists with the requested ID.", 4887 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 4888 // "httpMethod": "DELETE", 4889 // "id": "classroom.courses.announcements.delete", 4890 // "parameterOrder": [ 4891 // "courseId", 4892 // "id" 4893 // ], 4894 // "parameters": { 4895 // "courseId": { 4896 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 4897 // "location": "path", 4898 // "required": true, 4899 // "type": "string" 4900 // }, 4901 // "id": { 4902 // "description": "Identifier of the announcement to delete. This identifier is a Classroom-assigned identifier.", 4903 // "location": "path", 4904 // "required": true, 4905 // "type": "string" 4906 // } 4907 // }, 4908 // "path": "v1/courses/{courseId}/announcements/{id}", 4909 // "response": { 4910 // "$ref": "Empty" 4911 // }, 4912 // "scopes": [ 4913 // "https://www.googleapis.com/auth/classroom.announcements" 4914 // ] 4915 // } 4916 4917} 4918 4919// method id "classroom.courses.announcements.get": 4920 4921type CoursesAnnouncementsGetCall struct { 4922 s *Service 4923 courseId string 4924 id string 4925 urlParams_ gensupport.URLParams 4926 ifNoneMatch_ string 4927 ctx_ context.Context 4928 header_ http.Header 4929} 4930 4931// Get: Returns an announcement. This method returns the following error 4932// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 4933// to access the requested course or announcement, or for access errors. 4934// * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if 4935// the requested course or announcement does not exist. 4936// 4937// - courseId: Identifier of the course. This identifier can be either 4938// the Classroom-assigned identifier or an alias. 4939// - id: Identifier of the announcement. 4940func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall { 4941 c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4942 c.courseId = courseId 4943 c.id = id 4944 return c 4945} 4946 4947// Fields allows partial responses to be retrieved. See 4948// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4949// for more information. 4950func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall { 4951 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4952 return c 4953} 4954 4955// IfNoneMatch sets the optional parameter which makes the operation 4956// fail if the object's ETag matches the given value. This is useful for 4957// getting updates only after the object has changed since the last 4958// request. Use googleapi.IsNotModified to check whether the response 4959// error from Do is the result of In-None-Match. 4960func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall { 4961 c.ifNoneMatch_ = entityTag 4962 return c 4963} 4964 4965// Context sets the context to be used in this call's Do method. Any 4966// pending HTTP request will be aborted if the provided context is 4967// canceled. 4968func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall { 4969 c.ctx_ = ctx 4970 return c 4971} 4972 4973// Header returns an http.Header that can be modified by the caller to 4974// add HTTP headers to the request. 4975func (c *CoursesAnnouncementsGetCall) Header() http.Header { 4976 if c.header_ == nil { 4977 c.header_ = make(http.Header) 4978 } 4979 return c.header_ 4980} 4981 4982func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) { 4983 reqHeaders := make(http.Header) 4984 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 4985 for k, v := range c.header_ { 4986 reqHeaders[k] = v 4987 } 4988 reqHeaders.Set("User-Agent", c.s.userAgent()) 4989 if c.ifNoneMatch_ != "" { 4990 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4991 } 4992 var body io.Reader = nil 4993 c.urlParams_.Set("alt", alt) 4994 c.urlParams_.Set("prettyPrint", "false") 4995 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 4996 urls += "?" + c.urlParams_.Encode() 4997 req, err := http.NewRequest("GET", urls, body) 4998 if err != nil { 4999 return nil, err 5000 } 5001 req.Header = reqHeaders 5002 googleapi.Expand(req.URL, map[string]string{ 5003 "courseId": c.courseId, 5004 "id": c.id, 5005 }) 5006 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5007} 5008 5009// Do executes the "classroom.courses.announcements.get" call. 5010// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5011// status code is an error. Response headers are in either 5012// *Announcement.ServerResponse.Header or (if a response was returned at 5013// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5014// to check whether the returned error was because 5015// http.StatusNotModified was returned. 5016func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5017 gensupport.SetOptions(c.urlParams_, opts...) 5018 res, err := c.doRequest("json") 5019 if res != nil && res.StatusCode == http.StatusNotModified { 5020 if res.Body != nil { 5021 res.Body.Close() 5022 } 5023 return nil, &googleapi.Error{ 5024 Code: res.StatusCode, 5025 Header: res.Header, 5026 } 5027 } 5028 if err != nil { 5029 return nil, err 5030 } 5031 defer googleapi.CloseBody(res) 5032 if err := googleapi.CheckResponse(res); err != nil { 5033 return nil, err 5034 } 5035 ret := &Announcement{ 5036 ServerResponse: googleapi.ServerResponse{ 5037 Header: res.Header, 5038 HTTPStatusCode: res.StatusCode, 5039 }, 5040 } 5041 target := &ret 5042 if err := gensupport.DecodeResponse(target, res); err != nil { 5043 return nil, err 5044 } 5045 return ret, nil 5046 // { 5047 // "description": "Returns an announcement. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or announcement, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or announcement does not exist.", 5048 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5049 // "httpMethod": "GET", 5050 // "id": "classroom.courses.announcements.get", 5051 // "parameterOrder": [ 5052 // "courseId", 5053 // "id" 5054 // ], 5055 // "parameters": { 5056 // "courseId": { 5057 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5058 // "location": "path", 5059 // "required": true, 5060 // "type": "string" 5061 // }, 5062 // "id": { 5063 // "description": "Identifier of the announcement.", 5064 // "location": "path", 5065 // "required": true, 5066 // "type": "string" 5067 // } 5068 // }, 5069 // "path": "v1/courses/{courseId}/announcements/{id}", 5070 // "response": { 5071 // "$ref": "Announcement" 5072 // }, 5073 // "scopes": [ 5074 // "https://www.googleapis.com/auth/classroom.announcements", 5075 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5076 // ] 5077 // } 5078 5079} 5080 5081// method id "classroom.courses.announcements.list": 5082 5083type CoursesAnnouncementsListCall struct { 5084 s *Service 5085 courseId string 5086 urlParams_ gensupport.URLParams 5087 ifNoneMatch_ string 5088 ctx_ context.Context 5089 header_ http.Header 5090} 5091 5092// List: Returns a list of announcements that the requester is permitted 5093// to view. Course students may only view `PUBLISHED` announcements. 5094// Course teachers and domain administrators may view all announcements. 5095// This method returns the following error codes: * `PERMISSION_DENIED` 5096// if the requesting user is not permitted to access the requested 5097// course or for access errors. * `INVALID_ARGUMENT` if the request is 5098// malformed. * `NOT_FOUND` if the requested course does not exist. 5099// 5100// - courseId: Identifier of the course. This identifier can be either 5101// the Classroom-assigned identifier or an alias. 5102func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall { 5103 c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5104 c.courseId = courseId 5105 return c 5106} 5107 5108// AnnouncementStates sets the optional parameter "announcementStates": 5109// Restriction on the `state` of announcements returned. If this 5110// argument is left unspecified, the default value is `PUBLISHED`. 5111// 5112// Possible values: 5113// "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 5114// never returned. 5115// "PUBLISHED" - Status for announcement that has been published. This 5116// is the default state. 5117// "DRAFT" - Status for an announcement that is not yet published. 5118// Announcement in this state is visible only to course teachers and 5119// domain administrators. 5120// "DELETED" - Status for announcement that was published but is now 5121// deleted. Announcement in this state is visible only to course 5122// teachers and domain administrators. Announcement in this state is 5123// deleted after some time. 5124func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall { 5125 c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...)) 5126 return c 5127} 5128 5129// OrderBy sets the optional parameter "orderBy": Optional sort ordering 5130// for results. A comma-separated list of fields with an optional sort 5131// direction keyword. Supported field is `updateTime`. Supported 5132// direction keywords are `asc` and `desc`. If not specified, 5133// `updateTime desc` is the default behavior. Examples: `updateTime 5134// asc`, `updateTime` 5135func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall { 5136 c.urlParams_.Set("orderBy", orderBy) 5137 return c 5138} 5139 5140// PageSize sets the optional parameter "pageSize": Maximum number of 5141// items to return. Zero or unspecified indicates that the server may 5142// assign a maximum. The server may return fewer than the specified 5143// number of results. 5144func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall { 5145 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5146 return c 5147} 5148 5149// PageToken sets the optional parameter "pageToken": nextPageToken 5150// value returned from a previous list call, indicating that the 5151// subsequent page of results should be returned. The list request must 5152// be otherwise identical to the one that resulted in this token. 5153func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall { 5154 c.urlParams_.Set("pageToken", pageToken) 5155 return c 5156} 5157 5158// Fields allows partial responses to be retrieved. See 5159// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5160// for more information. 5161func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall { 5162 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5163 return c 5164} 5165 5166// IfNoneMatch sets the optional parameter which makes the operation 5167// fail if the object's ETag matches the given value. This is useful for 5168// getting updates only after the object has changed since the last 5169// request. Use googleapi.IsNotModified to check whether the response 5170// error from Do is the result of In-None-Match. 5171func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall { 5172 c.ifNoneMatch_ = entityTag 5173 return c 5174} 5175 5176// Context sets the context to be used in this call's Do method. Any 5177// pending HTTP request will be aborted if the provided context is 5178// canceled. 5179func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall { 5180 c.ctx_ = ctx 5181 return c 5182} 5183 5184// Header returns an http.Header that can be modified by the caller to 5185// add HTTP headers to the request. 5186func (c *CoursesAnnouncementsListCall) Header() http.Header { 5187 if c.header_ == nil { 5188 c.header_ = make(http.Header) 5189 } 5190 return c.header_ 5191} 5192 5193func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) { 5194 reqHeaders := make(http.Header) 5195 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 5196 for k, v := range c.header_ { 5197 reqHeaders[k] = v 5198 } 5199 reqHeaders.Set("User-Agent", c.s.userAgent()) 5200 if c.ifNoneMatch_ != "" { 5201 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5202 } 5203 var body io.Reader = nil 5204 c.urlParams_.Set("alt", alt) 5205 c.urlParams_.Set("prettyPrint", "false") 5206 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 5207 urls += "?" + c.urlParams_.Encode() 5208 req, err := http.NewRequest("GET", urls, body) 5209 if err != nil { 5210 return nil, err 5211 } 5212 req.Header = reqHeaders 5213 googleapi.Expand(req.URL, map[string]string{ 5214 "courseId": c.courseId, 5215 }) 5216 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5217} 5218 5219// Do executes the "classroom.courses.announcements.list" call. 5220// Exactly one of *ListAnnouncementsResponse or error will be non-nil. 5221// Any non-2xx status code is an error. Response headers are in either 5222// *ListAnnouncementsResponse.ServerResponse.Header or (if a response 5223// was returned at all) in error.(*googleapi.Error).Header. Use 5224// googleapi.IsNotModified to check whether the returned error was 5225// because http.StatusNotModified was returned. 5226func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) { 5227 gensupport.SetOptions(c.urlParams_, opts...) 5228 res, err := c.doRequest("json") 5229 if res != nil && res.StatusCode == http.StatusNotModified { 5230 if res.Body != nil { 5231 res.Body.Close() 5232 } 5233 return nil, &googleapi.Error{ 5234 Code: res.StatusCode, 5235 Header: res.Header, 5236 } 5237 } 5238 if err != nil { 5239 return nil, err 5240 } 5241 defer googleapi.CloseBody(res) 5242 if err := googleapi.CheckResponse(res); err != nil { 5243 return nil, err 5244 } 5245 ret := &ListAnnouncementsResponse{ 5246 ServerResponse: googleapi.ServerResponse{ 5247 Header: res.Header, 5248 HTTPStatusCode: res.StatusCode, 5249 }, 5250 } 5251 target := &ret 5252 if err := gensupport.DecodeResponse(target, res); err != nil { 5253 return nil, err 5254 } 5255 return ret, nil 5256 // { 5257 // "description": "Returns a list of announcements that the requester is permitted to view. Course students may only view `PUBLISHED` announcements. Course teachers and domain administrators may view all announcements. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 5258 // "flatPath": "v1/courses/{courseId}/announcements", 5259 // "httpMethod": "GET", 5260 // "id": "classroom.courses.announcements.list", 5261 // "parameterOrder": [ 5262 // "courseId" 5263 // ], 5264 // "parameters": { 5265 // "announcementStates": { 5266 // "description": "Restriction on the `state` of announcements returned. If this argument is left unspecified, the default value is `PUBLISHED`.", 5267 // "enum": [ 5268 // "ANNOUNCEMENT_STATE_UNSPECIFIED", 5269 // "PUBLISHED", 5270 // "DRAFT", 5271 // "DELETED" 5272 // ], 5273 // "enumDescriptions": [ 5274 // "No state specified. This is never returned.", 5275 // "Status for announcement that has been published. This is the default state.", 5276 // "Status for an announcement that is not yet published. Announcement in this state is visible only to course teachers and domain administrators.", 5277 // "Status for announcement that was published but is now deleted. Announcement in this state is visible only to course teachers and domain administrators. Announcement in this state is deleted after some time." 5278 // ], 5279 // "location": "query", 5280 // "repeated": true, 5281 // "type": "string" 5282 // }, 5283 // "courseId": { 5284 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5285 // "location": "path", 5286 // "required": true, 5287 // "type": "string" 5288 // }, 5289 // "orderBy": { 5290 // "description": "Optional sort ordering for results. A comma-separated list of fields with an optional sort direction keyword. Supported field is `updateTime`. Supported direction keywords are `asc` and `desc`. If not specified, `updateTime desc` is the default behavior. Examples: `updateTime asc`, `updateTime`", 5291 // "location": "query", 5292 // "type": "string" 5293 // }, 5294 // "pageSize": { 5295 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 5296 // "format": "int32", 5297 // "location": "query", 5298 // "type": "integer" 5299 // }, 5300 // "pageToken": { 5301 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 5302 // "location": "query", 5303 // "type": "string" 5304 // } 5305 // }, 5306 // "path": "v1/courses/{courseId}/announcements", 5307 // "response": { 5308 // "$ref": "ListAnnouncementsResponse" 5309 // }, 5310 // "scopes": [ 5311 // "https://www.googleapis.com/auth/classroom.announcements", 5312 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5313 // ] 5314 // } 5315 5316} 5317 5318// Pages invokes f for each page of results. 5319// A non-nil error returned from f will halt the iteration. 5320// The provided context supersedes any context provided to the Context method. 5321func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error { 5322 c.ctx_ = ctx 5323 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5324 for { 5325 x, err := c.Do() 5326 if err != nil { 5327 return err 5328 } 5329 if err := f(x); err != nil { 5330 return err 5331 } 5332 if x.NextPageToken == "" { 5333 return nil 5334 } 5335 c.PageToken(x.NextPageToken) 5336 } 5337} 5338 5339// method id "classroom.courses.announcements.modifyAssignees": 5340 5341type CoursesAnnouncementsModifyAssigneesCall struct { 5342 s *Service 5343 courseId string 5344 id string 5345 modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest 5346 urlParams_ gensupport.URLParams 5347 ctx_ context.Context 5348 header_ http.Header 5349} 5350 5351// ModifyAssignees: Modifies assignee mode and options of an 5352// announcement. Only a teacher of the course that contains the 5353// announcement may call this method. This method returns the following 5354// error codes: * `PERMISSION_DENIED` if the requesting user is not 5355// permitted to access the requested course or course work or for access 5356// errors. * `INVALID_ARGUMENT` if the request is malformed. * 5357// `NOT_FOUND` if the requested course or course work does not exist. 5358// 5359// - courseId: Identifier of the course. This identifier can be either 5360// the Classroom-assigned identifier or an alias. 5361// - id: Identifier of the announcement. 5362func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall { 5363 c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5364 c.courseId = courseId 5365 c.id = id 5366 c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest 5367 return c 5368} 5369 5370// Fields allows partial responses to be retrieved. See 5371// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5372// for more information. 5373func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall { 5374 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5375 return c 5376} 5377 5378// Context sets the context to be used in this call's Do method. Any 5379// pending HTTP request will be aborted if the provided context is 5380// canceled. 5381func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall { 5382 c.ctx_ = ctx 5383 return c 5384} 5385 5386// Header returns an http.Header that can be modified by the caller to 5387// add HTTP headers to the request. 5388func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header { 5389 if c.header_ == nil { 5390 c.header_ = make(http.Header) 5391 } 5392 return c.header_ 5393} 5394 5395func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 5396 reqHeaders := make(http.Header) 5397 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 5398 for k, v := range c.header_ { 5399 reqHeaders[k] = v 5400 } 5401 reqHeaders.Set("User-Agent", c.s.userAgent()) 5402 var body io.Reader = nil 5403 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest) 5404 if err != nil { 5405 return nil, err 5406 } 5407 reqHeaders.Set("Content-Type", "application/json") 5408 c.urlParams_.Set("alt", alt) 5409 c.urlParams_.Set("prettyPrint", "false") 5410 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees") 5411 urls += "?" + c.urlParams_.Encode() 5412 req, err := http.NewRequest("POST", urls, body) 5413 if err != nil { 5414 return nil, err 5415 } 5416 req.Header = reqHeaders 5417 googleapi.Expand(req.URL, map[string]string{ 5418 "courseId": c.courseId, 5419 "id": c.id, 5420 }) 5421 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5422} 5423 5424// Do executes the "classroom.courses.announcements.modifyAssignees" call. 5425// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5426// status code is an error. Response headers are in either 5427// *Announcement.ServerResponse.Header or (if a response was returned at 5428// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5429// to check whether the returned error was because 5430// http.StatusNotModified was returned. 5431func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5432 gensupport.SetOptions(c.urlParams_, opts...) 5433 res, err := c.doRequest("json") 5434 if res != nil && res.StatusCode == http.StatusNotModified { 5435 if res.Body != nil { 5436 res.Body.Close() 5437 } 5438 return nil, &googleapi.Error{ 5439 Code: res.StatusCode, 5440 Header: res.Header, 5441 } 5442 } 5443 if err != nil { 5444 return nil, err 5445 } 5446 defer googleapi.CloseBody(res) 5447 if err := googleapi.CheckResponse(res); err != nil { 5448 return nil, err 5449 } 5450 ret := &Announcement{ 5451 ServerResponse: googleapi.ServerResponse{ 5452 Header: res.Header, 5453 HTTPStatusCode: res.StatusCode, 5454 }, 5455 } 5456 target := &ret 5457 if err := gensupport.DecodeResponse(target, res); err != nil { 5458 return nil, err 5459 } 5460 return ret, nil 5461 // { 5462 // "description": "Modifies assignee mode and options of an announcement. Only a teacher of the course that contains the announcement may call this method. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work does not exist.", 5463 // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5464 // "httpMethod": "POST", 5465 // "id": "classroom.courses.announcements.modifyAssignees", 5466 // "parameterOrder": [ 5467 // "courseId", 5468 // "id" 5469 // ], 5470 // "parameters": { 5471 // "courseId": { 5472 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5473 // "location": "path", 5474 // "required": true, 5475 // "type": "string" 5476 // }, 5477 // "id": { 5478 // "description": "Identifier of the announcement.", 5479 // "location": "path", 5480 // "required": true, 5481 // "type": "string" 5482 // } 5483 // }, 5484 // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5485 // "request": { 5486 // "$ref": "ModifyAnnouncementAssigneesRequest" 5487 // }, 5488 // "response": { 5489 // "$ref": "Announcement" 5490 // }, 5491 // "scopes": [ 5492 // "https://www.googleapis.com/auth/classroom.announcements" 5493 // ] 5494 // } 5495 5496} 5497 5498// method id "classroom.courses.announcements.patch": 5499 5500type CoursesAnnouncementsPatchCall struct { 5501 s *Service 5502 courseId string 5503 id string 5504 announcement *Announcement 5505 urlParams_ gensupport.URLParams 5506 ctx_ context.Context 5507 header_ http.Header 5508} 5509 5510// Patch: Updates one or more fields of an announcement. This method 5511// returns the following error codes: * `PERMISSION_DENIED` if the 5512// requesting developer project did not create the corresponding 5513// announcement or for access errors. * `INVALID_ARGUMENT` if the 5514// request is malformed. * `FAILED_PRECONDITION` if the requested 5515// announcement has already been deleted. * `NOT_FOUND` if the requested 5516// course or announcement does not exist 5517// 5518// - courseId: Identifier of the course. This identifier can be either 5519// the Classroom-assigned identifier or an alias. 5520// - id: Identifier of the announcement. 5521func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall { 5522 c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5523 c.courseId = courseId 5524 c.id = id 5525 c.announcement = announcement 5526 return c 5527} 5528 5529// UpdateMask sets the optional parameter "updateMask": Mask that 5530// identifies which fields on the announcement to update. This field is 5531// required to do an update. The update fails if invalid fields are 5532// specified. If a field supports empty values, it can be cleared by 5533// specifying it in the update mask and not in the Announcement object. 5534// If a field that does not support empty values is included in the 5535// update mask and not set in the Announcement object, an 5536// `INVALID_ARGUMENT` error is returned. The following fields may be 5537// specified by teachers: * `text` * `state` * `scheduled_time` 5538func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall { 5539 c.urlParams_.Set("updateMask", updateMask) 5540 return c 5541} 5542 5543// Fields allows partial responses to be retrieved. See 5544// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5545// for more information. 5546func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall { 5547 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5548 return c 5549} 5550 5551// Context sets the context to be used in this call's Do method. Any 5552// pending HTTP request will be aborted if the provided context is 5553// canceled. 5554func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall { 5555 c.ctx_ = ctx 5556 return c 5557} 5558 5559// Header returns an http.Header that can be modified by the caller to 5560// add HTTP headers to the request. 5561func (c *CoursesAnnouncementsPatchCall) Header() http.Header { 5562 if c.header_ == nil { 5563 c.header_ = make(http.Header) 5564 } 5565 return c.header_ 5566} 5567 5568func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) { 5569 reqHeaders := make(http.Header) 5570 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 5571 for k, v := range c.header_ { 5572 reqHeaders[k] = v 5573 } 5574 reqHeaders.Set("User-Agent", c.s.userAgent()) 5575 var body io.Reader = nil 5576 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 5577 if err != nil { 5578 return nil, err 5579 } 5580 reqHeaders.Set("Content-Type", "application/json") 5581 c.urlParams_.Set("alt", alt) 5582 c.urlParams_.Set("prettyPrint", "false") 5583 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5584 urls += "?" + c.urlParams_.Encode() 5585 req, err := http.NewRequest("PATCH", urls, body) 5586 if err != nil { 5587 return nil, err 5588 } 5589 req.Header = reqHeaders 5590 googleapi.Expand(req.URL, map[string]string{ 5591 "courseId": c.courseId, 5592 "id": c.id, 5593 }) 5594 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5595} 5596 5597// Do executes the "classroom.courses.announcements.patch" call. 5598// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5599// status code is an error. Response headers are in either 5600// *Announcement.ServerResponse.Header or (if a response was returned at 5601// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5602// to check whether the returned error was because 5603// http.StatusNotModified was returned. 5604func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5605 gensupport.SetOptions(c.urlParams_, opts...) 5606 res, err := c.doRequest("json") 5607 if res != nil && res.StatusCode == http.StatusNotModified { 5608 if res.Body != nil { 5609 res.Body.Close() 5610 } 5611 return nil, &googleapi.Error{ 5612 Code: res.StatusCode, 5613 Header: res.Header, 5614 } 5615 } 5616 if err != nil { 5617 return nil, err 5618 } 5619 defer googleapi.CloseBody(res) 5620 if err := googleapi.CheckResponse(res); err != nil { 5621 return nil, err 5622 } 5623 ret := &Announcement{ 5624 ServerResponse: googleapi.ServerResponse{ 5625 Header: res.Header, 5626 HTTPStatusCode: res.StatusCode, 5627 }, 5628 } 5629 target := &ret 5630 if err := gensupport.DecodeResponse(target, res); err != nil { 5631 return nil, err 5632 } 5633 return ret, nil 5634 // { 5635 // "description": "Updates one or more fields of an announcement. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding announcement or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the requested announcement has already been deleted. * `NOT_FOUND` if the requested course or announcement does not exist", 5636 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5637 // "httpMethod": "PATCH", 5638 // "id": "classroom.courses.announcements.patch", 5639 // "parameterOrder": [ 5640 // "courseId", 5641 // "id" 5642 // ], 5643 // "parameters": { 5644 // "courseId": { 5645 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5646 // "location": "path", 5647 // "required": true, 5648 // "type": "string" 5649 // }, 5650 // "id": { 5651 // "description": "Identifier of the announcement.", 5652 // "location": "path", 5653 // "required": true, 5654 // "type": "string" 5655 // }, 5656 // "updateMask": { 5657 // "description": "Mask that identifies which fields on the announcement to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the Announcement object. If a field that does not support empty values is included in the update mask and not set in the Announcement object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified by teachers: * `text` * `state` * `scheduled_time`", 5658 // "format": "google-fieldmask", 5659 // "location": "query", 5660 // "type": "string" 5661 // } 5662 // }, 5663 // "path": "v1/courses/{courseId}/announcements/{id}", 5664 // "request": { 5665 // "$ref": "Announcement" 5666 // }, 5667 // "response": { 5668 // "$ref": "Announcement" 5669 // }, 5670 // "scopes": [ 5671 // "https://www.googleapis.com/auth/classroom.announcements" 5672 // ] 5673 // } 5674 5675} 5676 5677// method id "classroom.courses.courseWork.create": 5678 5679type CoursesCourseWorkCreateCall struct { 5680 s *Service 5681 courseId string 5682 coursework *CourseWork 5683 urlParams_ gensupport.URLParams 5684 ctx_ context.Context 5685 header_ http.Header 5686} 5687 5688// Create: Creates course work. The resulting course work (and 5689// corresponding student submissions) are associated with the Developer 5690// Console project of the OAuth client ID 5691// (https://support.google.com/cloud/answer/6158849) used to make the 5692// request. Classroom API requests to modify course work and student 5693// submissions must be made with an OAuth client ID from the associated 5694// Developer Console project. This method returns the following error 5695// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 5696// to access the requested course, create course work in the requested 5697// course, share a Drive attachment, or for access errors. * 5698// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 5699// requested course does not exist. * `FAILED_PRECONDITION` for the 5700// following request error: * AttachmentNotVisible 5701// 5702// - courseId: Identifier of the course. This identifier can be either 5703// the Classroom-assigned identifier or an alias. 5704func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall { 5705 c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5706 c.courseId = courseId 5707 c.coursework = coursework 5708 return c 5709} 5710 5711// Fields allows partial responses to be retrieved. See 5712// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5713// for more information. 5714func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall { 5715 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5716 return c 5717} 5718 5719// Context sets the context to be used in this call's Do method. Any 5720// pending HTTP request will be aborted if the provided context is 5721// canceled. 5722func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall { 5723 c.ctx_ = ctx 5724 return c 5725} 5726 5727// Header returns an http.Header that can be modified by the caller to 5728// add HTTP headers to the request. 5729func (c *CoursesCourseWorkCreateCall) Header() http.Header { 5730 if c.header_ == nil { 5731 c.header_ = make(http.Header) 5732 } 5733 return c.header_ 5734} 5735 5736func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) { 5737 reqHeaders := make(http.Header) 5738 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 5739 for k, v := range c.header_ { 5740 reqHeaders[k] = v 5741 } 5742 reqHeaders.Set("User-Agent", c.s.userAgent()) 5743 var body io.Reader = nil 5744 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 5745 if err != nil { 5746 return nil, err 5747 } 5748 reqHeaders.Set("Content-Type", "application/json") 5749 c.urlParams_.Set("alt", alt) 5750 c.urlParams_.Set("prettyPrint", "false") 5751 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 5752 urls += "?" + c.urlParams_.Encode() 5753 req, err := http.NewRequest("POST", urls, body) 5754 if err != nil { 5755 return nil, err 5756 } 5757 req.Header = reqHeaders 5758 googleapi.Expand(req.URL, map[string]string{ 5759 "courseId": c.courseId, 5760 }) 5761 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5762} 5763 5764// Do executes the "classroom.courses.courseWork.create" call. 5765// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 5766// status code is an error. Response headers are in either 5767// *CourseWork.ServerResponse.Header or (if a response was returned at 5768// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5769// to check whether the returned error was because 5770// http.StatusNotModified was returned. 5771func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 5772 gensupport.SetOptions(c.urlParams_, opts...) 5773 res, err := c.doRequest("json") 5774 if res != nil && res.StatusCode == http.StatusNotModified { 5775 if res.Body != nil { 5776 res.Body.Close() 5777 } 5778 return nil, &googleapi.Error{ 5779 Code: res.StatusCode, 5780 Header: res.Header, 5781 } 5782 } 5783 if err != nil { 5784 return nil, err 5785 } 5786 defer googleapi.CloseBody(res) 5787 if err := googleapi.CheckResponse(res); err != nil { 5788 return nil, err 5789 } 5790 ret := &CourseWork{ 5791 ServerResponse: googleapi.ServerResponse{ 5792 Header: res.Header, 5793 HTTPStatusCode: res.StatusCode, 5794 }, 5795 } 5796 target := &ret 5797 if err := gensupport.DecodeResponse(target, res); err != nil { 5798 return nil, err 5799 } 5800 return ret, nil 5801 // { 5802 // "description": "Creates course work. The resulting course work (and corresponding student submissions) are associated with the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to make the request. Classroom API requests to modify course work and student submissions must be made with an OAuth client ID from the associated Developer Console project. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create course work in the requested course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible", 5803 // "flatPath": "v1/courses/{courseId}/courseWork", 5804 // "httpMethod": "POST", 5805 // "id": "classroom.courses.courseWork.create", 5806 // "parameterOrder": [ 5807 // "courseId" 5808 // ], 5809 // "parameters": { 5810 // "courseId": { 5811 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5812 // "location": "path", 5813 // "required": true, 5814 // "type": "string" 5815 // } 5816 // }, 5817 // "path": "v1/courses/{courseId}/courseWork", 5818 // "request": { 5819 // "$ref": "CourseWork" 5820 // }, 5821 // "response": { 5822 // "$ref": "CourseWork" 5823 // }, 5824 // "scopes": [ 5825 // "https://www.googleapis.com/auth/classroom.coursework.students" 5826 // ] 5827 // } 5828 5829} 5830 5831// method id "classroom.courses.courseWork.delete": 5832 5833type CoursesCourseWorkDeleteCall struct { 5834 s *Service 5835 courseId string 5836 id string 5837 urlParams_ gensupport.URLParams 5838 ctx_ context.Context 5839 header_ http.Header 5840} 5841 5842// Delete: Deletes a course work. This request must be made by the 5843// Developer Console project of the OAuth client ID 5844// (https://support.google.com/cloud/answer/6158849) used to create the 5845// corresponding course work item. This method returns the following 5846// error codes: * `PERMISSION_DENIED` if the requesting developer 5847// project did not create the corresponding course work, if the 5848// requesting user is not permitted to delete the requested course or 5849// for access errors. * `FAILED_PRECONDITION` if the requested course 5850// work has already been deleted. * `NOT_FOUND` if no course exists with 5851// the requested ID. 5852// 5853// - courseId: Identifier of the course. This identifier can be either 5854// the Classroom-assigned identifier or an alias. 5855// - id: Identifier of the course work to delete. This identifier is a 5856// Classroom-assigned identifier. 5857func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall { 5858 c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5859 c.courseId = courseId 5860 c.id = id 5861 return c 5862} 5863 5864// Fields allows partial responses to be retrieved. See 5865// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5866// for more information. 5867func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall { 5868 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5869 return c 5870} 5871 5872// Context sets the context to be used in this call's Do method. Any 5873// pending HTTP request will be aborted if the provided context is 5874// canceled. 5875func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall { 5876 c.ctx_ = ctx 5877 return c 5878} 5879 5880// Header returns an http.Header that can be modified by the caller to 5881// add HTTP headers to the request. 5882func (c *CoursesCourseWorkDeleteCall) Header() http.Header { 5883 if c.header_ == nil { 5884 c.header_ = make(http.Header) 5885 } 5886 return c.header_ 5887} 5888 5889func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) { 5890 reqHeaders := make(http.Header) 5891 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 5892 for k, v := range c.header_ { 5893 reqHeaders[k] = v 5894 } 5895 reqHeaders.Set("User-Agent", c.s.userAgent()) 5896 var body io.Reader = nil 5897 c.urlParams_.Set("alt", alt) 5898 c.urlParams_.Set("prettyPrint", "false") 5899 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 5900 urls += "?" + c.urlParams_.Encode() 5901 req, err := http.NewRequest("DELETE", urls, body) 5902 if err != nil { 5903 return nil, err 5904 } 5905 req.Header = reqHeaders 5906 googleapi.Expand(req.URL, map[string]string{ 5907 "courseId": c.courseId, 5908 "id": c.id, 5909 }) 5910 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5911} 5912 5913// Do executes the "classroom.courses.courseWork.delete" call. 5914// Exactly one of *Empty or error will be non-nil. Any non-2xx status 5915// code is an error. Response headers are in either 5916// *Empty.ServerResponse.Header or (if a response was returned at all) 5917// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5918// check whether the returned error was because http.StatusNotModified 5919// was returned. 5920func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 5921 gensupport.SetOptions(c.urlParams_, opts...) 5922 res, err := c.doRequest("json") 5923 if res != nil && res.StatusCode == http.StatusNotModified { 5924 if res.Body != nil { 5925 res.Body.Close() 5926 } 5927 return nil, &googleapi.Error{ 5928 Code: res.StatusCode, 5929 Header: res.Header, 5930 } 5931 } 5932 if err != nil { 5933 return nil, err 5934 } 5935 defer googleapi.CloseBody(res) 5936 if err := googleapi.CheckResponse(res); err != nil { 5937 return nil, err 5938 } 5939 ret := &Empty{ 5940 ServerResponse: googleapi.ServerResponse{ 5941 Header: res.Header, 5942 HTTPStatusCode: res.StatusCode, 5943 }, 5944 } 5945 target := &ret 5946 if err := gensupport.DecodeResponse(target, res); err != nil { 5947 return nil, err 5948 } 5949 return ret, nil 5950 // { 5951 // "description": "Deletes a course work. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the requesting user is not permitted to delete the requested course or for access errors. * `FAILED_PRECONDITION` if the requested course work has already been deleted. * `NOT_FOUND` if no course exists with the requested ID.", 5952 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 5953 // "httpMethod": "DELETE", 5954 // "id": "classroom.courses.courseWork.delete", 5955 // "parameterOrder": [ 5956 // "courseId", 5957 // "id" 5958 // ], 5959 // "parameters": { 5960 // "courseId": { 5961 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5962 // "location": "path", 5963 // "required": true, 5964 // "type": "string" 5965 // }, 5966 // "id": { 5967 // "description": "Identifier of the course work to delete. This identifier is a Classroom-assigned identifier.", 5968 // "location": "path", 5969 // "required": true, 5970 // "type": "string" 5971 // } 5972 // }, 5973 // "path": "v1/courses/{courseId}/courseWork/{id}", 5974 // "response": { 5975 // "$ref": "Empty" 5976 // }, 5977 // "scopes": [ 5978 // "https://www.googleapis.com/auth/classroom.coursework.students" 5979 // ] 5980 // } 5981 5982} 5983 5984// method id "classroom.courses.courseWork.get": 5985 5986type CoursesCourseWorkGetCall struct { 5987 s *Service 5988 courseId string 5989 id string 5990 urlParams_ gensupport.URLParams 5991 ifNoneMatch_ string 5992 ctx_ context.Context 5993 header_ http.Header 5994} 5995 5996// Get: Returns course work. This method returns the following error 5997// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 5998// to access the requested course or course work, or for access errors. 5999// * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if 6000// the requested course or course work does not exist. 6001// 6002// - courseId: Identifier of the course. This identifier can be either 6003// the Classroom-assigned identifier or an alias. 6004// - id: Identifier of the course work. 6005func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall { 6006 c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6007 c.courseId = courseId 6008 c.id = id 6009 return c 6010} 6011 6012// Fields allows partial responses to be retrieved. See 6013// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6014// for more information. 6015func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall { 6016 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6017 return c 6018} 6019 6020// IfNoneMatch sets the optional parameter which makes the operation 6021// fail if the object's ETag matches the given value. This is useful for 6022// getting updates only after the object has changed since the last 6023// request. Use googleapi.IsNotModified to check whether the response 6024// error from Do is the result of In-None-Match. 6025func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall { 6026 c.ifNoneMatch_ = entityTag 6027 return c 6028} 6029 6030// Context sets the context to be used in this call's Do method. Any 6031// pending HTTP request will be aborted if the provided context is 6032// canceled. 6033func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall { 6034 c.ctx_ = ctx 6035 return c 6036} 6037 6038// Header returns an http.Header that can be modified by the caller to 6039// add HTTP headers to the request. 6040func (c *CoursesCourseWorkGetCall) Header() http.Header { 6041 if c.header_ == nil { 6042 c.header_ = make(http.Header) 6043 } 6044 return c.header_ 6045} 6046 6047func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) { 6048 reqHeaders := make(http.Header) 6049 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 6050 for k, v := range c.header_ { 6051 reqHeaders[k] = v 6052 } 6053 reqHeaders.Set("User-Agent", c.s.userAgent()) 6054 if c.ifNoneMatch_ != "" { 6055 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6056 } 6057 var body io.Reader = nil 6058 c.urlParams_.Set("alt", alt) 6059 c.urlParams_.Set("prettyPrint", "false") 6060 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6061 urls += "?" + c.urlParams_.Encode() 6062 req, err := http.NewRequest("GET", urls, body) 6063 if err != nil { 6064 return nil, err 6065 } 6066 req.Header = reqHeaders 6067 googleapi.Expand(req.URL, map[string]string{ 6068 "courseId": c.courseId, 6069 "id": c.id, 6070 }) 6071 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6072} 6073 6074// Do executes the "classroom.courses.courseWork.get" call. 6075// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6076// status code is an error. Response headers are in either 6077// *CourseWork.ServerResponse.Header or (if a response was returned at 6078// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6079// to check whether the returned error was because 6080// http.StatusNotModified was returned. 6081func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6082 gensupport.SetOptions(c.urlParams_, opts...) 6083 res, err := c.doRequest("json") 6084 if res != nil && res.StatusCode == http.StatusNotModified { 6085 if res.Body != nil { 6086 res.Body.Close() 6087 } 6088 return nil, &googleapi.Error{ 6089 Code: res.StatusCode, 6090 Header: res.Header, 6091 } 6092 } 6093 if err != nil { 6094 return nil, err 6095 } 6096 defer googleapi.CloseBody(res) 6097 if err := googleapi.CheckResponse(res); err != nil { 6098 return nil, err 6099 } 6100 ret := &CourseWork{ 6101 ServerResponse: googleapi.ServerResponse{ 6102 Header: res.Header, 6103 HTTPStatusCode: res.StatusCode, 6104 }, 6105 } 6106 target := &ret 6107 if err := gensupport.DecodeResponse(target, res); err != nil { 6108 return nil, err 6109 } 6110 return ret, nil 6111 // { 6112 // "description": "Returns course work. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work does not exist.", 6113 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6114 // "httpMethod": "GET", 6115 // "id": "classroom.courses.courseWork.get", 6116 // "parameterOrder": [ 6117 // "courseId", 6118 // "id" 6119 // ], 6120 // "parameters": { 6121 // "courseId": { 6122 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6123 // "location": "path", 6124 // "required": true, 6125 // "type": "string" 6126 // }, 6127 // "id": { 6128 // "description": "Identifier of the course work.", 6129 // "location": "path", 6130 // "required": true, 6131 // "type": "string" 6132 // } 6133 // }, 6134 // "path": "v1/courses/{courseId}/courseWork/{id}", 6135 // "response": { 6136 // "$ref": "CourseWork" 6137 // }, 6138 // "scopes": [ 6139 // "https://www.googleapis.com/auth/classroom.coursework.me", 6140 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6141 // "https://www.googleapis.com/auth/classroom.coursework.students", 6142 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6143 // ] 6144 // } 6145 6146} 6147 6148// method id "classroom.courses.courseWork.list": 6149 6150type CoursesCourseWorkListCall struct { 6151 s *Service 6152 courseId string 6153 urlParams_ gensupport.URLParams 6154 ifNoneMatch_ string 6155 ctx_ context.Context 6156 header_ http.Header 6157} 6158 6159// List: Returns a list of course work that the requester is permitted 6160// to view. Course students may only view `PUBLISHED` course work. 6161// Course teachers and domain administrators may view all course work. 6162// This method returns the following error codes: * `PERMISSION_DENIED` 6163// if the requesting user is not permitted to access the requested 6164// course or for access errors. * `INVALID_ARGUMENT` if the request is 6165// malformed. * `NOT_FOUND` if the requested course does not exist. 6166// 6167// - courseId: Identifier of the course. This identifier can be either 6168// the Classroom-assigned identifier or an alias. 6169func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall { 6170 c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6171 c.courseId = courseId 6172 return c 6173} 6174 6175// CourseWorkStates sets the optional parameter "courseWorkStates": 6176// Restriction on the work status to return. Only courseWork that 6177// matches is returned. If unspecified, items with a work status of 6178// `PUBLISHED` is returned. 6179// 6180// Possible values: 6181// "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 6182// returned. 6183// "PUBLISHED" - Status for work that has been published. This is the 6184// default state. 6185// "DRAFT" - Status for work that is not yet published. Work in this 6186// state is visible only to course teachers and domain administrators. 6187// "DELETED" - Status for work that was published but is now deleted. 6188// Work in this state is visible only to course teachers and domain 6189// administrators. Work in this state is deleted after some time. 6190func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall { 6191 c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...)) 6192 return c 6193} 6194 6195// OrderBy sets the optional parameter "orderBy": Optional sort ordering 6196// for results. A comma-separated list of fields with an optional sort 6197// direction keyword. Supported fields are `updateTime` and `dueDate`. 6198// Supported direction keywords are `asc` and `desc`. If not specified, 6199// `updateTime desc` is the default behavior. Examples: `dueDate 6200// asc,updateTime desc`, `updateTime,dueDate desc` 6201func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall { 6202 c.urlParams_.Set("orderBy", orderBy) 6203 return c 6204} 6205 6206// PageSize sets the optional parameter "pageSize": Maximum number of 6207// items to return. Zero or unspecified indicates that the server may 6208// assign a maximum. The server may return fewer than the specified 6209// number of results. 6210func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall { 6211 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6212 return c 6213} 6214 6215// PageToken sets the optional parameter "pageToken": nextPageToken 6216// value returned from a previous list call, indicating that the 6217// subsequent page of results should be returned. The list request must 6218// be otherwise identical to the one that resulted in this token. 6219func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall { 6220 c.urlParams_.Set("pageToken", pageToken) 6221 return c 6222} 6223 6224// Fields allows partial responses to be retrieved. See 6225// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6226// for more information. 6227func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall { 6228 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6229 return c 6230} 6231 6232// IfNoneMatch sets the optional parameter which makes the operation 6233// fail if the object's ETag matches the given value. This is useful for 6234// getting updates only after the object has changed since the last 6235// request. Use googleapi.IsNotModified to check whether the response 6236// error from Do is the result of In-None-Match. 6237func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall { 6238 c.ifNoneMatch_ = entityTag 6239 return c 6240} 6241 6242// Context sets the context to be used in this call's Do method. Any 6243// pending HTTP request will be aborted if the provided context is 6244// canceled. 6245func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall { 6246 c.ctx_ = ctx 6247 return c 6248} 6249 6250// Header returns an http.Header that can be modified by the caller to 6251// add HTTP headers to the request. 6252func (c *CoursesCourseWorkListCall) Header() http.Header { 6253 if c.header_ == nil { 6254 c.header_ = make(http.Header) 6255 } 6256 return c.header_ 6257} 6258 6259func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) { 6260 reqHeaders := make(http.Header) 6261 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 6262 for k, v := range c.header_ { 6263 reqHeaders[k] = v 6264 } 6265 reqHeaders.Set("User-Agent", c.s.userAgent()) 6266 if c.ifNoneMatch_ != "" { 6267 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6268 } 6269 var body io.Reader = nil 6270 c.urlParams_.Set("alt", alt) 6271 c.urlParams_.Set("prettyPrint", "false") 6272 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6273 urls += "?" + c.urlParams_.Encode() 6274 req, err := http.NewRequest("GET", urls, body) 6275 if err != nil { 6276 return nil, err 6277 } 6278 req.Header = reqHeaders 6279 googleapi.Expand(req.URL, map[string]string{ 6280 "courseId": c.courseId, 6281 }) 6282 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6283} 6284 6285// Do executes the "classroom.courses.courseWork.list" call. 6286// Exactly one of *ListCourseWorkResponse or error will be non-nil. Any 6287// non-2xx status code is an error. Response headers are in either 6288// *ListCourseWorkResponse.ServerResponse.Header or (if a response was 6289// returned at all) in error.(*googleapi.Error).Header. Use 6290// googleapi.IsNotModified to check whether the returned error was 6291// because http.StatusNotModified was returned. 6292func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) { 6293 gensupport.SetOptions(c.urlParams_, opts...) 6294 res, err := c.doRequest("json") 6295 if res != nil && res.StatusCode == http.StatusNotModified { 6296 if res.Body != nil { 6297 res.Body.Close() 6298 } 6299 return nil, &googleapi.Error{ 6300 Code: res.StatusCode, 6301 Header: res.Header, 6302 } 6303 } 6304 if err != nil { 6305 return nil, err 6306 } 6307 defer googleapi.CloseBody(res) 6308 if err := googleapi.CheckResponse(res); err != nil { 6309 return nil, err 6310 } 6311 ret := &ListCourseWorkResponse{ 6312 ServerResponse: googleapi.ServerResponse{ 6313 Header: res.Header, 6314 HTTPStatusCode: res.StatusCode, 6315 }, 6316 } 6317 target := &ret 6318 if err := gensupport.DecodeResponse(target, res); err != nil { 6319 return nil, err 6320 } 6321 return ret, nil 6322 // { 6323 // "description": "Returns a list of course work that the requester is permitted to view. Course students may only view `PUBLISHED` course work. Course teachers and domain administrators may view all course work. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 6324 // "flatPath": "v1/courses/{courseId}/courseWork", 6325 // "httpMethod": "GET", 6326 // "id": "classroom.courses.courseWork.list", 6327 // "parameterOrder": [ 6328 // "courseId" 6329 // ], 6330 // "parameters": { 6331 // "courseId": { 6332 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6333 // "location": "path", 6334 // "required": true, 6335 // "type": "string" 6336 // }, 6337 // "courseWorkStates": { 6338 // "description": "Restriction on the work status to return. Only courseWork that matches is returned. If unspecified, items with a work status of `PUBLISHED` is returned.", 6339 // "enum": [ 6340 // "COURSE_WORK_STATE_UNSPECIFIED", 6341 // "PUBLISHED", 6342 // "DRAFT", 6343 // "DELETED" 6344 // ], 6345 // "enumDescriptions": [ 6346 // "No state specified. This is never returned.", 6347 // "Status for work that has been published. This is the default state.", 6348 // "Status for work that is not yet published. Work in this state is visible only to course teachers and domain administrators.", 6349 // "Status for work that was published but is now deleted. Work in this state is visible only to course teachers and domain administrators. Work in this state is deleted after some time." 6350 // ], 6351 // "location": "query", 6352 // "repeated": true, 6353 // "type": "string" 6354 // }, 6355 // "orderBy": { 6356 // "description": "Optional sort ordering for results. A comma-separated list of fields with an optional sort direction keyword. Supported fields are `updateTime` and `dueDate`. Supported direction keywords are `asc` and `desc`. If not specified, `updateTime desc` is the default behavior. Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc`", 6357 // "location": "query", 6358 // "type": "string" 6359 // }, 6360 // "pageSize": { 6361 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 6362 // "format": "int32", 6363 // "location": "query", 6364 // "type": "integer" 6365 // }, 6366 // "pageToken": { 6367 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 6368 // "location": "query", 6369 // "type": "string" 6370 // } 6371 // }, 6372 // "path": "v1/courses/{courseId}/courseWork", 6373 // "response": { 6374 // "$ref": "ListCourseWorkResponse" 6375 // }, 6376 // "scopes": [ 6377 // "https://www.googleapis.com/auth/classroom.coursework.me", 6378 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6379 // "https://www.googleapis.com/auth/classroom.coursework.students", 6380 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6381 // ] 6382 // } 6383 6384} 6385 6386// Pages invokes f for each page of results. 6387// A non-nil error returned from f will halt the iteration. 6388// The provided context supersedes any context provided to the Context method. 6389func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error { 6390 c.ctx_ = ctx 6391 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6392 for { 6393 x, err := c.Do() 6394 if err != nil { 6395 return err 6396 } 6397 if err := f(x); err != nil { 6398 return err 6399 } 6400 if x.NextPageToken == "" { 6401 return nil 6402 } 6403 c.PageToken(x.NextPageToken) 6404 } 6405} 6406 6407// method id "classroom.courses.courseWork.modifyAssignees": 6408 6409type CoursesCourseWorkModifyAssigneesCall struct { 6410 s *Service 6411 courseId string 6412 id string 6413 modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest 6414 urlParams_ gensupport.URLParams 6415 ctx_ context.Context 6416 header_ http.Header 6417} 6418 6419// ModifyAssignees: Modifies assignee mode and options of a coursework. 6420// Only a teacher of the course that contains the coursework may call 6421// this method. This method returns the following error codes: * 6422// `PERMISSION_DENIED` if the requesting user is not permitted to access 6423// the requested course or course work or for access errors. * 6424// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 6425// requested course or course work does not exist. 6426// 6427// - courseId: Identifier of the course. This identifier can be either 6428// the Classroom-assigned identifier or an alias. 6429// - id: Identifier of the coursework. 6430func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall { 6431 c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6432 c.courseId = courseId 6433 c.id = id 6434 c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest 6435 return c 6436} 6437 6438// Fields allows partial responses to be retrieved. See 6439// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6440// for more information. 6441func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall { 6442 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6443 return c 6444} 6445 6446// Context sets the context to be used in this call's Do method. Any 6447// pending HTTP request will be aborted if the provided context is 6448// canceled. 6449func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall { 6450 c.ctx_ = ctx 6451 return c 6452} 6453 6454// Header returns an http.Header that can be modified by the caller to 6455// add HTTP headers to the request. 6456func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header { 6457 if c.header_ == nil { 6458 c.header_ = make(http.Header) 6459 } 6460 return c.header_ 6461} 6462 6463func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 6464 reqHeaders := make(http.Header) 6465 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 6466 for k, v := range c.header_ { 6467 reqHeaders[k] = v 6468 } 6469 reqHeaders.Set("User-Agent", c.s.userAgent()) 6470 var body io.Reader = nil 6471 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest) 6472 if err != nil { 6473 return nil, err 6474 } 6475 reqHeaders.Set("Content-Type", "application/json") 6476 c.urlParams_.Set("alt", alt) 6477 c.urlParams_.Set("prettyPrint", "false") 6478 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees") 6479 urls += "?" + c.urlParams_.Encode() 6480 req, err := http.NewRequest("POST", urls, body) 6481 if err != nil { 6482 return nil, err 6483 } 6484 req.Header = reqHeaders 6485 googleapi.Expand(req.URL, map[string]string{ 6486 "courseId": c.courseId, 6487 "id": c.id, 6488 }) 6489 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6490} 6491 6492// Do executes the "classroom.courses.courseWork.modifyAssignees" call. 6493// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6494// status code is an error. Response headers are in either 6495// *CourseWork.ServerResponse.Header or (if a response was returned at 6496// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6497// to check whether the returned error was because 6498// http.StatusNotModified was returned. 6499func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6500 gensupport.SetOptions(c.urlParams_, opts...) 6501 res, err := c.doRequest("json") 6502 if res != nil && res.StatusCode == http.StatusNotModified { 6503 if res.Body != nil { 6504 res.Body.Close() 6505 } 6506 return nil, &googleapi.Error{ 6507 Code: res.StatusCode, 6508 Header: res.Header, 6509 } 6510 } 6511 if err != nil { 6512 return nil, err 6513 } 6514 defer googleapi.CloseBody(res) 6515 if err := googleapi.CheckResponse(res); err != nil { 6516 return nil, err 6517 } 6518 ret := &CourseWork{ 6519 ServerResponse: googleapi.ServerResponse{ 6520 Header: res.Header, 6521 HTTPStatusCode: res.StatusCode, 6522 }, 6523 } 6524 target := &ret 6525 if err := gensupport.DecodeResponse(target, res); err != nil { 6526 return nil, err 6527 } 6528 return ret, nil 6529 // { 6530 // "description": "Modifies assignee mode and options of a coursework. Only a teacher of the course that contains the coursework may call this method. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work does not exist.", 6531 // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6532 // "httpMethod": "POST", 6533 // "id": "classroom.courses.courseWork.modifyAssignees", 6534 // "parameterOrder": [ 6535 // "courseId", 6536 // "id" 6537 // ], 6538 // "parameters": { 6539 // "courseId": { 6540 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6541 // "location": "path", 6542 // "required": true, 6543 // "type": "string" 6544 // }, 6545 // "id": { 6546 // "description": "Identifier of the coursework.", 6547 // "location": "path", 6548 // "required": true, 6549 // "type": "string" 6550 // } 6551 // }, 6552 // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6553 // "request": { 6554 // "$ref": "ModifyCourseWorkAssigneesRequest" 6555 // }, 6556 // "response": { 6557 // "$ref": "CourseWork" 6558 // }, 6559 // "scopes": [ 6560 // "https://www.googleapis.com/auth/classroom.coursework.students" 6561 // ] 6562 // } 6563 6564} 6565 6566// method id "classroom.courses.courseWork.patch": 6567 6568type CoursesCourseWorkPatchCall struct { 6569 s *Service 6570 courseId string 6571 id string 6572 coursework *CourseWork 6573 urlParams_ gensupport.URLParams 6574 ctx_ context.Context 6575 header_ http.Header 6576} 6577 6578// Patch: Updates one or more fields of a course work. See 6579// google.classroom.v1.CourseWork for details of which fields may be 6580// updated and who may change them. This request must be made by the 6581// Developer Console project of the OAuth client ID 6582// (https://support.google.com/cloud/answer/6158849) used to create the 6583// corresponding course work item. This method returns the following 6584// error codes: * `PERMISSION_DENIED` if the requesting developer 6585// project did not create the corresponding course work, if the user is 6586// not permitted to make the requested modification to the student 6587// submission, or for access errors. * `INVALID_ARGUMENT` if the request 6588// is malformed. * `FAILED_PRECONDITION` if the requested course work 6589// has already been deleted. * `NOT_FOUND` if the requested course, 6590// course work, or student submission does not exist. 6591// 6592// - courseId: Identifier of the course. This identifier can be either 6593// the Classroom-assigned identifier or an alias. 6594// - id: Identifier of the course work. 6595func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall { 6596 c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6597 c.courseId = courseId 6598 c.id = id 6599 c.coursework = coursework 6600 return c 6601} 6602 6603// UpdateMask sets the optional parameter "updateMask": Mask that 6604// identifies which fields on the course work to update. This field is 6605// required to do an update. The update fails if invalid fields are 6606// specified. If a field supports empty values, it can be cleared by 6607// specifying it in the update mask and not in the CourseWork object. If 6608// a field that does not support empty values is included in the update 6609// mask and not set in the CourseWork object, an `INVALID_ARGUMENT` 6610// error is returned. The following fields may be specified by teachers: 6611// * `title` * `description` * `state` * `due_date` * `due_time` * 6612// `max_points` * `scheduled_time` * `submission_modification_mode` * 6613// `topic_id` 6614func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall { 6615 c.urlParams_.Set("updateMask", updateMask) 6616 return c 6617} 6618 6619// Fields allows partial responses to be retrieved. See 6620// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6621// for more information. 6622func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall { 6623 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6624 return c 6625} 6626 6627// Context sets the context to be used in this call's Do method. Any 6628// pending HTTP request will be aborted if the provided context is 6629// canceled. 6630func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall { 6631 c.ctx_ = ctx 6632 return c 6633} 6634 6635// Header returns an http.Header that can be modified by the caller to 6636// add HTTP headers to the request. 6637func (c *CoursesCourseWorkPatchCall) Header() http.Header { 6638 if c.header_ == nil { 6639 c.header_ = make(http.Header) 6640 } 6641 return c.header_ 6642} 6643 6644func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) { 6645 reqHeaders := make(http.Header) 6646 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 6647 for k, v := range c.header_ { 6648 reqHeaders[k] = v 6649 } 6650 reqHeaders.Set("User-Agent", c.s.userAgent()) 6651 var body io.Reader = nil 6652 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6653 if err != nil { 6654 return nil, err 6655 } 6656 reqHeaders.Set("Content-Type", "application/json") 6657 c.urlParams_.Set("alt", alt) 6658 c.urlParams_.Set("prettyPrint", "false") 6659 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6660 urls += "?" + c.urlParams_.Encode() 6661 req, err := http.NewRequest("PATCH", urls, body) 6662 if err != nil { 6663 return nil, err 6664 } 6665 req.Header = reqHeaders 6666 googleapi.Expand(req.URL, map[string]string{ 6667 "courseId": c.courseId, 6668 "id": c.id, 6669 }) 6670 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6671} 6672 6673// Do executes the "classroom.courses.courseWork.patch" call. 6674// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6675// status code is an error. Response headers are in either 6676// *CourseWork.ServerResponse.Header or (if a response was returned at 6677// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6678// to check whether the returned error was because 6679// http.StatusNotModified was returned. 6680func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6681 gensupport.SetOptions(c.urlParams_, opts...) 6682 res, err := c.doRequest("json") 6683 if res != nil && res.StatusCode == http.StatusNotModified { 6684 if res.Body != nil { 6685 res.Body.Close() 6686 } 6687 return nil, &googleapi.Error{ 6688 Code: res.StatusCode, 6689 Header: res.Header, 6690 } 6691 } 6692 if err != nil { 6693 return nil, err 6694 } 6695 defer googleapi.CloseBody(res) 6696 if err := googleapi.CheckResponse(res); err != nil { 6697 return nil, err 6698 } 6699 ret := &CourseWork{ 6700 ServerResponse: googleapi.ServerResponse{ 6701 Header: res.Header, 6702 HTTPStatusCode: res.StatusCode, 6703 }, 6704 } 6705 target := &ret 6706 if err := gensupport.DecodeResponse(target, res); err != nil { 6707 return nil, err 6708 } 6709 return ret, nil 6710 // { 6711 // "description": "Updates one or more fields of a course work. See google.classroom.v1.CourseWork for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the requested course work has already been deleted. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 6712 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6713 // "httpMethod": "PATCH", 6714 // "id": "classroom.courses.courseWork.patch", 6715 // "parameterOrder": [ 6716 // "courseId", 6717 // "id" 6718 // ], 6719 // "parameters": { 6720 // "courseId": { 6721 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6722 // "location": "path", 6723 // "required": true, 6724 // "type": "string" 6725 // }, 6726 // "id": { 6727 // "description": "Identifier of the course work.", 6728 // "location": "path", 6729 // "required": true, 6730 // "type": "string" 6731 // }, 6732 // "updateMask": { 6733 // "description": "Mask that identifies which fields on the course work to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the CourseWork object. If a field that does not support empty values is included in the update mask and not set in the CourseWork object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified by teachers: * `title` * `description` * `state` * `due_date` * `due_time` * `max_points` * `scheduled_time` * `submission_modification_mode` * `topic_id`", 6734 // "format": "google-fieldmask", 6735 // "location": "query", 6736 // "type": "string" 6737 // } 6738 // }, 6739 // "path": "v1/courses/{courseId}/courseWork/{id}", 6740 // "request": { 6741 // "$ref": "CourseWork" 6742 // }, 6743 // "response": { 6744 // "$ref": "CourseWork" 6745 // }, 6746 // "scopes": [ 6747 // "https://www.googleapis.com/auth/classroom.coursework.students" 6748 // ] 6749 // } 6750 6751} 6752 6753// method id "classroom.courses.courseWork.studentSubmissions.get": 6754 6755type CoursesCourseWorkStudentSubmissionsGetCall struct { 6756 s *Service 6757 courseId string 6758 courseWorkId string 6759 id string 6760 urlParams_ gensupport.URLParams 6761 ifNoneMatch_ string 6762 ctx_ context.Context 6763 header_ http.Header 6764} 6765 6766// Get: Returns a student submission. * `PERMISSION_DENIED` if the 6767// requesting user is not permitted to access the requested course, 6768// course work, or student submission or for access errors. * 6769// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 6770// requested course, course work, or student submission does not exist. 6771// 6772// - courseId: Identifier of the course. This identifier can be either 6773// the Classroom-assigned identifier or an alias. 6774// - courseWorkId: Identifier of the course work. 6775// - id: Identifier of the student submission. 6776func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall { 6777 c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6778 c.courseId = courseId 6779 c.courseWorkId = courseWorkId 6780 c.id = id 6781 return c 6782} 6783 6784// Fields allows partial responses to be retrieved. See 6785// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6786// for more information. 6787func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall { 6788 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6789 return c 6790} 6791 6792// IfNoneMatch sets the optional parameter which makes the operation 6793// fail if the object's ETag matches the given value. This is useful for 6794// getting updates only after the object has changed since the last 6795// request. Use googleapi.IsNotModified to check whether the response 6796// error from Do is the result of In-None-Match. 6797func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall { 6798 c.ifNoneMatch_ = entityTag 6799 return c 6800} 6801 6802// Context sets the context to be used in this call's Do method. Any 6803// pending HTTP request will be aborted if the provided context is 6804// canceled. 6805func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall { 6806 c.ctx_ = ctx 6807 return c 6808} 6809 6810// Header returns an http.Header that can be modified by the caller to 6811// add HTTP headers to the request. 6812func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header { 6813 if c.header_ == nil { 6814 c.header_ = make(http.Header) 6815 } 6816 return c.header_ 6817} 6818 6819func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) { 6820 reqHeaders := make(http.Header) 6821 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 6822 for k, v := range c.header_ { 6823 reqHeaders[k] = v 6824 } 6825 reqHeaders.Set("User-Agent", c.s.userAgent()) 6826 if c.ifNoneMatch_ != "" { 6827 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6828 } 6829 var body io.Reader = nil 6830 c.urlParams_.Set("alt", alt) 6831 c.urlParams_.Set("prettyPrint", "false") 6832 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 6833 urls += "?" + c.urlParams_.Encode() 6834 req, err := http.NewRequest("GET", urls, body) 6835 if err != nil { 6836 return nil, err 6837 } 6838 req.Header = reqHeaders 6839 googleapi.Expand(req.URL, map[string]string{ 6840 "courseId": c.courseId, 6841 "courseWorkId": c.courseWorkId, 6842 "id": c.id, 6843 }) 6844 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6845} 6846 6847// Do executes the "classroom.courses.courseWork.studentSubmissions.get" call. 6848// Exactly one of *StudentSubmission or error will be non-nil. Any 6849// non-2xx status code is an error. Response headers are in either 6850// *StudentSubmission.ServerResponse.Header or (if a response was 6851// returned at all) in error.(*googleapi.Error).Header. Use 6852// googleapi.IsNotModified to check whether the returned error was 6853// because http.StatusNotModified was returned. 6854func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 6855 gensupport.SetOptions(c.urlParams_, opts...) 6856 res, err := c.doRequest("json") 6857 if res != nil && res.StatusCode == http.StatusNotModified { 6858 if res.Body != nil { 6859 res.Body.Close() 6860 } 6861 return nil, &googleapi.Error{ 6862 Code: res.StatusCode, 6863 Header: res.Header, 6864 } 6865 } 6866 if err != nil { 6867 return nil, err 6868 } 6869 defer googleapi.CloseBody(res) 6870 if err := googleapi.CheckResponse(res); err != nil { 6871 return nil, err 6872 } 6873 ret := &StudentSubmission{ 6874 ServerResponse: googleapi.ServerResponse{ 6875 Header: res.Header, 6876 HTTPStatusCode: res.StatusCode, 6877 }, 6878 } 6879 target := &ret 6880 if err := gensupport.DecodeResponse(target, res); err != nil { 6881 return nil, err 6882 } 6883 return ret, nil 6884 // { 6885 // "description": "Returns a student submission. * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, course work, or student submission or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 6886 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 6887 // "httpMethod": "GET", 6888 // "id": "classroom.courses.courseWork.studentSubmissions.get", 6889 // "parameterOrder": [ 6890 // "courseId", 6891 // "courseWorkId", 6892 // "id" 6893 // ], 6894 // "parameters": { 6895 // "courseId": { 6896 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6897 // "location": "path", 6898 // "required": true, 6899 // "type": "string" 6900 // }, 6901 // "courseWorkId": { 6902 // "description": "Identifier of the course work.", 6903 // "location": "path", 6904 // "required": true, 6905 // "type": "string" 6906 // }, 6907 // "id": { 6908 // "description": "Identifier of the student submission.", 6909 // "location": "path", 6910 // "required": true, 6911 // "type": "string" 6912 // } 6913 // }, 6914 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 6915 // "response": { 6916 // "$ref": "StudentSubmission" 6917 // }, 6918 // "scopes": [ 6919 // "https://www.googleapis.com/auth/classroom.coursework.me", 6920 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6921 // "https://www.googleapis.com/auth/classroom.coursework.students", 6922 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 6923 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 6924 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 6925 // ] 6926 // } 6927 6928} 6929 6930// method id "classroom.courses.courseWork.studentSubmissions.list": 6931 6932type CoursesCourseWorkStudentSubmissionsListCall struct { 6933 s *Service 6934 courseId string 6935 courseWorkId string 6936 urlParams_ gensupport.URLParams 6937 ifNoneMatch_ string 6938 ctx_ context.Context 6939 header_ http.Header 6940} 6941 6942// List: Returns a list of student submissions that the requester is 6943// permitted to view, factoring in the OAuth scopes of the request. `-` 6944// may be specified as the `course_work_id` to include student 6945// submissions for multiple course work items. Course students may only 6946// view their own work. Course teachers and domain administrators may 6947// view all student submissions. This method returns the following error 6948// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 6949// to access the requested course or course work, or for access errors. 6950// * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if 6951// the requested course does not exist. 6952// 6953// - courseId: Identifier of the course. This identifier can be either 6954// the Classroom-assigned identifier or an alias. 6955// - courseWorkId: Identifier of the student work to request. This may 6956// be set to the string literal "-" to request student work for all 6957// course work in the specified course. 6958func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall { 6959 c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6960 c.courseId = courseId 6961 c.courseWorkId = courseWorkId 6962 return c 6963} 6964 6965// Late sets the optional parameter "late": Requested lateness value. If 6966// specified, returned student submissions are restricted by the 6967// requested value. If unspecified, submissions are returned regardless 6968// of `late` value. 6969// 6970// Possible values: 6971// "LATE_VALUES_UNSPECIFIED" - No restriction on submission late 6972// values specified. 6973// "LATE_ONLY" - Return StudentSubmissions where late is true. 6974// "NOT_LATE_ONLY" - Return StudentSubmissions where late is false. 6975func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall { 6976 c.urlParams_.Set("late", late) 6977 return c 6978} 6979 6980// PageSize sets the optional parameter "pageSize": Maximum number of 6981// items to return. Zero or unspecified indicates that the server may 6982// assign a maximum. The server may return fewer than the specified 6983// number of results. 6984func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall { 6985 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6986 return c 6987} 6988 6989// PageToken sets the optional parameter "pageToken": nextPageToken 6990// value returned from a previous list call, indicating that the 6991// subsequent page of results should be returned. The list request must 6992// be otherwise identical to the one that resulted in this token. 6993func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall { 6994 c.urlParams_.Set("pageToken", pageToken) 6995 return c 6996} 6997 6998// States sets the optional parameter "states": Requested submission 6999// states. If specified, returned student submissions match one of the 7000// specified submission states. 7001// 7002// Possible values: 7003// "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 7004// never be returned. 7005// "NEW" - The student has never accessed this submission. Attachments 7006// are not returned and timestamps is not set. 7007// "CREATED" - Has been created. 7008// "TURNED_IN" - Has been turned in to the teacher. 7009// "RETURNED" - Has been returned to the student. 7010// "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 7011// assignment. 7012func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall { 7013 c.urlParams_.SetMulti("states", append([]string{}, states...)) 7014 return c 7015} 7016 7017// UserId sets the optional parameter "userId": Optional argument to 7018// restrict returned student work to those owned by the student with the 7019// specified identifier. The identifier can be one of the following: * 7020// the numeric identifier for the user * the email address of the user * 7021// the string literal "me", indicating the requesting user 7022func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall { 7023 c.urlParams_.Set("userId", userId) 7024 return c 7025} 7026 7027// Fields allows partial responses to be retrieved. See 7028// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7029// for more information. 7030func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall { 7031 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7032 return c 7033} 7034 7035// IfNoneMatch sets the optional parameter which makes the operation 7036// fail if the object's ETag matches the given value. This is useful for 7037// getting updates only after the object has changed since the last 7038// request. Use googleapi.IsNotModified to check whether the response 7039// error from Do is the result of In-None-Match. 7040func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall { 7041 c.ifNoneMatch_ = entityTag 7042 return c 7043} 7044 7045// Context sets the context to be used in this call's Do method. Any 7046// pending HTTP request will be aborted if the provided context is 7047// canceled. 7048func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall { 7049 c.ctx_ = ctx 7050 return c 7051} 7052 7053// Header returns an http.Header that can be modified by the caller to 7054// add HTTP headers to the request. 7055func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header { 7056 if c.header_ == nil { 7057 c.header_ = make(http.Header) 7058 } 7059 return c.header_ 7060} 7061 7062func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) { 7063 reqHeaders := make(http.Header) 7064 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 7065 for k, v := range c.header_ { 7066 reqHeaders[k] = v 7067 } 7068 reqHeaders.Set("User-Agent", c.s.userAgent()) 7069 if c.ifNoneMatch_ != "" { 7070 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7071 } 7072 var body io.Reader = nil 7073 c.urlParams_.Set("alt", alt) 7074 c.urlParams_.Set("prettyPrint", "false") 7075 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions") 7076 urls += "?" + c.urlParams_.Encode() 7077 req, err := http.NewRequest("GET", urls, body) 7078 if err != nil { 7079 return nil, err 7080 } 7081 req.Header = reqHeaders 7082 googleapi.Expand(req.URL, map[string]string{ 7083 "courseId": c.courseId, 7084 "courseWorkId": c.courseWorkId, 7085 }) 7086 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7087} 7088 7089// Do executes the "classroom.courses.courseWork.studentSubmissions.list" call. 7090// Exactly one of *ListStudentSubmissionsResponse or error will be 7091// non-nil. Any non-2xx status code is an error. Response headers are in 7092// either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a 7093// response was returned at all) in error.(*googleapi.Error).Header. Use 7094// googleapi.IsNotModified to check whether the returned error was 7095// because http.StatusNotModified was returned. 7096func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) { 7097 gensupport.SetOptions(c.urlParams_, opts...) 7098 res, err := c.doRequest("json") 7099 if res != nil && res.StatusCode == http.StatusNotModified { 7100 if res.Body != nil { 7101 res.Body.Close() 7102 } 7103 return nil, &googleapi.Error{ 7104 Code: res.StatusCode, 7105 Header: res.Header, 7106 } 7107 } 7108 if err != nil { 7109 return nil, err 7110 } 7111 defer googleapi.CloseBody(res) 7112 if err := googleapi.CheckResponse(res); err != nil { 7113 return nil, err 7114 } 7115 ret := &ListStudentSubmissionsResponse{ 7116 ServerResponse: googleapi.ServerResponse{ 7117 Header: res.Header, 7118 HTTPStatusCode: res.StatusCode, 7119 }, 7120 } 7121 target := &ret 7122 if err := gensupport.DecodeResponse(target, res); err != nil { 7123 return nil, err 7124 } 7125 return ret, nil 7126 // { 7127 // "description": "Returns a list of student submissions that the requester is permitted to view, factoring in the OAuth scopes of the request. `-` may be specified as the `course_work_id` to include student submissions for multiple course work items. Course students may only view their own work. Course teachers and domain administrators may view all student submissions. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 7128 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7129 // "httpMethod": "GET", 7130 // "id": "classroom.courses.courseWork.studentSubmissions.list", 7131 // "parameterOrder": [ 7132 // "courseId", 7133 // "courseWorkId" 7134 // ], 7135 // "parameters": { 7136 // "courseId": { 7137 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7138 // "location": "path", 7139 // "required": true, 7140 // "type": "string" 7141 // }, 7142 // "courseWorkId": { 7143 // "description": "Identifier of the student work to request. This may be set to the string literal `\"-\"` to request student work for all course work in the specified course.", 7144 // "location": "path", 7145 // "required": true, 7146 // "type": "string" 7147 // }, 7148 // "late": { 7149 // "description": "Requested lateness value. If specified, returned student submissions are restricted by the requested value. If unspecified, submissions are returned regardless of `late` value.", 7150 // "enum": [ 7151 // "LATE_VALUES_UNSPECIFIED", 7152 // "LATE_ONLY", 7153 // "NOT_LATE_ONLY" 7154 // ], 7155 // "enumDescriptions": [ 7156 // "No restriction on submission late values specified.", 7157 // "Return StudentSubmissions where late is true.", 7158 // "Return StudentSubmissions where late is false." 7159 // ], 7160 // "location": "query", 7161 // "type": "string" 7162 // }, 7163 // "pageSize": { 7164 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 7165 // "format": "int32", 7166 // "location": "query", 7167 // "type": "integer" 7168 // }, 7169 // "pageToken": { 7170 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 7171 // "location": "query", 7172 // "type": "string" 7173 // }, 7174 // "states": { 7175 // "description": "Requested submission states. If specified, returned student submissions match one of the specified submission states.", 7176 // "enum": [ 7177 // "SUBMISSION_STATE_UNSPECIFIED", 7178 // "NEW", 7179 // "CREATED", 7180 // "TURNED_IN", 7181 // "RETURNED", 7182 // "RECLAIMED_BY_STUDENT" 7183 // ], 7184 // "enumDescriptions": [ 7185 // "No state specified. This should never be returned.", 7186 // "The student has never accessed this submission. Attachments are not returned and timestamps is not set.", 7187 // "Has been created.", 7188 // "Has been turned in to the teacher.", 7189 // "Has been returned to the student.", 7190 // "Student chose to \"unsubmit\" the assignment." 7191 // ], 7192 // "location": "query", 7193 // "repeated": true, 7194 // "type": "string" 7195 // }, 7196 // "userId": { 7197 // "description": "Optional argument to restrict returned student work to those owned by the student with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 7198 // "location": "query", 7199 // "type": "string" 7200 // } 7201 // }, 7202 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7203 // "response": { 7204 // "$ref": "ListStudentSubmissionsResponse" 7205 // }, 7206 // "scopes": [ 7207 // "https://www.googleapis.com/auth/classroom.coursework.me", 7208 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7209 // "https://www.googleapis.com/auth/classroom.coursework.students", 7210 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7211 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7212 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7213 // ] 7214 // } 7215 7216} 7217 7218// Pages invokes f for each page of results. 7219// A non-nil error returned from f will halt the iteration. 7220// The provided context supersedes any context provided to the Context method. 7221func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error { 7222 c.ctx_ = ctx 7223 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7224 for { 7225 x, err := c.Do() 7226 if err != nil { 7227 return err 7228 } 7229 if err := f(x); err != nil { 7230 return err 7231 } 7232 if x.NextPageToken == "" { 7233 return nil 7234 } 7235 c.PageToken(x.NextPageToken) 7236 } 7237} 7238 7239// method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments": 7240 7241type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct { 7242 s *Service 7243 courseId string 7244 courseWorkId string 7245 id string 7246 modifyattachmentsrequest *ModifyAttachmentsRequest 7247 urlParams_ gensupport.URLParams 7248 ctx_ context.Context 7249 header_ http.Header 7250} 7251 7252// ModifyAttachments: Modifies attachments of student submission. 7253// Attachments may only be added to student submissions belonging to 7254// course work objects with a `workType` of `ASSIGNMENT`. This request 7255// must be made by the Developer Console project of the OAuth client ID 7256// (https://support.google.com/cloud/answer/6158849) used to create the 7257// corresponding course work item. This method returns the following 7258// error codes: * `PERMISSION_DENIED` if the requesting user is not 7259// permitted to access the requested course or course work, if the user 7260// is not permitted to modify attachments on the requested student 7261// submission, or for access errors. * `INVALID_ARGUMENT` if the request 7262// is malformed. * `NOT_FOUND` if the requested course, course work, or 7263// student submission does not exist. 7264// 7265// - courseId: Identifier of the course. This identifier can be either 7266// the Classroom-assigned identifier or an alias. 7267// - courseWorkId: Identifier of the course work. 7268// - id: Identifier of the student submission. 7269func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7270 c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7271 c.courseId = courseId 7272 c.courseWorkId = courseWorkId 7273 c.id = id 7274 c.modifyattachmentsrequest = modifyattachmentsrequest 7275 return c 7276} 7277 7278// Fields allows partial responses to be retrieved. See 7279// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7280// for more information. 7281func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7282 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7283 return c 7284} 7285 7286// Context sets the context to be used in this call's Do method. Any 7287// pending HTTP request will be aborted if the provided context is 7288// canceled. 7289func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7290 c.ctx_ = ctx 7291 return c 7292} 7293 7294// Header returns an http.Header that can be modified by the caller to 7295// add HTTP headers to the request. 7296func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header { 7297 if c.header_ == nil { 7298 c.header_ = make(http.Header) 7299 } 7300 return c.header_ 7301} 7302 7303func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) { 7304 reqHeaders := make(http.Header) 7305 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 7306 for k, v := range c.header_ { 7307 reqHeaders[k] = v 7308 } 7309 reqHeaders.Set("User-Agent", c.s.userAgent()) 7310 var body io.Reader = nil 7311 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest) 7312 if err != nil { 7313 return nil, err 7314 } 7315 reqHeaders.Set("Content-Type", "application/json") 7316 c.urlParams_.Set("alt", alt) 7317 c.urlParams_.Set("prettyPrint", "false") 7318 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments") 7319 urls += "?" + c.urlParams_.Encode() 7320 req, err := http.NewRequest("POST", urls, body) 7321 if err != nil { 7322 return nil, err 7323 } 7324 req.Header = reqHeaders 7325 googleapi.Expand(req.URL, map[string]string{ 7326 "courseId": c.courseId, 7327 "courseWorkId": c.courseWorkId, 7328 "id": c.id, 7329 }) 7330 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7331} 7332 7333// Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call. 7334// Exactly one of *StudentSubmission or error will be non-nil. Any 7335// non-2xx status code is an error. Response headers are in either 7336// *StudentSubmission.ServerResponse.Header or (if a response was 7337// returned at all) in error.(*googleapi.Error).Header. Use 7338// googleapi.IsNotModified to check whether the returned error was 7339// because http.StatusNotModified was returned. 7340func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7341 gensupport.SetOptions(c.urlParams_, opts...) 7342 res, err := c.doRequest("json") 7343 if res != nil && res.StatusCode == http.StatusNotModified { 7344 if res.Body != nil { 7345 res.Body.Close() 7346 } 7347 return nil, &googleapi.Error{ 7348 Code: res.StatusCode, 7349 Header: res.Header, 7350 } 7351 } 7352 if err != nil { 7353 return nil, err 7354 } 7355 defer googleapi.CloseBody(res) 7356 if err := googleapi.CheckResponse(res); err != nil { 7357 return nil, err 7358 } 7359 ret := &StudentSubmission{ 7360 ServerResponse: googleapi.ServerResponse{ 7361 Header: res.Header, 7362 HTTPStatusCode: res.StatusCode, 7363 }, 7364 } 7365 target := &ret 7366 if err := gensupport.DecodeResponse(target, res); err != nil { 7367 return nil, err 7368 } 7369 return ret, nil 7370 // { 7371 // "description": "Modifies attachments of student submission. Attachments may only be added to student submissions belonging to course work objects with a `workType` of `ASSIGNMENT`. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, if the user is not permitted to modify attachments on the requested student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7372 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7373 // "httpMethod": "POST", 7374 // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments", 7375 // "parameterOrder": [ 7376 // "courseId", 7377 // "courseWorkId", 7378 // "id" 7379 // ], 7380 // "parameters": { 7381 // "courseId": { 7382 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7383 // "location": "path", 7384 // "required": true, 7385 // "type": "string" 7386 // }, 7387 // "courseWorkId": { 7388 // "description": "Identifier of the course work.", 7389 // "location": "path", 7390 // "required": true, 7391 // "type": "string" 7392 // }, 7393 // "id": { 7394 // "description": "Identifier of the student submission.", 7395 // "location": "path", 7396 // "required": true, 7397 // "type": "string" 7398 // } 7399 // }, 7400 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7401 // "request": { 7402 // "$ref": "ModifyAttachmentsRequest" 7403 // }, 7404 // "response": { 7405 // "$ref": "StudentSubmission" 7406 // }, 7407 // "scopes": [ 7408 // "https://www.googleapis.com/auth/classroom.coursework.me", 7409 // "https://www.googleapis.com/auth/classroom.coursework.students" 7410 // ] 7411 // } 7412 7413} 7414 7415// method id "classroom.courses.courseWork.studentSubmissions.patch": 7416 7417type CoursesCourseWorkStudentSubmissionsPatchCall struct { 7418 s *Service 7419 courseId string 7420 courseWorkId string 7421 id string 7422 studentsubmission *StudentSubmission 7423 urlParams_ gensupport.URLParams 7424 ctx_ context.Context 7425 header_ http.Header 7426} 7427 7428// Patch: Updates one or more fields of a student submission. See 7429// google.classroom.v1.StudentSubmission for details of which fields may 7430// be updated and who may change them. This request must be made by the 7431// Developer Console project of the OAuth client ID 7432// (https://support.google.com/cloud/answer/6158849) used to create the 7433// corresponding course work item. This method returns the following 7434// error codes: * `PERMISSION_DENIED` if the requesting developer 7435// project did not create the corresponding course work, if the user is 7436// not permitted to make the requested modification to the student 7437// submission, or for access errors. * `INVALID_ARGUMENT` if the request 7438// is malformed. * `NOT_FOUND` if the requested course, course work, or 7439// student submission does not exist. 7440// 7441// - courseId: Identifier of the course. This identifier can be either 7442// the Classroom-assigned identifier or an alias. 7443// - courseWorkId: Identifier of the course work. 7444// - id: Identifier of the student submission. 7445func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall { 7446 c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7447 c.courseId = courseId 7448 c.courseWorkId = courseWorkId 7449 c.id = id 7450 c.studentsubmission = studentsubmission 7451 return c 7452} 7453 7454// UpdateMask sets the optional parameter "updateMask": Mask that 7455// identifies which fields on the student submission to update. This 7456// field is required to do an update. The update fails if invalid fields 7457// are specified. The following fields may be specified by teachers: * 7458// `draft_grade` * `assigned_grade` 7459func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall { 7460 c.urlParams_.Set("updateMask", updateMask) 7461 return c 7462} 7463 7464// Fields allows partial responses to be retrieved. See 7465// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7466// for more information. 7467func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall { 7468 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7469 return c 7470} 7471 7472// Context sets the context to be used in this call's Do method. Any 7473// pending HTTP request will be aborted if the provided context is 7474// canceled. 7475func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall { 7476 c.ctx_ = ctx 7477 return c 7478} 7479 7480// Header returns an http.Header that can be modified by the caller to 7481// add HTTP headers to the request. 7482func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header { 7483 if c.header_ == nil { 7484 c.header_ = make(http.Header) 7485 } 7486 return c.header_ 7487} 7488 7489func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) { 7490 reqHeaders := make(http.Header) 7491 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 7492 for k, v := range c.header_ { 7493 reqHeaders[k] = v 7494 } 7495 reqHeaders.Set("User-Agent", c.s.userAgent()) 7496 var body io.Reader = nil 7497 body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission) 7498 if err != nil { 7499 return nil, err 7500 } 7501 reqHeaders.Set("Content-Type", "application/json") 7502 c.urlParams_.Set("alt", alt) 7503 c.urlParams_.Set("prettyPrint", "false") 7504 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7505 urls += "?" + c.urlParams_.Encode() 7506 req, err := http.NewRequest("PATCH", urls, body) 7507 if err != nil { 7508 return nil, err 7509 } 7510 req.Header = reqHeaders 7511 googleapi.Expand(req.URL, map[string]string{ 7512 "courseId": c.courseId, 7513 "courseWorkId": c.courseWorkId, 7514 "id": c.id, 7515 }) 7516 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7517} 7518 7519// Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call. 7520// Exactly one of *StudentSubmission or error will be non-nil. Any 7521// non-2xx status code is an error. Response headers are in either 7522// *StudentSubmission.ServerResponse.Header or (if a response was 7523// returned at all) in error.(*googleapi.Error).Header. Use 7524// googleapi.IsNotModified to check whether the returned error was 7525// because http.StatusNotModified was returned. 7526func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7527 gensupport.SetOptions(c.urlParams_, opts...) 7528 res, err := c.doRequest("json") 7529 if res != nil && res.StatusCode == http.StatusNotModified { 7530 if res.Body != nil { 7531 res.Body.Close() 7532 } 7533 return nil, &googleapi.Error{ 7534 Code: res.StatusCode, 7535 Header: res.Header, 7536 } 7537 } 7538 if err != nil { 7539 return nil, err 7540 } 7541 defer googleapi.CloseBody(res) 7542 if err := googleapi.CheckResponse(res); err != nil { 7543 return nil, err 7544 } 7545 ret := &StudentSubmission{ 7546 ServerResponse: googleapi.ServerResponse{ 7547 Header: res.Header, 7548 HTTPStatusCode: res.StatusCode, 7549 }, 7550 } 7551 target := &ret 7552 if err := gensupport.DecodeResponse(target, res); err != nil { 7553 return nil, err 7554 } 7555 return ret, nil 7556 // { 7557 // "description": "Updates one or more fields of a student submission. See google.classroom.v1.StudentSubmission for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7558 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7559 // "httpMethod": "PATCH", 7560 // "id": "classroom.courses.courseWork.studentSubmissions.patch", 7561 // "parameterOrder": [ 7562 // "courseId", 7563 // "courseWorkId", 7564 // "id" 7565 // ], 7566 // "parameters": { 7567 // "courseId": { 7568 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7569 // "location": "path", 7570 // "required": true, 7571 // "type": "string" 7572 // }, 7573 // "courseWorkId": { 7574 // "description": "Identifier of the course work.", 7575 // "location": "path", 7576 // "required": true, 7577 // "type": "string" 7578 // }, 7579 // "id": { 7580 // "description": "Identifier of the student submission.", 7581 // "location": "path", 7582 // "required": true, 7583 // "type": "string" 7584 // }, 7585 // "updateMask": { 7586 // "description": "Mask that identifies which fields on the student submission to update. This field is required to do an update. The update fails if invalid fields are specified. The following fields may be specified by teachers: * `draft_grade` * `assigned_grade`", 7587 // "format": "google-fieldmask", 7588 // "location": "query", 7589 // "type": "string" 7590 // } 7591 // }, 7592 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7593 // "request": { 7594 // "$ref": "StudentSubmission" 7595 // }, 7596 // "response": { 7597 // "$ref": "StudentSubmission" 7598 // }, 7599 // "scopes": [ 7600 // "https://www.googleapis.com/auth/classroom.coursework.me", 7601 // "https://www.googleapis.com/auth/classroom.coursework.students" 7602 // ] 7603 // } 7604 7605} 7606 7607// method id "classroom.courses.courseWork.studentSubmissions.reclaim": 7608 7609type CoursesCourseWorkStudentSubmissionsReclaimCall struct { 7610 s *Service 7611 courseId string 7612 courseWorkId string 7613 id string 7614 reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest 7615 urlParams_ gensupport.URLParams 7616 ctx_ context.Context 7617 header_ http.Header 7618} 7619 7620// Reclaim: Reclaims a student submission on behalf of the student that 7621// owns it. Reclaiming a student submission transfers ownership of 7622// attached Drive files to the student and updates the submission state. 7623// Only the student that owns the requested student submission may call 7624// this method, and only for a student submission that has been turned 7625// in. This request must be made by the Developer Console project of the 7626// OAuth client ID (https://support.google.com/cloud/answer/6158849) 7627// used to create the corresponding course work item. This method 7628// returns the following error codes: * `PERMISSION_DENIED` if the 7629// requesting user is not permitted to access the requested course or 7630// course work, unsubmit the requested student submission, or for access 7631// errors. * `FAILED_PRECONDITION` if the student submission has not 7632// been turned in. * `INVALID_ARGUMENT` if the request is malformed. * 7633// `NOT_FOUND` if the requested course, course work, or student 7634// submission does not exist. 7635// 7636// - courseId: Identifier of the course. This identifier can be either 7637// the Classroom-assigned identifier or an alias. 7638// - courseWorkId: Identifier of the course work. 7639// - id: Identifier of the student submission. 7640func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7641 c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7642 c.courseId = courseId 7643 c.courseWorkId = courseWorkId 7644 c.id = id 7645 c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest 7646 return c 7647} 7648 7649// Fields allows partial responses to be retrieved. See 7650// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7651// for more information. 7652func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7653 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7654 return c 7655} 7656 7657// Context sets the context to be used in this call's Do method. Any 7658// pending HTTP request will be aborted if the provided context is 7659// canceled. 7660func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7661 c.ctx_ = ctx 7662 return c 7663} 7664 7665// Header returns an http.Header that can be modified by the caller to 7666// add HTTP headers to the request. 7667func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header { 7668 if c.header_ == nil { 7669 c.header_ = make(http.Header) 7670 } 7671 return c.header_ 7672} 7673 7674func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) { 7675 reqHeaders := make(http.Header) 7676 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 7677 for k, v := range c.header_ { 7678 reqHeaders[k] = v 7679 } 7680 reqHeaders.Set("User-Agent", c.s.userAgent()) 7681 var body io.Reader = nil 7682 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest) 7683 if err != nil { 7684 return nil, err 7685 } 7686 reqHeaders.Set("Content-Type", "application/json") 7687 c.urlParams_.Set("alt", alt) 7688 c.urlParams_.Set("prettyPrint", "false") 7689 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim") 7690 urls += "?" + c.urlParams_.Encode() 7691 req, err := http.NewRequest("POST", urls, body) 7692 if err != nil { 7693 return nil, err 7694 } 7695 req.Header = reqHeaders 7696 googleapi.Expand(req.URL, map[string]string{ 7697 "courseId": c.courseId, 7698 "courseWorkId": c.courseWorkId, 7699 "id": c.id, 7700 }) 7701 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7702} 7703 7704// Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call. 7705// Exactly one of *Empty or error will be non-nil. Any non-2xx status 7706// code is an error. Response headers are in either 7707// *Empty.ServerResponse.Header or (if a response was returned at all) 7708// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7709// check whether the returned error was because http.StatusNotModified 7710// was returned. 7711func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 7712 gensupport.SetOptions(c.urlParams_, opts...) 7713 res, err := c.doRequest("json") 7714 if res != nil && res.StatusCode == http.StatusNotModified { 7715 if res.Body != nil { 7716 res.Body.Close() 7717 } 7718 return nil, &googleapi.Error{ 7719 Code: res.StatusCode, 7720 Header: res.Header, 7721 } 7722 } 7723 if err != nil { 7724 return nil, err 7725 } 7726 defer googleapi.CloseBody(res) 7727 if err := googleapi.CheckResponse(res); err != nil { 7728 return nil, err 7729 } 7730 ret := &Empty{ 7731 ServerResponse: googleapi.ServerResponse{ 7732 Header: res.Header, 7733 HTTPStatusCode: res.StatusCode, 7734 }, 7735 } 7736 target := &ret 7737 if err := gensupport.DecodeResponse(target, res); err != nil { 7738 return nil, err 7739 } 7740 return ret, nil 7741 // { 7742 // "description": "Reclaims a student submission on behalf of the student that owns it. Reclaiming a student submission transfers ownership of attached Drive files to the student and updates the submission state. Only the student that owns the requested student submission may call this method, and only for a student submission that has been turned in. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, unsubmit the requested student submission, or for access errors. * `FAILED_PRECONDITION` if the student submission has not been turned in. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7743 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 7744 // "httpMethod": "POST", 7745 // "id": "classroom.courses.courseWork.studentSubmissions.reclaim", 7746 // "parameterOrder": [ 7747 // "courseId", 7748 // "courseWorkId", 7749 // "id" 7750 // ], 7751 // "parameters": { 7752 // "courseId": { 7753 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7754 // "location": "path", 7755 // "required": true, 7756 // "type": "string" 7757 // }, 7758 // "courseWorkId": { 7759 // "description": "Identifier of the course work.", 7760 // "location": "path", 7761 // "required": true, 7762 // "type": "string" 7763 // }, 7764 // "id": { 7765 // "description": "Identifier of the student submission.", 7766 // "location": "path", 7767 // "required": true, 7768 // "type": "string" 7769 // } 7770 // }, 7771 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 7772 // "request": { 7773 // "$ref": "ReclaimStudentSubmissionRequest" 7774 // }, 7775 // "response": { 7776 // "$ref": "Empty" 7777 // }, 7778 // "scopes": [ 7779 // "https://www.googleapis.com/auth/classroom.coursework.me" 7780 // ] 7781 // } 7782 7783} 7784 7785// method id "classroom.courses.courseWork.studentSubmissions.return": 7786 7787type CoursesCourseWorkStudentSubmissionsReturnCall struct { 7788 s *Service 7789 courseId string 7790 courseWorkId string 7791 id string 7792 returnstudentsubmissionrequest *ReturnStudentSubmissionRequest 7793 urlParams_ gensupport.URLParams 7794 ctx_ context.Context 7795 header_ http.Header 7796} 7797 7798// Return: Returns a student submission. Returning a student submission 7799// transfers ownership of attached Drive files to the student and may 7800// also update the submission state. Unlike the Classroom application, 7801// returning a student submission does not set assignedGrade to the 7802// draftGrade value. Only a teacher of the course that contains the 7803// requested student submission may call this method. This request must 7804// be made by the Developer Console project of the OAuth client ID 7805// (https://support.google.com/cloud/answer/6158849) used to create the 7806// corresponding course work item. This method returns the following 7807// error codes: * `PERMISSION_DENIED` if the requesting user is not 7808// permitted to access the requested course or course work, return the 7809// requested student submission, or for access errors. * 7810// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 7811// requested course, course work, or student submission does not exist. 7812// 7813// - courseId: Identifier of the course. This identifier can be either 7814// the Classroom-assigned identifier or an alias. 7815// - courseWorkId: Identifier of the course work. 7816// - id: Identifier of the student submission. 7817func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall { 7818 c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7819 c.courseId = courseId 7820 c.courseWorkId = courseWorkId 7821 c.id = id 7822 c.returnstudentsubmissionrequest = returnstudentsubmissionrequest 7823 return c 7824} 7825 7826// Fields allows partial responses to be retrieved. See 7827// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7828// for more information. 7829func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall { 7830 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7831 return c 7832} 7833 7834// Context sets the context to be used in this call's Do method. Any 7835// pending HTTP request will be aborted if the provided context is 7836// canceled. 7837func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall { 7838 c.ctx_ = ctx 7839 return c 7840} 7841 7842// Header returns an http.Header that can be modified by the caller to 7843// add HTTP headers to the request. 7844func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header { 7845 if c.header_ == nil { 7846 c.header_ = make(http.Header) 7847 } 7848 return c.header_ 7849} 7850 7851func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) { 7852 reqHeaders := make(http.Header) 7853 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 7854 for k, v := range c.header_ { 7855 reqHeaders[k] = v 7856 } 7857 reqHeaders.Set("User-Agent", c.s.userAgent()) 7858 var body io.Reader = nil 7859 body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest) 7860 if err != nil { 7861 return nil, err 7862 } 7863 reqHeaders.Set("Content-Type", "application/json") 7864 c.urlParams_.Set("alt", alt) 7865 c.urlParams_.Set("prettyPrint", "false") 7866 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return") 7867 urls += "?" + c.urlParams_.Encode() 7868 req, err := http.NewRequest("POST", urls, body) 7869 if err != nil { 7870 return nil, err 7871 } 7872 req.Header = reqHeaders 7873 googleapi.Expand(req.URL, map[string]string{ 7874 "courseId": c.courseId, 7875 "courseWorkId": c.courseWorkId, 7876 "id": c.id, 7877 }) 7878 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7879} 7880 7881// Do executes the "classroom.courses.courseWork.studentSubmissions.return" call. 7882// Exactly one of *Empty or error will be non-nil. Any non-2xx status 7883// code is an error. Response headers are in either 7884// *Empty.ServerResponse.Header or (if a response was returned at all) 7885// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7886// check whether the returned error was because http.StatusNotModified 7887// was returned. 7888func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 7889 gensupport.SetOptions(c.urlParams_, opts...) 7890 res, err := c.doRequest("json") 7891 if res != nil && res.StatusCode == http.StatusNotModified { 7892 if res.Body != nil { 7893 res.Body.Close() 7894 } 7895 return nil, &googleapi.Error{ 7896 Code: res.StatusCode, 7897 Header: res.Header, 7898 } 7899 } 7900 if err != nil { 7901 return nil, err 7902 } 7903 defer googleapi.CloseBody(res) 7904 if err := googleapi.CheckResponse(res); err != nil { 7905 return nil, err 7906 } 7907 ret := &Empty{ 7908 ServerResponse: googleapi.ServerResponse{ 7909 Header: res.Header, 7910 HTTPStatusCode: res.StatusCode, 7911 }, 7912 } 7913 target := &ret 7914 if err := gensupport.DecodeResponse(target, res); err != nil { 7915 return nil, err 7916 } 7917 return ret, nil 7918 // { 7919 // "description": "Returns a student submission. Returning a student submission transfers ownership of attached Drive files to the student and may also update the submission state. Unlike the Classroom application, returning a student submission does not set assignedGrade to the draftGrade value. Only a teacher of the course that contains the requested student submission may call this method. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, return the requested student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7920 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 7921 // "httpMethod": "POST", 7922 // "id": "classroom.courses.courseWork.studentSubmissions.return", 7923 // "parameterOrder": [ 7924 // "courseId", 7925 // "courseWorkId", 7926 // "id" 7927 // ], 7928 // "parameters": { 7929 // "courseId": { 7930 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7931 // "location": "path", 7932 // "required": true, 7933 // "type": "string" 7934 // }, 7935 // "courseWorkId": { 7936 // "description": "Identifier of the course work.", 7937 // "location": "path", 7938 // "required": true, 7939 // "type": "string" 7940 // }, 7941 // "id": { 7942 // "description": "Identifier of the student submission.", 7943 // "location": "path", 7944 // "required": true, 7945 // "type": "string" 7946 // } 7947 // }, 7948 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 7949 // "request": { 7950 // "$ref": "ReturnStudentSubmissionRequest" 7951 // }, 7952 // "response": { 7953 // "$ref": "Empty" 7954 // }, 7955 // "scopes": [ 7956 // "https://www.googleapis.com/auth/classroom.coursework.students" 7957 // ] 7958 // } 7959 7960} 7961 7962// method id "classroom.courses.courseWork.studentSubmissions.turnIn": 7963 7964type CoursesCourseWorkStudentSubmissionsTurnInCall struct { 7965 s *Service 7966 courseId string 7967 courseWorkId string 7968 id string 7969 turninstudentsubmissionrequest *TurnInStudentSubmissionRequest 7970 urlParams_ gensupport.URLParams 7971 ctx_ context.Context 7972 header_ http.Header 7973} 7974 7975// TurnIn: Turns in a student submission. Turning in a student 7976// submission transfers ownership of attached Drive files to the teacher 7977// and may also update the submission state. This may only be called by 7978// the student that owns the specified student submission. This request 7979// must be made by the Developer Console project of the OAuth client ID 7980// (https://support.google.com/cloud/answer/6158849) used to create the 7981// corresponding course work item. This method returns the following 7982// error codes: * `PERMISSION_DENIED` if the requesting user is not 7983// permitted to access the requested course or course work, turn in the 7984// requested student submission, or for access errors. * 7985// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 7986// requested course, course work, or student submission does not exist. 7987// 7988// - courseId: Identifier of the course. This identifier can be either 7989// the Classroom-assigned identifier or an alias. 7990// - courseWorkId: Identifier of the course work. 7991// - id: Identifier of the student submission. 7992func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall { 7993 c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7994 c.courseId = courseId 7995 c.courseWorkId = courseWorkId 7996 c.id = id 7997 c.turninstudentsubmissionrequest = turninstudentsubmissionrequest 7998 return c 7999} 8000 8001// Fields allows partial responses to be retrieved. See 8002// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8003// for more information. 8004func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8005 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8006 return c 8007} 8008 8009// Context sets the context to be used in this call's Do method. Any 8010// pending HTTP request will be aborted if the provided context is 8011// canceled. 8012func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8013 c.ctx_ = ctx 8014 return c 8015} 8016 8017// Header returns an http.Header that can be modified by the caller to 8018// add HTTP headers to the request. 8019func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header { 8020 if c.header_ == nil { 8021 c.header_ = make(http.Header) 8022 } 8023 return c.header_ 8024} 8025 8026func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) { 8027 reqHeaders := make(http.Header) 8028 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 8029 for k, v := range c.header_ { 8030 reqHeaders[k] = v 8031 } 8032 reqHeaders.Set("User-Agent", c.s.userAgent()) 8033 var body io.Reader = nil 8034 body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest) 8035 if err != nil { 8036 return nil, err 8037 } 8038 reqHeaders.Set("Content-Type", "application/json") 8039 c.urlParams_.Set("alt", alt) 8040 c.urlParams_.Set("prettyPrint", "false") 8041 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn") 8042 urls += "?" + c.urlParams_.Encode() 8043 req, err := http.NewRequest("POST", urls, body) 8044 if err != nil { 8045 return nil, err 8046 } 8047 req.Header = reqHeaders 8048 googleapi.Expand(req.URL, map[string]string{ 8049 "courseId": c.courseId, 8050 "courseWorkId": c.courseWorkId, 8051 "id": c.id, 8052 }) 8053 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8054} 8055 8056// Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call. 8057// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8058// code is an error. Response headers are in either 8059// *Empty.ServerResponse.Header or (if a response was returned at all) 8060// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8061// check whether the returned error was because http.StatusNotModified 8062// was returned. 8063func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8064 gensupport.SetOptions(c.urlParams_, opts...) 8065 res, err := c.doRequest("json") 8066 if res != nil && res.StatusCode == http.StatusNotModified { 8067 if res.Body != nil { 8068 res.Body.Close() 8069 } 8070 return nil, &googleapi.Error{ 8071 Code: res.StatusCode, 8072 Header: res.Header, 8073 } 8074 } 8075 if err != nil { 8076 return nil, err 8077 } 8078 defer googleapi.CloseBody(res) 8079 if err := googleapi.CheckResponse(res); err != nil { 8080 return nil, err 8081 } 8082 ret := &Empty{ 8083 ServerResponse: googleapi.ServerResponse{ 8084 Header: res.Header, 8085 HTTPStatusCode: res.StatusCode, 8086 }, 8087 } 8088 target := &ret 8089 if err := gensupport.DecodeResponse(target, res); err != nil { 8090 return nil, err 8091 } 8092 return ret, nil 8093 // { 8094 // "description": "Turns in a student submission. Turning in a student submission transfers ownership of attached Drive files to the teacher and may also update the submission state. This may only be called by the student that owns the specified student submission. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, turn in the requested student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 8095 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8096 // "httpMethod": "POST", 8097 // "id": "classroom.courses.courseWork.studentSubmissions.turnIn", 8098 // "parameterOrder": [ 8099 // "courseId", 8100 // "courseWorkId", 8101 // "id" 8102 // ], 8103 // "parameters": { 8104 // "courseId": { 8105 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8106 // "location": "path", 8107 // "required": true, 8108 // "type": "string" 8109 // }, 8110 // "courseWorkId": { 8111 // "description": "Identifier of the course work.", 8112 // "location": "path", 8113 // "required": true, 8114 // "type": "string" 8115 // }, 8116 // "id": { 8117 // "description": "Identifier of the student submission.", 8118 // "location": "path", 8119 // "required": true, 8120 // "type": "string" 8121 // } 8122 // }, 8123 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8124 // "request": { 8125 // "$ref": "TurnInStudentSubmissionRequest" 8126 // }, 8127 // "response": { 8128 // "$ref": "Empty" 8129 // }, 8130 // "scopes": [ 8131 // "https://www.googleapis.com/auth/classroom.coursework.me" 8132 // ] 8133 // } 8134 8135} 8136 8137// method id "classroom.courses.courseWorkMaterials.create": 8138 8139type CoursesCourseWorkMaterialsCreateCall struct { 8140 s *Service 8141 courseId string 8142 courseworkmaterial *CourseWorkMaterial 8143 urlParams_ gensupport.URLParams 8144 ctx_ context.Context 8145 header_ http.Header 8146} 8147 8148// Create: Creates a course work material. This method returns the 8149// following error codes: * `PERMISSION_DENIED` if the requesting user 8150// is not permitted to access the requested course, create course work 8151// material in the requested course, share a Drive attachment, or for 8152// access errors. * `INVALID_ARGUMENT` if the request is malformed or if 8153// more than 20 * materials are provided. * `NOT_FOUND` if the requested 8154// course does not exist. * `FAILED_PRECONDITION` for the following 8155// request error: * AttachmentNotVisible 8156// 8157// - courseId: Identifier of the course. This identifier can be either 8158// the Classroom-assigned identifier or an alias. 8159func (r *CoursesCourseWorkMaterialsService) Create(courseId string, courseworkmaterial *CourseWorkMaterial) *CoursesCourseWorkMaterialsCreateCall { 8160 c := &CoursesCourseWorkMaterialsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8161 c.courseId = courseId 8162 c.courseworkmaterial = courseworkmaterial 8163 return c 8164} 8165 8166// Fields allows partial responses to be retrieved. See 8167// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8168// for more information. 8169func (c *CoursesCourseWorkMaterialsCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsCreateCall { 8170 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8171 return c 8172} 8173 8174// Context sets the context to be used in this call's Do method. Any 8175// pending HTTP request will be aborted if the provided context is 8176// canceled. 8177func (c *CoursesCourseWorkMaterialsCreateCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsCreateCall { 8178 c.ctx_ = ctx 8179 return c 8180} 8181 8182// Header returns an http.Header that can be modified by the caller to 8183// add HTTP headers to the request. 8184func (c *CoursesCourseWorkMaterialsCreateCall) Header() http.Header { 8185 if c.header_ == nil { 8186 c.header_ = make(http.Header) 8187 } 8188 return c.header_ 8189} 8190 8191func (c *CoursesCourseWorkMaterialsCreateCall) doRequest(alt string) (*http.Response, error) { 8192 reqHeaders := make(http.Header) 8193 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 8194 for k, v := range c.header_ { 8195 reqHeaders[k] = v 8196 } 8197 reqHeaders.Set("User-Agent", c.s.userAgent()) 8198 var body io.Reader = nil 8199 body, err := googleapi.WithoutDataWrapper.JSONReader(c.courseworkmaterial) 8200 if err != nil { 8201 return nil, err 8202 } 8203 reqHeaders.Set("Content-Type", "application/json") 8204 c.urlParams_.Set("alt", alt) 8205 c.urlParams_.Set("prettyPrint", "false") 8206 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials") 8207 urls += "?" + c.urlParams_.Encode() 8208 req, err := http.NewRequest("POST", urls, body) 8209 if err != nil { 8210 return nil, err 8211 } 8212 req.Header = reqHeaders 8213 googleapi.Expand(req.URL, map[string]string{ 8214 "courseId": c.courseId, 8215 }) 8216 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8217} 8218 8219// Do executes the "classroom.courses.courseWorkMaterials.create" call. 8220// Exactly one of *CourseWorkMaterial or error will be non-nil. Any 8221// non-2xx status code is an error. Response headers are in either 8222// *CourseWorkMaterial.ServerResponse.Header or (if a response was 8223// returned at all) in error.(*googleapi.Error).Header. Use 8224// googleapi.IsNotModified to check whether the returned error was 8225// because http.StatusNotModified was returned. 8226func (c *CoursesCourseWorkMaterialsCreateCall) Do(opts ...googleapi.CallOption) (*CourseWorkMaterial, error) { 8227 gensupport.SetOptions(c.urlParams_, opts...) 8228 res, err := c.doRequest("json") 8229 if res != nil && res.StatusCode == http.StatusNotModified { 8230 if res.Body != nil { 8231 res.Body.Close() 8232 } 8233 return nil, &googleapi.Error{ 8234 Code: res.StatusCode, 8235 Header: res.Header, 8236 } 8237 } 8238 if err != nil { 8239 return nil, err 8240 } 8241 defer googleapi.CloseBody(res) 8242 if err := googleapi.CheckResponse(res); err != nil { 8243 return nil, err 8244 } 8245 ret := &CourseWorkMaterial{ 8246 ServerResponse: googleapi.ServerResponse{ 8247 Header: res.Header, 8248 HTTPStatusCode: res.StatusCode, 8249 }, 8250 } 8251 target := &ret 8252 if err := gensupport.DecodeResponse(target, res); err != nil { 8253 return nil, err 8254 } 8255 return ret, nil 8256 // { 8257 // "description": "Creates a course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create course work material in the requested course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is malformed or if more than 20 * materials are provided. * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible", 8258 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials", 8259 // "httpMethod": "POST", 8260 // "id": "classroom.courses.courseWorkMaterials.create", 8261 // "parameterOrder": [ 8262 // "courseId" 8263 // ], 8264 // "parameters": { 8265 // "courseId": { 8266 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8267 // "location": "path", 8268 // "required": true, 8269 // "type": "string" 8270 // } 8271 // }, 8272 // "path": "v1/courses/{courseId}/courseWorkMaterials", 8273 // "request": { 8274 // "$ref": "CourseWorkMaterial" 8275 // }, 8276 // "response": { 8277 // "$ref": "CourseWorkMaterial" 8278 // }, 8279 // "scopes": [ 8280 // "https://www.googleapis.com/auth/classroom.courseworkmaterials" 8281 // ] 8282 // } 8283 8284} 8285 8286// method id "classroom.courses.courseWorkMaterials.delete": 8287 8288type CoursesCourseWorkMaterialsDeleteCall struct { 8289 s *Service 8290 courseId string 8291 id string 8292 urlParams_ gensupport.URLParams 8293 ctx_ context.Context 8294 header_ http.Header 8295} 8296 8297// Delete: Deletes a course work material. This request must be made by 8298// the Developer Console project of the OAuth client ID 8299// (https://support.google.com/cloud/answer/6158849) used to create the 8300// corresponding course work material item. This method returns the 8301// following error codes: * `PERMISSION_DENIED` if the requesting 8302// developer project did not create the corresponding course work 8303// material, if the requesting user is not permitted to delete the 8304// requested course or for access errors. * `FAILED_PRECONDITION` if the 8305// requested course work material has already been deleted. * 8306// `NOT_FOUND` if no course exists with the requested ID. 8307// 8308// - courseId: Identifier of the course. This identifier can be either 8309// the Classroom-assigned identifier or an alias. 8310// - id: Identifier of the course work material to delete. This 8311// identifier is a Classroom-assigned identifier. 8312func (r *CoursesCourseWorkMaterialsService) Delete(courseId string, id string) *CoursesCourseWorkMaterialsDeleteCall { 8313 c := &CoursesCourseWorkMaterialsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8314 c.courseId = courseId 8315 c.id = id 8316 return c 8317} 8318 8319// Fields allows partial responses to be retrieved. See 8320// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8321// for more information. 8322func (c *CoursesCourseWorkMaterialsDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsDeleteCall { 8323 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8324 return c 8325} 8326 8327// Context sets the context to be used in this call's Do method. Any 8328// pending HTTP request will be aborted if the provided context is 8329// canceled. 8330func (c *CoursesCourseWorkMaterialsDeleteCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsDeleteCall { 8331 c.ctx_ = ctx 8332 return c 8333} 8334 8335// Header returns an http.Header that can be modified by the caller to 8336// add HTTP headers to the request. 8337func (c *CoursesCourseWorkMaterialsDeleteCall) Header() http.Header { 8338 if c.header_ == nil { 8339 c.header_ = make(http.Header) 8340 } 8341 return c.header_ 8342} 8343 8344func (c *CoursesCourseWorkMaterialsDeleteCall) doRequest(alt string) (*http.Response, error) { 8345 reqHeaders := make(http.Header) 8346 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 8347 for k, v := range c.header_ { 8348 reqHeaders[k] = v 8349 } 8350 reqHeaders.Set("User-Agent", c.s.userAgent()) 8351 var body io.Reader = nil 8352 c.urlParams_.Set("alt", alt) 8353 c.urlParams_.Set("prettyPrint", "false") 8354 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials/{id}") 8355 urls += "?" + c.urlParams_.Encode() 8356 req, err := http.NewRequest("DELETE", urls, body) 8357 if err != nil { 8358 return nil, err 8359 } 8360 req.Header = reqHeaders 8361 googleapi.Expand(req.URL, map[string]string{ 8362 "courseId": c.courseId, 8363 "id": c.id, 8364 }) 8365 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8366} 8367 8368// Do executes the "classroom.courses.courseWorkMaterials.delete" call. 8369// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8370// code is an error. Response headers are in either 8371// *Empty.ServerResponse.Header or (if a response was returned at all) 8372// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8373// check whether the returned error was because http.StatusNotModified 8374// was returned. 8375func (c *CoursesCourseWorkMaterialsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8376 gensupport.SetOptions(c.urlParams_, opts...) 8377 res, err := c.doRequest("json") 8378 if res != nil && res.StatusCode == http.StatusNotModified { 8379 if res.Body != nil { 8380 res.Body.Close() 8381 } 8382 return nil, &googleapi.Error{ 8383 Code: res.StatusCode, 8384 Header: res.Header, 8385 } 8386 } 8387 if err != nil { 8388 return nil, err 8389 } 8390 defer googleapi.CloseBody(res) 8391 if err := googleapi.CheckResponse(res); err != nil { 8392 return nil, err 8393 } 8394 ret := &Empty{ 8395 ServerResponse: googleapi.ServerResponse{ 8396 Header: res.Header, 8397 HTTPStatusCode: res.StatusCode, 8398 }, 8399 } 8400 target := &ret 8401 if err := gensupport.DecodeResponse(target, res); err != nil { 8402 return nil, err 8403 } 8404 return ret, nil 8405 // { 8406 // "description": "Deletes a course work material. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work material item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work material, if the requesting user is not permitted to delete the requested course or for access errors. * `FAILED_PRECONDITION` if the requested course work material has already been deleted. * `NOT_FOUND` if no course exists with the requested ID.", 8407 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8408 // "httpMethod": "DELETE", 8409 // "id": "classroom.courses.courseWorkMaterials.delete", 8410 // "parameterOrder": [ 8411 // "courseId", 8412 // "id" 8413 // ], 8414 // "parameters": { 8415 // "courseId": { 8416 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8417 // "location": "path", 8418 // "required": true, 8419 // "type": "string" 8420 // }, 8421 // "id": { 8422 // "description": "Identifier of the course work material to delete. This identifier is a Classroom-assigned identifier.", 8423 // "location": "path", 8424 // "required": true, 8425 // "type": "string" 8426 // } 8427 // }, 8428 // "path": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8429 // "response": { 8430 // "$ref": "Empty" 8431 // }, 8432 // "scopes": [ 8433 // "https://www.googleapis.com/auth/classroom.courseworkmaterials" 8434 // ] 8435 // } 8436 8437} 8438 8439// method id "classroom.courses.courseWorkMaterials.get": 8440 8441type CoursesCourseWorkMaterialsGetCall struct { 8442 s *Service 8443 courseId string 8444 id string 8445 urlParams_ gensupport.URLParams 8446 ifNoneMatch_ string 8447 ctx_ context.Context 8448 header_ http.Header 8449} 8450 8451// Get: Returns a course work material. This method returns the 8452// following error codes: * `PERMISSION_DENIED` if the requesting user 8453// is not permitted to access the requested course or course work 8454// material, or for access errors. * `INVALID_ARGUMENT` if the request 8455// is malformed. * `NOT_FOUND` if the requested course or course work 8456// material does not exist. 8457// 8458// - courseId: Identifier of the course. This identifier can be either 8459// the Classroom-assigned identifier or an alias. 8460// - id: Identifier of the course work material. 8461func (r *CoursesCourseWorkMaterialsService) Get(courseId string, id string) *CoursesCourseWorkMaterialsGetCall { 8462 c := &CoursesCourseWorkMaterialsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8463 c.courseId = courseId 8464 c.id = id 8465 return c 8466} 8467 8468// Fields allows partial responses to be retrieved. See 8469// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8470// for more information. 8471func (c *CoursesCourseWorkMaterialsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsGetCall { 8472 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8473 return c 8474} 8475 8476// IfNoneMatch sets the optional parameter which makes the operation 8477// fail if the object's ETag matches the given value. This is useful for 8478// getting updates only after the object has changed since the last 8479// request. Use googleapi.IsNotModified to check whether the response 8480// error from Do is the result of In-None-Match. 8481func (c *CoursesCourseWorkMaterialsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkMaterialsGetCall { 8482 c.ifNoneMatch_ = entityTag 8483 return c 8484} 8485 8486// Context sets the context to be used in this call's Do method. Any 8487// pending HTTP request will be aborted if the provided context is 8488// canceled. 8489func (c *CoursesCourseWorkMaterialsGetCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsGetCall { 8490 c.ctx_ = ctx 8491 return c 8492} 8493 8494// Header returns an http.Header that can be modified by the caller to 8495// add HTTP headers to the request. 8496func (c *CoursesCourseWorkMaterialsGetCall) Header() http.Header { 8497 if c.header_ == nil { 8498 c.header_ = make(http.Header) 8499 } 8500 return c.header_ 8501} 8502 8503func (c *CoursesCourseWorkMaterialsGetCall) doRequest(alt string) (*http.Response, error) { 8504 reqHeaders := make(http.Header) 8505 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 8506 for k, v := range c.header_ { 8507 reqHeaders[k] = v 8508 } 8509 reqHeaders.Set("User-Agent", c.s.userAgent()) 8510 if c.ifNoneMatch_ != "" { 8511 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8512 } 8513 var body io.Reader = nil 8514 c.urlParams_.Set("alt", alt) 8515 c.urlParams_.Set("prettyPrint", "false") 8516 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials/{id}") 8517 urls += "?" + c.urlParams_.Encode() 8518 req, err := http.NewRequest("GET", urls, body) 8519 if err != nil { 8520 return nil, err 8521 } 8522 req.Header = reqHeaders 8523 googleapi.Expand(req.URL, map[string]string{ 8524 "courseId": c.courseId, 8525 "id": c.id, 8526 }) 8527 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8528} 8529 8530// Do executes the "classroom.courses.courseWorkMaterials.get" call. 8531// Exactly one of *CourseWorkMaterial or error will be non-nil. Any 8532// non-2xx status code is an error. Response headers are in either 8533// *CourseWorkMaterial.ServerResponse.Header or (if a response was 8534// returned at all) in error.(*googleapi.Error).Header. Use 8535// googleapi.IsNotModified to check whether the returned error was 8536// because http.StatusNotModified was returned. 8537func (c *CoursesCourseWorkMaterialsGetCall) Do(opts ...googleapi.CallOption) (*CourseWorkMaterial, error) { 8538 gensupport.SetOptions(c.urlParams_, opts...) 8539 res, err := c.doRequest("json") 8540 if res != nil && res.StatusCode == http.StatusNotModified { 8541 if res.Body != nil { 8542 res.Body.Close() 8543 } 8544 return nil, &googleapi.Error{ 8545 Code: res.StatusCode, 8546 Header: res.Header, 8547 } 8548 } 8549 if err != nil { 8550 return nil, err 8551 } 8552 defer googleapi.CloseBody(res) 8553 if err := googleapi.CheckResponse(res); err != nil { 8554 return nil, err 8555 } 8556 ret := &CourseWorkMaterial{ 8557 ServerResponse: googleapi.ServerResponse{ 8558 Header: res.Header, 8559 HTTPStatusCode: res.StatusCode, 8560 }, 8561 } 8562 target := &ret 8563 if err := gensupport.DecodeResponse(target, res); err != nil { 8564 return nil, err 8565 } 8566 return ret, nil 8567 // { 8568 // "description": "Returns a course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work material, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work material does not exist.", 8569 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8570 // "httpMethod": "GET", 8571 // "id": "classroom.courses.courseWorkMaterials.get", 8572 // "parameterOrder": [ 8573 // "courseId", 8574 // "id" 8575 // ], 8576 // "parameters": { 8577 // "courseId": { 8578 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8579 // "location": "path", 8580 // "required": true, 8581 // "type": "string" 8582 // }, 8583 // "id": { 8584 // "description": "Identifier of the course work material.", 8585 // "location": "path", 8586 // "required": true, 8587 // "type": "string" 8588 // } 8589 // }, 8590 // "path": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8591 // "response": { 8592 // "$ref": "CourseWorkMaterial" 8593 // }, 8594 // "scopes": [ 8595 // "https://www.googleapis.com/auth/classroom.courseworkmaterials", 8596 // "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly" 8597 // ] 8598 // } 8599 8600} 8601 8602// method id "classroom.courses.courseWorkMaterials.list": 8603 8604type CoursesCourseWorkMaterialsListCall struct { 8605 s *Service 8606 courseId string 8607 urlParams_ gensupport.URLParams 8608 ifNoneMatch_ string 8609 ctx_ context.Context 8610 header_ http.Header 8611} 8612 8613// List: Returns a list of course work material that the requester is 8614// permitted to view. Course students may only view `PUBLISHED` course 8615// work material. Course teachers and domain administrators may view all 8616// course work material. This method returns the following error codes: 8617// * `PERMISSION_DENIED` if the requesting user is not permitted to 8618// access the requested course or for access errors. * 8619// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 8620// requested course does not exist. 8621// 8622// - courseId: Identifier of the course. This identifier can be either 8623// the Classroom-assigned identifier or an alias. 8624func (r *CoursesCourseWorkMaterialsService) List(courseId string) *CoursesCourseWorkMaterialsListCall { 8625 c := &CoursesCourseWorkMaterialsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8626 c.courseId = courseId 8627 return c 8628} 8629 8630// CourseWorkMaterialStates sets the optional parameter 8631// "courseWorkMaterialStates": Restriction on the work status to return. 8632// Only course work material that matches is returned. If unspecified, 8633// items with a work status of `PUBLISHED` is returned. 8634// 8635// Possible values: 8636// "COURSEWORK_MATERIAL_STATE_UNSPECIFIED" - No state specified. This 8637// is never returned. 8638// "PUBLISHED" - Status for course work material that has been 8639// published. This is the default state. 8640// "DRAFT" - Status for an course work material that is not yet 8641// published. Course work material in this state is visible only to 8642// course teachers and domain administrators. 8643// "DELETED" - Status for course work material that was published but 8644// is now deleted. Course work material in this state is visible only to 8645// course teachers and domain administrators. Course work material in 8646// this state is deleted after some time. 8647func (c *CoursesCourseWorkMaterialsListCall) CourseWorkMaterialStates(courseWorkMaterialStates ...string) *CoursesCourseWorkMaterialsListCall { 8648 c.urlParams_.SetMulti("courseWorkMaterialStates", append([]string{}, courseWorkMaterialStates...)) 8649 return c 8650} 8651 8652// MaterialDriveId sets the optional parameter "materialDriveId": 8653// Optional filtering for course work material with at least one Drive 8654// material whose ID matches the provided string. If `material_link` is 8655// also specified, course work material must have materials matching 8656// both filters. 8657func (c *CoursesCourseWorkMaterialsListCall) MaterialDriveId(materialDriveId string) *CoursesCourseWorkMaterialsListCall { 8658 c.urlParams_.Set("materialDriveId", materialDriveId) 8659 return c 8660} 8661 8662// MaterialLink sets the optional parameter "materialLink": Optional 8663// filtering for course work material with at least one link material 8664// whose URL partially matches the provided string. 8665func (c *CoursesCourseWorkMaterialsListCall) MaterialLink(materialLink string) *CoursesCourseWorkMaterialsListCall { 8666 c.urlParams_.Set("materialLink", materialLink) 8667 return c 8668} 8669 8670// OrderBy sets the optional parameter "orderBy": Optional sort ordering 8671// for results. A comma-separated list of fields with an optional sort 8672// direction keyword. Supported field is `updateTime`. Supported 8673// direction keywords are `asc` and `desc`. If not specified, 8674// `updateTime desc` is the default behavior. Examples: `updateTime 8675// asc`, `updateTime` 8676func (c *CoursesCourseWorkMaterialsListCall) OrderBy(orderBy string) *CoursesCourseWorkMaterialsListCall { 8677 c.urlParams_.Set("orderBy", orderBy) 8678 return c 8679} 8680 8681// PageSize sets the optional parameter "pageSize": Maximum number of 8682// items to return. Zero or unspecified indicates that the server may 8683// assign a maximum. The server may return fewer than the specified 8684// number of results. 8685func (c *CoursesCourseWorkMaterialsListCall) PageSize(pageSize int64) *CoursesCourseWorkMaterialsListCall { 8686 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8687 return c 8688} 8689 8690// PageToken sets the optional parameter "pageToken": nextPageToken 8691// value returned from a previous list call, indicating that the 8692// subsequent page of results should be returned. The list request must 8693// be otherwise identical to the one that resulted in this token. 8694func (c *CoursesCourseWorkMaterialsListCall) PageToken(pageToken string) *CoursesCourseWorkMaterialsListCall { 8695 c.urlParams_.Set("pageToken", pageToken) 8696 return c 8697} 8698 8699// Fields allows partial responses to be retrieved. See 8700// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8701// for more information. 8702func (c *CoursesCourseWorkMaterialsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsListCall { 8703 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8704 return c 8705} 8706 8707// IfNoneMatch sets the optional parameter which makes the operation 8708// fail if the object's ETag matches the given value. This is useful for 8709// getting updates only after the object has changed since the last 8710// request. Use googleapi.IsNotModified to check whether the response 8711// error from Do is the result of In-None-Match. 8712func (c *CoursesCourseWorkMaterialsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkMaterialsListCall { 8713 c.ifNoneMatch_ = entityTag 8714 return c 8715} 8716 8717// Context sets the context to be used in this call's Do method. Any 8718// pending HTTP request will be aborted if the provided context is 8719// canceled. 8720func (c *CoursesCourseWorkMaterialsListCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsListCall { 8721 c.ctx_ = ctx 8722 return c 8723} 8724 8725// Header returns an http.Header that can be modified by the caller to 8726// add HTTP headers to the request. 8727func (c *CoursesCourseWorkMaterialsListCall) Header() http.Header { 8728 if c.header_ == nil { 8729 c.header_ = make(http.Header) 8730 } 8731 return c.header_ 8732} 8733 8734func (c *CoursesCourseWorkMaterialsListCall) doRequest(alt string) (*http.Response, error) { 8735 reqHeaders := make(http.Header) 8736 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 8737 for k, v := range c.header_ { 8738 reqHeaders[k] = v 8739 } 8740 reqHeaders.Set("User-Agent", c.s.userAgent()) 8741 if c.ifNoneMatch_ != "" { 8742 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8743 } 8744 var body io.Reader = nil 8745 c.urlParams_.Set("alt", alt) 8746 c.urlParams_.Set("prettyPrint", "false") 8747 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials") 8748 urls += "?" + c.urlParams_.Encode() 8749 req, err := http.NewRequest("GET", urls, body) 8750 if err != nil { 8751 return nil, err 8752 } 8753 req.Header = reqHeaders 8754 googleapi.Expand(req.URL, map[string]string{ 8755 "courseId": c.courseId, 8756 }) 8757 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8758} 8759 8760// Do executes the "classroom.courses.courseWorkMaterials.list" call. 8761// Exactly one of *ListCourseWorkMaterialResponse or error will be 8762// non-nil. Any non-2xx status code is an error. Response headers are in 8763// either *ListCourseWorkMaterialResponse.ServerResponse.Header or (if a 8764// response was returned at all) in error.(*googleapi.Error).Header. Use 8765// googleapi.IsNotModified to check whether the returned error was 8766// because http.StatusNotModified was returned. 8767func (c *CoursesCourseWorkMaterialsListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkMaterialResponse, error) { 8768 gensupport.SetOptions(c.urlParams_, opts...) 8769 res, err := c.doRequest("json") 8770 if res != nil && res.StatusCode == http.StatusNotModified { 8771 if res.Body != nil { 8772 res.Body.Close() 8773 } 8774 return nil, &googleapi.Error{ 8775 Code: res.StatusCode, 8776 Header: res.Header, 8777 } 8778 } 8779 if err != nil { 8780 return nil, err 8781 } 8782 defer googleapi.CloseBody(res) 8783 if err := googleapi.CheckResponse(res); err != nil { 8784 return nil, err 8785 } 8786 ret := &ListCourseWorkMaterialResponse{ 8787 ServerResponse: googleapi.ServerResponse{ 8788 Header: res.Header, 8789 HTTPStatusCode: res.StatusCode, 8790 }, 8791 } 8792 target := &ret 8793 if err := gensupport.DecodeResponse(target, res); err != nil { 8794 return nil, err 8795 } 8796 return ret, nil 8797 // { 8798 // "description": "Returns a list of course work material that the requester is permitted to view. Course students may only view `PUBLISHED` course work material. Course teachers and domain administrators may view all course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 8799 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials", 8800 // "httpMethod": "GET", 8801 // "id": "classroom.courses.courseWorkMaterials.list", 8802 // "parameterOrder": [ 8803 // "courseId" 8804 // ], 8805 // "parameters": { 8806 // "courseId": { 8807 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8808 // "location": "path", 8809 // "required": true, 8810 // "type": "string" 8811 // }, 8812 // "courseWorkMaterialStates": { 8813 // "description": "Restriction on the work status to return. Only course work material that matches is returned. If unspecified, items with a work status of `PUBLISHED` is returned.", 8814 // "enum": [ 8815 // "COURSEWORK_MATERIAL_STATE_UNSPECIFIED", 8816 // "PUBLISHED", 8817 // "DRAFT", 8818 // "DELETED" 8819 // ], 8820 // "enumDescriptions": [ 8821 // "No state specified. This is never returned.", 8822 // "Status for course work material that has been published. This is the default state.", 8823 // "Status for an course work material that is not yet published. Course work material in this state is visible only to course teachers and domain administrators.", 8824 // "Status for course work material that was published but is now deleted. Course work material in this state is visible only to course teachers and domain administrators. Course work material in this state is deleted after some time." 8825 // ], 8826 // "location": "query", 8827 // "repeated": true, 8828 // "type": "string" 8829 // }, 8830 // "materialDriveId": { 8831 // "description": "Optional filtering for course work material with at least one Drive material whose ID matches the provided string. If `material_link` is also specified, course work material must have materials matching both filters.", 8832 // "location": "query", 8833 // "type": "string" 8834 // }, 8835 // "materialLink": { 8836 // "description": "Optional filtering for course work material with at least one link material whose URL partially matches the provided string.", 8837 // "location": "query", 8838 // "type": "string" 8839 // }, 8840 // "orderBy": { 8841 // "description": "Optional sort ordering for results. A comma-separated list of fields with an optional sort direction keyword. Supported field is `updateTime`. Supported direction keywords are `asc` and `desc`. If not specified, `updateTime desc` is the default behavior. Examples: `updateTime asc`, `updateTime`", 8842 // "location": "query", 8843 // "type": "string" 8844 // }, 8845 // "pageSize": { 8846 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 8847 // "format": "int32", 8848 // "location": "query", 8849 // "type": "integer" 8850 // }, 8851 // "pageToken": { 8852 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 8853 // "location": "query", 8854 // "type": "string" 8855 // } 8856 // }, 8857 // "path": "v1/courses/{courseId}/courseWorkMaterials", 8858 // "response": { 8859 // "$ref": "ListCourseWorkMaterialResponse" 8860 // }, 8861 // "scopes": [ 8862 // "https://www.googleapis.com/auth/classroom.courseworkmaterials", 8863 // "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly" 8864 // ] 8865 // } 8866 8867} 8868 8869// Pages invokes f for each page of results. 8870// A non-nil error returned from f will halt the iteration. 8871// The provided context supersedes any context provided to the Context method. 8872func (c *CoursesCourseWorkMaterialsListCall) Pages(ctx context.Context, f func(*ListCourseWorkMaterialResponse) error) error { 8873 c.ctx_ = ctx 8874 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 8875 for { 8876 x, err := c.Do() 8877 if err != nil { 8878 return err 8879 } 8880 if err := f(x); err != nil { 8881 return err 8882 } 8883 if x.NextPageToken == "" { 8884 return nil 8885 } 8886 c.PageToken(x.NextPageToken) 8887 } 8888} 8889 8890// method id "classroom.courses.courseWorkMaterials.patch": 8891 8892type CoursesCourseWorkMaterialsPatchCall struct { 8893 s *Service 8894 courseId string 8895 id string 8896 courseworkmaterial *CourseWorkMaterial 8897 urlParams_ gensupport.URLParams 8898 ctx_ context.Context 8899 header_ http.Header 8900} 8901 8902// Patch: Updates one or more fields of a course work material. This 8903// method returns the following error codes: * `PERMISSION_DENIED` if 8904// the requesting developer project for access errors. * 8905// `INVALID_ARGUMENT` if the request is malformed. * 8906// `FAILED_PRECONDITION` if the requested course work material has 8907// already been deleted. * `NOT_FOUND` if the requested course or course 8908// work material does not exist 8909// 8910// - courseId: Identifier of the course. This identifier can be either 8911// the Classroom-assigned identifier or an alias. 8912// - id: Identifier of the course work material. 8913func (r *CoursesCourseWorkMaterialsService) Patch(courseId string, id string, courseworkmaterial *CourseWorkMaterial) *CoursesCourseWorkMaterialsPatchCall { 8914 c := &CoursesCourseWorkMaterialsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8915 c.courseId = courseId 8916 c.id = id 8917 c.courseworkmaterial = courseworkmaterial 8918 return c 8919} 8920 8921// UpdateMask sets the optional parameter "updateMask": Mask that 8922// identifies which fields on the course work material to update. This 8923// field is required to do an update. The update fails if invalid fields 8924// are specified. If a field supports empty values, it can be cleared by 8925// specifying it in the update mask and not in the course work material 8926// object. If a field that does not support empty values is included in 8927// the update mask and not set in the course work material object, an 8928// `INVALID_ARGUMENT` error is returned. The following fields may be 8929// specified by teachers: * `title` * `description` * `state` * 8930// `scheduled_time` * `topic_id` 8931func (c *CoursesCourseWorkMaterialsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkMaterialsPatchCall { 8932 c.urlParams_.Set("updateMask", updateMask) 8933 return c 8934} 8935 8936// Fields allows partial responses to be retrieved. See 8937// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8938// for more information. 8939func (c *CoursesCourseWorkMaterialsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsPatchCall { 8940 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8941 return c 8942} 8943 8944// Context sets the context to be used in this call's Do method. Any 8945// pending HTTP request will be aborted if the provided context is 8946// canceled. 8947func (c *CoursesCourseWorkMaterialsPatchCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsPatchCall { 8948 c.ctx_ = ctx 8949 return c 8950} 8951 8952// Header returns an http.Header that can be modified by the caller to 8953// add HTTP headers to the request. 8954func (c *CoursesCourseWorkMaterialsPatchCall) Header() http.Header { 8955 if c.header_ == nil { 8956 c.header_ = make(http.Header) 8957 } 8958 return c.header_ 8959} 8960 8961func (c *CoursesCourseWorkMaterialsPatchCall) doRequest(alt string) (*http.Response, error) { 8962 reqHeaders := make(http.Header) 8963 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 8964 for k, v := range c.header_ { 8965 reqHeaders[k] = v 8966 } 8967 reqHeaders.Set("User-Agent", c.s.userAgent()) 8968 var body io.Reader = nil 8969 body, err := googleapi.WithoutDataWrapper.JSONReader(c.courseworkmaterial) 8970 if err != nil { 8971 return nil, err 8972 } 8973 reqHeaders.Set("Content-Type", "application/json") 8974 c.urlParams_.Set("alt", alt) 8975 c.urlParams_.Set("prettyPrint", "false") 8976 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials/{id}") 8977 urls += "?" + c.urlParams_.Encode() 8978 req, err := http.NewRequest("PATCH", urls, body) 8979 if err != nil { 8980 return nil, err 8981 } 8982 req.Header = reqHeaders 8983 googleapi.Expand(req.URL, map[string]string{ 8984 "courseId": c.courseId, 8985 "id": c.id, 8986 }) 8987 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8988} 8989 8990// Do executes the "classroom.courses.courseWorkMaterials.patch" call. 8991// Exactly one of *CourseWorkMaterial or error will be non-nil. Any 8992// non-2xx status code is an error. Response headers are in either 8993// *CourseWorkMaterial.ServerResponse.Header or (if a response was 8994// returned at all) in error.(*googleapi.Error).Header. Use 8995// googleapi.IsNotModified to check whether the returned error was 8996// because http.StatusNotModified was returned. 8997func (c *CoursesCourseWorkMaterialsPatchCall) Do(opts ...googleapi.CallOption) (*CourseWorkMaterial, error) { 8998 gensupport.SetOptions(c.urlParams_, opts...) 8999 res, err := c.doRequest("json") 9000 if res != nil && res.StatusCode == http.StatusNotModified { 9001 if res.Body != nil { 9002 res.Body.Close() 9003 } 9004 return nil, &googleapi.Error{ 9005 Code: res.StatusCode, 9006 Header: res.Header, 9007 } 9008 } 9009 if err != nil { 9010 return nil, err 9011 } 9012 defer googleapi.CloseBody(res) 9013 if err := googleapi.CheckResponse(res); err != nil { 9014 return nil, err 9015 } 9016 ret := &CourseWorkMaterial{ 9017 ServerResponse: googleapi.ServerResponse{ 9018 Header: res.Header, 9019 HTTPStatusCode: res.StatusCode, 9020 }, 9021 } 9022 target := &ret 9023 if err := gensupport.DecodeResponse(target, res); err != nil { 9024 return nil, err 9025 } 9026 return ret, nil 9027 // { 9028 // "description": "Updates one or more fields of a course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the requested course work material has already been deleted. * `NOT_FOUND` if the requested course or course work material does not exist", 9029 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials/{id}", 9030 // "httpMethod": "PATCH", 9031 // "id": "classroom.courses.courseWorkMaterials.patch", 9032 // "parameterOrder": [ 9033 // "courseId", 9034 // "id" 9035 // ], 9036 // "parameters": { 9037 // "courseId": { 9038 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9039 // "location": "path", 9040 // "required": true, 9041 // "type": "string" 9042 // }, 9043 // "id": { 9044 // "description": "Identifier of the course work material.", 9045 // "location": "path", 9046 // "required": true, 9047 // "type": "string" 9048 // }, 9049 // "updateMask": { 9050 // "description": "Mask that identifies which fields on the course work material to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the course work material object. If a field that does not support empty values is included in the update mask and not set in the course work material object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified by teachers: * `title` * `description` * `state` * `scheduled_time` * `topic_id`", 9051 // "format": "google-fieldmask", 9052 // "location": "query", 9053 // "type": "string" 9054 // } 9055 // }, 9056 // "path": "v1/courses/{courseId}/courseWorkMaterials/{id}", 9057 // "request": { 9058 // "$ref": "CourseWorkMaterial" 9059 // }, 9060 // "response": { 9061 // "$ref": "CourseWorkMaterial" 9062 // }, 9063 // "scopes": [ 9064 // "https://www.googleapis.com/auth/classroom.courseworkmaterials" 9065 // ] 9066 // } 9067 9068} 9069 9070// method id "classroom.courses.students.create": 9071 9072type CoursesStudentsCreateCall struct { 9073 s *Service 9074 courseId string 9075 student *Student 9076 urlParams_ gensupport.URLParams 9077 ctx_ context.Context 9078 header_ http.Header 9079} 9080 9081// Create: Adds a user as a student of a course. This method returns the 9082// following error codes: * `PERMISSION_DENIED` if the requesting user 9083// is not permitted to create students in this course or for access 9084// errors. * `NOT_FOUND` if the requested course ID does not exist. * 9085// `FAILED_PRECONDITION` if the requested user's account is disabled, 9086// for the following request errors: * CourseMemberLimitReached * 9087// CourseNotModifiable * UserGroupsMembershipLimitReached * 9088// `ALREADY_EXISTS` if the user is already a student or teacher in the 9089// course. 9090// 9091// - courseId: Identifier of the course to create the student in. This 9092// identifier can be either the Classroom-assigned identifier or an 9093// alias. 9094func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall { 9095 c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9096 c.courseId = courseId 9097 c.student = student 9098 return c 9099} 9100 9101// EnrollmentCode sets the optional parameter "enrollmentCode": 9102// Enrollment code of the course to create the student in. This code is 9103// required if userId corresponds to the requesting user; it may be 9104// omitted if the requesting user has administrative permissions to 9105// create students for any user. 9106func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall { 9107 c.urlParams_.Set("enrollmentCode", enrollmentCode) 9108 return c 9109} 9110 9111// Fields allows partial responses to be retrieved. See 9112// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9113// for more information. 9114func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall { 9115 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9116 return c 9117} 9118 9119// Context sets the context to be used in this call's Do method. Any 9120// pending HTTP request will be aborted if the provided context is 9121// canceled. 9122func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall { 9123 c.ctx_ = ctx 9124 return c 9125} 9126 9127// Header returns an http.Header that can be modified by the caller to 9128// add HTTP headers to the request. 9129func (c *CoursesStudentsCreateCall) Header() http.Header { 9130 if c.header_ == nil { 9131 c.header_ = make(http.Header) 9132 } 9133 return c.header_ 9134} 9135 9136func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) { 9137 reqHeaders := make(http.Header) 9138 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 9139 for k, v := range c.header_ { 9140 reqHeaders[k] = v 9141 } 9142 reqHeaders.Set("User-Agent", c.s.userAgent()) 9143 var body io.Reader = nil 9144 body, err := googleapi.WithoutDataWrapper.JSONReader(c.student) 9145 if err != nil { 9146 return nil, err 9147 } 9148 reqHeaders.Set("Content-Type", "application/json") 9149 c.urlParams_.Set("alt", alt) 9150 c.urlParams_.Set("prettyPrint", "false") 9151 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9152 urls += "?" + c.urlParams_.Encode() 9153 req, err := http.NewRequest("POST", urls, body) 9154 if err != nil { 9155 return nil, err 9156 } 9157 req.Header = reqHeaders 9158 googleapi.Expand(req.URL, map[string]string{ 9159 "courseId": c.courseId, 9160 }) 9161 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9162} 9163 9164// Do executes the "classroom.courses.students.create" call. 9165// Exactly one of *Student or error will be non-nil. Any non-2xx status 9166// code is an error. Response headers are in either 9167// *Student.ServerResponse.Header or (if a response was returned at all) 9168// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9169// check whether the returned error was because http.StatusNotModified 9170// was returned. 9171func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) { 9172 gensupport.SetOptions(c.urlParams_, opts...) 9173 res, err := c.doRequest("json") 9174 if res != nil && res.StatusCode == http.StatusNotModified { 9175 if res.Body != nil { 9176 res.Body.Close() 9177 } 9178 return nil, &googleapi.Error{ 9179 Code: res.StatusCode, 9180 Header: res.Header, 9181 } 9182 } 9183 if err != nil { 9184 return nil, err 9185 } 9186 defer googleapi.CloseBody(res) 9187 if err := googleapi.CheckResponse(res); err != nil { 9188 return nil, err 9189 } 9190 ret := &Student{ 9191 ServerResponse: googleapi.ServerResponse{ 9192 Header: res.Header, 9193 HTTPStatusCode: res.StatusCode, 9194 }, 9195 } 9196 target := &ret 9197 if err := gensupport.DecodeResponse(target, res); err != nil { 9198 return nil, err 9199 } 9200 return ret, nil 9201 // { 9202 // "description": "Adds a user as a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create students in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a student or teacher in the course.", 9203 // "flatPath": "v1/courses/{courseId}/students", 9204 // "httpMethod": "POST", 9205 // "id": "classroom.courses.students.create", 9206 // "parameterOrder": [ 9207 // "courseId" 9208 // ], 9209 // "parameters": { 9210 // "courseId": { 9211 // "description": "Identifier of the course to create the student in. This identifier can be either the Classroom-assigned identifier or an alias.", 9212 // "location": "path", 9213 // "required": true, 9214 // "type": "string" 9215 // }, 9216 // "enrollmentCode": { 9217 // "description": "Enrollment code of the course to create the student in. This code is required if userId corresponds to the requesting user; it may be omitted if the requesting user has administrative permissions to create students for any user.", 9218 // "location": "query", 9219 // "type": "string" 9220 // } 9221 // }, 9222 // "path": "v1/courses/{courseId}/students", 9223 // "request": { 9224 // "$ref": "Student" 9225 // }, 9226 // "response": { 9227 // "$ref": "Student" 9228 // }, 9229 // "scopes": [ 9230 // "https://www.googleapis.com/auth/classroom.profile.emails", 9231 // "https://www.googleapis.com/auth/classroom.profile.photos", 9232 // "https://www.googleapis.com/auth/classroom.rosters" 9233 // ] 9234 // } 9235 9236} 9237 9238// method id "classroom.courses.students.delete": 9239 9240type CoursesStudentsDeleteCall struct { 9241 s *Service 9242 courseId string 9243 userId string 9244 urlParams_ gensupport.URLParams 9245 ctx_ context.Context 9246 header_ http.Header 9247} 9248 9249// Delete: Deletes a student of a course. This method returns the 9250// following error codes: * `PERMISSION_DENIED` if the requesting user 9251// is not permitted to delete students of this course or for access 9252// errors. * `NOT_FOUND` if no student of this course has the requested 9253// ID or if the course does not exist. 9254// 9255// - courseId: Identifier of the course. This identifier can be either 9256// the Classroom-assigned identifier or an alias. 9257// - userId: Identifier of the student to delete. The identifier can be 9258// one of the following: * the numeric identifier for the user * the 9259// email address of the user * the string literal "me", indicating 9260// the requesting user. 9261func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall { 9262 c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9263 c.courseId = courseId 9264 c.userId = userId 9265 return c 9266} 9267 9268// Fields allows partial responses to be retrieved. See 9269// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9270// for more information. 9271func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall { 9272 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9273 return c 9274} 9275 9276// Context sets the context to be used in this call's Do method. Any 9277// pending HTTP request will be aborted if the provided context is 9278// canceled. 9279func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall { 9280 c.ctx_ = ctx 9281 return c 9282} 9283 9284// Header returns an http.Header that can be modified by the caller to 9285// add HTTP headers to the request. 9286func (c *CoursesStudentsDeleteCall) Header() http.Header { 9287 if c.header_ == nil { 9288 c.header_ = make(http.Header) 9289 } 9290 return c.header_ 9291} 9292 9293func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) { 9294 reqHeaders := make(http.Header) 9295 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 9296 for k, v := range c.header_ { 9297 reqHeaders[k] = v 9298 } 9299 reqHeaders.Set("User-Agent", c.s.userAgent()) 9300 var body io.Reader = nil 9301 c.urlParams_.Set("alt", alt) 9302 c.urlParams_.Set("prettyPrint", "false") 9303 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 9304 urls += "?" + c.urlParams_.Encode() 9305 req, err := http.NewRequest("DELETE", urls, body) 9306 if err != nil { 9307 return nil, err 9308 } 9309 req.Header = reqHeaders 9310 googleapi.Expand(req.URL, map[string]string{ 9311 "courseId": c.courseId, 9312 "userId": c.userId, 9313 }) 9314 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9315} 9316 9317// Do executes the "classroom.courses.students.delete" call. 9318// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9319// code is an error. Response headers are in either 9320// *Empty.ServerResponse.Header or (if a response was returned at all) 9321// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9322// check whether the returned error was because http.StatusNotModified 9323// was returned. 9324func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9325 gensupport.SetOptions(c.urlParams_, opts...) 9326 res, err := c.doRequest("json") 9327 if res != nil && res.StatusCode == http.StatusNotModified { 9328 if res.Body != nil { 9329 res.Body.Close() 9330 } 9331 return nil, &googleapi.Error{ 9332 Code: res.StatusCode, 9333 Header: res.Header, 9334 } 9335 } 9336 if err != nil { 9337 return nil, err 9338 } 9339 defer googleapi.CloseBody(res) 9340 if err := googleapi.CheckResponse(res); err != nil { 9341 return nil, err 9342 } 9343 ret := &Empty{ 9344 ServerResponse: googleapi.ServerResponse{ 9345 Header: res.Header, 9346 HTTPStatusCode: res.StatusCode, 9347 }, 9348 } 9349 target := &ret 9350 if err := gensupport.DecodeResponse(target, res); err != nil { 9351 return nil, err 9352 } 9353 return ret, nil 9354 // { 9355 // "description": "Deletes a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist.", 9356 // "flatPath": "v1/courses/{courseId}/students/{userId}", 9357 // "httpMethod": "DELETE", 9358 // "id": "classroom.courses.students.delete", 9359 // "parameterOrder": [ 9360 // "courseId", 9361 // "userId" 9362 // ], 9363 // "parameters": { 9364 // "courseId": { 9365 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9366 // "location": "path", 9367 // "required": true, 9368 // "type": "string" 9369 // }, 9370 // "userId": { 9371 // "description": "Identifier of the student to delete. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 9372 // "location": "path", 9373 // "required": true, 9374 // "type": "string" 9375 // } 9376 // }, 9377 // "path": "v1/courses/{courseId}/students/{userId}", 9378 // "response": { 9379 // "$ref": "Empty" 9380 // }, 9381 // "scopes": [ 9382 // "https://www.googleapis.com/auth/classroom.rosters" 9383 // ] 9384 // } 9385 9386} 9387 9388// method id "classroom.courses.students.get": 9389 9390type CoursesStudentsGetCall struct { 9391 s *Service 9392 courseId string 9393 userId string 9394 urlParams_ gensupport.URLParams 9395 ifNoneMatch_ string 9396 ctx_ context.Context 9397 header_ http.Header 9398} 9399 9400// Get: Returns a student of a course. This method returns the following 9401// error codes: * `PERMISSION_DENIED` if the requesting user is not 9402// permitted to view students of this course or for access errors. * 9403// `NOT_FOUND` if no student of this course has the requested ID or if 9404// the course does not exist. 9405// 9406// - courseId: Identifier of the course. This identifier can be either 9407// the Classroom-assigned identifier or an alias. 9408// - userId: Identifier of the student to return. The identifier can be 9409// one of the following: * the numeric identifier for the user * the 9410// email address of the user * the string literal "me", indicating 9411// the requesting user. 9412func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall { 9413 c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9414 c.courseId = courseId 9415 c.userId = userId 9416 return c 9417} 9418 9419// Fields allows partial responses to be retrieved. See 9420// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9421// for more information. 9422func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall { 9423 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9424 return c 9425} 9426 9427// IfNoneMatch sets the optional parameter which makes the operation 9428// fail if the object's ETag matches the given value. This is useful for 9429// getting updates only after the object has changed since the last 9430// request. Use googleapi.IsNotModified to check whether the response 9431// error from Do is the result of In-None-Match. 9432func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall { 9433 c.ifNoneMatch_ = entityTag 9434 return c 9435} 9436 9437// Context sets the context to be used in this call's Do method. Any 9438// pending HTTP request will be aborted if the provided context is 9439// canceled. 9440func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall { 9441 c.ctx_ = ctx 9442 return c 9443} 9444 9445// Header returns an http.Header that can be modified by the caller to 9446// add HTTP headers to the request. 9447func (c *CoursesStudentsGetCall) Header() http.Header { 9448 if c.header_ == nil { 9449 c.header_ = make(http.Header) 9450 } 9451 return c.header_ 9452} 9453 9454func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) { 9455 reqHeaders := make(http.Header) 9456 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 9457 for k, v := range c.header_ { 9458 reqHeaders[k] = v 9459 } 9460 reqHeaders.Set("User-Agent", c.s.userAgent()) 9461 if c.ifNoneMatch_ != "" { 9462 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9463 } 9464 var body io.Reader = nil 9465 c.urlParams_.Set("alt", alt) 9466 c.urlParams_.Set("prettyPrint", "false") 9467 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 9468 urls += "?" + c.urlParams_.Encode() 9469 req, err := http.NewRequest("GET", urls, body) 9470 if err != nil { 9471 return nil, err 9472 } 9473 req.Header = reqHeaders 9474 googleapi.Expand(req.URL, map[string]string{ 9475 "courseId": c.courseId, 9476 "userId": c.userId, 9477 }) 9478 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9479} 9480 9481// Do executes the "classroom.courses.students.get" call. 9482// Exactly one of *Student or error will be non-nil. Any non-2xx status 9483// code is an error. Response headers are in either 9484// *Student.ServerResponse.Header or (if a response was returned at all) 9485// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9486// check whether the returned error was because http.StatusNotModified 9487// was returned. 9488func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) { 9489 gensupport.SetOptions(c.urlParams_, opts...) 9490 res, err := c.doRequest("json") 9491 if res != nil && res.StatusCode == http.StatusNotModified { 9492 if res.Body != nil { 9493 res.Body.Close() 9494 } 9495 return nil, &googleapi.Error{ 9496 Code: res.StatusCode, 9497 Header: res.Header, 9498 } 9499 } 9500 if err != nil { 9501 return nil, err 9502 } 9503 defer googleapi.CloseBody(res) 9504 if err := googleapi.CheckResponse(res); err != nil { 9505 return nil, err 9506 } 9507 ret := &Student{ 9508 ServerResponse: googleapi.ServerResponse{ 9509 Header: res.Header, 9510 HTTPStatusCode: res.StatusCode, 9511 }, 9512 } 9513 target := &ret 9514 if err := gensupport.DecodeResponse(target, res); err != nil { 9515 return nil, err 9516 } 9517 return ret, nil 9518 // { 9519 // "description": "Returns a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist.", 9520 // "flatPath": "v1/courses/{courseId}/students/{userId}", 9521 // "httpMethod": "GET", 9522 // "id": "classroom.courses.students.get", 9523 // "parameterOrder": [ 9524 // "courseId", 9525 // "userId" 9526 // ], 9527 // "parameters": { 9528 // "courseId": { 9529 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9530 // "location": "path", 9531 // "required": true, 9532 // "type": "string" 9533 // }, 9534 // "userId": { 9535 // "description": "Identifier of the student to return. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 9536 // "location": "path", 9537 // "required": true, 9538 // "type": "string" 9539 // } 9540 // }, 9541 // "path": "v1/courses/{courseId}/students/{userId}", 9542 // "response": { 9543 // "$ref": "Student" 9544 // }, 9545 // "scopes": [ 9546 // "https://www.googleapis.com/auth/classroom.profile.emails", 9547 // "https://www.googleapis.com/auth/classroom.profile.photos", 9548 // "https://www.googleapis.com/auth/classroom.rosters", 9549 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9550 // ] 9551 // } 9552 9553} 9554 9555// method id "classroom.courses.students.list": 9556 9557type CoursesStudentsListCall struct { 9558 s *Service 9559 courseId string 9560 urlParams_ gensupport.URLParams 9561 ifNoneMatch_ string 9562 ctx_ context.Context 9563 header_ http.Header 9564} 9565 9566// List: Returns a list of students of this course that the requester is 9567// permitted to view. This method returns the following error codes: * 9568// `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for 9569// access errors. 9570// 9571// - courseId: Identifier of the course. This identifier can be either 9572// the Classroom-assigned identifier or an alias. 9573func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall { 9574 c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9575 c.courseId = courseId 9576 return c 9577} 9578 9579// PageSize sets the optional parameter "pageSize": Maximum number of 9580// items to return. The default is 30 if unspecified or `0`. The server 9581// may return fewer than the specified number of results. 9582func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall { 9583 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9584 return c 9585} 9586 9587// PageToken sets the optional parameter "pageToken": nextPageToken 9588// value returned from a previous list call, indicating that the 9589// subsequent page of results should be returned. The list request must 9590// be otherwise identical to the one that resulted in this token. 9591func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall { 9592 c.urlParams_.Set("pageToken", pageToken) 9593 return c 9594} 9595 9596// Fields allows partial responses to be retrieved. See 9597// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9598// for more information. 9599func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall { 9600 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9601 return c 9602} 9603 9604// IfNoneMatch sets the optional parameter which makes the operation 9605// fail if the object's ETag matches the given value. This is useful for 9606// getting updates only after the object has changed since the last 9607// request. Use googleapi.IsNotModified to check whether the response 9608// error from Do is the result of In-None-Match. 9609func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall { 9610 c.ifNoneMatch_ = entityTag 9611 return c 9612} 9613 9614// Context sets the context to be used in this call's Do method. Any 9615// pending HTTP request will be aborted if the provided context is 9616// canceled. 9617func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall { 9618 c.ctx_ = ctx 9619 return c 9620} 9621 9622// Header returns an http.Header that can be modified by the caller to 9623// add HTTP headers to the request. 9624func (c *CoursesStudentsListCall) Header() http.Header { 9625 if c.header_ == nil { 9626 c.header_ = make(http.Header) 9627 } 9628 return c.header_ 9629} 9630 9631func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) { 9632 reqHeaders := make(http.Header) 9633 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 9634 for k, v := range c.header_ { 9635 reqHeaders[k] = v 9636 } 9637 reqHeaders.Set("User-Agent", c.s.userAgent()) 9638 if c.ifNoneMatch_ != "" { 9639 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9640 } 9641 var body io.Reader = nil 9642 c.urlParams_.Set("alt", alt) 9643 c.urlParams_.Set("prettyPrint", "false") 9644 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9645 urls += "?" + c.urlParams_.Encode() 9646 req, err := http.NewRequest("GET", urls, body) 9647 if err != nil { 9648 return nil, err 9649 } 9650 req.Header = reqHeaders 9651 googleapi.Expand(req.URL, map[string]string{ 9652 "courseId": c.courseId, 9653 }) 9654 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9655} 9656 9657// Do executes the "classroom.courses.students.list" call. 9658// Exactly one of *ListStudentsResponse or error will be non-nil. Any 9659// non-2xx status code is an error. Response headers are in either 9660// *ListStudentsResponse.ServerResponse.Header or (if a response was 9661// returned at all) in error.(*googleapi.Error).Header. Use 9662// googleapi.IsNotModified to check whether the returned error was 9663// because http.StatusNotModified was returned. 9664func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) { 9665 gensupport.SetOptions(c.urlParams_, opts...) 9666 res, err := c.doRequest("json") 9667 if res != nil && res.StatusCode == http.StatusNotModified { 9668 if res.Body != nil { 9669 res.Body.Close() 9670 } 9671 return nil, &googleapi.Error{ 9672 Code: res.StatusCode, 9673 Header: res.Header, 9674 } 9675 } 9676 if err != nil { 9677 return nil, err 9678 } 9679 defer googleapi.CloseBody(res) 9680 if err := googleapi.CheckResponse(res); err != nil { 9681 return nil, err 9682 } 9683 ret := &ListStudentsResponse{ 9684 ServerResponse: googleapi.ServerResponse{ 9685 Header: res.Header, 9686 HTTPStatusCode: res.StatusCode, 9687 }, 9688 } 9689 target := &ret 9690 if err := gensupport.DecodeResponse(target, res); err != nil { 9691 return nil, err 9692 } 9693 return ret, nil 9694 // { 9695 // "description": "Returns a list of students of this course that the requester is permitted to view. This method returns the following error codes: * `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for access errors.", 9696 // "flatPath": "v1/courses/{courseId}/students", 9697 // "httpMethod": "GET", 9698 // "id": "classroom.courses.students.list", 9699 // "parameterOrder": [ 9700 // "courseId" 9701 // ], 9702 // "parameters": { 9703 // "courseId": { 9704 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9705 // "location": "path", 9706 // "required": true, 9707 // "type": "string" 9708 // }, 9709 // "pageSize": { 9710 // "description": "Maximum number of items to return. The default is 30 if unspecified or `0`. The server may return fewer than the specified number of results.", 9711 // "format": "int32", 9712 // "location": "query", 9713 // "type": "integer" 9714 // }, 9715 // "pageToken": { 9716 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 9717 // "location": "query", 9718 // "type": "string" 9719 // } 9720 // }, 9721 // "path": "v1/courses/{courseId}/students", 9722 // "response": { 9723 // "$ref": "ListStudentsResponse" 9724 // }, 9725 // "scopes": [ 9726 // "https://www.googleapis.com/auth/classroom.profile.emails", 9727 // "https://www.googleapis.com/auth/classroom.profile.photos", 9728 // "https://www.googleapis.com/auth/classroom.rosters", 9729 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9730 // ] 9731 // } 9732 9733} 9734 9735// Pages invokes f for each page of results. 9736// A non-nil error returned from f will halt the iteration. 9737// The provided context supersedes any context provided to the Context method. 9738func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error { 9739 c.ctx_ = ctx 9740 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9741 for { 9742 x, err := c.Do() 9743 if err != nil { 9744 return err 9745 } 9746 if err := f(x); err != nil { 9747 return err 9748 } 9749 if x.NextPageToken == "" { 9750 return nil 9751 } 9752 c.PageToken(x.NextPageToken) 9753 } 9754} 9755 9756// method id "classroom.courses.teachers.create": 9757 9758type CoursesTeachersCreateCall struct { 9759 s *Service 9760 courseId string 9761 teacher *Teacher 9762 urlParams_ gensupport.URLParams 9763 ctx_ context.Context 9764 header_ http.Header 9765} 9766 9767// Create: Creates a teacher of a course. This method returns the 9768// following error codes: * `PERMISSION_DENIED` if the requesting user 9769// is not permitted to create teachers in this course or for access 9770// errors. * `NOT_FOUND` if the requested course ID does not exist. * 9771// `FAILED_PRECONDITION` if the requested user's account is disabled, 9772// for the following request errors: * CourseMemberLimitReached * 9773// CourseNotModifiable * CourseTeacherLimitReached * 9774// UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is 9775// already a teacher or student in the course. 9776// 9777// - courseId: Identifier of the course. This identifier can be either 9778// the Classroom-assigned identifier or an alias. 9779func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall { 9780 c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9781 c.courseId = courseId 9782 c.teacher = teacher 9783 return c 9784} 9785 9786// Fields allows partial responses to be retrieved. See 9787// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9788// for more information. 9789func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall { 9790 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9791 return c 9792} 9793 9794// Context sets the context to be used in this call's Do method. Any 9795// pending HTTP request will be aborted if the provided context is 9796// canceled. 9797func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall { 9798 c.ctx_ = ctx 9799 return c 9800} 9801 9802// Header returns an http.Header that can be modified by the caller to 9803// add HTTP headers to the request. 9804func (c *CoursesTeachersCreateCall) Header() http.Header { 9805 if c.header_ == nil { 9806 c.header_ = make(http.Header) 9807 } 9808 return c.header_ 9809} 9810 9811func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) { 9812 reqHeaders := make(http.Header) 9813 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 9814 for k, v := range c.header_ { 9815 reqHeaders[k] = v 9816 } 9817 reqHeaders.Set("User-Agent", c.s.userAgent()) 9818 var body io.Reader = nil 9819 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher) 9820 if err != nil { 9821 return nil, err 9822 } 9823 reqHeaders.Set("Content-Type", "application/json") 9824 c.urlParams_.Set("alt", alt) 9825 c.urlParams_.Set("prettyPrint", "false") 9826 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9827 urls += "?" + c.urlParams_.Encode() 9828 req, err := http.NewRequest("POST", urls, body) 9829 if err != nil { 9830 return nil, err 9831 } 9832 req.Header = reqHeaders 9833 googleapi.Expand(req.URL, map[string]string{ 9834 "courseId": c.courseId, 9835 }) 9836 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9837} 9838 9839// Do executes the "classroom.courses.teachers.create" call. 9840// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9841// code is an error. Response headers are in either 9842// *Teacher.ServerResponse.Header or (if a response was returned at all) 9843// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9844// check whether the returned error was because http.StatusNotModified 9845// was returned. 9846func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9847 gensupport.SetOptions(c.urlParams_, opts...) 9848 res, err := c.doRequest("json") 9849 if res != nil && res.StatusCode == http.StatusNotModified { 9850 if res.Body != nil { 9851 res.Body.Close() 9852 } 9853 return nil, &googleapi.Error{ 9854 Code: res.StatusCode, 9855 Header: res.Header, 9856 } 9857 } 9858 if err != nil { 9859 return nil, err 9860 } 9861 defer googleapi.CloseBody(res) 9862 if err := googleapi.CheckResponse(res); err != nil { 9863 return nil, err 9864 } 9865 ret := &Teacher{ 9866 ServerResponse: googleapi.ServerResponse{ 9867 Header: res.Header, 9868 HTTPStatusCode: res.StatusCode, 9869 }, 9870 } 9871 target := &ret 9872 if err := gensupport.DecodeResponse(target, res); err != nil { 9873 return nil, err 9874 } 9875 return ret, nil 9876 // { 9877 // "description": "Creates a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create teachers in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a teacher or student in the course.", 9878 // "flatPath": "v1/courses/{courseId}/teachers", 9879 // "httpMethod": "POST", 9880 // "id": "classroom.courses.teachers.create", 9881 // "parameterOrder": [ 9882 // "courseId" 9883 // ], 9884 // "parameters": { 9885 // "courseId": { 9886 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9887 // "location": "path", 9888 // "required": true, 9889 // "type": "string" 9890 // } 9891 // }, 9892 // "path": "v1/courses/{courseId}/teachers", 9893 // "request": { 9894 // "$ref": "Teacher" 9895 // }, 9896 // "response": { 9897 // "$ref": "Teacher" 9898 // }, 9899 // "scopes": [ 9900 // "https://www.googleapis.com/auth/classroom.profile.emails", 9901 // "https://www.googleapis.com/auth/classroom.profile.photos", 9902 // "https://www.googleapis.com/auth/classroom.rosters" 9903 // ] 9904 // } 9905 9906} 9907 9908// method id "classroom.courses.teachers.delete": 9909 9910type CoursesTeachersDeleteCall struct { 9911 s *Service 9912 courseId string 9913 userId string 9914 urlParams_ gensupport.URLParams 9915 ctx_ context.Context 9916 header_ http.Header 9917} 9918 9919// Delete: Deletes a teacher of a course. This method returns the 9920// following error codes: * `PERMISSION_DENIED` if the requesting user 9921// is not permitted to delete teachers of this course or for access 9922// errors. * `NOT_FOUND` if no teacher of this course has the requested 9923// ID or if the course does not exist. * `FAILED_PRECONDITION` if the 9924// requested ID belongs to the primary teacher of this course. 9925// 9926// - courseId: Identifier of the course. This identifier can be either 9927// the Classroom-assigned identifier or an alias. 9928// - userId: Identifier of the teacher to delete. The identifier can be 9929// one of the following: * the numeric identifier for the user * the 9930// email address of the user * the string literal "me", indicating 9931// the requesting user. 9932func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall { 9933 c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9934 c.courseId = courseId 9935 c.userId = userId 9936 return c 9937} 9938 9939// Fields allows partial responses to be retrieved. See 9940// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9941// for more information. 9942func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall { 9943 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9944 return c 9945} 9946 9947// Context sets the context to be used in this call's Do method. Any 9948// pending HTTP request will be aborted if the provided context is 9949// canceled. 9950func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall { 9951 c.ctx_ = ctx 9952 return c 9953} 9954 9955// Header returns an http.Header that can be modified by the caller to 9956// add HTTP headers to the request. 9957func (c *CoursesTeachersDeleteCall) Header() http.Header { 9958 if c.header_ == nil { 9959 c.header_ = make(http.Header) 9960 } 9961 return c.header_ 9962} 9963 9964func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) { 9965 reqHeaders := make(http.Header) 9966 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 9967 for k, v := range c.header_ { 9968 reqHeaders[k] = v 9969 } 9970 reqHeaders.Set("User-Agent", c.s.userAgent()) 9971 var body io.Reader = nil 9972 c.urlParams_.Set("alt", alt) 9973 c.urlParams_.Set("prettyPrint", "false") 9974 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9975 urls += "?" + c.urlParams_.Encode() 9976 req, err := http.NewRequest("DELETE", urls, body) 9977 if err != nil { 9978 return nil, err 9979 } 9980 req.Header = reqHeaders 9981 googleapi.Expand(req.URL, map[string]string{ 9982 "courseId": c.courseId, 9983 "userId": c.userId, 9984 }) 9985 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9986} 9987 9988// Do executes the "classroom.courses.teachers.delete" call. 9989// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9990// code is an error. Response headers are in either 9991// *Empty.ServerResponse.Header or (if a response was returned at all) 9992// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9993// check whether the returned error was because http.StatusNotModified 9994// was returned. 9995func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9996 gensupport.SetOptions(c.urlParams_, opts...) 9997 res, err := c.doRequest("json") 9998 if res != nil && res.StatusCode == http.StatusNotModified { 9999 if res.Body != nil { 10000 res.Body.Close() 10001 } 10002 return nil, &googleapi.Error{ 10003 Code: res.StatusCode, 10004 Header: res.Header, 10005 } 10006 } 10007 if err != nil { 10008 return nil, err 10009 } 10010 defer googleapi.CloseBody(res) 10011 if err := googleapi.CheckResponse(res); err != nil { 10012 return nil, err 10013 } 10014 ret := &Empty{ 10015 ServerResponse: googleapi.ServerResponse{ 10016 Header: res.Header, 10017 HTTPStatusCode: res.StatusCode, 10018 }, 10019 } 10020 target := &ret 10021 if err := gensupport.DecodeResponse(target, res); err != nil { 10022 return nil, err 10023 } 10024 return ret, nil 10025 // { 10026 // "description": "Deletes a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete teachers of this course or for access errors. * `NOT_FOUND` if no teacher of this course has the requested ID or if the course does not exist. * `FAILED_PRECONDITION` if the requested ID belongs to the primary teacher of this course.", 10027 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 10028 // "httpMethod": "DELETE", 10029 // "id": "classroom.courses.teachers.delete", 10030 // "parameterOrder": [ 10031 // "courseId", 10032 // "userId" 10033 // ], 10034 // "parameters": { 10035 // "courseId": { 10036 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10037 // "location": "path", 10038 // "required": true, 10039 // "type": "string" 10040 // }, 10041 // "userId": { 10042 // "description": "Identifier of the teacher to delete. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 10043 // "location": "path", 10044 // "required": true, 10045 // "type": "string" 10046 // } 10047 // }, 10048 // "path": "v1/courses/{courseId}/teachers/{userId}", 10049 // "response": { 10050 // "$ref": "Empty" 10051 // }, 10052 // "scopes": [ 10053 // "https://www.googleapis.com/auth/classroom.rosters" 10054 // ] 10055 // } 10056 10057} 10058 10059// method id "classroom.courses.teachers.get": 10060 10061type CoursesTeachersGetCall struct { 10062 s *Service 10063 courseId string 10064 userId string 10065 urlParams_ gensupport.URLParams 10066 ifNoneMatch_ string 10067 ctx_ context.Context 10068 header_ http.Header 10069} 10070 10071// Get: Returns a teacher of a course. This method returns the following 10072// error codes: * `PERMISSION_DENIED` if the requesting user is not 10073// permitted to view teachers of this course or for access errors. * 10074// `NOT_FOUND` if no teacher of this course has the requested ID or if 10075// the course does not exist. 10076// 10077// - courseId: Identifier of the course. This identifier can be either 10078// the Classroom-assigned identifier or an alias. 10079// - userId: Identifier of the teacher to return. The identifier can be 10080// one of the following: * the numeric identifier for the user * the 10081// email address of the user * the string literal "me", indicating 10082// the requesting user. 10083func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall { 10084 c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10085 c.courseId = courseId 10086 c.userId = userId 10087 return c 10088} 10089 10090// Fields allows partial responses to be retrieved. See 10091// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10092// for more information. 10093func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall { 10094 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10095 return c 10096} 10097 10098// IfNoneMatch sets the optional parameter which makes the operation 10099// fail if the object's ETag matches the given value. This is useful for 10100// getting updates only after the object has changed since the last 10101// request. Use googleapi.IsNotModified to check whether the response 10102// error from Do is the result of In-None-Match. 10103func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall { 10104 c.ifNoneMatch_ = entityTag 10105 return c 10106} 10107 10108// Context sets the context to be used in this call's Do method. Any 10109// pending HTTP request will be aborted if the provided context is 10110// canceled. 10111func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall { 10112 c.ctx_ = ctx 10113 return c 10114} 10115 10116// Header returns an http.Header that can be modified by the caller to 10117// add HTTP headers to the request. 10118func (c *CoursesTeachersGetCall) Header() http.Header { 10119 if c.header_ == nil { 10120 c.header_ = make(http.Header) 10121 } 10122 return c.header_ 10123} 10124 10125func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) { 10126 reqHeaders := make(http.Header) 10127 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 10128 for k, v := range c.header_ { 10129 reqHeaders[k] = v 10130 } 10131 reqHeaders.Set("User-Agent", c.s.userAgent()) 10132 if c.ifNoneMatch_ != "" { 10133 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10134 } 10135 var body io.Reader = nil 10136 c.urlParams_.Set("alt", alt) 10137 c.urlParams_.Set("prettyPrint", "false") 10138 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 10139 urls += "?" + c.urlParams_.Encode() 10140 req, err := http.NewRequest("GET", urls, body) 10141 if err != nil { 10142 return nil, err 10143 } 10144 req.Header = reqHeaders 10145 googleapi.Expand(req.URL, map[string]string{ 10146 "courseId": c.courseId, 10147 "userId": c.userId, 10148 }) 10149 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10150} 10151 10152// Do executes the "classroom.courses.teachers.get" call. 10153// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 10154// code is an error. Response headers are in either 10155// *Teacher.ServerResponse.Header or (if a response was returned at all) 10156// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10157// check whether the returned error was because http.StatusNotModified 10158// was returned. 10159func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 10160 gensupport.SetOptions(c.urlParams_, opts...) 10161 res, err := c.doRequest("json") 10162 if res != nil && res.StatusCode == http.StatusNotModified { 10163 if res.Body != nil { 10164 res.Body.Close() 10165 } 10166 return nil, &googleapi.Error{ 10167 Code: res.StatusCode, 10168 Header: res.Header, 10169 } 10170 } 10171 if err != nil { 10172 return nil, err 10173 } 10174 defer googleapi.CloseBody(res) 10175 if err := googleapi.CheckResponse(res); err != nil { 10176 return nil, err 10177 } 10178 ret := &Teacher{ 10179 ServerResponse: googleapi.ServerResponse{ 10180 Header: res.Header, 10181 HTTPStatusCode: res.StatusCode, 10182 }, 10183 } 10184 target := &ret 10185 if err := gensupport.DecodeResponse(target, res); err != nil { 10186 return nil, err 10187 } 10188 return ret, nil 10189 // { 10190 // "description": "Returns a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view teachers of this course or for access errors. * `NOT_FOUND` if no teacher of this course has the requested ID or if the course does not exist.", 10191 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 10192 // "httpMethod": "GET", 10193 // "id": "classroom.courses.teachers.get", 10194 // "parameterOrder": [ 10195 // "courseId", 10196 // "userId" 10197 // ], 10198 // "parameters": { 10199 // "courseId": { 10200 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10201 // "location": "path", 10202 // "required": true, 10203 // "type": "string" 10204 // }, 10205 // "userId": { 10206 // "description": "Identifier of the teacher to return. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 10207 // "location": "path", 10208 // "required": true, 10209 // "type": "string" 10210 // } 10211 // }, 10212 // "path": "v1/courses/{courseId}/teachers/{userId}", 10213 // "response": { 10214 // "$ref": "Teacher" 10215 // }, 10216 // "scopes": [ 10217 // "https://www.googleapis.com/auth/classroom.profile.emails", 10218 // "https://www.googleapis.com/auth/classroom.profile.photos", 10219 // "https://www.googleapis.com/auth/classroom.rosters", 10220 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 10221 // ] 10222 // } 10223 10224} 10225 10226// method id "classroom.courses.teachers.list": 10227 10228type CoursesTeachersListCall struct { 10229 s *Service 10230 courseId string 10231 urlParams_ gensupport.URLParams 10232 ifNoneMatch_ string 10233 ctx_ context.Context 10234 header_ http.Header 10235} 10236 10237// List: Returns a list of teachers of this course that the requester is 10238// permitted to view. This method returns the following error codes: * 10239// `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for 10240// access errors. 10241// 10242// - courseId: Identifier of the course. This identifier can be either 10243// the Classroom-assigned identifier or an alias. 10244func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall { 10245 c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10246 c.courseId = courseId 10247 return c 10248} 10249 10250// PageSize sets the optional parameter "pageSize": Maximum number of 10251// items to return. The default is 30 if unspecified or `0`. The server 10252// may return fewer than the specified number of results. 10253func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall { 10254 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10255 return c 10256} 10257 10258// PageToken sets the optional parameter "pageToken": nextPageToken 10259// value returned from a previous list call, indicating that the 10260// subsequent page of results should be returned. The list request must 10261// be otherwise identical to the one that resulted in this token. 10262func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall { 10263 c.urlParams_.Set("pageToken", pageToken) 10264 return c 10265} 10266 10267// Fields allows partial responses to be retrieved. See 10268// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10269// for more information. 10270func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall { 10271 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10272 return c 10273} 10274 10275// IfNoneMatch sets the optional parameter which makes the operation 10276// fail if the object's ETag matches the given value. This is useful for 10277// getting updates only after the object has changed since the last 10278// request. Use googleapi.IsNotModified to check whether the response 10279// error from Do is the result of In-None-Match. 10280func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall { 10281 c.ifNoneMatch_ = entityTag 10282 return c 10283} 10284 10285// Context sets the context to be used in this call's Do method. Any 10286// pending HTTP request will be aborted if the provided context is 10287// canceled. 10288func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall { 10289 c.ctx_ = ctx 10290 return c 10291} 10292 10293// Header returns an http.Header that can be modified by the caller to 10294// add HTTP headers to the request. 10295func (c *CoursesTeachersListCall) Header() http.Header { 10296 if c.header_ == nil { 10297 c.header_ = make(http.Header) 10298 } 10299 return c.header_ 10300} 10301 10302func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) { 10303 reqHeaders := make(http.Header) 10304 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 10305 for k, v := range c.header_ { 10306 reqHeaders[k] = v 10307 } 10308 reqHeaders.Set("User-Agent", c.s.userAgent()) 10309 if c.ifNoneMatch_ != "" { 10310 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10311 } 10312 var body io.Reader = nil 10313 c.urlParams_.Set("alt", alt) 10314 c.urlParams_.Set("prettyPrint", "false") 10315 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 10316 urls += "?" + c.urlParams_.Encode() 10317 req, err := http.NewRequest("GET", urls, body) 10318 if err != nil { 10319 return nil, err 10320 } 10321 req.Header = reqHeaders 10322 googleapi.Expand(req.URL, map[string]string{ 10323 "courseId": c.courseId, 10324 }) 10325 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10326} 10327 10328// Do executes the "classroom.courses.teachers.list" call. 10329// Exactly one of *ListTeachersResponse or error will be non-nil. Any 10330// non-2xx status code is an error. Response headers are in either 10331// *ListTeachersResponse.ServerResponse.Header or (if a response was 10332// returned at all) in error.(*googleapi.Error).Header. Use 10333// googleapi.IsNotModified to check whether the returned error was 10334// because http.StatusNotModified was returned. 10335func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) { 10336 gensupport.SetOptions(c.urlParams_, opts...) 10337 res, err := c.doRequest("json") 10338 if res != nil && res.StatusCode == http.StatusNotModified { 10339 if res.Body != nil { 10340 res.Body.Close() 10341 } 10342 return nil, &googleapi.Error{ 10343 Code: res.StatusCode, 10344 Header: res.Header, 10345 } 10346 } 10347 if err != nil { 10348 return nil, err 10349 } 10350 defer googleapi.CloseBody(res) 10351 if err := googleapi.CheckResponse(res); err != nil { 10352 return nil, err 10353 } 10354 ret := &ListTeachersResponse{ 10355 ServerResponse: googleapi.ServerResponse{ 10356 Header: res.Header, 10357 HTTPStatusCode: res.StatusCode, 10358 }, 10359 } 10360 target := &ret 10361 if err := gensupport.DecodeResponse(target, res); err != nil { 10362 return nil, err 10363 } 10364 return ret, nil 10365 // { 10366 // "description": "Returns a list of teachers of this course that the requester is permitted to view. This method returns the following error codes: * `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for access errors.", 10367 // "flatPath": "v1/courses/{courseId}/teachers", 10368 // "httpMethod": "GET", 10369 // "id": "classroom.courses.teachers.list", 10370 // "parameterOrder": [ 10371 // "courseId" 10372 // ], 10373 // "parameters": { 10374 // "courseId": { 10375 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10376 // "location": "path", 10377 // "required": true, 10378 // "type": "string" 10379 // }, 10380 // "pageSize": { 10381 // "description": "Maximum number of items to return. The default is 30 if unspecified or `0`. The server may return fewer than the specified number of results.", 10382 // "format": "int32", 10383 // "location": "query", 10384 // "type": "integer" 10385 // }, 10386 // "pageToken": { 10387 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 10388 // "location": "query", 10389 // "type": "string" 10390 // } 10391 // }, 10392 // "path": "v1/courses/{courseId}/teachers", 10393 // "response": { 10394 // "$ref": "ListTeachersResponse" 10395 // }, 10396 // "scopes": [ 10397 // "https://www.googleapis.com/auth/classroom.profile.emails", 10398 // "https://www.googleapis.com/auth/classroom.profile.photos", 10399 // "https://www.googleapis.com/auth/classroom.rosters", 10400 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 10401 // ] 10402 // } 10403 10404} 10405 10406// Pages invokes f for each page of results. 10407// A non-nil error returned from f will halt the iteration. 10408// The provided context supersedes any context provided to the Context method. 10409func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error { 10410 c.ctx_ = ctx 10411 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10412 for { 10413 x, err := c.Do() 10414 if err != nil { 10415 return err 10416 } 10417 if err := f(x); err != nil { 10418 return err 10419 } 10420 if x.NextPageToken == "" { 10421 return nil 10422 } 10423 c.PageToken(x.NextPageToken) 10424 } 10425} 10426 10427// method id "classroom.courses.topics.create": 10428 10429type CoursesTopicsCreateCall struct { 10430 s *Service 10431 courseId string 10432 topic *Topic 10433 urlParams_ gensupport.URLParams 10434 ctx_ context.Context 10435 header_ http.Header 10436} 10437 10438// Create: Creates a topic. This method returns the following error 10439// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 10440// to access the requested course, create a topic in the requested 10441// course, or for access errors. * `INVALID_ARGUMENT` if the request is 10442// malformed. * `NOT_FOUND` if the requested course does not exist. 10443// 10444// - courseId: Identifier of the course. This identifier can be either 10445// the Classroom-assigned identifier or an alias. 10446func (r *CoursesTopicsService) Create(courseId string, topic *Topic) *CoursesTopicsCreateCall { 10447 c := &CoursesTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10448 c.courseId = courseId 10449 c.topic = topic 10450 return c 10451} 10452 10453// Fields allows partial responses to be retrieved. See 10454// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10455// for more information. 10456func (c *CoursesTopicsCreateCall) Fields(s ...googleapi.Field) *CoursesTopicsCreateCall { 10457 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10458 return c 10459} 10460 10461// Context sets the context to be used in this call's Do method. Any 10462// pending HTTP request will be aborted if the provided context is 10463// canceled. 10464func (c *CoursesTopicsCreateCall) Context(ctx context.Context) *CoursesTopicsCreateCall { 10465 c.ctx_ = ctx 10466 return c 10467} 10468 10469// Header returns an http.Header that can be modified by the caller to 10470// add HTTP headers to the request. 10471func (c *CoursesTopicsCreateCall) Header() http.Header { 10472 if c.header_ == nil { 10473 c.header_ = make(http.Header) 10474 } 10475 return c.header_ 10476} 10477 10478func (c *CoursesTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 10479 reqHeaders := make(http.Header) 10480 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 10481 for k, v := range c.header_ { 10482 reqHeaders[k] = v 10483 } 10484 reqHeaders.Set("User-Agent", c.s.userAgent()) 10485 var body io.Reader = nil 10486 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 10487 if err != nil { 10488 return nil, err 10489 } 10490 reqHeaders.Set("Content-Type", "application/json") 10491 c.urlParams_.Set("alt", alt) 10492 c.urlParams_.Set("prettyPrint", "false") 10493 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10494 urls += "?" + c.urlParams_.Encode() 10495 req, err := http.NewRequest("POST", urls, body) 10496 if err != nil { 10497 return nil, err 10498 } 10499 req.Header = reqHeaders 10500 googleapi.Expand(req.URL, map[string]string{ 10501 "courseId": c.courseId, 10502 }) 10503 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10504} 10505 10506// Do executes the "classroom.courses.topics.create" call. 10507// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10508// code is an error. Response headers are in either 10509// *Topic.ServerResponse.Header or (if a response was returned at all) 10510// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10511// check whether the returned error was because http.StatusNotModified 10512// was returned. 10513func (c *CoursesTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10514 gensupport.SetOptions(c.urlParams_, opts...) 10515 res, err := c.doRequest("json") 10516 if res != nil && res.StatusCode == http.StatusNotModified { 10517 if res.Body != nil { 10518 res.Body.Close() 10519 } 10520 return nil, &googleapi.Error{ 10521 Code: res.StatusCode, 10522 Header: res.Header, 10523 } 10524 } 10525 if err != nil { 10526 return nil, err 10527 } 10528 defer googleapi.CloseBody(res) 10529 if err := googleapi.CheckResponse(res); err != nil { 10530 return nil, err 10531 } 10532 ret := &Topic{ 10533 ServerResponse: googleapi.ServerResponse{ 10534 Header: res.Header, 10535 HTTPStatusCode: res.StatusCode, 10536 }, 10537 } 10538 target := &ret 10539 if err := gensupport.DecodeResponse(target, res); err != nil { 10540 return nil, err 10541 } 10542 return ret, nil 10543 // { 10544 // "description": "Creates a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create a topic in the requested course, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 10545 // "flatPath": "v1/courses/{courseId}/topics", 10546 // "httpMethod": "POST", 10547 // "id": "classroom.courses.topics.create", 10548 // "parameterOrder": [ 10549 // "courseId" 10550 // ], 10551 // "parameters": { 10552 // "courseId": { 10553 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10554 // "location": "path", 10555 // "required": true, 10556 // "type": "string" 10557 // } 10558 // }, 10559 // "path": "v1/courses/{courseId}/topics", 10560 // "request": { 10561 // "$ref": "Topic" 10562 // }, 10563 // "response": { 10564 // "$ref": "Topic" 10565 // }, 10566 // "scopes": [ 10567 // "https://www.googleapis.com/auth/classroom.topics" 10568 // ] 10569 // } 10570 10571} 10572 10573// method id "classroom.courses.topics.delete": 10574 10575type CoursesTopicsDeleteCall struct { 10576 s *Service 10577 courseId string 10578 id string 10579 urlParams_ gensupport.URLParams 10580 ctx_ context.Context 10581 header_ http.Header 10582} 10583 10584// Delete: Deletes a topic. This method returns the following error 10585// codes: * `PERMISSION_DENIED` if the requesting user is not allowed to 10586// delete the requested topic or for access errors. * 10587// `FAILED_PRECONDITION` if the requested topic has already been 10588// deleted. * `NOT_FOUND` if no course or topic exists with the 10589// requested ID. 10590// 10591// - courseId: Identifier of the course. This identifier can be either 10592// the Classroom-assigned identifier or an alias. 10593// - id: Identifier of the topic to delete. 10594func (r *CoursesTopicsService) Delete(courseId string, id string) *CoursesTopicsDeleteCall { 10595 c := &CoursesTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10596 c.courseId = courseId 10597 c.id = id 10598 return c 10599} 10600 10601// Fields allows partial responses to be retrieved. See 10602// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10603// for more information. 10604func (c *CoursesTopicsDeleteCall) Fields(s ...googleapi.Field) *CoursesTopicsDeleteCall { 10605 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10606 return c 10607} 10608 10609// Context sets the context to be used in this call's Do method. Any 10610// pending HTTP request will be aborted if the provided context is 10611// canceled. 10612func (c *CoursesTopicsDeleteCall) Context(ctx context.Context) *CoursesTopicsDeleteCall { 10613 c.ctx_ = ctx 10614 return c 10615} 10616 10617// Header returns an http.Header that can be modified by the caller to 10618// add HTTP headers to the request. 10619func (c *CoursesTopicsDeleteCall) Header() http.Header { 10620 if c.header_ == nil { 10621 c.header_ = make(http.Header) 10622 } 10623 return c.header_ 10624} 10625 10626func (c *CoursesTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 10627 reqHeaders := make(http.Header) 10628 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 10629 for k, v := range c.header_ { 10630 reqHeaders[k] = v 10631 } 10632 reqHeaders.Set("User-Agent", c.s.userAgent()) 10633 var body io.Reader = nil 10634 c.urlParams_.Set("alt", alt) 10635 c.urlParams_.Set("prettyPrint", "false") 10636 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10637 urls += "?" + c.urlParams_.Encode() 10638 req, err := http.NewRequest("DELETE", urls, body) 10639 if err != nil { 10640 return nil, err 10641 } 10642 req.Header = reqHeaders 10643 googleapi.Expand(req.URL, map[string]string{ 10644 "courseId": c.courseId, 10645 "id": c.id, 10646 }) 10647 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10648} 10649 10650// Do executes the "classroom.courses.topics.delete" call. 10651// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10652// code is an error. Response headers are in either 10653// *Empty.ServerResponse.Header or (if a response was returned at all) 10654// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10655// check whether the returned error was because http.StatusNotModified 10656// was returned. 10657func (c *CoursesTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10658 gensupport.SetOptions(c.urlParams_, opts...) 10659 res, err := c.doRequest("json") 10660 if res != nil && res.StatusCode == http.StatusNotModified { 10661 if res.Body != nil { 10662 res.Body.Close() 10663 } 10664 return nil, &googleapi.Error{ 10665 Code: res.StatusCode, 10666 Header: res.Header, 10667 } 10668 } 10669 if err != nil { 10670 return nil, err 10671 } 10672 defer googleapi.CloseBody(res) 10673 if err := googleapi.CheckResponse(res); err != nil { 10674 return nil, err 10675 } 10676 ret := &Empty{ 10677 ServerResponse: googleapi.ServerResponse{ 10678 Header: res.Header, 10679 HTTPStatusCode: res.StatusCode, 10680 }, 10681 } 10682 target := &ret 10683 if err := gensupport.DecodeResponse(target, res); err != nil { 10684 return nil, err 10685 } 10686 return ret, nil 10687 // { 10688 // "description": "Deletes a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not allowed to delete the requested topic or for access errors. * `FAILED_PRECONDITION` if the requested topic has already been deleted. * `NOT_FOUND` if no course or topic exists with the requested ID.", 10689 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10690 // "httpMethod": "DELETE", 10691 // "id": "classroom.courses.topics.delete", 10692 // "parameterOrder": [ 10693 // "courseId", 10694 // "id" 10695 // ], 10696 // "parameters": { 10697 // "courseId": { 10698 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10699 // "location": "path", 10700 // "required": true, 10701 // "type": "string" 10702 // }, 10703 // "id": { 10704 // "description": "Identifier of the topic to delete.", 10705 // "location": "path", 10706 // "required": true, 10707 // "type": "string" 10708 // } 10709 // }, 10710 // "path": "v1/courses/{courseId}/topics/{id}", 10711 // "response": { 10712 // "$ref": "Empty" 10713 // }, 10714 // "scopes": [ 10715 // "https://www.googleapis.com/auth/classroom.topics" 10716 // ] 10717 // } 10718 10719} 10720 10721// method id "classroom.courses.topics.get": 10722 10723type CoursesTopicsGetCall struct { 10724 s *Service 10725 courseId string 10726 id string 10727 urlParams_ gensupport.URLParams 10728 ifNoneMatch_ string 10729 ctx_ context.Context 10730 header_ http.Header 10731} 10732 10733// Get: Returns a topic. This method returns the following error codes: 10734// * `PERMISSION_DENIED` if the requesting user is not permitted to 10735// access the requested course or topic, or for access errors. * 10736// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 10737// requested course or topic does not exist. 10738// 10739// - courseId: Identifier of the course. 10740// - id: Identifier of the topic. 10741func (r *CoursesTopicsService) Get(courseId string, id string) *CoursesTopicsGetCall { 10742 c := &CoursesTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10743 c.courseId = courseId 10744 c.id = id 10745 return c 10746} 10747 10748// Fields allows partial responses to be retrieved. See 10749// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10750// for more information. 10751func (c *CoursesTopicsGetCall) Fields(s ...googleapi.Field) *CoursesTopicsGetCall { 10752 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10753 return c 10754} 10755 10756// IfNoneMatch sets the optional parameter which makes the operation 10757// fail if the object's ETag matches the given value. This is useful for 10758// getting updates only after the object has changed since the last 10759// request. Use googleapi.IsNotModified to check whether the response 10760// error from Do is the result of In-None-Match. 10761func (c *CoursesTopicsGetCall) IfNoneMatch(entityTag string) *CoursesTopicsGetCall { 10762 c.ifNoneMatch_ = entityTag 10763 return c 10764} 10765 10766// Context sets the context to be used in this call's Do method. Any 10767// pending HTTP request will be aborted if the provided context is 10768// canceled. 10769func (c *CoursesTopicsGetCall) Context(ctx context.Context) *CoursesTopicsGetCall { 10770 c.ctx_ = ctx 10771 return c 10772} 10773 10774// Header returns an http.Header that can be modified by the caller to 10775// add HTTP headers to the request. 10776func (c *CoursesTopicsGetCall) Header() http.Header { 10777 if c.header_ == nil { 10778 c.header_ = make(http.Header) 10779 } 10780 return c.header_ 10781} 10782 10783func (c *CoursesTopicsGetCall) doRequest(alt string) (*http.Response, error) { 10784 reqHeaders := make(http.Header) 10785 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 10786 for k, v := range c.header_ { 10787 reqHeaders[k] = v 10788 } 10789 reqHeaders.Set("User-Agent", c.s.userAgent()) 10790 if c.ifNoneMatch_ != "" { 10791 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10792 } 10793 var body io.Reader = nil 10794 c.urlParams_.Set("alt", alt) 10795 c.urlParams_.Set("prettyPrint", "false") 10796 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10797 urls += "?" + c.urlParams_.Encode() 10798 req, err := http.NewRequest("GET", urls, body) 10799 if err != nil { 10800 return nil, err 10801 } 10802 req.Header = reqHeaders 10803 googleapi.Expand(req.URL, map[string]string{ 10804 "courseId": c.courseId, 10805 "id": c.id, 10806 }) 10807 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10808} 10809 10810// Do executes the "classroom.courses.topics.get" call. 10811// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10812// code is an error. Response headers are in either 10813// *Topic.ServerResponse.Header or (if a response was returned at all) 10814// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10815// check whether the returned error was because http.StatusNotModified 10816// was returned. 10817func (c *CoursesTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10818 gensupport.SetOptions(c.urlParams_, opts...) 10819 res, err := c.doRequest("json") 10820 if res != nil && res.StatusCode == http.StatusNotModified { 10821 if res.Body != nil { 10822 res.Body.Close() 10823 } 10824 return nil, &googleapi.Error{ 10825 Code: res.StatusCode, 10826 Header: res.Header, 10827 } 10828 } 10829 if err != nil { 10830 return nil, err 10831 } 10832 defer googleapi.CloseBody(res) 10833 if err := googleapi.CheckResponse(res); err != nil { 10834 return nil, err 10835 } 10836 ret := &Topic{ 10837 ServerResponse: googleapi.ServerResponse{ 10838 Header: res.Header, 10839 HTTPStatusCode: res.StatusCode, 10840 }, 10841 } 10842 target := &ret 10843 if err := gensupport.DecodeResponse(target, res); err != nil { 10844 return nil, err 10845 } 10846 return ret, nil 10847 // { 10848 // "description": "Returns a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or topic, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or topic does not exist.", 10849 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10850 // "httpMethod": "GET", 10851 // "id": "classroom.courses.topics.get", 10852 // "parameterOrder": [ 10853 // "courseId", 10854 // "id" 10855 // ], 10856 // "parameters": { 10857 // "courseId": { 10858 // "description": "Identifier of the course.", 10859 // "location": "path", 10860 // "required": true, 10861 // "type": "string" 10862 // }, 10863 // "id": { 10864 // "description": "Identifier of the topic.", 10865 // "location": "path", 10866 // "required": true, 10867 // "type": "string" 10868 // } 10869 // }, 10870 // "path": "v1/courses/{courseId}/topics/{id}", 10871 // "response": { 10872 // "$ref": "Topic" 10873 // }, 10874 // "scopes": [ 10875 // "https://www.googleapis.com/auth/classroom.topics", 10876 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10877 // ] 10878 // } 10879 10880} 10881 10882// method id "classroom.courses.topics.list": 10883 10884type CoursesTopicsListCall struct { 10885 s *Service 10886 courseId string 10887 urlParams_ gensupport.URLParams 10888 ifNoneMatch_ string 10889 ctx_ context.Context 10890 header_ http.Header 10891} 10892 10893// List: Returns the list of topics that the requester is permitted to 10894// view. This method returns the following error codes: * 10895// `PERMISSION_DENIED` if the requesting user is not permitted to access 10896// the requested course or for access errors. * `INVALID_ARGUMENT` if 10897// the request is malformed. * `NOT_FOUND` if the requested course does 10898// not exist. 10899// 10900// - courseId: Identifier of the course. This identifier can be either 10901// the Classroom-assigned identifier or an alias. 10902func (r *CoursesTopicsService) List(courseId string) *CoursesTopicsListCall { 10903 c := &CoursesTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10904 c.courseId = courseId 10905 return c 10906} 10907 10908// PageSize sets the optional parameter "pageSize": Maximum number of 10909// items to return. Zero or unspecified indicates that the server may 10910// assign a maximum. The server may return fewer than the specified 10911// number of results. 10912func (c *CoursesTopicsListCall) PageSize(pageSize int64) *CoursesTopicsListCall { 10913 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10914 return c 10915} 10916 10917// PageToken sets the optional parameter "pageToken": nextPageToken 10918// value returned from a previous list call, indicating that the 10919// subsequent page of results should be returned. The list request must 10920// be otherwise identical to the one that resulted in this token. 10921func (c *CoursesTopicsListCall) PageToken(pageToken string) *CoursesTopicsListCall { 10922 c.urlParams_.Set("pageToken", pageToken) 10923 return c 10924} 10925 10926// Fields allows partial responses to be retrieved. See 10927// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10928// for more information. 10929func (c *CoursesTopicsListCall) Fields(s ...googleapi.Field) *CoursesTopicsListCall { 10930 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10931 return c 10932} 10933 10934// IfNoneMatch sets the optional parameter which makes the operation 10935// fail if the object's ETag matches the given value. This is useful for 10936// getting updates only after the object has changed since the last 10937// request. Use googleapi.IsNotModified to check whether the response 10938// error from Do is the result of In-None-Match. 10939func (c *CoursesTopicsListCall) IfNoneMatch(entityTag string) *CoursesTopicsListCall { 10940 c.ifNoneMatch_ = entityTag 10941 return c 10942} 10943 10944// Context sets the context to be used in this call's Do method. Any 10945// pending HTTP request will be aborted if the provided context is 10946// canceled. 10947func (c *CoursesTopicsListCall) Context(ctx context.Context) *CoursesTopicsListCall { 10948 c.ctx_ = ctx 10949 return c 10950} 10951 10952// Header returns an http.Header that can be modified by the caller to 10953// add HTTP headers to the request. 10954func (c *CoursesTopicsListCall) Header() http.Header { 10955 if c.header_ == nil { 10956 c.header_ = make(http.Header) 10957 } 10958 return c.header_ 10959} 10960 10961func (c *CoursesTopicsListCall) doRequest(alt string) (*http.Response, error) { 10962 reqHeaders := make(http.Header) 10963 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 10964 for k, v := range c.header_ { 10965 reqHeaders[k] = v 10966 } 10967 reqHeaders.Set("User-Agent", c.s.userAgent()) 10968 if c.ifNoneMatch_ != "" { 10969 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10970 } 10971 var body io.Reader = nil 10972 c.urlParams_.Set("alt", alt) 10973 c.urlParams_.Set("prettyPrint", "false") 10974 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10975 urls += "?" + c.urlParams_.Encode() 10976 req, err := http.NewRequest("GET", urls, body) 10977 if err != nil { 10978 return nil, err 10979 } 10980 req.Header = reqHeaders 10981 googleapi.Expand(req.URL, map[string]string{ 10982 "courseId": c.courseId, 10983 }) 10984 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10985} 10986 10987// Do executes the "classroom.courses.topics.list" call. 10988// Exactly one of *ListTopicResponse or error will be non-nil. Any 10989// non-2xx status code is an error. Response headers are in either 10990// *ListTopicResponse.ServerResponse.Header or (if a response was 10991// returned at all) in error.(*googleapi.Error).Header. Use 10992// googleapi.IsNotModified to check whether the returned error was 10993// because http.StatusNotModified was returned. 10994func (c *CoursesTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicResponse, error) { 10995 gensupport.SetOptions(c.urlParams_, opts...) 10996 res, err := c.doRequest("json") 10997 if res != nil && res.StatusCode == http.StatusNotModified { 10998 if res.Body != nil { 10999 res.Body.Close() 11000 } 11001 return nil, &googleapi.Error{ 11002 Code: res.StatusCode, 11003 Header: res.Header, 11004 } 11005 } 11006 if err != nil { 11007 return nil, err 11008 } 11009 defer googleapi.CloseBody(res) 11010 if err := googleapi.CheckResponse(res); err != nil { 11011 return nil, err 11012 } 11013 ret := &ListTopicResponse{ 11014 ServerResponse: googleapi.ServerResponse{ 11015 Header: res.Header, 11016 HTTPStatusCode: res.StatusCode, 11017 }, 11018 } 11019 target := &ret 11020 if err := gensupport.DecodeResponse(target, res); err != nil { 11021 return nil, err 11022 } 11023 return ret, nil 11024 // { 11025 // "description": "Returns the list of topics that the requester is permitted to view. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 11026 // "flatPath": "v1/courses/{courseId}/topics", 11027 // "httpMethod": "GET", 11028 // "id": "classroom.courses.topics.list", 11029 // "parameterOrder": [ 11030 // "courseId" 11031 // ], 11032 // "parameters": { 11033 // "courseId": { 11034 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 11035 // "location": "path", 11036 // "required": true, 11037 // "type": "string" 11038 // }, 11039 // "pageSize": { 11040 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 11041 // "format": "int32", 11042 // "location": "query", 11043 // "type": "integer" 11044 // }, 11045 // "pageToken": { 11046 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 11047 // "location": "query", 11048 // "type": "string" 11049 // } 11050 // }, 11051 // "path": "v1/courses/{courseId}/topics", 11052 // "response": { 11053 // "$ref": "ListTopicResponse" 11054 // }, 11055 // "scopes": [ 11056 // "https://www.googleapis.com/auth/classroom.topics", 11057 // "https://www.googleapis.com/auth/classroom.topics.readonly" 11058 // ] 11059 // } 11060 11061} 11062 11063// Pages invokes f for each page of results. 11064// A non-nil error returned from f will halt the iteration. 11065// The provided context supersedes any context provided to the Context method. 11066func (c *CoursesTopicsListCall) Pages(ctx context.Context, f func(*ListTopicResponse) error) error { 11067 c.ctx_ = ctx 11068 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 11069 for { 11070 x, err := c.Do() 11071 if err != nil { 11072 return err 11073 } 11074 if err := f(x); err != nil { 11075 return err 11076 } 11077 if x.NextPageToken == "" { 11078 return nil 11079 } 11080 c.PageToken(x.NextPageToken) 11081 } 11082} 11083 11084// method id "classroom.courses.topics.patch": 11085 11086type CoursesTopicsPatchCall struct { 11087 s *Service 11088 courseId string 11089 id string 11090 topic *Topic 11091 urlParams_ gensupport.URLParams 11092 ctx_ context.Context 11093 header_ http.Header 11094} 11095 11096// Patch: Updates one or more fields of a topic. This method returns the 11097// following error codes: * `PERMISSION_DENIED` if the requesting 11098// developer project did not create the corresponding topic or for 11099// access errors. * `INVALID_ARGUMENT` if the request is malformed. * 11100// `NOT_FOUND` if the requested course or topic does not exist 11101// 11102// - courseId: Identifier of the course. This identifier can be either 11103// the Classroom-assigned identifier or an alias. 11104// - id: Identifier of the topic. 11105func (r *CoursesTopicsService) Patch(courseId string, id string, topic *Topic) *CoursesTopicsPatchCall { 11106 c := &CoursesTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11107 c.courseId = courseId 11108 c.id = id 11109 c.topic = topic 11110 return c 11111} 11112 11113// UpdateMask sets the optional parameter "updateMask": Mask that 11114// identifies which fields on the topic to update. This field is 11115// required to do an update. The update fails if invalid fields are 11116// specified. If a field supports empty values, it can be cleared by 11117// specifying it in the update mask and not in the Topic object. If a 11118// field that does not support empty values is included in the update 11119// mask and not set in the Topic object, an `INVALID_ARGUMENT` error is 11120// returned. The following fields may be specified: * `name` 11121func (c *CoursesTopicsPatchCall) UpdateMask(updateMask string) *CoursesTopicsPatchCall { 11122 c.urlParams_.Set("updateMask", updateMask) 11123 return c 11124} 11125 11126// Fields allows partial responses to be retrieved. See 11127// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11128// for more information. 11129func (c *CoursesTopicsPatchCall) Fields(s ...googleapi.Field) *CoursesTopicsPatchCall { 11130 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11131 return c 11132} 11133 11134// Context sets the context to be used in this call's Do method. Any 11135// pending HTTP request will be aborted if the provided context is 11136// canceled. 11137func (c *CoursesTopicsPatchCall) Context(ctx context.Context) *CoursesTopicsPatchCall { 11138 c.ctx_ = ctx 11139 return c 11140} 11141 11142// Header returns an http.Header that can be modified by the caller to 11143// add HTTP headers to the request. 11144func (c *CoursesTopicsPatchCall) Header() http.Header { 11145 if c.header_ == nil { 11146 c.header_ = make(http.Header) 11147 } 11148 return c.header_ 11149} 11150 11151func (c *CoursesTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 11152 reqHeaders := make(http.Header) 11153 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 11154 for k, v := range c.header_ { 11155 reqHeaders[k] = v 11156 } 11157 reqHeaders.Set("User-Agent", c.s.userAgent()) 11158 var body io.Reader = nil 11159 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 11160 if err != nil { 11161 return nil, err 11162 } 11163 reqHeaders.Set("Content-Type", "application/json") 11164 c.urlParams_.Set("alt", alt) 11165 c.urlParams_.Set("prettyPrint", "false") 11166 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 11167 urls += "?" + c.urlParams_.Encode() 11168 req, err := http.NewRequest("PATCH", urls, body) 11169 if err != nil { 11170 return nil, err 11171 } 11172 req.Header = reqHeaders 11173 googleapi.Expand(req.URL, map[string]string{ 11174 "courseId": c.courseId, 11175 "id": c.id, 11176 }) 11177 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11178} 11179 11180// Do executes the "classroom.courses.topics.patch" call. 11181// Exactly one of *Topic or error will be non-nil. Any non-2xx status 11182// code is an error. Response headers are in either 11183// *Topic.ServerResponse.Header or (if a response was returned at all) 11184// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11185// check whether the returned error was because http.StatusNotModified 11186// was returned. 11187func (c *CoursesTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 11188 gensupport.SetOptions(c.urlParams_, opts...) 11189 res, err := c.doRequest("json") 11190 if res != nil && res.StatusCode == http.StatusNotModified { 11191 if res.Body != nil { 11192 res.Body.Close() 11193 } 11194 return nil, &googleapi.Error{ 11195 Code: res.StatusCode, 11196 Header: res.Header, 11197 } 11198 } 11199 if err != nil { 11200 return nil, err 11201 } 11202 defer googleapi.CloseBody(res) 11203 if err := googleapi.CheckResponse(res); err != nil { 11204 return nil, err 11205 } 11206 ret := &Topic{ 11207 ServerResponse: googleapi.ServerResponse{ 11208 Header: res.Header, 11209 HTTPStatusCode: res.StatusCode, 11210 }, 11211 } 11212 target := &ret 11213 if err := gensupport.DecodeResponse(target, res); err != nil { 11214 return nil, err 11215 } 11216 return ret, nil 11217 // { 11218 // "description": "Updates one or more fields of a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding topic or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or topic does not exist", 11219 // "flatPath": "v1/courses/{courseId}/topics/{id}", 11220 // "httpMethod": "PATCH", 11221 // "id": "classroom.courses.topics.patch", 11222 // "parameterOrder": [ 11223 // "courseId", 11224 // "id" 11225 // ], 11226 // "parameters": { 11227 // "courseId": { 11228 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 11229 // "location": "path", 11230 // "required": true, 11231 // "type": "string" 11232 // }, 11233 // "id": { 11234 // "description": "Identifier of the topic.", 11235 // "location": "path", 11236 // "required": true, 11237 // "type": "string" 11238 // }, 11239 // "updateMask": { 11240 // "description": "Mask that identifies which fields on the topic to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the Topic object. If a field that does not support empty values is included in the update mask and not set in the Topic object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified: * `name`", 11241 // "format": "google-fieldmask", 11242 // "location": "query", 11243 // "type": "string" 11244 // } 11245 // }, 11246 // "path": "v1/courses/{courseId}/topics/{id}", 11247 // "request": { 11248 // "$ref": "Topic" 11249 // }, 11250 // "response": { 11251 // "$ref": "Topic" 11252 // }, 11253 // "scopes": [ 11254 // "https://www.googleapis.com/auth/classroom.topics" 11255 // ] 11256 // } 11257 11258} 11259 11260// method id "classroom.invitations.accept": 11261 11262type InvitationsAcceptCall struct { 11263 s *Service 11264 id string 11265 urlParams_ gensupport.URLParams 11266 ctx_ context.Context 11267 header_ http.Header 11268} 11269 11270// Accept: Accepts an invitation, removing it and adding the invited 11271// user to the teachers or students (as appropriate) of the specified 11272// course. Only the invited user may accept an invitation. This method 11273// returns the following error codes: * `PERMISSION_DENIED` if the 11274// requesting user is not permitted to accept the requested invitation 11275// or for access errors. * `FAILED_PRECONDITION` for the following 11276// request errors: * CourseMemberLimitReached * CourseNotModifiable * 11277// CourseTeacherLimitReached * UserGroupsMembershipLimitReached * 11278// `NOT_FOUND` if no invitation exists with the requested ID. 11279// 11280// - id: Identifier of the invitation to accept. 11281func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall { 11282 c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11283 c.id = id 11284 return c 11285} 11286 11287// Fields allows partial responses to be retrieved. See 11288// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11289// for more information. 11290func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall { 11291 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11292 return c 11293} 11294 11295// Context sets the context to be used in this call's Do method. Any 11296// pending HTTP request will be aborted if the provided context is 11297// canceled. 11298func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall { 11299 c.ctx_ = ctx 11300 return c 11301} 11302 11303// Header returns an http.Header that can be modified by the caller to 11304// add HTTP headers to the request. 11305func (c *InvitationsAcceptCall) Header() http.Header { 11306 if c.header_ == nil { 11307 c.header_ = make(http.Header) 11308 } 11309 return c.header_ 11310} 11311 11312func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) { 11313 reqHeaders := make(http.Header) 11314 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 11315 for k, v := range c.header_ { 11316 reqHeaders[k] = v 11317 } 11318 reqHeaders.Set("User-Agent", c.s.userAgent()) 11319 var body io.Reader = nil 11320 c.urlParams_.Set("alt", alt) 11321 c.urlParams_.Set("prettyPrint", "false") 11322 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept") 11323 urls += "?" + c.urlParams_.Encode() 11324 req, err := http.NewRequest("POST", urls, body) 11325 if err != nil { 11326 return nil, err 11327 } 11328 req.Header = reqHeaders 11329 googleapi.Expand(req.URL, map[string]string{ 11330 "id": c.id, 11331 }) 11332 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11333} 11334 11335// Do executes the "classroom.invitations.accept" call. 11336// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11337// code is an error. Response headers are in either 11338// *Empty.ServerResponse.Header or (if a response was returned at all) 11339// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11340// check whether the returned error was because http.StatusNotModified 11341// was returned. 11342func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11343 gensupport.SetOptions(c.urlParams_, opts...) 11344 res, err := c.doRequest("json") 11345 if res != nil && res.StatusCode == http.StatusNotModified { 11346 if res.Body != nil { 11347 res.Body.Close() 11348 } 11349 return nil, &googleapi.Error{ 11350 Code: res.StatusCode, 11351 Header: res.Header, 11352 } 11353 } 11354 if err != nil { 11355 return nil, err 11356 } 11357 defer googleapi.CloseBody(res) 11358 if err := googleapi.CheckResponse(res); err != nil { 11359 return nil, err 11360 } 11361 ret := &Empty{ 11362 ServerResponse: googleapi.ServerResponse{ 11363 Header: res.Header, 11364 HTTPStatusCode: res.StatusCode, 11365 }, 11366 } 11367 target := &ret 11368 if err := gensupport.DecodeResponse(target, res); err != nil { 11369 return nil, err 11370 } 11371 return ret, nil 11372 // { 11373 // "description": "Accepts an invitation, removing it and adding the invited user to the teachers or students (as appropriate) of the specified course. Only the invited user may accept an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to accept the requested invitation or for access errors. * `FAILED_PRECONDITION` for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `NOT_FOUND` if no invitation exists with the requested ID.", 11374 // "flatPath": "v1/invitations/{id}:accept", 11375 // "httpMethod": "POST", 11376 // "id": "classroom.invitations.accept", 11377 // "parameterOrder": [ 11378 // "id" 11379 // ], 11380 // "parameters": { 11381 // "id": { 11382 // "description": "Identifier of the invitation to accept.", 11383 // "location": "path", 11384 // "required": true, 11385 // "type": "string" 11386 // } 11387 // }, 11388 // "path": "v1/invitations/{id}:accept", 11389 // "response": { 11390 // "$ref": "Empty" 11391 // }, 11392 // "scopes": [ 11393 // "https://www.googleapis.com/auth/classroom.rosters" 11394 // ] 11395 // } 11396 11397} 11398 11399// method id "classroom.invitations.create": 11400 11401type InvitationsCreateCall struct { 11402 s *Service 11403 invitation *Invitation 11404 urlParams_ gensupport.URLParams 11405 ctx_ context.Context 11406 header_ http.Header 11407} 11408 11409// Create: Creates an invitation. Only one invitation for a user and 11410// course may exist at a time. Delete and re-create an invitation to 11411// make changes. This method returns the following error codes: * 11412// `PERMISSION_DENIED` if the requesting user is not permitted to create 11413// invitations for this course or for access errors. * `NOT_FOUND` if 11414// the course or the user does not exist. * `FAILED_PRECONDITION` if the 11415// requested user's account is disabled or if the user already has this 11416// role or a role with greater permissions. * `ALREADY_EXISTS` if an 11417// invitation for the specified user and course already exists. 11418func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall { 11419 c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11420 c.invitation = invitation 11421 return c 11422} 11423 11424// Fields allows partial responses to be retrieved. See 11425// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11426// for more information. 11427func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall { 11428 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11429 return c 11430} 11431 11432// Context sets the context to be used in this call's Do method. Any 11433// pending HTTP request will be aborted if the provided context is 11434// canceled. 11435func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall { 11436 c.ctx_ = ctx 11437 return c 11438} 11439 11440// Header returns an http.Header that can be modified by the caller to 11441// add HTTP headers to the request. 11442func (c *InvitationsCreateCall) Header() http.Header { 11443 if c.header_ == nil { 11444 c.header_ = make(http.Header) 11445 } 11446 return c.header_ 11447} 11448 11449func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 11450 reqHeaders := make(http.Header) 11451 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 11452 for k, v := range c.header_ { 11453 reqHeaders[k] = v 11454 } 11455 reqHeaders.Set("User-Agent", c.s.userAgent()) 11456 var body io.Reader = nil 11457 body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation) 11458 if err != nil { 11459 return nil, err 11460 } 11461 reqHeaders.Set("Content-Type", "application/json") 11462 c.urlParams_.Set("alt", alt) 11463 c.urlParams_.Set("prettyPrint", "false") 11464 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11465 urls += "?" + c.urlParams_.Encode() 11466 req, err := http.NewRequest("POST", urls, body) 11467 if err != nil { 11468 return nil, err 11469 } 11470 req.Header = reqHeaders 11471 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11472} 11473 11474// Do executes the "classroom.invitations.create" call. 11475// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11476// status code is an error. Response headers are in either 11477// *Invitation.ServerResponse.Header or (if a response was returned at 11478// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11479// to check whether the returned error was because 11480// http.StatusNotModified was returned. 11481func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11482 gensupport.SetOptions(c.urlParams_, opts...) 11483 res, err := c.doRequest("json") 11484 if res != nil && res.StatusCode == http.StatusNotModified { 11485 if res.Body != nil { 11486 res.Body.Close() 11487 } 11488 return nil, &googleapi.Error{ 11489 Code: res.StatusCode, 11490 Header: res.Header, 11491 } 11492 } 11493 if err != nil { 11494 return nil, err 11495 } 11496 defer googleapi.CloseBody(res) 11497 if err := googleapi.CheckResponse(res); err != nil { 11498 return nil, err 11499 } 11500 ret := &Invitation{ 11501 ServerResponse: googleapi.ServerResponse{ 11502 Header: res.Header, 11503 HTTPStatusCode: res.StatusCode, 11504 }, 11505 } 11506 target := &ret 11507 if err := gensupport.DecodeResponse(target, res); err != nil { 11508 return nil, err 11509 } 11510 return ret, nil 11511 // { 11512 // "description": "Creates an invitation. Only one invitation for a user and course may exist at a time. Delete and re-create an invitation to make changes. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create invitations for this course or for access errors. * `NOT_FOUND` if the course or the user does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled or if the user already has this role or a role with greater permissions. * `ALREADY_EXISTS` if an invitation for the specified user and course already exists.", 11513 // "flatPath": "v1/invitations", 11514 // "httpMethod": "POST", 11515 // "id": "classroom.invitations.create", 11516 // "parameterOrder": [], 11517 // "parameters": {}, 11518 // "path": "v1/invitations", 11519 // "request": { 11520 // "$ref": "Invitation" 11521 // }, 11522 // "response": { 11523 // "$ref": "Invitation" 11524 // }, 11525 // "scopes": [ 11526 // "https://www.googleapis.com/auth/classroom.rosters" 11527 // ] 11528 // } 11529 11530} 11531 11532// method id "classroom.invitations.delete": 11533 11534type InvitationsDeleteCall struct { 11535 s *Service 11536 id string 11537 urlParams_ gensupport.URLParams 11538 ctx_ context.Context 11539 header_ http.Header 11540} 11541 11542// Delete: Deletes an invitation. This method returns the following 11543// error codes: * `PERMISSION_DENIED` if the requesting user is not 11544// permitted to delete the requested invitation or for access errors. * 11545// `NOT_FOUND` if no invitation exists with the requested ID. 11546// 11547// - id: Identifier of the invitation to delete. 11548func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall { 11549 c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11550 c.id = id 11551 return c 11552} 11553 11554// Fields allows partial responses to be retrieved. See 11555// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11556// for more information. 11557func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall { 11558 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11559 return c 11560} 11561 11562// Context sets the context to be used in this call's Do method. Any 11563// pending HTTP request will be aborted if the provided context is 11564// canceled. 11565func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall { 11566 c.ctx_ = ctx 11567 return c 11568} 11569 11570// Header returns an http.Header that can be modified by the caller to 11571// add HTTP headers to the request. 11572func (c *InvitationsDeleteCall) Header() http.Header { 11573 if c.header_ == nil { 11574 c.header_ = make(http.Header) 11575 } 11576 return c.header_ 11577} 11578 11579func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11580 reqHeaders := make(http.Header) 11581 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 11582 for k, v := range c.header_ { 11583 reqHeaders[k] = v 11584 } 11585 reqHeaders.Set("User-Agent", c.s.userAgent()) 11586 var body io.Reader = nil 11587 c.urlParams_.Set("alt", alt) 11588 c.urlParams_.Set("prettyPrint", "false") 11589 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11590 urls += "?" + c.urlParams_.Encode() 11591 req, err := http.NewRequest("DELETE", urls, body) 11592 if err != nil { 11593 return nil, err 11594 } 11595 req.Header = reqHeaders 11596 googleapi.Expand(req.URL, map[string]string{ 11597 "id": c.id, 11598 }) 11599 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11600} 11601 11602// Do executes the "classroom.invitations.delete" call. 11603// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11604// code is an error. Response headers are in either 11605// *Empty.ServerResponse.Header or (if a response was returned at all) 11606// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11607// check whether the returned error was because http.StatusNotModified 11608// was returned. 11609func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11610 gensupport.SetOptions(c.urlParams_, opts...) 11611 res, err := c.doRequest("json") 11612 if res != nil && res.StatusCode == http.StatusNotModified { 11613 if res.Body != nil { 11614 res.Body.Close() 11615 } 11616 return nil, &googleapi.Error{ 11617 Code: res.StatusCode, 11618 Header: res.Header, 11619 } 11620 } 11621 if err != nil { 11622 return nil, err 11623 } 11624 defer googleapi.CloseBody(res) 11625 if err := googleapi.CheckResponse(res); err != nil { 11626 return nil, err 11627 } 11628 ret := &Empty{ 11629 ServerResponse: googleapi.ServerResponse{ 11630 Header: res.Header, 11631 HTTPStatusCode: res.StatusCode, 11632 }, 11633 } 11634 target := &ret 11635 if err := gensupport.DecodeResponse(target, res); err != nil { 11636 return nil, err 11637 } 11638 return ret, nil 11639 // { 11640 // "description": "Deletes an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete the requested invitation or for access errors. * `NOT_FOUND` if no invitation exists with the requested ID.", 11641 // "flatPath": "v1/invitations/{id}", 11642 // "httpMethod": "DELETE", 11643 // "id": "classroom.invitations.delete", 11644 // "parameterOrder": [ 11645 // "id" 11646 // ], 11647 // "parameters": { 11648 // "id": { 11649 // "description": "Identifier of the invitation to delete.", 11650 // "location": "path", 11651 // "required": true, 11652 // "type": "string" 11653 // } 11654 // }, 11655 // "path": "v1/invitations/{id}", 11656 // "response": { 11657 // "$ref": "Empty" 11658 // }, 11659 // "scopes": [ 11660 // "https://www.googleapis.com/auth/classroom.rosters" 11661 // ] 11662 // } 11663 11664} 11665 11666// method id "classroom.invitations.get": 11667 11668type InvitationsGetCall struct { 11669 s *Service 11670 id string 11671 urlParams_ gensupport.URLParams 11672 ifNoneMatch_ string 11673 ctx_ context.Context 11674 header_ http.Header 11675} 11676 11677// Get: Returns an invitation. This method returns the following error 11678// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 11679// to view the requested invitation or for access errors. * `NOT_FOUND` 11680// if no invitation exists with the requested ID. 11681// 11682// - id: Identifier of the invitation to return. 11683func (r *InvitationsService) Get(id string) *InvitationsGetCall { 11684 c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11685 c.id = id 11686 return c 11687} 11688 11689// Fields allows partial responses to be retrieved. See 11690// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11691// for more information. 11692func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall { 11693 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11694 return c 11695} 11696 11697// IfNoneMatch sets the optional parameter which makes the operation 11698// fail if the object's ETag matches the given value. This is useful for 11699// getting updates only after the object has changed since the last 11700// request. Use googleapi.IsNotModified to check whether the response 11701// error from Do is the result of In-None-Match. 11702func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall { 11703 c.ifNoneMatch_ = entityTag 11704 return c 11705} 11706 11707// Context sets the context to be used in this call's Do method. Any 11708// pending HTTP request will be aborted if the provided context is 11709// canceled. 11710func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall { 11711 c.ctx_ = ctx 11712 return c 11713} 11714 11715// Header returns an http.Header that can be modified by the caller to 11716// add HTTP headers to the request. 11717func (c *InvitationsGetCall) Header() http.Header { 11718 if c.header_ == nil { 11719 c.header_ = make(http.Header) 11720 } 11721 return c.header_ 11722} 11723 11724func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) { 11725 reqHeaders := make(http.Header) 11726 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 11727 for k, v := range c.header_ { 11728 reqHeaders[k] = v 11729 } 11730 reqHeaders.Set("User-Agent", c.s.userAgent()) 11731 if c.ifNoneMatch_ != "" { 11732 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11733 } 11734 var body io.Reader = nil 11735 c.urlParams_.Set("alt", alt) 11736 c.urlParams_.Set("prettyPrint", "false") 11737 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11738 urls += "?" + c.urlParams_.Encode() 11739 req, err := http.NewRequest("GET", urls, body) 11740 if err != nil { 11741 return nil, err 11742 } 11743 req.Header = reqHeaders 11744 googleapi.Expand(req.URL, map[string]string{ 11745 "id": c.id, 11746 }) 11747 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11748} 11749 11750// Do executes the "classroom.invitations.get" call. 11751// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11752// status code is an error. Response headers are in either 11753// *Invitation.ServerResponse.Header or (if a response was returned at 11754// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11755// to check whether the returned error was because 11756// http.StatusNotModified was returned. 11757func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11758 gensupport.SetOptions(c.urlParams_, opts...) 11759 res, err := c.doRequest("json") 11760 if res != nil && res.StatusCode == http.StatusNotModified { 11761 if res.Body != nil { 11762 res.Body.Close() 11763 } 11764 return nil, &googleapi.Error{ 11765 Code: res.StatusCode, 11766 Header: res.Header, 11767 } 11768 } 11769 if err != nil { 11770 return nil, err 11771 } 11772 defer googleapi.CloseBody(res) 11773 if err := googleapi.CheckResponse(res); err != nil { 11774 return nil, err 11775 } 11776 ret := &Invitation{ 11777 ServerResponse: googleapi.ServerResponse{ 11778 Header: res.Header, 11779 HTTPStatusCode: res.StatusCode, 11780 }, 11781 } 11782 target := &ret 11783 if err := gensupport.DecodeResponse(target, res); err != nil { 11784 return nil, err 11785 } 11786 return ret, nil 11787 // { 11788 // "description": "Returns an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view the requested invitation or for access errors. * `NOT_FOUND` if no invitation exists with the requested ID.", 11789 // "flatPath": "v1/invitations/{id}", 11790 // "httpMethod": "GET", 11791 // "id": "classroom.invitations.get", 11792 // "parameterOrder": [ 11793 // "id" 11794 // ], 11795 // "parameters": { 11796 // "id": { 11797 // "description": "Identifier of the invitation to return.", 11798 // "location": "path", 11799 // "required": true, 11800 // "type": "string" 11801 // } 11802 // }, 11803 // "path": "v1/invitations/{id}", 11804 // "response": { 11805 // "$ref": "Invitation" 11806 // }, 11807 // "scopes": [ 11808 // "https://www.googleapis.com/auth/classroom.rosters", 11809 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11810 // ] 11811 // } 11812 11813} 11814 11815// method id "classroom.invitations.list": 11816 11817type InvitationsListCall struct { 11818 s *Service 11819 urlParams_ gensupport.URLParams 11820 ifNoneMatch_ string 11821 ctx_ context.Context 11822 header_ http.Header 11823} 11824 11825// List: Returns a list of invitations that the requesting user is 11826// permitted to view, restricted to those that match the list request. 11827// *Note:* At least one of `user_id` or `course_id` must be supplied. 11828// Both fields can be supplied. This method returns the following error 11829// codes: * `PERMISSION_DENIED` for access errors. 11830func (r *InvitationsService) List() *InvitationsListCall { 11831 c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11832 return c 11833} 11834 11835// CourseId sets the optional parameter "courseId": Restricts returned 11836// invitations to those for a course with the specified identifier. 11837func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall { 11838 c.urlParams_.Set("courseId", courseId) 11839 return c 11840} 11841 11842// PageSize sets the optional parameter "pageSize": Maximum number of 11843// items to return. The default is 500 if unspecified or `0`. The server 11844// may return fewer than the specified number of results. 11845func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall { 11846 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 11847 return c 11848} 11849 11850// PageToken sets the optional parameter "pageToken": nextPageToken 11851// value returned from a previous list call, indicating that the 11852// subsequent page of results should be returned. The list request must 11853// be otherwise identical to the one that resulted in this token. 11854func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall { 11855 c.urlParams_.Set("pageToken", pageToken) 11856 return c 11857} 11858 11859// UserId sets the optional parameter "userId": Restricts returned 11860// invitations to those for a specific user. The identifier can be one 11861// of the following: * the numeric identifier for the user * the email 11862// address of the user * the string literal "me", indicating the 11863// requesting user 11864func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall { 11865 c.urlParams_.Set("userId", userId) 11866 return c 11867} 11868 11869// Fields allows partial responses to be retrieved. See 11870// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11871// for more information. 11872func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall { 11873 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11874 return c 11875} 11876 11877// IfNoneMatch sets the optional parameter which makes the operation 11878// fail if the object's ETag matches the given value. This is useful for 11879// getting updates only after the object has changed since the last 11880// request. Use googleapi.IsNotModified to check whether the response 11881// error from Do is the result of In-None-Match. 11882func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall { 11883 c.ifNoneMatch_ = entityTag 11884 return c 11885} 11886 11887// Context sets the context to be used in this call's Do method. Any 11888// pending HTTP request will be aborted if the provided context is 11889// canceled. 11890func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall { 11891 c.ctx_ = ctx 11892 return c 11893} 11894 11895// Header returns an http.Header that can be modified by the caller to 11896// add HTTP headers to the request. 11897func (c *InvitationsListCall) Header() http.Header { 11898 if c.header_ == nil { 11899 c.header_ = make(http.Header) 11900 } 11901 return c.header_ 11902} 11903 11904func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) { 11905 reqHeaders := make(http.Header) 11906 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 11907 for k, v := range c.header_ { 11908 reqHeaders[k] = v 11909 } 11910 reqHeaders.Set("User-Agent", c.s.userAgent()) 11911 if c.ifNoneMatch_ != "" { 11912 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11913 } 11914 var body io.Reader = nil 11915 c.urlParams_.Set("alt", alt) 11916 c.urlParams_.Set("prettyPrint", "false") 11917 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11918 urls += "?" + c.urlParams_.Encode() 11919 req, err := http.NewRequest("GET", urls, body) 11920 if err != nil { 11921 return nil, err 11922 } 11923 req.Header = reqHeaders 11924 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11925} 11926 11927// Do executes the "classroom.invitations.list" call. 11928// Exactly one of *ListInvitationsResponse or error will be non-nil. Any 11929// non-2xx status code is an error. Response headers are in either 11930// *ListInvitationsResponse.ServerResponse.Header or (if a response was 11931// returned at all) in error.(*googleapi.Error).Header. Use 11932// googleapi.IsNotModified to check whether the returned error was 11933// because http.StatusNotModified was returned. 11934func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) { 11935 gensupport.SetOptions(c.urlParams_, opts...) 11936 res, err := c.doRequest("json") 11937 if res != nil && res.StatusCode == http.StatusNotModified { 11938 if res.Body != nil { 11939 res.Body.Close() 11940 } 11941 return nil, &googleapi.Error{ 11942 Code: res.StatusCode, 11943 Header: res.Header, 11944 } 11945 } 11946 if err != nil { 11947 return nil, err 11948 } 11949 defer googleapi.CloseBody(res) 11950 if err := googleapi.CheckResponse(res); err != nil { 11951 return nil, err 11952 } 11953 ret := &ListInvitationsResponse{ 11954 ServerResponse: googleapi.ServerResponse{ 11955 Header: res.Header, 11956 HTTPStatusCode: res.StatusCode, 11957 }, 11958 } 11959 target := &ret 11960 if err := gensupport.DecodeResponse(target, res); err != nil { 11961 return nil, err 11962 } 11963 return ret, nil 11964 // { 11965 // "description": "Returns a list of invitations that the requesting user is permitted to view, restricted to those that match the list request. *Note:* At least one of `user_id` or `course_id` must be supplied. Both fields can be supplied. This method returns the following error codes: * `PERMISSION_DENIED` for access errors.", 11966 // "flatPath": "v1/invitations", 11967 // "httpMethod": "GET", 11968 // "id": "classroom.invitations.list", 11969 // "parameterOrder": [], 11970 // "parameters": { 11971 // "courseId": { 11972 // "description": "Restricts returned invitations to those for a course with the specified identifier.", 11973 // "location": "query", 11974 // "type": "string" 11975 // }, 11976 // "pageSize": { 11977 // "description": "Maximum number of items to return. The default is 500 if unspecified or `0`. The server may return fewer than the specified number of results.", 11978 // "format": "int32", 11979 // "location": "query", 11980 // "type": "integer" 11981 // }, 11982 // "pageToken": { 11983 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 11984 // "location": "query", 11985 // "type": "string" 11986 // }, 11987 // "userId": { 11988 // "description": "Restricts returned invitations to those for a specific user. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 11989 // "location": "query", 11990 // "type": "string" 11991 // } 11992 // }, 11993 // "path": "v1/invitations", 11994 // "response": { 11995 // "$ref": "ListInvitationsResponse" 11996 // }, 11997 // "scopes": [ 11998 // "https://www.googleapis.com/auth/classroom.rosters", 11999 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 12000 // ] 12001 // } 12002 12003} 12004 12005// Pages invokes f for each page of results. 12006// A non-nil error returned from f will halt the iteration. 12007// The provided context supersedes any context provided to the Context method. 12008func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error { 12009 c.ctx_ = ctx 12010 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12011 for { 12012 x, err := c.Do() 12013 if err != nil { 12014 return err 12015 } 12016 if err := f(x); err != nil { 12017 return err 12018 } 12019 if x.NextPageToken == "" { 12020 return nil 12021 } 12022 c.PageToken(x.NextPageToken) 12023 } 12024} 12025 12026// method id "classroom.registrations.create": 12027 12028type RegistrationsCreateCall struct { 12029 s *Service 12030 registration *Registration 12031 urlParams_ gensupport.URLParams 12032 ctx_ context.Context 12033 header_ http.Header 12034} 12035 12036// Create: Creates a `Registration`, causing Classroom to start sending 12037// notifications from the provided `feed` to the destination provided in 12038// `cloudPubSubTopic`. Returns the created `Registration`. Currently, 12039// this will be the same as the argument, but with server-assigned 12040// fields such as `expiry_time` and `id` filled in. Note that any value 12041// specified for the `expiry_time` or `id` fields will be ignored. While 12042// Classroom may validate the `cloudPubSubTopic` and return errors on a 12043// best effort basis, it is the caller's responsibility to ensure that 12044// it exists and that Classroom has permission to publish to it. This 12045// method may return the following error codes: * `PERMISSION_DENIED` 12046// if: * the authenticated user does not have permission to receive 12047// notifications from the requested field; or * the current user has not 12048// granted access to the current Cloud project with the appropriate 12049// scope for the requested feed. Note that domain-wide delegation of 12050// authority is not currently supported for this purpose. If the request 12051// has the appropriate scope, but no grant exists, a Request Errors is 12052// returned. * another access error is encountered. * `INVALID_ARGUMENT` 12053// if: * no `cloudPubsubTopic` is specified, or the specified 12054// `cloudPubsubTopic` is not valid; or * no `feed` is specified, or the 12055// specified `feed` is not valid. * `NOT_FOUND` if: * the specified 12056// `feed` cannot be located, or the requesting user does not have 12057// permission to determine whether or not it exists; or * the specified 12058// `cloudPubsubTopic` cannot be located, or Classroom has not been 12059// granted permission to publish to it. 12060func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall { 12061 c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12062 c.registration = registration 12063 return c 12064} 12065 12066// Fields allows partial responses to be retrieved. See 12067// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12068// for more information. 12069func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall { 12070 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12071 return c 12072} 12073 12074// Context sets the context to be used in this call's Do method. Any 12075// pending HTTP request will be aborted if the provided context is 12076// canceled. 12077func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall { 12078 c.ctx_ = ctx 12079 return c 12080} 12081 12082// Header returns an http.Header that can be modified by the caller to 12083// add HTTP headers to the request. 12084func (c *RegistrationsCreateCall) Header() http.Header { 12085 if c.header_ == nil { 12086 c.header_ = make(http.Header) 12087 } 12088 return c.header_ 12089} 12090 12091func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) { 12092 reqHeaders := make(http.Header) 12093 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 12094 for k, v := range c.header_ { 12095 reqHeaders[k] = v 12096 } 12097 reqHeaders.Set("User-Agent", c.s.userAgent()) 12098 var body io.Reader = nil 12099 body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration) 12100 if err != nil { 12101 return nil, err 12102 } 12103 reqHeaders.Set("Content-Type", "application/json") 12104 c.urlParams_.Set("alt", alt) 12105 c.urlParams_.Set("prettyPrint", "false") 12106 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations") 12107 urls += "?" + c.urlParams_.Encode() 12108 req, err := http.NewRequest("POST", urls, body) 12109 if err != nil { 12110 return nil, err 12111 } 12112 req.Header = reqHeaders 12113 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12114} 12115 12116// Do executes the "classroom.registrations.create" call. 12117// Exactly one of *Registration or error will be non-nil. Any non-2xx 12118// status code is an error. Response headers are in either 12119// *Registration.ServerResponse.Header or (if a response was returned at 12120// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12121// to check whether the returned error was because 12122// http.StatusNotModified was returned. 12123func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) { 12124 gensupport.SetOptions(c.urlParams_, opts...) 12125 res, err := c.doRequest("json") 12126 if res != nil && res.StatusCode == http.StatusNotModified { 12127 if res.Body != nil { 12128 res.Body.Close() 12129 } 12130 return nil, &googleapi.Error{ 12131 Code: res.StatusCode, 12132 Header: res.Header, 12133 } 12134 } 12135 if err != nil { 12136 return nil, err 12137 } 12138 defer googleapi.CloseBody(res) 12139 if err := googleapi.CheckResponse(res); err != nil { 12140 return nil, err 12141 } 12142 ret := &Registration{ 12143 ServerResponse: googleapi.ServerResponse{ 12144 Header: res.Header, 12145 HTTPStatusCode: res.StatusCode, 12146 }, 12147 } 12148 target := &ret 12149 if err := gensupport.DecodeResponse(target, res); err != nil { 12150 return nil, err 12151 } 12152 return ret, nil 12153 // { 12154 // "description": "Creates a `Registration`, causing Classroom to start sending notifications from the provided `feed` to the destination provided in `cloudPubSubTopic`. Returns the created `Registration`. Currently, this will be the same as the argument, but with server-assigned fields such as `expiry_time` and `id` filled in. Note that any value specified for the `expiry_time` or `id` fields will be ignored. While Classroom may validate the `cloudPubSubTopic` and return errors on a best effort basis, it is the caller's responsibility to ensure that it exists and that Classroom has permission to publish to it. This method may return the following error codes: * `PERMISSION_DENIED` if: * the authenticated user does not have permission to receive notifications from the requested field; or * the current user has not granted access to the current Cloud project with the appropriate scope for the requested feed. Note that domain-wide delegation of authority is not currently supported for this purpose. If the request has the appropriate scope, but no grant exists, a Request Errors is returned. * another access error is encountered. * `INVALID_ARGUMENT` if: * no `cloudPubsubTopic` is specified, or the specified `cloudPubsubTopic` is not valid; or * no `feed` is specified, or the specified `feed` is not valid. * `NOT_FOUND` if: * the specified `feed` cannot be located, or the requesting user does not have permission to determine whether or not it exists; or * the specified `cloudPubsubTopic` cannot be located, or Classroom has not been granted permission to publish to it.", 12155 // "flatPath": "v1/registrations", 12156 // "httpMethod": "POST", 12157 // "id": "classroom.registrations.create", 12158 // "parameterOrder": [], 12159 // "parameters": {}, 12160 // "path": "v1/registrations", 12161 // "request": { 12162 // "$ref": "Registration" 12163 // }, 12164 // "response": { 12165 // "$ref": "Registration" 12166 // }, 12167 // "scopes": [ 12168 // "https://www.googleapis.com/auth/classroom.push-notifications" 12169 // ] 12170 // } 12171 12172} 12173 12174// method id "classroom.registrations.delete": 12175 12176type RegistrationsDeleteCall struct { 12177 s *Service 12178 registrationId string 12179 urlParams_ gensupport.URLParams 12180 ctx_ context.Context 12181 header_ http.Header 12182} 12183 12184// Delete: Deletes a `Registration`, causing Classroom to stop sending 12185// notifications for that `Registration`. 12186// 12187// - registrationId: The `registration_id` of the `Registration` to be 12188// deleted. 12189func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall { 12190 c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12191 c.registrationId = registrationId 12192 return c 12193} 12194 12195// Fields allows partial responses to be retrieved. See 12196// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12197// for more information. 12198func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall { 12199 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12200 return c 12201} 12202 12203// Context sets the context to be used in this call's Do method. Any 12204// pending HTTP request will be aborted if the provided context is 12205// canceled. 12206func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall { 12207 c.ctx_ = ctx 12208 return c 12209} 12210 12211// Header returns an http.Header that can be modified by the caller to 12212// add HTTP headers to the request. 12213func (c *RegistrationsDeleteCall) Header() http.Header { 12214 if c.header_ == nil { 12215 c.header_ = make(http.Header) 12216 } 12217 return c.header_ 12218} 12219 12220func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) { 12221 reqHeaders := make(http.Header) 12222 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 12223 for k, v := range c.header_ { 12224 reqHeaders[k] = v 12225 } 12226 reqHeaders.Set("User-Agent", c.s.userAgent()) 12227 var body io.Reader = nil 12228 c.urlParams_.Set("alt", alt) 12229 c.urlParams_.Set("prettyPrint", "false") 12230 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}") 12231 urls += "?" + c.urlParams_.Encode() 12232 req, err := http.NewRequest("DELETE", urls, body) 12233 if err != nil { 12234 return nil, err 12235 } 12236 req.Header = reqHeaders 12237 googleapi.Expand(req.URL, map[string]string{ 12238 "registrationId": c.registrationId, 12239 }) 12240 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12241} 12242 12243// Do executes the "classroom.registrations.delete" call. 12244// Exactly one of *Empty or error will be non-nil. Any non-2xx status 12245// code is an error. Response headers are in either 12246// *Empty.ServerResponse.Header or (if a response was returned at all) 12247// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12248// check whether the returned error was because http.StatusNotModified 12249// was returned. 12250func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 12251 gensupport.SetOptions(c.urlParams_, opts...) 12252 res, err := c.doRequest("json") 12253 if res != nil && res.StatusCode == http.StatusNotModified { 12254 if res.Body != nil { 12255 res.Body.Close() 12256 } 12257 return nil, &googleapi.Error{ 12258 Code: res.StatusCode, 12259 Header: res.Header, 12260 } 12261 } 12262 if err != nil { 12263 return nil, err 12264 } 12265 defer googleapi.CloseBody(res) 12266 if err := googleapi.CheckResponse(res); err != nil { 12267 return nil, err 12268 } 12269 ret := &Empty{ 12270 ServerResponse: googleapi.ServerResponse{ 12271 Header: res.Header, 12272 HTTPStatusCode: res.StatusCode, 12273 }, 12274 } 12275 target := &ret 12276 if err := gensupport.DecodeResponse(target, res); err != nil { 12277 return nil, err 12278 } 12279 return ret, nil 12280 // { 12281 // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications for that `Registration`.", 12282 // "flatPath": "v1/registrations/{registrationId}", 12283 // "httpMethod": "DELETE", 12284 // "id": "classroom.registrations.delete", 12285 // "parameterOrder": [ 12286 // "registrationId" 12287 // ], 12288 // "parameters": { 12289 // "registrationId": { 12290 // "description": "The `registration_id` of the `Registration` to be deleted.", 12291 // "location": "path", 12292 // "required": true, 12293 // "type": "string" 12294 // } 12295 // }, 12296 // "path": "v1/registrations/{registrationId}", 12297 // "response": { 12298 // "$ref": "Empty" 12299 // }, 12300 // "scopes": [ 12301 // "https://www.googleapis.com/auth/classroom.push-notifications" 12302 // ] 12303 // } 12304 12305} 12306 12307// method id "classroom.userProfiles.get": 12308 12309type UserProfilesGetCall struct { 12310 s *Service 12311 userId string 12312 urlParams_ gensupport.URLParams 12313 ifNoneMatch_ string 12314 ctx_ context.Context 12315 header_ http.Header 12316} 12317 12318// Get: Returns a user profile. This method returns the following error 12319// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 12320// to access this user profile, if no profile exists with the requested 12321// ID, or for access errors. 12322// 12323// - userId: Identifier of the profile to return. The identifier can be 12324// one of the following: * the numeric identifier for the user * the 12325// email address of the user * the string literal "me", indicating 12326// the requesting user. 12327func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall { 12328 c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12329 c.userId = userId 12330 return c 12331} 12332 12333// Fields allows partial responses to be retrieved. See 12334// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12335// for more information. 12336func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall { 12337 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12338 return c 12339} 12340 12341// IfNoneMatch sets the optional parameter which makes the operation 12342// fail if the object's ETag matches the given value. This is useful for 12343// getting updates only after the object has changed since the last 12344// request. Use googleapi.IsNotModified to check whether the response 12345// error from Do is the result of In-None-Match. 12346func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall { 12347 c.ifNoneMatch_ = entityTag 12348 return c 12349} 12350 12351// Context sets the context to be used in this call's Do method. Any 12352// pending HTTP request will be aborted if the provided context is 12353// canceled. 12354func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall { 12355 c.ctx_ = ctx 12356 return c 12357} 12358 12359// Header returns an http.Header that can be modified by the caller to 12360// add HTTP headers to the request. 12361func (c *UserProfilesGetCall) Header() http.Header { 12362 if c.header_ == nil { 12363 c.header_ = make(http.Header) 12364 } 12365 return c.header_ 12366} 12367 12368func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) { 12369 reqHeaders := make(http.Header) 12370 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 12371 for k, v := range c.header_ { 12372 reqHeaders[k] = v 12373 } 12374 reqHeaders.Set("User-Agent", c.s.userAgent()) 12375 if c.ifNoneMatch_ != "" { 12376 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12377 } 12378 var body io.Reader = nil 12379 c.urlParams_.Set("alt", alt) 12380 c.urlParams_.Set("prettyPrint", "false") 12381 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}") 12382 urls += "?" + c.urlParams_.Encode() 12383 req, err := http.NewRequest("GET", urls, body) 12384 if err != nil { 12385 return nil, err 12386 } 12387 req.Header = reqHeaders 12388 googleapi.Expand(req.URL, map[string]string{ 12389 "userId": c.userId, 12390 }) 12391 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12392} 12393 12394// Do executes the "classroom.userProfiles.get" call. 12395// Exactly one of *UserProfile or error will be non-nil. Any non-2xx 12396// status code is an error. Response headers are in either 12397// *UserProfile.ServerResponse.Header or (if a response was returned at 12398// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12399// to check whether the returned error was because 12400// http.StatusNotModified was returned. 12401func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) { 12402 gensupport.SetOptions(c.urlParams_, opts...) 12403 res, err := c.doRequest("json") 12404 if res != nil && res.StatusCode == http.StatusNotModified { 12405 if res.Body != nil { 12406 res.Body.Close() 12407 } 12408 return nil, &googleapi.Error{ 12409 Code: res.StatusCode, 12410 Header: res.Header, 12411 } 12412 } 12413 if err != nil { 12414 return nil, err 12415 } 12416 defer googleapi.CloseBody(res) 12417 if err := googleapi.CheckResponse(res); err != nil { 12418 return nil, err 12419 } 12420 ret := &UserProfile{ 12421 ServerResponse: googleapi.ServerResponse{ 12422 Header: res.Header, 12423 HTTPStatusCode: res.StatusCode, 12424 }, 12425 } 12426 target := &ret 12427 if err := gensupport.DecodeResponse(target, res); err != nil { 12428 return nil, err 12429 } 12430 return ret, nil 12431 // { 12432 // "description": "Returns a user profile. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access this user profile, if no profile exists with the requested ID, or for access errors.", 12433 // "flatPath": "v1/userProfiles/{userId}", 12434 // "httpMethod": "GET", 12435 // "id": "classroom.userProfiles.get", 12436 // "parameterOrder": [ 12437 // "userId" 12438 // ], 12439 // "parameters": { 12440 // "userId": { 12441 // "description": "Identifier of the profile to return. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 12442 // "location": "path", 12443 // "required": true, 12444 // "type": "string" 12445 // } 12446 // }, 12447 // "path": "v1/userProfiles/{userId}", 12448 // "response": { 12449 // "$ref": "UserProfile" 12450 // }, 12451 // "scopes": [ 12452 // "https://www.googleapis.com/auth/classroom.profile.emails", 12453 // "https://www.googleapis.com/auth/classroom.profile.photos", 12454 // "https://www.googleapis.com/auth/classroom.rosters", 12455 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 12456 // ] 12457 // } 12458 12459} 12460 12461// method id "classroom.userProfiles.guardianInvitations.create": 12462 12463type UserProfilesGuardianInvitationsCreateCall struct { 12464 s *Service 12465 studentId string 12466 guardianinvitation *GuardianInvitation 12467 urlParams_ gensupport.URLParams 12468 ctx_ context.Context 12469 header_ http.Header 12470} 12471 12472// Create: Creates a guardian invitation, and sends an email to the 12473// guardian asking them to confirm that they are the student's guardian. 12474// Once the guardian accepts the invitation, their `state` will change 12475// to `COMPLETED` and they will start receiving guardian notifications. 12476// A `Guardian` resource will also be created to represent the active 12477// guardian. The request object must have the `student_id` and 12478// `invited_email_address` fields set. Failing to set these fields, or 12479// setting any other fields in the request, will result in an error. 12480// This method returns the following error codes: * `PERMISSION_DENIED` 12481// if the current user does not have permission to manage guardians, if 12482// the guardian in question has already rejected too many requests for 12483// that student, if guardians are not enabled for the domain in 12484// question, or for other access errors. * `RESOURCE_EXHAUSTED` if the 12485// student or guardian has exceeded the guardian link limit. * 12486// `INVALID_ARGUMENT` if the guardian email address is not valid (for 12487// example, if it is too long), or if the format of the student ID 12488// provided cannot be recognized (it is not an email address, nor a 12489// `user_id` from this API). This error will also be returned if 12490// read-only fields are set, or if the `state` field is set to to a 12491// value other than `PENDING`. * `NOT_FOUND` if the student ID provided 12492// is a valid student ID, but Classroom has no record of that student. * 12493// `ALREADY_EXISTS` if there is already a pending guardian invitation 12494// for the student and `invited_email_address` provided, or if the 12495// provided `invited_email_address` matches the Google account of an 12496// existing `Guardian` for this user. 12497// 12498// - studentId: ID of the student (in standard format). 12499func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall { 12500 c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12501 c.studentId = studentId 12502 c.guardianinvitation = guardianinvitation 12503 return c 12504} 12505 12506// Fields allows partial responses to be retrieved. See 12507// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12508// for more information. 12509func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall { 12510 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12511 return c 12512} 12513 12514// Context sets the context to be used in this call's Do method. Any 12515// pending HTTP request will be aborted if the provided context is 12516// canceled. 12517func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall { 12518 c.ctx_ = ctx 12519 return c 12520} 12521 12522// Header returns an http.Header that can be modified by the caller to 12523// add HTTP headers to the request. 12524func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header { 12525 if c.header_ == nil { 12526 c.header_ = make(http.Header) 12527 } 12528 return c.header_ 12529} 12530 12531func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 12532 reqHeaders := make(http.Header) 12533 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 12534 for k, v := range c.header_ { 12535 reqHeaders[k] = v 12536 } 12537 reqHeaders.Set("User-Agent", c.s.userAgent()) 12538 var body io.Reader = nil 12539 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12540 if err != nil { 12541 return nil, err 12542 } 12543 reqHeaders.Set("Content-Type", "application/json") 12544 c.urlParams_.Set("alt", alt) 12545 c.urlParams_.Set("prettyPrint", "false") 12546 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12547 urls += "?" + c.urlParams_.Encode() 12548 req, err := http.NewRequest("POST", urls, body) 12549 if err != nil { 12550 return nil, err 12551 } 12552 req.Header = reqHeaders 12553 googleapi.Expand(req.URL, map[string]string{ 12554 "studentId": c.studentId, 12555 }) 12556 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12557} 12558 12559// Do executes the "classroom.userProfiles.guardianInvitations.create" call. 12560// Exactly one of *GuardianInvitation or error will be non-nil. Any 12561// non-2xx status code is an error. Response headers are in either 12562// *GuardianInvitation.ServerResponse.Header or (if a response was 12563// returned at all) in error.(*googleapi.Error).Header. Use 12564// googleapi.IsNotModified to check whether the returned error was 12565// because http.StatusNotModified was returned. 12566func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12567 gensupport.SetOptions(c.urlParams_, opts...) 12568 res, err := c.doRequest("json") 12569 if res != nil && res.StatusCode == http.StatusNotModified { 12570 if res.Body != nil { 12571 res.Body.Close() 12572 } 12573 return nil, &googleapi.Error{ 12574 Code: res.StatusCode, 12575 Header: res.Header, 12576 } 12577 } 12578 if err != nil { 12579 return nil, err 12580 } 12581 defer googleapi.CloseBody(res) 12582 if err := googleapi.CheckResponse(res); err != nil { 12583 return nil, err 12584 } 12585 ret := &GuardianInvitation{ 12586 ServerResponse: googleapi.ServerResponse{ 12587 Header: res.Header, 12588 HTTPStatusCode: res.StatusCode, 12589 }, 12590 } 12591 target := &ret 12592 if err := gensupport.DecodeResponse(target, res); err != nil { 12593 return nil, err 12594 } 12595 return ret, nil 12596 // { 12597 // "description": "Creates a guardian invitation, and sends an email to the guardian asking them to confirm that they are the student's guardian. Once the guardian accepts the invitation, their `state` will change to `COMPLETED` and they will start receiving guardian notifications. A `Guardian` resource will also be created to represent the active guardian. The request object must have the `student_id` and `invited_email_address` fields set. Failing to set these fields, or setting any other fields in the request, will result in an error. This method returns the following error codes: * `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if the guardian in question has already rejected too many requests for that student, if guardians are not enabled for the domain in question, or for other access errors. * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the guardian link limit. * `INVALID_ARGUMENT` if the guardian email address is not valid (for example, if it is too long), or if the format of the student ID provided cannot be recognized (it is not an email address, nor a `user_id` from this API). This error will also be returned if read-only fields are set, or if the `state` field is set to to a value other than `PENDING`. * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student. * `ALREADY_EXISTS` if there is already a pending guardian invitation for the student and `invited_email_address` provided, or if the provided `invited_email_address` matches the Google account of an existing `Guardian` for this user.", 12598 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12599 // "httpMethod": "POST", 12600 // "id": "classroom.userProfiles.guardianInvitations.create", 12601 // "parameterOrder": [ 12602 // "studentId" 12603 // ], 12604 // "parameters": { 12605 // "studentId": { 12606 // "description": "ID of the student (in standard format)", 12607 // "location": "path", 12608 // "required": true, 12609 // "type": "string" 12610 // } 12611 // }, 12612 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12613 // "request": { 12614 // "$ref": "GuardianInvitation" 12615 // }, 12616 // "response": { 12617 // "$ref": "GuardianInvitation" 12618 // }, 12619 // "scopes": [ 12620 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12621 // ] 12622 // } 12623 12624} 12625 12626// method id "classroom.userProfiles.guardianInvitations.get": 12627 12628type UserProfilesGuardianInvitationsGetCall struct { 12629 s *Service 12630 studentId string 12631 invitationId string 12632 urlParams_ gensupport.URLParams 12633 ifNoneMatch_ string 12634 ctx_ context.Context 12635 header_ http.Header 12636} 12637 12638// Get: Returns a specific guardian invitation. This method returns the 12639// following error codes: * `PERMISSION_DENIED` if the requesting user 12640// is not permitted to view guardian invitations for the student 12641// identified by the `student_id`, if guardians are not enabled for the 12642// domain in question, or for other access errors. * `INVALID_ARGUMENT` 12643// if a `student_id` is specified, but its format cannot be recognized 12644// (it is not an email address, nor a `student_id` from the API, nor the 12645// literal string `me`). * `NOT_FOUND` if Classroom cannot find any 12646// record of the given student or `invitation_id`. May also be returned 12647// if the student exists, but the requesting user does not have access 12648// to see that student. 12649// 12650// - invitationId: The `id` field of the `GuardianInvitation` being 12651// requested. 12652// - studentId: The ID of the student whose guardian invitation is being 12653// requested. 12654func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall { 12655 c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12656 c.studentId = studentId 12657 c.invitationId = invitationId 12658 return c 12659} 12660 12661// Fields allows partial responses to be retrieved. See 12662// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12663// for more information. 12664func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall { 12665 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12666 return c 12667} 12668 12669// IfNoneMatch sets the optional parameter which makes the operation 12670// fail if the object's ETag matches the given value. This is useful for 12671// getting updates only after the object has changed since the last 12672// request. Use googleapi.IsNotModified to check whether the response 12673// error from Do is the result of In-None-Match. 12674func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall { 12675 c.ifNoneMatch_ = entityTag 12676 return c 12677} 12678 12679// Context sets the context to be used in this call's Do method. Any 12680// pending HTTP request will be aborted if the provided context is 12681// canceled. 12682func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall { 12683 c.ctx_ = ctx 12684 return c 12685} 12686 12687// Header returns an http.Header that can be modified by the caller to 12688// add HTTP headers to the request. 12689func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header { 12690 if c.header_ == nil { 12691 c.header_ = make(http.Header) 12692 } 12693 return c.header_ 12694} 12695 12696func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) { 12697 reqHeaders := make(http.Header) 12698 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 12699 for k, v := range c.header_ { 12700 reqHeaders[k] = v 12701 } 12702 reqHeaders.Set("User-Agent", c.s.userAgent()) 12703 if c.ifNoneMatch_ != "" { 12704 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12705 } 12706 var body io.Reader = nil 12707 c.urlParams_.Set("alt", alt) 12708 c.urlParams_.Set("prettyPrint", "false") 12709 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12710 urls += "?" + c.urlParams_.Encode() 12711 req, err := http.NewRequest("GET", urls, body) 12712 if err != nil { 12713 return nil, err 12714 } 12715 req.Header = reqHeaders 12716 googleapi.Expand(req.URL, map[string]string{ 12717 "studentId": c.studentId, 12718 "invitationId": c.invitationId, 12719 }) 12720 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12721} 12722 12723// Do executes the "classroom.userProfiles.guardianInvitations.get" call. 12724// Exactly one of *GuardianInvitation or error will be non-nil. Any 12725// non-2xx status code is an error. Response headers are in either 12726// *GuardianInvitation.ServerResponse.Header or (if a response was 12727// returned at all) in error.(*googleapi.Error).Header. Use 12728// googleapi.IsNotModified to check whether the returned error was 12729// because http.StatusNotModified was returned. 12730func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12731 gensupport.SetOptions(c.urlParams_, opts...) 12732 res, err := c.doRequest("json") 12733 if res != nil && res.StatusCode == http.StatusNotModified { 12734 if res.Body != nil { 12735 res.Body.Close() 12736 } 12737 return nil, &googleapi.Error{ 12738 Code: res.StatusCode, 12739 Header: res.Header, 12740 } 12741 } 12742 if err != nil { 12743 return nil, err 12744 } 12745 defer googleapi.CloseBody(res) 12746 if err := googleapi.CheckResponse(res); err != nil { 12747 return nil, err 12748 } 12749 ret := &GuardianInvitation{ 12750 ServerResponse: googleapi.ServerResponse{ 12751 Header: res.Header, 12752 HTTPStatusCode: res.StatusCode, 12753 }, 12754 } 12755 target := &ret 12756 if err := gensupport.DecodeResponse(target, res); err != nil { 12757 return nil, err 12758 } 12759 return ret, nil 12760 // { 12761 // "description": "Returns a specific guardian invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view guardian invitations for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). * `NOT_FOUND` if Classroom cannot find any record of the given student or `invitation_id`. May also be returned if the student exists, but the requesting user does not have access to see that student.", 12762 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12763 // "httpMethod": "GET", 12764 // "id": "classroom.userProfiles.guardianInvitations.get", 12765 // "parameterOrder": [ 12766 // "studentId", 12767 // "invitationId" 12768 // ], 12769 // "parameters": { 12770 // "invitationId": { 12771 // "description": "The `id` field of the `GuardianInvitation` being requested.", 12772 // "location": "path", 12773 // "required": true, 12774 // "type": "string" 12775 // }, 12776 // "studentId": { 12777 // "description": "The ID of the student whose guardian invitation is being requested.", 12778 // "location": "path", 12779 // "required": true, 12780 // "type": "string" 12781 // } 12782 // }, 12783 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12784 // "response": { 12785 // "$ref": "GuardianInvitation" 12786 // }, 12787 // "scopes": [ 12788 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12789 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12790 // ] 12791 // } 12792 12793} 12794 12795// method id "classroom.userProfiles.guardianInvitations.list": 12796 12797type UserProfilesGuardianInvitationsListCall struct { 12798 s *Service 12799 studentId string 12800 urlParams_ gensupport.URLParams 12801 ifNoneMatch_ string 12802 ctx_ context.Context 12803 header_ http.Header 12804} 12805 12806// List: Returns a list of guardian invitations that the requesting user 12807// is permitted to view, filtered by the parameters provided. This 12808// method returns the following error codes: * `PERMISSION_DENIED` if a 12809// `student_id` is specified, and the requesting user is not permitted 12810// to view guardian invitations for that student, if "-" is specified 12811// as the `student_id` and the user is not a domain administrator, if 12812// guardians are not enabled for the domain in question, or for other 12813// access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, 12814// but its format cannot be recognized (it is not an email address, nor 12815// a `student_id` from the API, nor the literal string `me`). May also 12816// be returned if an invalid `page_token` or `state` is provided. * 12817// `NOT_FOUND` if a `student_id` is specified, and its format can be 12818// recognized, but Classroom has no record of that student. 12819// 12820// - studentId: The ID of the student whose guardian invitations are to 12821// be returned. The identifier can be one of the following: * the 12822// numeric identifier for the user * the email address of the user * 12823// the string literal "me", indicating the requesting user * the 12824// string literal "-", indicating that results should be returned 12825// for all students that the requesting user is permitted to view 12826// guardian invitations. 12827func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall { 12828 c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12829 c.studentId = studentId 12830 return c 12831} 12832 12833// InvitedEmailAddress sets the optional parameter 12834// "invitedEmailAddress": If specified, only results with the specified 12835// `invited_email_address` are returned. 12836func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall { 12837 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 12838 return c 12839} 12840 12841// PageSize sets the optional parameter "pageSize": Maximum number of 12842// items to return. Zero or unspecified indicates that the server may 12843// assign a maximum. The server may return fewer than the specified 12844// number of results. 12845func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall { 12846 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 12847 return c 12848} 12849 12850// PageToken sets the optional parameter "pageToken": nextPageToken 12851// value returned from a previous list call, indicating that the 12852// subsequent page of results should be returned. The list request must 12853// be otherwise identical to the one that resulted in this token. 12854func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall { 12855 c.urlParams_.Set("pageToken", pageToken) 12856 return c 12857} 12858 12859// States sets the optional parameter "states": If specified, only 12860// results with the specified `state` values are returned. Otherwise, 12861// results with a `state` of `PENDING` are returned. 12862// 12863// Possible values: 12864// "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 12865// "PENDING" - The invitation is active and awaiting a response. 12866// "COMPLETE" - The invitation is no longer active. It may have been 12867// accepted, declined, withdrawn or it may have expired. 12868func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall { 12869 c.urlParams_.SetMulti("states", append([]string{}, states...)) 12870 return c 12871} 12872 12873// Fields allows partial responses to be retrieved. See 12874// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12875// for more information. 12876func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall { 12877 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12878 return c 12879} 12880 12881// IfNoneMatch sets the optional parameter which makes the operation 12882// fail if the object's ETag matches the given value. This is useful for 12883// getting updates only after the object has changed since the last 12884// request. Use googleapi.IsNotModified to check whether the response 12885// error from Do is the result of In-None-Match. 12886func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall { 12887 c.ifNoneMatch_ = entityTag 12888 return c 12889} 12890 12891// Context sets the context to be used in this call's Do method. Any 12892// pending HTTP request will be aborted if the provided context is 12893// canceled. 12894func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall { 12895 c.ctx_ = ctx 12896 return c 12897} 12898 12899// Header returns an http.Header that can be modified by the caller to 12900// add HTTP headers to the request. 12901func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header { 12902 if c.header_ == nil { 12903 c.header_ = make(http.Header) 12904 } 12905 return c.header_ 12906} 12907 12908func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) { 12909 reqHeaders := make(http.Header) 12910 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 12911 for k, v := range c.header_ { 12912 reqHeaders[k] = v 12913 } 12914 reqHeaders.Set("User-Agent", c.s.userAgent()) 12915 if c.ifNoneMatch_ != "" { 12916 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12917 } 12918 var body io.Reader = nil 12919 c.urlParams_.Set("alt", alt) 12920 c.urlParams_.Set("prettyPrint", "false") 12921 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12922 urls += "?" + c.urlParams_.Encode() 12923 req, err := http.NewRequest("GET", urls, body) 12924 if err != nil { 12925 return nil, err 12926 } 12927 req.Header = reqHeaders 12928 googleapi.Expand(req.URL, map[string]string{ 12929 "studentId": c.studentId, 12930 }) 12931 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12932} 12933 12934// Do executes the "classroom.userProfiles.guardianInvitations.list" call. 12935// Exactly one of *ListGuardianInvitationsResponse or error will be 12936// non-nil. Any non-2xx status code is an error. Response headers are in 12937// either *ListGuardianInvitationsResponse.ServerResponse.Header or (if 12938// a response was returned at all) in error.(*googleapi.Error).Header. 12939// Use googleapi.IsNotModified to check whether the returned error was 12940// because http.StatusNotModified was returned. 12941func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) { 12942 gensupport.SetOptions(c.urlParams_, opts...) 12943 res, err := c.doRequest("json") 12944 if res != nil && res.StatusCode == http.StatusNotModified { 12945 if res.Body != nil { 12946 res.Body.Close() 12947 } 12948 return nil, &googleapi.Error{ 12949 Code: res.StatusCode, 12950 Header: res.Header, 12951 } 12952 } 12953 if err != nil { 12954 return nil, err 12955 } 12956 defer googleapi.CloseBody(res) 12957 if err := googleapi.CheckResponse(res); err != nil { 12958 return nil, err 12959 } 12960 ret := &ListGuardianInvitationsResponse{ 12961 ServerResponse: googleapi.ServerResponse{ 12962 Header: res.Header, 12963 HTTPStatusCode: res.StatusCode, 12964 }, 12965 } 12966 target := &ret 12967 if err := gensupport.DecodeResponse(target, res); err != nil { 12968 return nil, err 12969 } 12970 return ret, nil 12971 // { 12972 // "description": "Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if `\"-\"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", 12973 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12974 // "httpMethod": "GET", 12975 // "id": "classroom.userProfiles.guardianInvitations.list", 12976 // "parameterOrder": [ 12977 // "studentId" 12978 // ], 12979 // "parameters": { 12980 // "invitedEmailAddress": { 12981 // "description": "If specified, only results with the specified `invited_email_address` are returned.", 12982 // "location": "query", 12983 // "type": "string" 12984 // }, 12985 // "pageSize": { 12986 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 12987 // "format": "int32", 12988 // "location": "query", 12989 // "type": "integer" 12990 // }, 12991 // "pageToken": { 12992 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 12993 // "location": "query", 12994 // "type": "string" 12995 // }, 12996 // "states": { 12997 // "description": "If specified, only results with the specified `state` values are returned. Otherwise, results with a `state` of `PENDING` are returned.", 12998 // "enum": [ 12999 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED", 13000 // "PENDING", 13001 // "COMPLETE" 13002 // ], 13003 // "enumDescriptions": [ 13004 // "Should never be returned.", 13005 // "The invitation is active and awaiting a response.", 13006 // "The invitation is no longer active. It may have been accepted, declined, withdrawn or it may have expired." 13007 // ], 13008 // "location": "query", 13009 // "repeated": true, 13010 // "type": "string" 13011 // }, 13012 // "studentId": { 13013 // "description": "The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user * the string literal `\"-\"`, indicating that results should be returned for all students that the requesting user is permitted to view guardian invitations.", 13014 // "location": "path", 13015 // "required": true, 13016 // "type": "string" 13017 // } 13018 // }, 13019 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 13020 // "response": { 13021 // "$ref": "ListGuardianInvitationsResponse" 13022 // }, 13023 // "scopes": [ 13024 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13025 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13026 // ] 13027 // } 13028 13029} 13030 13031// Pages invokes f for each page of results. 13032// A non-nil error returned from f will halt the iteration. 13033// The provided context supersedes any context provided to the Context method. 13034func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error { 13035 c.ctx_ = ctx 13036 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13037 for { 13038 x, err := c.Do() 13039 if err != nil { 13040 return err 13041 } 13042 if err := f(x); err != nil { 13043 return err 13044 } 13045 if x.NextPageToken == "" { 13046 return nil 13047 } 13048 c.PageToken(x.NextPageToken) 13049 } 13050} 13051 13052// method id "classroom.userProfiles.guardianInvitations.patch": 13053 13054type UserProfilesGuardianInvitationsPatchCall struct { 13055 s *Service 13056 studentId string 13057 invitationId string 13058 guardianinvitation *GuardianInvitation 13059 urlParams_ gensupport.URLParams 13060 ctx_ context.Context 13061 header_ http.Header 13062} 13063 13064// Patch: Modifies a guardian invitation. Currently, the only valid 13065// modification is to change the `state` from `PENDING` to `COMPLETE`. 13066// This has the effect of withdrawing the invitation. This method 13067// returns the following error codes: * `PERMISSION_DENIED` if the 13068// current user does not have permission to manage guardians, if 13069// guardians are not enabled for the domain in question or for other 13070// access errors. * `FAILED_PRECONDITION` if the guardian link is not in 13071// the `PENDING` state. * `INVALID_ARGUMENT` if the format of the 13072// student ID provided cannot be recognized (it is not an email address, 13073// nor a `user_id` from this API), or if the passed `GuardianInvitation` 13074// has a `state` other than `COMPLETE`, or if it modifies fields other 13075// than `state`. * `NOT_FOUND` if the student ID provided is a valid 13076// student ID, but Classroom has no record of that student, or if the 13077// `id` field does not refer to a guardian invitation known to 13078// Classroom. 13079// 13080// - invitationId: The `id` field of the `GuardianInvitation` to be 13081// modified. 13082// - studentId: The ID of the student whose guardian invitation is to be 13083// modified. 13084func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall { 13085 c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13086 c.studentId = studentId 13087 c.invitationId = invitationId 13088 c.guardianinvitation = guardianinvitation 13089 return c 13090} 13091 13092// UpdateMask sets the optional parameter "updateMask": Mask that 13093// identifies which fields on the course to update. This field is 13094// required to do an update. The update fails if invalid fields are 13095// specified. The following fields are valid: * `state` When set in a 13096// query parameter, this field should be specified as `updateMask=,,...` 13097func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall { 13098 c.urlParams_.Set("updateMask", updateMask) 13099 return c 13100} 13101 13102// Fields allows partial responses to be retrieved. See 13103// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13104// for more information. 13105func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall { 13106 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13107 return c 13108} 13109 13110// Context sets the context to be used in this call's Do method. Any 13111// pending HTTP request will be aborted if the provided context is 13112// canceled. 13113func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall { 13114 c.ctx_ = ctx 13115 return c 13116} 13117 13118// Header returns an http.Header that can be modified by the caller to 13119// add HTTP headers to the request. 13120func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header { 13121 if c.header_ == nil { 13122 c.header_ = make(http.Header) 13123 } 13124 return c.header_ 13125} 13126 13127func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) { 13128 reqHeaders := make(http.Header) 13129 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 13130 for k, v := range c.header_ { 13131 reqHeaders[k] = v 13132 } 13133 reqHeaders.Set("User-Agent", c.s.userAgent()) 13134 var body io.Reader = nil 13135 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 13136 if err != nil { 13137 return nil, err 13138 } 13139 reqHeaders.Set("Content-Type", "application/json") 13140 c.urlParams_.Set("alt", alt) 13141 c.urlParams_.Set("prettyPrint", "false") 13142 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 13143 urls += "?" + c.urlParams_.Encode() 13144 req, err := http.NewRequest("PATCH", urls, body) 13145 if err != nil { 13146 return nil, err 13147 } 13148 req.Header = reqHeaders 13149 googleapi.Expand(req.URL, map[string]string{ 13150 "studentId": c.studentId, 13151 "invitationId": c.invitationId, 13152 }) 13153 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13154} 13155 13156// Do executes the "classroom.userProfiles.guardianInvitations.patch" call. 13157// Exactly one of *GuardianInvitation or error will be non-nil. Any 13158// non-2xx status code is an error. Response headers are in either 13159// *GuardianInvitation.ServerResponse.Header or (if a response was 13160// returned at all) in error.(*googleapi.Error).Header. Use 13161// googleapi.IsNotModified to check whether the returned error was 13162// because http.StatusNotModified was returned. 13163func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 13164 gensupport.SetOptions(c.urlParams_, opts...) 13165 res, err := c.doRequest("json") 13166 if res != nil && res.StatusCode == http.StatusNotModified { 13167 if res.Body != nil { 13168 res.Body.Close() 13169 } 13170 return nil, &googleapi.Error{ 13171 Code: res.StatusCode, 13172 Header: res.Header, 13173 } 13174 } 13175 if err != nil { 13176 return nil, err 13177 } 13178 defer googleapi.CloseBody(res) 13179 if err := googleapi.CheckResponse(res); err != nil { 13180 return nil, err 13181 } 13182 ret := &GuardianInvitation{ 13183 ServerResponse: googleapi.ServerResponse{ 13184 Header: res.Header, 13185 HTTPStatusCode: res.StatusCode, 13186 }, 13187 } 13188 target := &ret 13189 if err := gensupport.DecodeResponse(target, res); err != nil { 13190 return nil, err 13191 } 13192 return ret, nil 13193 // { 13194 // "description": "Modifies a guardian invitation. Currently, the only valid modification is to change the `state` from `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if guardians are not enabled for the domain in question or for other access errors. * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. * `INVALID_ARGUMENT` if the format of the student ID provided cannot be recognized (it is not an email address, nor a `user_id` from this API), or if the passed `GuardianInvitation` has a `state` other than `COMPLETE`, or if it modifies fields other than `state`. * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student, or if the `id` field does not refer to a guardian invitation known to Classroom.", 13195 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 13196 // "httpMethod": "PATCH", 13197 // "id": "classroom.userProfiles.guardianInvitations.patch", 13198 // "parameterOrder": [ 13199 // "studentId", 13200 // "invitationId" 13201 // ], 13202 // "parameters": { 13203 // "invitationId": { 13204 // "description": "The `id` field of the `GuardianInvitation` to be modified.", 13205 // "location": "path", 13206 // "required": true, 13207 // "type": "string" 13208 // }, 13209 // "studentId": { 13210 // "description": "The ID of the student whose guardian invitation is to be modified.", 13211 // "location": "path", 13212 // "required": true, 13213 // "type": "string" 13214 // }, 13215 // "updateMask": { 13216 // "description": "Mask that identifies which fields on the course to update. This field is required to do an update. The update fails if invalid fields are specified. The following fields are valid: * `state` When set in a query parameter, this field should be specified as `updateMask=,,...`", 13217 // "format": "google-fieldmask", 13218 // "location": "query", 13219 // "type": "string" 13220 // } 13221 // }, 13222 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 13223 // "request": { 13224 // "$ref": "GuardianInvitation" 13225 // }, 13226 // "response": { 13227 // "$ref": "GuardianInvitation" 13228 // }, 13229 // "scopes": [ 13230 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 13231 // ] 13232 // } 13233 13234} 13235 13236// method id "classroom.userProfiles.guardians.delete": 13237 13238type UserProfilesGuardiansDeleteCall struct { 13239 s *Service 13240 studentId string 13241 guardianId string 13242 urlParams_ gensupport.URLParams 13243 ctx_ context.Context 13244 header_ http.Header 13245} 13246 13247// Delete: Deletes a guardian. The guardian will no longer receive 13248// guardian notifications and the guardian will no longer be accessible 13249// via the API. This method returns the following error codes: * 13250// `PERMISSION_DENIED` if no user that matches the provided `student_id` 13251// is visible to the requesting user, if the requesting user is not 13252// permitted to manage guardians for the student identified by the 13253// `student_id`, if guardians are not enabled for the domain in 13254// question, or for other access errors. * `INVALID_ARGUMENT` if a 13255// `student_id` is specified, but its format cannot be recognized (it is 13256// not an email address, nor a `student_id` from the API). * `NOT_FOUND` 13257// if the requesting user is permitted to modify guardians for the 13258// requested `student_id`, but no `Guardian` record exists for that 13259// student with the provided `guardian_id`. 13260// 13261// - guardianId: The `id` field from a `Guardian`. 13262// - studentId: The student whose guardian is to be deleted. One of the 13263// following: * the numeric identifier for the user * the email 13264// address of the user * the string literal "me", indicating the 13265// requesting user. 13266func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall { 13267 c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13268 c.studentId = studentId 13269 c.guardianId = guardianId 13270 return c 13271} 13272 13273// Fields allows partial responses to be retrieved. See 13274// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13275// for more information. 13276func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall { 13277 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13278 return c 13279} 13280 13281// Context sets the context to be used in this call's Do method. Any 13282// pending HTTP request will be aborted if the provided context is 13283// canceled. 13284func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall { 13285 c.ctx_ = ctx 13286 return c 13287} 13288 13289// Header returns an http.Header that can be modified by the caller to 13290// add HTTP headers to the request. 13291func (c *UserProfilesGuardiansDeleteCall) Header() http.Header { 13292 if c.header_ == nil { 13293 c.header_ = make(http.Header) 13294 } 13295 return c.header_ 13296} 13297 13298func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) { 13299 reqHeaders := make(http.Header) 13300 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 13301 for k, v := range c.header_ { 13302 reqHeaders[k] = v 13303 } 13304 reqHeaders.Set("User-Agent", c.s.userAgent()) 13305 var body io.Reader = nil 13306 c.urlParams_.Set("alt", alt) 13307 c.urlParams_.Set("prettyPrint", "false") 13308 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13309 urls += "?" + c.urlParams_.Encode() 13310 req, err := http.NewRequest("DELETE", urls, body) 13311 if err != nil { 13312 return nil, err 13313 } 13314 req.Header = reqHeaders 13315 googleapi.Expand(req.URL, map[string]string{ 13316 "studentId": c.studentId, 13317 "guardianId": c.guardianId, 13318 }) 13319 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13320} 13321 13322// Do executes the "classroom.userProfiles.guardians.delete" call. 13323// Exactly one of *Empty or error will be non-nil. Any non-2xx status 13324// code is an error. Response headers are in either 13325// *Empty.ServerResponse.Header or (if a response was returned at all) 13326// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 13327// check whether the returned error was because http.StatusNotModified 13328// was returned. 13329func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 13330 gensupport.SetOptions(c.urlParams_, opts...) 13331 res, err := c.doRequest("json") 13332 if res != nil && res.StatusCode == http.StatusNotModified { 13333 if res.Body != nil { 13334 res.Body.Close() 13335 } 13336 return nil, &googleapi.Error{ 13337 Code: res.StatusCode, 13338 Header: res.Header, 13339 } 13340 } 13341 if err != nil { 13342 return nil, err 13343 } 13344 defer googleapi.CloseBody(res) 13345 if err := googleapi.CheckResponse(res); err != nil { 13346 return nil, err 13347 } 13348 ret := &Empty{ 13349 ServerResponse: googleapi.ServerResponse{ 13350 Header: res.Header, 13351 HTTPStatusCode: res.StatusCode, 13352 }, 13353 } 13354 target := &ret 13355 if err := gensupport.DecodeResponse(target, res); err != nil { 13356 return nil, err 13357 } 13358 return ret, nil 13359 // { 13360 // "description": "Deletes a guardian. The guardian will no longer receive guardian notifications and the guardian will no longer be accessible via the API. This method returns the following error codes: * `PERMISSION_DENIED` if no user that matches the provided `student_id` is visible to the requesting user, if the requesting user is not permitted to manage guardians for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API). * `NOT_FOUND` if the requesting user is permitted to modify guardians for the requested `student_id`, but no `Guardian` record exists for that student with the provided `guardian_id`.", 13361 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13362 // "httpMethod": "DELETE", 13363 // "id": "classroom.userProfiles.guardians.delete", 13364 // "parameterOrder": [ 13365 // "studentId", 13366 // "guardianId" 13367 // ], 13368 // "parameters": { 13369 // "guardianId": { 13370 // "description": "The `id` field from a `Guardian`.", 13371 // "location": "path", 13372 // "required": true, 13373 // "type": "string" 13374 // }, 13375 // "studentId": { 13376 // "description": "The student whose guardian is to be deleted. One of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 13377 // "location": "path", 13378 // "required": true, 13379 // "type": "string" 13380 // } 13381 // }, 13382 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13383 // "response": { 13384 // "$ref": "Empty" 13385 // }, 13386 // "scopes": [ 13387 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 13388 // ] 13389 // } 13390 13391} 13392 13393// method id "classroom.userProfiles.guardians.get": 13394 13395type UserProfilesGuardiansGetCall struct { 13396 s *Service 13397 studentId string 13398 guardianId string 13399 urlParams_ gensupport.URLParams 13400 ifNoneMatch_ string 13401 ctx_ context.Context 13402 header_ http.Header 13403} 13404 13405// Get: Returns a specific guardian. This method returns the following 13406// error codes: * `PERMISSION_DENIED` if no user that matches the 13407// provided `student_id` is visible to the requesting user, if the 13408// requesting user is not permitted to view guardian information for the 13409// student identified by the `student_id`, if guardians are not enabled 13410// for the domain in question, or for other access errors. * 13411// `INVALID_ARGUMENT` if a `student_id` is specified, but its format 13412// cannot be recognized (it is not an email address, nor a `student_id` 13413// from the API, nor the literal string `me`). * `NOT_FOUND` if the 13414// requesting user is permitted to view guardians for the requested 13415// `student_id`, but no `Guardian` record exists for that student that 13416// matches the provided `guardian_id`. 13417// 13418// - guardianId: The `id` field from a `Guardian`. 13419// - studentId: The student whose guardian is being requested. One of 13420// the following: * the numeric identifier for the user * the email 13421// address of the user * the string literal "me", indicating the 13422// requesting user. 13423func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall { 13424 c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13425 c.studentId = studentId 13426 c.guardianId = guardianId 13427 return c 13428} 13429 13430// Fields allows partial responses to be retrieved. See 13431// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13432// for more information. 13433func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall { 13434 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13435 return c 13436} 13437 13438// IfNoneMatch sets the optional parameter which makes the operation 13439// fail if the object's ETag matches the given value. This is useful for 13440// getting updates only after the object has changed since the last 13441// request. Use googleapi.IsNotModified to check whether the response 13442// error from Do is the result of In-None-Match. 13443func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall { 13444 c.ifNoneMatch_ = entityTag 13445 return c 13446} 13447 13448// Context sets the context to be used in this call's Do method. Any 13449// pending HTTP request will be aborted if the provided context is 13450// canceled. 13451func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall { 13452 c.ctx_ = ctx 13453 return c 13454} 13455 13456// Header returns an http.Header that can be modified by the caller to 13457// add HTTP headers to the request. 13458func (c *UserProfilesGuardiansGetCall) Header() http.Header { 13459 if c.header_ == nil { 13460 c.header_ = make(http.Header) 13461 } 13462 return c.header_ 13463} 13464 13465func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) { 13466 reqHeaders := make(http.Header) 13467 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 13468 for k, v := range c.header_ { 13469 reqHeaders[k] = v 13470 } 13471 reqHeaders.Set("User-Agent", c.s.userAgent()) 13472 if c.ifNoneMatch_ != "" { 13473 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13474 } 13475 var body io.Reader = nil 13476 c.urlParams_.Set("alt", alt) 13477 c.urlParams_.Set("prettyPrint", "false") 13478 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13479 urls += "?" + c.urlParams_.Encode() 13480 req, err := http.NewRequest("GET", urls, body) 13481 if err != nil { 13482 return nil, err 13483 } 13484 req.Header = reqHeaders 13485 googleapi.Expand(req.URL, map[string]string{ 13486 "studentId": c.studentId, 13487 "guardianId": c.guardianId, 13488 }) 13489 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13490} 13491 13492// Do executes the "classroom.userProfiles.guardians.get" call. 13493// Exactly one of *Guardian or error will be non-nil. Any non-2xx status 13494// code is an error. Response headers are in either 13495// *Guardian.ServerResponse.Header or (if a response was returned at 13496// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13497// to check whether the returned error was because 13498// http.StatusNotModified was returned. 13499func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) { 13500 gensupport.SetOptions(c.urlParams_, opts...) 13501 res, err := c.doRequest("json") 13502 if res != nil && res.StatusCode == http.StatusNotModified { 13503 if res.Body != nil { 13504 res.Body.Close() 13505 } 13506 return nil, &googleapi.Error{ 13507 Code: res.StatusCode, 13508 Header: res.Header, 13509 } 13510 } 13511 if err != nil { 13512 return nil, err 13513 } 13514 defer googleapi.CloseBody(res) 13515 if err := googleapi.CheckResponse(res); err != nil { 13516 return nil, err 13517 } 13518 ret := &Guardian{ 13519 ServerResponse: googleapi.ServerResponse{ 13520 Header: res.Header, 13521 HTTPStatusCode: res.StatusCode, 13522 }, 13523 } 13524 target := &ret 13525 if err := gensupport.DecodeResponse(target, res); err != nil { 13526 return nil, err 13527 } 13528 return ret, nil 13529 // { 13530 // "description": "Returns a specific guardian. This method returns the following error codes: * `PERMISSION_DENIED` if no user that matches the provided `student_id` is visible to the requesting user, if the requesting user is not permitted to view guardian information for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). * `NOT_FOUND` if the requesting user is permitted to view guardians for the requested `student_id`, but no `Guardian` record exists for that student that matches the provided `guardian_id`.", 13531 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13532 // "httpMethod": "GET", 13533 // "id": "classroom.userProfiles.guardians.get", 13534 // "parameterOrder": [ 13535 // "studentId", 13536 // "guardianId" 13537 // ], 13538 // "parameters": { 13539 // "guardianId": { 13540 // "description": "The `id` field from a `Guardian`.", 13541 // "location": "path", 13542 // "required": true, 13543 // "type": "string" 13544 // }, 13545 // "studentId": { 13546 // "description": "The student whose guardian is being requested. One of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 13547 // "location": "path", 13548 // "required": true, 13549 // "type": "string" 13550 // } 13551 // }, 13552 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13553 // "response": { 13554 // "$ref": "Guardian" 13555 // }, 13556 // "scopes": [ 13557 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13558 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13559 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13560 // ] 13561 // } 13562 13563} 13564 13565// method id "classroom.userProfiles.guardians.list": 13566 13567type UserProfilesGuardiansListCall struct { 13568 s *Service 13569 studentId string 13570 urlParams_ gensupport.URLParams 13571 ifNoneMatch_ string 13572 ctx_ context.Context 13573 header_ http.Header 13574} 13575 13576// List: Returns a list of guardians that the requesting user is 13577// permitted to view, restricted to those that match the request. To 13578// list guardians for any student that the requesting user may view 13579// guardians for, use the literal character `-` for the student ID. This 13580// method returns the following error codes: * `PERMISSION_DENIED` if a 13581// `student_id` is specified, and the requesting user is not permitted 13582// to view guardian information for that student, if "-" is specified 13583// as the `student_id` and the user is not a domain administrator, if 13584// guardians are not enabled for the domain in question, if the 13585// `invited_email_address` filter is set by a user who is not a domain 13586// administrator, or for other access errors. * `INVALID_ARGUMENT` if a 13587// `student_id` is specified, but its format cannot be recognized (it is 13588// not an email address, nor a `student_id` from the API, nor the 13589// literal string `me`). May also be returned if an invalid `page_token` 13590// is provided. * `NOT_FOUND` if a `student_id` is specified, and its 13591// format can be recognized, but Classroom has no record of that 13592// student. 13593// 13594// - studentId: Filter results by the student who the guardian is linked 13595// to. The identifier can be one of the following: * the numeric 13596// identifier for the user * the email address of the user * the 13597// string literal "me", indicating the requesting user * the string 13598// literal "-", indicating that results should be returned for all 13599// students that the requesting user has access to view. 13600func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall { 13601 c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13602 c.studentId = studentId 13603 return c 13604} 13605 13606// InvitedEmailAddress sets the optional parameter 13607// "invitedEmailAddress": Filter results by the email address that the 13608// original invitation was sent to, resulting in this guardian link. 13609// This filter can only be used by domain administrators. 13610func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall { 13611 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 13612 return c 13613} 13614 13615// PageSize sets the optional parameter "pageSize": Maximum number of 13616// items to return. Zero or unspecified indicates that the server may 13617// assign a maximum. The server may return fewer than the specified 13618// number of results. 13619func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall { 13620 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 13621 return c 13622} 13623 13624// PageToken sets the optional parameter "pageToken": nextPageToken 13625// value returned from a previous list call, indicating that the 13626// subsequent page of results should be returned. The list request must 13627// be otherwise identical to the one that resulted in this token. 13628func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall { 13629 c.urlParams_.Set("pageToken", pageToken) 13630 return c 13631} 13632 13633// Fields allows partial responses to be retrieved. See 13634// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13635// for more information. 13636func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall { 13637 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13638 return c 13639} 13640 13641// IfNoneMatch sets the optional parameter which makes the operation 13642// fail if the object's ETag matches the given value. This is useful for 13643// getting updates only after the object has changed since the last 13644// request. Use googleapi.IsNotModified to check whether the response 13645// error from Do is the result of In-None-Match. 13646func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall { 13647 c.ifNoneMatch_ = entityTag 13648 return c 13649} 13650 13651// Context sets the context to be used in this call's Do method. Any 13652// pending HTTP request will be aborted if the provided context is 13653// canceled. 13654func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall { 13655 c.ctx_ = ctx 13656 return c 13657} 13658 13659// Header returns an http.Header that can be modified by the caller to 13660// add HTTP headers to the request. 13661func (c *UserProfilesGuardiansListCall) Header() http.Header { 13662 if c.header_ == nil { 13663 c.header_ = make(http.Header) 13664 } 13665 return c.header_ 13666} 13667 13668func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) { 13669 reqHeaders := make(http.Header) 13670 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 13671 for k, v := range c.header_ { 13672 reqHeaders[k] = v 13673 } 13674 reqHeaders.Set("User-Agent", c.s.userAgent()) 13675 if c.ifNoneMatch_ != "" { 13676 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13677 } 13678 var body io.Reader = nil 13679 c.urlParams_.Set("alt", alt) 13680 c.urlParams_.Set("prettyPrint", "false") 13681 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians") 13682 urls += "?" + c.urlParams_.Encode() 13683 req, err := http.NewRequest("GET", urls, body) 13684 if err != nil { 13685 return nil, err 13686 } 13687 req.Header = reqHeaders 13688 googleapi.Expand(req.URL, map[string]string{ 13689 "studentId": c.studentId, 13690 }) 13691 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13692} 13693 13694// Do executes the "classroom.userProfiles.guardians.list" call. 13695// Exactly one of *ListGuardiansResponse or error will be non-nil. Any 13696// non-2xx status code is an error. Response headers are in either 13697// *ListGuardiansResponse.ServerResponse.Header or (if a response was 13698// returned at all) in error.(*googleapi.Error).Header. Use 13699// googleapi.IsNotModified to check whether the returned error was 13700// because http.StatusNotModified was returned. 13701func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) { 13702 gensupport.SetOptions(c.urlParams_, opts...) 13703 res, err := c.doRequest("json") 13704 if res != nil && res.StatusCode == http.StatusNotModified { 13705 if res.Body != nil { 13706 res.Body.Close() 13707 } 13708 return nil, &googleapi.Error{ 13709 Code: res.StatusCode, 13710 Header: res.Header, 13711 } 13712 } 13713 if err != nil { 13714 return nil, err 13715 } 13716 defer googleapi.CloseBody(res) 13717 if err := googleapi.CheckResponse(res); err != nil { 13718 return nil, err 13719 } 13720 ret := &ListGuardiansResponse{ 13721 ServerResponse: googleapi.ServerResponse{ 13722 Header: res.Header, 13723 HTTPStatusCode: res.StatusCode, 13724 }, 13725 } 13726 target := &ret 13727 if err := gensupport.DecodeResponse(target, res); err != nil { 13728 return nil, err 13729 } 13730 return ret, nil 13731 // { 13732 // "description": "Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `\"-\"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", 13733 // "flatPath": "v1/userProfiles/{studentId}/guardians", 13734 // "httpMethod": "GET", 13735 // "id": "classroom.userProfiles.guardians.list", 13736 // "parameterOrder": [ 13737 // "studentId" 13738 // ], 13739 // "parameters": { 13740 // "invitedEmailAddress": { 13741 // "description": "Filter results by the email address that the original invitation was sent to, resulting in this guardian link. This filter can only be used by domain administrators.", 13742 // "location": "query", 13743 // "type": "string" 13744 // }, 13745 // "pageSize": { 13746 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 13747 // "format": "int32", 13748 // "location": "query", 13749 // "type": "integer" 13750 // }, 13751 // "pageToken": { 13752 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 13753 // "location": "query", 13754 // "type": "string" 13755 // }, 13756 // "studentId": { 13757 // "description": "Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user * the string literal `\"-\"`, indicating that results should be returned for all students that the requesting user has access to view.", 13758 // "location": "path", 13759 // "required": true, 13760 // "type": "string" 13761 // } 13762 // }, 13763 // "path": "v1/userProfiles/{studentId}/guardians", 13764 // "response": { 13765 // "$ref": "ListGuardiansResponse" 13766 // }, 13767 // "scopes": [ 13768 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13769 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13770 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13771 // ] 13772 // } 13773 13774} 13775 13776// Pages invokes f for each page of results. 13777// A non-nil error returned from f will halt the iteration. 13778// The provided context supersedes any context provided to the Context method. 13779func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error { 13780 c.ctx_ = ctx 13781 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13782 for { 13783 x, err := c.Do() 13784 if err != nil { 13785 return err 13786 } 13787 if err := f(x); err != nil { 13788 return err 13789 } 13790 if x.NextPageToken == "" { 13791 return nil 13792 } 13793 c.PageToken(x.NextPageToken) 13794 } 13795} 13796