1// Copyright 2020 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 // Manage your Google Classroom classes 93 ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses" 94 95 // View your Google Classroom classes 96 ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly" 97 98 // Manage your course work and view your grades in Google Classroom 99 ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me" 100 101 // View your course work and grades in Google Classroom 102 ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly" 103 104 // Manage course work and grades for students in the Google Classroom 105 // classes you teach and view the course work and grades for classes you 106 // administer 107 ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students" 108 109 // View course work and grades for students in the Google Classroom 110 // classes you teach or administer 111 ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 112 113 // View your Google Classroom guardians 114 ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly" 115 116 // View and manage guardians for students in your Google Classroom 117 // classes 118 ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students" 119 120 // View guardians for students in your Google Classroom classes 121 ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 122 123 // View the email addresses of people in your classes 124 ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails" 125 126 // View the profile photos of people in your classes 127 ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos" 128 129 // Receive notifications about your Google Classroom data 130 ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications" 131 132 // Manage your Google Classroom class rosters 133 ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters" 134 135 // View your Google Classroom class rosters 136 ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly" 137 138 // View your course work and grades in Google Classroom 139 ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly" 140 141 // View course work and grades for students in the Google Classroom 142 // classes you teach or administer 143 ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 144 145 // See, create, and edit topics in Google Classroom 146 ClassroomTopicsScope = "https://www.googleapis.com/auth/classroom.topics" 147 148 // View topics in Google Classroom 149 ClassroomTopicsReadonlyScope = "https://www.googleapis.com/auth/classroom.topics.readonly" 150) 151 152// NewService creates a new Service. 153func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 154 scopesOption := option.WithScopes( 155 "https://www.googleapis.com/auth/classroom.announcements", 156 "https://www.googleapis.com/auth/classroom.announcements.readonly", 157 "https://www.googleapis.com/auth/classroom.courses", 158 "https://www.googleapis.com/auth/classroom.courses.readonly", 159 "https://www.googleapis.com/auth/classroom.coursework.me", 160 "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 161 "https://www.googleapis.com/auth/classroom.coursework.students", 162 "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 163 "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 164 "https://www.googleapis.com/auth/classroom.guardianlinks.students", 165 "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly", 166 "https://www.googleapis.com/auth/classroom.profile.emails", 167 "https://www.googleapis.com/auth/classroom.profile.photos", 168 "https://www.googleapis.com/auth/classroom.push-notifications", 169 "https://www.googleapis.com/auth/classroom.rosters", 170 "https://www.googleapis.com/auth/classroom.rosters.readonly", 171 "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 172 "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly", 173 "https://www.googleapis.com/auth/classroom.topics", 174 "https://www.googleapis.com/auth/classroom.topics.readonly", 175 ) 176 // NOTE: prepend, so we don't override user-specified scopes. 177 opts = append([]option.ClientOption{scopesOption}, opts...) 178 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 179 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 180 client, endpoint, err := htransport.NewClient(ctx, opts...) 181 if err != nil { 182 return nil, err 183 } 184 s, err := New(client) 185 if err != nil { 186 return nil, err 187 } 188 if endpoint != "" { 189 s.BasePath = endpoint 190 } 191 return s, nil 192} 193 194// New creates a new Service. It uses the provided http.Client for requests. 195// 196// Deprecated: please use NewService instead. 197// To provide a custom HTTP client, use option.WithHTTPClient. 198// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 199func New(client *http.Client) (*Service, error) { 200 if client == nil { 201 return nil, errors.New("client is nil") 202 } 203 s := &Service{client: client, BasePath: basePath} 204 s.Courses = NewCoursesService(s) 205 s.Invitations = NewInvitationsService(s) 206 s.Registrations = NewRegistrationsService(s) 207 s.UserProfiles = NewUserProfilesService(s) 208 return s, nil 209} 210 211type Service struct { 212 client *http.Client 213 BasePath string // API endpoint base URL 214 UserAgent string // optional additional User-Agent fragment 215 216 Courses *CoursesService 217 218 Invitations *InvitationsService 219 220 Registrations *RegistrationsService 221 222 UserProfiles *UserProfilesService 223} 224 225func (s *Service) userAgent() string { 226 if s.UserAgent == "" { 227 return googleapi.UserAgent 228 } 229 return googleapi.UserAgent + " " + s.UserAgent 230} 231 232func NewCoursesService(s *Service) *CoursesService { 233 rs := &CoursesService{s: s} 234 rs.Aliases = NewCoursesAliasesService(s) 235 rs.Announcements = NewCoursesAnnouncementsService(s) 236 rs.CourseWork = NewCoursesCourseWorkService(s) 237 rs.Students = NewCoursesStudentsService(s) 238 rs.Teachers = NewCoursesTeachersService(s) 239 rs.Topics = NewCoursesTopicsService(s) 240 return rs 241} 242 243type CoursesService struct { 244 s *Service 245 246 Aliases *CoursesAliasesService 247 248 Announcements *CoursesAnnouncementsService 249 250 CourseWork *CoursesCourseWorkService 251 252 Students *CoursesStudentsService 253 254 Teachers *CoursesTeachersService 255 256 Topics *CoursesTopicsService 257} 258 259func NewCoursesAliasesService(s *Service) *CoursesAliasesService { 260 rs := &CoursesAliasesService{s: s} 261 return rs 262} 263 264type CoursesAliasesService struct { 265 s *Service 266} 267 268func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService { 269 rs := &CoursesAnnouncementsService{s: s} 270 return rs 271} 272 273type CoursesAnnouncementsService struct { 274 s *Service 275} 276 277func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService { 278 rs := &CoursesCourseWorkService{s: s} 279 rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s) 280 return rs 281} 282 283type CoursesCourseWorkService struct { 284 s *Service 285 286 StudentSubmissions *CoursesCourseWorkStudentSubmissionsService 287} 288 289func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService { 290 rs := &CoursesCourseWorkStudentSubmissionsService{s: s} 291 return rs 292} 293 294type CoursesCourseWorkStudentSubmissionsService struct { 295 s *Service 296} 297 298func NewCoursesStudentsService(s *Service) *CoursesStudentsService { 299 rs := &CoursesStudentsService{s: s} 300 return rs 301} 302 303type CoursesStudentsService struct { 304 s *Service 305} 306 307func NewCoursesTeachersService(s *Service) *CoursesTeachersService { 308 rs := &CoursesTeachersService{s: s} 309 return rs 310} 311 312type CoursesTeachersService struct { 313 s *Service 314} 315 316func NewCoursesTopicsService(s *Service) *CoursesTopicsService { 317 rs := &CoursesTopicsService{s: s} 318 return rs 319} 320 321type CoursesTopicsService struct { 322 s *Service 323} 324 325func NewInvitationsService(s *Service) *InvitationsService { 326 rs := &InvitationsService{s: s} 327 return rs 328} 329 330type InvitationsService struct { 331 s *Service 332} 333 334func NewRegistrationsService(s *Service) *RegistrationsService { 335 rs := &RegistrationsService{s: s} 336 return rs 337} 338 339type RegistrationsService struct { 340 s *Service 341} 342 343func NewUserProfilesService(s *Service) *UserProfilesService { 344 rs := &UserProfilesService{s: s} 345 rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s) 346 rs.Guardians = NewUserProfilesGuardiansService(s) 347 return rs 348} 349 350type UserProfilesService struct { 351 s *Service 352 353 GuardianInvitations *UserProfilesGuardianInvitationsService 354 355 Guardians *UserProfilesGuardiansService 356} 357 358func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService { 359 rs := &UserProfilesGuardianInvitationsService{s: s} 360 return rs 361} 362 363type UserProfilesGuardianInvitationsService struct { 364 s *Service 365} 366 367func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService { 368 rs := &UserProfilesGuardiansService{s: s} 369 return rs 370} 371 372type UserProfilesGuardiansService struct { 373 s *Service 374} 375 376// Announcement: Announcement created by a teacher for students of the 377// course 378type Announcement struct { 379 // AlternateLink: Absolute link to this announcement in the Classroom 380 // web UI. 381 // This is only populated if `state` is `PUBLISHED`. 382 // 383 // Read-only. 384 AlternateLink string `json:"alternateLink,omitempty"` 385 386 // AssigneeMode: Assignee mode of the announcement. 387 // If unspecified, the default value is `ALL_STUDENTS`. 388 // 389 // Possible values: 390 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 391 // returned. 392 // "ALL_STUDENTS" - All students can see the item. 393 // This is the default state. 394 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 395 AssigneeMode string `json:"assigneeMode,omitempty"` 396 397 // CourseId: Identifier of the course. 398 // 399 // Read-only. 400 CourseId string `json:"courseId,omitempty"` 401 402 // CreationTime: Timestamp when this announcement was 403 // created. 404 // 405 // Read-only. 406 CreationTime string `json:"creationTime,omitempty"` 407 408 // CreatorUserId: Identifier for the user that created the 409 // announcement. 410 // 411 // Read-only. 412 CreatorUserId string `json:"creatorUserId,omitempty"` 413 414 // Id: Classroom-assigned identifier of this announcement, unique per 415 // course. 416 // 417 // Read-only. 418 Id string `json:"id,omitempty"` 419 420 // IndividualStudentsOptions: Identifiers of students with access to the 421 // announcement. 422 // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`. 423 // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only 424 // students 425 // specified in this field can see the announcement. 426 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 427 428 // Materials: Additional materials. 429 // 430 // Announcements must have no more than 20 material items. 431 Materials []*Material `json:"materials,omitempty"` 432 433 // ScheduledTime: Optional timestamp when this announcement is scheduled 434 // to be published. 435 ScheduledTime string `json:"scheduledTime,omitempty"` 436 437 // State: Status of this announcement. 438 // If unspecified, the default state is `DRAFT`. 439 // 440 // Possible values: 441 // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 442 // never returned. 443 // "PUBLISHED" - Status for announcement that has been published. 444 // This is the default state. 445 // "DRAFT" - Status for an announcement that is not yet 446 // published. 447 // Announcement in this state is visible only to course teachers and 448 // domain 449 // administrators. 450 // "DELETED" - Status for announcement that was published but is now 451 // deleted. 452 // Announcement in this state is visible only to course teachers and 453 // domain 454 // administrators. 455 // Announcement in this state is deleted after some time. 456 State string `json:"state,omitempty"` 457 458 // Text: Description of this announcement. 459 // The text must be a valid UTF-8 string containing no more 460 // than 30,000 characters. 461 Text string `json:"text,omitempty"` 462 463 // UpdateTime: Timestamp of the most recent change to this 464 // announcement. 465 // 466 // Read-only. 467 UpdateTime string `json:"updateTime,omitempty"` 468 469 // ServerResponse contains the HTTP response code and headers from the 470 // server. 471 googleapi.ServerResponse `json:"-"` 472 473 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 474 // unconditionally include in API requests. By default, fields with 475 // empty values are omitted from API requests. However, any non-pointer, 476 // non-interface field appearing in ForceSendFields will be sent to the 477 // server regardless of whether the field is empty or not. This may be 478 // used to include empty fields in Patch requests. 479 ForceSendFields []string `json:"-"` 480 481 // NullFields is a list of field names (e.g. "AlternateLink") to include 482 // in API requests with the JSON null value. By default, fields with 483 // empty values are omitted from API requests. However, any field with 484 // an empty value appearing in NullFields will be sent to the server as 485 // null. It is an error if a field in this list has a non-empty value. 486 // This may be used to include null fields in Patch requests. 487 NullFields []string `json:"-"` 488} 489 490func (s *Announcement) MarshalJSON() ([]byte, error) { 491 type NoMethod Announcement 492 raw := NoMethod(*s) 493 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 494} 495 496// Assignment: Additional details for assignments. 497type Assignment struct { 498 // StudentWorkFolder: Drive folder where attachments from student 499 // submissions are placed. 500 // This is only populated for course teachers and administrators. 501 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 502 503 // ForceSendFields is a list of field names (e.g. "StudentWorkFolder") 504 // to unconditionally include in API requests. By default, fields with 505 // empty values are omitted from API requests. However, any non-pointer, 506 // non-interface field appearing in ForceSendFields will be sent to the 507 // server regardless of whether the field is empty or not. This may be 508 // used to include empty fields in Patch requests. 509 ForceSendFields []string `json:"-"` 510 511 // NullFields is a list of field names (e.g. "StudentWorkFolder") to 512 // include in API requests with the JSON null value. By default, fields 513 // with empty values are omitted from API requests. However, any field 514 // with an empty value appearing in NullFields will be sent to the 515 // server as null. It is an error if a field in this list has a 516 // non-empty value. This may be used to include null fields in Patch 517 // requests. 518 NullFields []string `json:"-"` 519} 520 521func (s *Assignment) MarshalJSON() ([]byte, error) { 522 type NoMethod Assignment 523 raw := NoMethod(*s) 524 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 525} 526 527// AssignmentSubmission: Student work for an assignment. 528type AssignmentSubmission struct { 529 // Attachments: Attachments added by the student. 530 // Drive files that correspond to materials with a share mode 531 // of 532 // STUDENT_COPY may not exist yet if the student has not accessed 533 // the 534 // assignment in Classroom. 535 // 536 // Some attachment metadata is only populated if the requesting user 537 // has 538 // permission to access it. Identifier and alternate_link fields are 539 // always 540 // available, but others (for example, title) may not be. 541 Attachments []*Attachment `json:"attachments,omitempty"` 542 543 // ForceSendFields is a list of field names (e.g. "Attachments") to 544 // unconditionally include in API requests. By default, fields with 545 // empty values are omitted from API requests. However, any non-pointer, 546 // non-interface field appearing in ForceSendFields will be sent to the 547 // server regardless of whether the field is empty or not. This may be 548 // used to include empty fields in Patch requests. 549 ForceSendFields []string `json:"-"` 550 551 // NullFields is a list of field names (e.g. "Attachments") to include 552 // in API requests with the JSON null value. By default, fields with 553 // empty values are omitted from API requests. However, any field with 554 // an empty value appearing in NullFields will be sent to the server as 555 // null. It is an error if a field in this list has a non-empty value. 556 // This may be used to include null fields in Patch requests. 557 NullFields []string `json:"-"` 558} 559 560func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) { 561 type NoMethod AssignmentSubmission 562 raw := NoMethod(*s) 563 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 564} 565 566// Attachment: Attachment added to student assignment work. 567// 568// When creating attachments, setting the `form` field is not supported. 569type Attachment struct { 570 // DriveFile: Google Drive file attachment. 571 DriveFile *DriveFile `json:"driveFile,omitempty"` 572 573 // Form: Google Forms attachment. 574 Form *Form `json:"form,omitempty"` 575 576 // Link: Link attachment. 577 Link *Link `json:"link,omitempty"` 578 579 // YouTubeVideo: Youtube video attachment. 580 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 581 582 // ForceSendFields is a list of field names (e.g. "DriveFile") to 583 // unconditionally include in API requests. By default, fields with 584 // empty values are omitted from API requests. However, any non-pointer, 585 // non-interface field appearing in ForceSendFields will be sent to the 586 // server regardless of whether the field is empty or not. This may be 587 // used to include empty fields in Patch requests. 588 ForceSendFields []string `json:"-"` 589 590 // NullFields is a list of field names (e.g. "DriveFile") to include in 591 // API requests with the JSON null value. By default, fields with empty 592 // values are omitted from API requests. However, any field with an 593 // empty value appearing in NullFields will be sent to the server as 594 // null. It is an error if a field in this list has a non-empty value. 595 // This may be used to include null fields in Patch requests. 596 NullFields []string `json:"-"` 597} 598 599func (s *Attachment) MarshalJSON() ([]byte, error) { 600 type NoMethod Attachment 601 raw := NoMethod(*s) 602 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 603} 604 605// CloudPubsubTopic: A reference to a Cloud Pub/Sub topic. 606// 607// To register for notifications, the owner of the topic must 608// grant 609// `classroom-notifications@system.gserviceaccount.com` the 610// `projects.topics.publish` permission. 611type CloudPubsubTopic struct { 612 // TopicName: The `name` field of a Cloud 613 // Pub/Sub 614 // [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1 615 // /projects.topics#Topic). 616 TopicName string `json:"topicName,omitempty"` 617 618 // ForceSendFields is a list of field names (e.g. "TopicName") to 619 // unconditionally include in API requests. By default, fields with 620 // empty values are omitted from API requests. However, any non-pointer, 621 // non-interface field appearing in ForceSendFields will be sent to the 622 // server regardless of whether the field is empty or not. This may be 623 // used to include empty fields in Patch requests. 624 ForceSendFields []string `json:"-"` 625 626 // NullFields is a list of field names (e.g. "TopicName") to include in 627 // API requests with the JSON null value. By default, fields with empty 628 // values are omitted from API requests. However, any field with an 629 // empty value appearing in NullFields will be sent to the server as 630 // null. It is an error if a field in this list has a non-empty value. 631 // This may be used to include null fields in Patch requests. 632 NullFields []string `json:"-"` 633} 634 635func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) { 636 type NoMethod CloudPubsubTopic 637 raw := NoMethod(*s) 638 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 639} 640 641// Course: A Course in Classroom. 642type Course struct { 643 // AlternateLink: Absolute link to this course in the Classroom web 644 // UI. 645 // 646 // Read-only. 647 AlternateLink string `json:"alternateLink,omitempty"` 648 649 // CalendarId: The Calendar ID for a calendar that all course members 650 // can see, to which 651 // Classroom adds events for course work and announcements in the 652 // course. 653 // 654 // Read-only. 655 CalendarId string `json:"calendarId,omitempty"` 656 657 // CourseGroupEmail: The email address of a Google group containing all 658 // members of the course. 659 // This group does not accept email and can only be used for 660 // permissions. 661 // 662 // Read-only. 663 CourseGroupEmail string `json:"courseGroupEmail,omitempty"` 664 665 // CourseMaterialSets: Sets of materials that appear on the "about" page 666 // of this course. 667 // 668 // Read-only. 669 CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"` 670 671 // CourseState: State of the course. 672 // If unspecified, the default state is `PROVISIONED`. 673 // 674 // Possible values: 675 // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 676 // message will use this value. 677 // "ACTIVE" - The course is active. 678 // "ARCHIVED" - The course has been archived. You cannot modify it 679 // except to change it 680 // to a different state. 681 // "PROVISIONED" - The course has been created, but not yet activated. 682 // It is accessible by 683 // the primary teacher and domain administrators, who may modify it 684 // or 685 // change it to the `ACTIVE` or `DECLINED` states. 686 // A course may only be changed to `PROVISIONED` if it is in the 687 // `DECLINED` 688 // state. 689 // "DECLINED" - The course has been created, but declined. It is 690 // accessible by the 691 // course owner and domain administrators, though it will not 692 // be 693 // displayed in the web UI. You cannot modify the course except to 694 // change it 695 // to the `PROVISIONED` state. 696 // A course may only be changed to `DECLINED` if it is in the 697 // `PROVISIONED` 698 // state. 699 // "SUSPENDED" - The course has been suspended. You cannot modify the 700 // course, and only the 701 // user identified by the `owner_id` can view the course. 702 // A course may be placed in this state if it potentially violates 703 // the 704 // Terms of Service. 705 CourseState string `json:"courseState,omitempty"` 706 707 // CreationTime: Creation time of the course. 708 // Specifying this field in a course update mask results in an 709 // error. 710 // 711 // Read-only. 712 CreationTime string `json:"creationTime,omitempty"` 713 714 // Description: Optional description. 715 // For example, "We'll be learning about the structure of 716 // living 717 // creatures from a combination of textbooks, guest lectures, and lab 718 // work. 719 // Expect to be excited!" 720 // If set, this field must be a valid UTF-8 string and no longer than 721 // 30,000 722 // characters. 723 Description string `json:"description,omitempty"` 724 725 // DescriptionHeading: Optional heading for the description. 726 // For example, "Welcome to 10th Grade Biology." 727 // If set, this field must be a valid UTF-8 string and no longer than 728 // 3600 729 // characters. 730 DescriptionHeading string `json:"descriptionHeading,omitempty"` 731 732 // EnrollmentCode: Enrollment code to use when joining this 733 // course. 734 // Specifying this field in a course update mask results in an 735 // error. 736 // 737 // Read-only. 738 EnrollmentCode string `json:"enrollmentCode,omitempty"` 739 740 // GuardiansEnabled: Whether or not guardian notifications are enabled 741 // for this course. 742 // 743 // Read-only. 744 GuardiansEnabled bool `json:"guardiansEnabled,omitempty"` 745 746 // Id: Identifier for this course assigned by Classroom. 747 // 748 // When 749 // creating a course, 750 // you may optionally set this identifier to an 751 // alias string in the 752 // request to create a corresponding alias. The `id` is still assigned 753 // by 754 // Classroom and cannot be updated after the course is 755 // created. 756 // 757 // Specifying this field in a course update mask results in an error. 758 Id string `json:"id,omitempty"` 759 760 // Name: Name of the course. 761 // For example, "10th Grade Biology". 762 // The name is required. It must be between 1 and 750 characters and a 763 // valid 764 // UTF-8 string. 765 Name string `json:"name,omitempty"` 766 767 // OwnerId: The identifier of the owner of a course. 768 // 769 // When specified as a parameter of a 770 // create course request, this 771 // field is required. 772 // The identifier can be one of the following: 773 // 774 // * the numeric identifier for the user 775 // * the email address of the user 776 // * the string literal "me", indicating the requesting user 777 // 778 // This must be set in a create request. Admins can also specify this 779 // field 780 // in a patch course request to 781 // transfer ownership. In other contexts, it is read-only. 782 OwnerId string `json:"ownerId,omitempty"` 783 784 // Room: Optional room location. 785 // For example, "301". 786 // If set, this field must be a valid UTF-8 string and no longer than 787 // 650 788 // characters. 789 Room string `json:"room,omitempty"` 790 791 // Section: Section of the course. 792 // For example, "Period 2". 793 // If set, this field must be a valid UTF-8 string and no longer than 794 // 2800 795 // characters. 796 Section string `json:"section,omitempty"` 797 798 // TeacherFolder: Information about a Drive Folder that is shared with 799 // all teachers of the 800 // course. 801 // 802 // This field will only be set for teachers of the course and 803 // domain 804 // administrators. 805 // 806 // Read-only. 807 TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"` 808 809 // TeacherGroupEmail: The email address of a Google group containing all 810 // teachers of the course. 811 // This group does not accept email and can only be used for 812 // permissions. 813 // 814 // Read-only. 815 TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"` 816 817 // UpdateTime: Time of the most recent update to this course. 818 // Specifying this field in a course update mask results in an 819 // error. 820 // 821 // Read-only. 822 UpdateTime string `json:"updateTime,omitempty"` 823 824 // ServerResponse contains the HTTP response code and headers from the 825 // server. 826 googleapi.ServerResponse `json:"-"` 827 828 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 829 // unconditionally include in API requests. By default, fields with 830 // empty values are omitted from API requests. However, any non-pointer, 831 // non-interface field appearing in ForceSendFields will be sent to the 832 // server regardless of whether the field is empty or not. This may be 833 // used to include empty fields in Patch requests. 834 ForceSendFields []string `json:"-"` 835 836 // NullFields is a list of field names (e.g. "AlternateLink") to include 837 // in API requests with the JSON null value. By default, fields with 838 // empty values are omitted from API requests. However, any field with 839 // an empty value appearing in NullFields will be sent to the server as 840 // null. It is an error if a field in this list has a non-empty value. 841 // This may be used to include null fields in Patch requests. 842 NullFields []string `json:"-"` 843} 844 845func (s *Course) MarshalJSON() ([]byte, error) { 846 type NoMethod Course 847 raw := NoMethod(*s) 848 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 849} 850 851// CourseAlias: Alternative identifier for a course. 852// 853// An alias uniquely identifies a course. It must be unique within one 854// of the 855// following scopes: 856// 857// * domain: A domain-scoped alias is visible to all users within the 858// alias 859// creator's domain and can be created only by a domain admin. A 860// domain-scoped 861// alias is often used when a course has an identifier external to 862// Classroom. 863// 864// * project: A project-scoped alias is visible to any request from 865// an 866// application using the Developer Console project ID that created the 867// alias 868// and can be created by any project. A project-scoped alias is often 869// used when 870// an application has alternative identifiers. A random value can also 871// be used 872// to avoid duplicate courses in the event of transmission failures, as 873// retrying 874// a request will return `ALREADY_EXISTS` if a previous one has 875// succeeded. 876type CourseAlias struct { 877 // Alias: Alias string. The format of the string indicates the desired 878 // alias scoping. 879 // 880 // * `d:<name>` indicates a domain-scoped alias. 881 // Example: `d:math_101` 882 // * `p:<name>` indicates a project-scoped alias. 883 // Example: `p:abc123` 884 // 885 // This field has a maximum length of 256 characters. 886 Alias string `json:"alias,omitempty"` 887 888 // ServerResponse contains the HTTP response code and headers from the 889 // server. 890 googleapi.ServerResponse `json:"-"` 891 892 // ForceSendFields is a list of field names (e.g. "Alias") to 893 // unconditionally include in API requests. By default, fields with 894 // empty values are omitted from API requests. However, any non-pointer, 895 // non-interface field appearing in ForceSendFields will be sent to the 896 // server regardless of whether the field is empty or not. This may be 897 // used to include empty fields in Patch requests. 898 ForceSendFields []string `json:"-"` 899 900 // NullFields is a list of field names (e.g. "Alias") to include in API 901 // requests with the JSON null value. By default, fields with empty 902 // values are omitted from API requests. However, any field with an 903 // empty value appearing in NullFields will be sent to the server as 904 // null. It is an error if a field in this list has a non-empty value. 905 // This may be used to include null fields in Patch requests. 906 NullFields []string `json:"-"` 907} 908 909func (s *CourseAlias) MarshalJSON() ([]byte, error) { 910 type NoMethod CourseAlias 911 raw := NoMethod(*s) 912 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 913} 914 915// CourseMaterial: A material attached to a course as part of a material 916// set. 917type CourseMaterial struct { 918 // DriveFile: Google Drive file attachment. 919 DriveFile *DriveFile `json:"driveFile,omitempty"` 920 921 // Form: Google Forms attachment. 922 Form *Form `json:"form,omitempty"` 923 924 // Link: Link atatchment. 925 Link *Link `json:"link,omitempty"` 926 927 // YouTubeVideo: Youtube video attachment. 928 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 929 930 // ForceSendFields is a list of field names (e.g. "DriveFile") to 931 // unconditionally include in API requests. By default, fields with 932 // empty values are omitted from API requests. However, any non-pointer, 933 // non-interface field appearing in ForceSendFields will be sent to the 934 // server regardless of whether the field is empty or not. This may be 935 // used to include empty fields in Patch requests. 936 ForceSendFields []string `json:"-"` 937 938 // NullFields is a list of field names (e.g. "DriveFile") to include in 939 // API requests with the JSON null value. By default, fields with empty 940 // values are omitted from API requests. However, any field with an 941 // empty value appearing in NullFields will be sent to the server as 942 // null. It is an error if a field in this list has a non-empty value. 943 // This may be used to include null fields in Patch requests. 944 NullFields []string `json:"-"` 945} 946 947func (s *CourseMaterial) MarshalJSON() ([]byte, error) { 948 type NoMethod CourseMaterial 949 raw := NoMethod(*s) 950 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 951} 952 953// CourseMaterialSet: A set of materials that appears on the "About" 954// page of the course. 955// These materials might include a syllabus, schedule, or other 956// background 957// information relating to the course as a whole. 958type CourseMaterialSet struct { 959 // Materials: Materials attached to this set. 960 Materials []*CourseMaterial `json:"materials,omitempty"` 961 962 // Title: Title for this set. 963 Title string `json:"title,omitempty"` 964 965 // ForceSendFields is a list of field names (e.g. "Materials") to 966 // unconditionally include in API requests. By default, fields with 967 // empty values are omitted from API requests. However, any non-pointer, 968 // non-interface field appearing in ForceSendFields will be sent to the 969 // server regardless of whether the field is empty or not. This may be 970 // used to include empty fields in Patch requests. 971 ForceSendFields []string `json:"-"` 972 973 // NullFields is a list of field names (e.g. "Materials") to include in 974 // API requests with the JSON null value. By default, fields with empty 975 // values are omitted from API requests. However, any field with an 976 // empty value appearing in NullFields will be sent to the server as 977 // null. It is an error if a field in this list has a non-empty value. 978 // This may be used to include null fields in Patch requests. 979 NullFields []string `json:"-"` 980} 981 982func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) { 983 type NoMethod CourseMaterialSet 984 raw := NoMethod(*s) 985 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 986} 987 988// CourseRosterChangesInfo: Information about a `Feed` with a 989// `feed_type` of `COURSE_ROSTER_CHANGES`. 990type CourseRosterChangesInfo struct { 991 // CourseId: The `course_id` of the course to subscribe to roster 992 // changes for. 993 CourseId string `json:"courseId,omitempty"` 994 995 // ForceSendFields is a list of field names (e.g. "CourseId") to 996 // unconditionally include in API requests. By default, fields with 997 // empty values are omitted from API requests. However, any non-pointer, 998 // non-interface field appearing in ForceSendFields will be sent to the 999 // server regardless of whether the field is empty or not. This may be 1000 // used to include empty fields in Patch requests. 1001 ForceSendFields []string `json:"-"` 1002 1003 // NullFields is a list of field names (e.g. "CourseId") to include in 1004 // API requests with the JSON null value. By default, fields with empty 1005 // values are omitted from API requests. However, any field with an 1006 // empty value appearing in NullFields will be sent to the server as 1007 // null. It is an error if a field in this list has a non-empty value. 1008 // This may be used to include null fields in Patch requests. 1009 NullFields []string `json:"-"` 1010} 1011 1012func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) { 1013 type NoMethod CourseRosterChangesInfo 1014 raw := NoMethod(*s) 1015 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1016} 1017 1018// CourseWork: Course work created by a teacher for students of the 1019// course. 1020type CourseWork struct { 1021 // AlternateLink: Absolute link to this course work in the Classroom web 1022 // UI. 1023 // This is only populated if `state` is `PUBLISHED`. 1024 // 1025 // Read-only. 1026 AlternateLink string `json:"alternateLink,omitempty"` 1027 1028 // AssigneeMode: Assignee mode of the coursework. 1029 // If unspecified, the default value is `ALL_STUDENTS`. 1030 // 1031 // Possible values: 1032 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 1033 // returned. 1034 // "ALL_STUDENTS" - All students can see the item. 1035 // This is the default state. 1036 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 1037 AssigneeMode string `json:"assigneeMode,omitempty"` 1038 1039 // Assignment: Assignment details. 1040 // This is populated only when `work_type` is `ASSIGNMENT`. 1041 // 1042 // Read-only. 1043 Assignment *Assignment `json:"assignment,omitempty"` 1044 1045 // AssociatedWithDeveloper: Whether this course work item is associated 1046 // with the Developer Console 1047 // project making the request. 1048 // 1049 // See CreateCourseWork for more 1050 // details. 1051 // 1052 // Read-only. 1053 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 1054 1055 // CourseId: Identifier of the course. 1056 // 1057 // Read-only. 1058 CourseId string `json:"courseId,omitempty"` 1059 1060 // CreationTime: Timestamp when this course work was 1061 // created. 1062 // 1063 // Read-only. 1064 CreationTime string `json:"creationTime,omitempty"` 1065 1066 // CreatorUserId: Identifier for the user that created the 1067 // coursework. 1068 // 1069 // Read-only. 1070 CreatorUserId string `json:"creatorUserId,omitempty"` 1071 1072 // Description: Optional description of this course work. 1073 // If set, the description must be a valid UTF-8 string containing no 1074 // more 1075 // than 30,000 characters. 1076 Description string `json:"description,omitempty"` 1077 1078 // DueDate: Optional date, in UTC, that submissions for this course work 1079 // are due. 1080 // This must be specified if `due_time` is specified. 1081 DueDate *Date `json:"dueDate,omitempty"` 1082 1083 // DueTime: Optional time of day, in UTC, that submissions for this 1084 // course work 1085 // are due. 1086 // This must be specified if `due_date` is specified. 1087 DueTime *TimeOfDay `json:"dueTime,omitempty"` 1088 1089 // Id: Classroom-assigned identifier of this course work, unique per 1090 // course. 1091 // 1092 // Read-only. 1093 Id string `json:"id,omitempty"` 1094 1095 // IndividualStudentsOptions: Identifiers of students with access to the 1096 // coursework. 1097 // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`. 1098 // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only 1099 // students 1100 // specified in this field are assigned the coursework. 1101 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 1102 1103 // Materials: Additional materials. 1104 // 1105 // CourseWork must have no more than 20 material items. 1106 Materials []*Material `json:"materials,omitempty"` 1107 1108 // MaxPoints: Maximum grade for this course work. 1109 // If zero or unspecified, this assignment is considered ungraded. 1110 // This must be a non-negative integer value. 1111 MaxPoints float64 `json:"maxPoints,omitempty"` 1112 1113 // MultipleChoiceQuestion: Multiple choice question details. 1114 // For read operations, this field is populated only when `work_type` 1115 // is 1116 // `MULTIPLE_CHOICE_QUESTION`. 1117 // For write operations, this field must be specified when creating 1118 // course 1119 // work with a `work_type` of `MULTIPLE_CHOICE_QUESTION`, and it must 1120 // not be 1121 // set otherwise. 1122 MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"` 1123 1124 // ScheduledTime: Optional timestamp when this course work is scheduled 1125 // to be published. 1126 ScheduledTime string `json:"scheduledTime,omitempty"` 1127 1128 // State: Status of this course work. 1129 // If unspecified, the default state is `DRAFT`. 1130 // 1131 // Possible values: 1132 // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 1133 // returned. 1134 // "PUBLISHED" - Status for work that has been published. 1135 // This is the default state. 1136 // "DRAFT" - Status for work that is not yet published. 1137 // Work in this state is visible only to course teachers and 1138 // domain 1139 // administrators. 1140 // "DELETED" - Status for work that was published but is now 1141 // deleted. 1142 // Work in this state is visible only to course teachers and 1143 // domain 1144 // administrators. 1145 // Work in this state is deleted after some time. 1146 State string `json:"state,omitempty"` 1147 1148 // SubmissionModificationMode: Setting to determine when students are 1149 // allowed to modify submissions. 1150 // If unspecified, the default value is `MODIFIABLE_UNTIL_TURNED_IN`. 1151 // 1152 // Possible values: 1153 // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode 1154 // specified. This is never returned. 1155 // "MODIFIABLE_UNTIL_TURNED_IN" - Submissions can be modified before 1156 // being turned in. 1157 // "MODIFIABLE" - Submissions can be modified at any time. 1158 SubmissionModificationMode string `json:"submissionModificationMode,omitempty"` 1159 1160 // Title: Title of this course work. 1161 // The title must be a valid UTF-8 string containing between 1 and 1162 // 3000 1163 // characters. 1164 Title string `json:"title,omitempty"` 1165 1166 // TopicId: Identifier for the topic that this coursework is associated 1167 // with. 1168 // Must match an existing topic in the course. 1169 TopicId string `json:"topicId,omitempty"` 1170 1171 // UpdateTime: Timestamp of the most recent change to this course 1172 // work. 1173 // 1174 // Read-only. 1175 UpdateTime string `json:"updateTime,omitempty"` 1176 1177 // WorkType: Type of this course work. 1178 // 1179 // The type is set when the course work is created and cannot be 1180 // changed. 1181 // 1182 // Possible values: 1183 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 1184 // never returned. 1185 // "ASSIGNMENT" - An assignment. 1186 // "SHORT_ANSWER_QUESTION" - A short answer question. 1187 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 1188 WorkType string `json:"workType,omitempty"` 1189 1190 // ServerResponse contains the HTTP response code and headers from the 1191 // server. 1192 googleapi.ServerResponse `json:"-"` 1193 1194 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1195 // unconditionally include in API requests. By default, fields with 1196 // empty values are omitted from API requests. However, any non-pointer, 1197 // non-interface field appearing in ForceSendFields will be sent to the 1198 // server regardless of whether the field is empty or not. This may be 1199 // used to include empty fields in Patch requests. 1200 ForceSendFields []string `json:"-"` 1201 1202 // NullFields is a list of field names (e.g. "AlternateLink") to include 1203 // in API requests with the JSON null value. By default, fields with 1204 // empty values are omitted from API requests. However, any field with 1205 // an empty value appearing in NullFields will be sent to the server as 1206 // null. It is an error if a field in this list has a non-empty value. 1207 // This may be used to include null fields in Patch requests. 1208 NullFields []string `json:"-"` 1209} 1210 1211func (s *CourseWork) MarshalJSON() ([]byte, error) { 1212 type NoMethod CourseWork 1213 raw := NoMethod(*s) 1214 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1215} 1216 1217func (s *CourseWork) UnmarshalJSON(data []byte) error { 1218 type NoMethod CourseWork 1219 var s1 struct { 1220 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1221 *NoMethod 1222 } 1223 s1.NoMethod = (*NoMethod)(s) 1224 if err := json.Unmarshal(data, &s1); err != nil { 1225 return err 1226 } 1227 s.MaxPoints = float64(s1.MaxPoints) 1228 return nil 1229} 1230 1231// CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1232// of `COURSE_WORK_CHANGES`. 1233type CourseWorkChangesInfo struct { 1234 // CourseId: The `course_id` of the course to subscribe to work changes 1235 // for. 1236 CourseId string `json:"courseId,omitempty"` 1237 1238 // ForceSendFields is a list of field names (e.g. "CourseId") to 1239 // unconditionally include in API requests. By default, fields with 1240 // empty values are omitted from API requests. However, any non-pointer, 1241 // non-interface field appearing in ForceSendFields will be sent to the 1242 // server regardless of whether the field is empty or not. This may be 1243 // used to include empty fields in Patch requests. 1244 ForceSendFields []string `json:"-"` 1245 1246 // NullFields is a list of field names (e.g. "CourseId") to include in 1247 // API requests with the JSON null value. By default, fields with empty 1248 // values are omitted from API requests. However, any field with an 1249 // empty value appearing in NullFields will be sent to the server as 1250 // null. It is an error if a field in this list has a non-empty value. 1251 // This may be used to include null fields in Patch requests. 1252 NullFields []string `json:"-"` 1253} 1254 1255func (s *CourseWorkChangesInfo) MarshalJSON() ([]byte, error) { 1256 type NoMethod CourseWorkChangesInfo 1257 raw := NoMethod(*s) 1258 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1259} 1260 1261// Date: Represents a whole or partial calendar date, e.g. a birthday. 1262// The time of day 1263// and time zone are either specified elsewhere or are not significant. 1264// The date 1265// is relative to the Proleptic Gregorian Calendar. This can 1266// represent: 1267// 1268// * A full date, with non-zero year, month and day values 1269// * A month and day value, with a zero year, e.g. an anniversary 1270// * A year on its own, with zero month and day values 1271// * A year and month value, with a zero day, e.g. a credit card 1272// expiration date 1273// 1274// Related types are google.type.TimeOfDay and 1275// `google.protobuf.Timestamp`. 1276type Date struct { 1277 // Day: Day of month. Must be from 1 to 31 and valid for the year and 1278 // month, or 0 1279 // if specifying a year by itself or a year and month where the day is 1280 // not 1281 // significant. 1282 Day int64 `json:"day,omitempty"` 1283 1284 // Month: Month of year. Must be from 1 to 12, or 0 if specifying a year 1285 // without a 1286 // month and day. 1287 Month int64 `json:"month,omitempty"` 1288 1289 // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date 1290 // without 1291 // a year. 1292 Year int64 `json:"year,omitempty"` 1293 1294 // ForceSendFields is a list of field names (e.g. "Day") to 1295 // unconditionally include in API requests. By default, fields with 1296 // empty values are omitted from API requests. However, any non-pointer, 1297 // non-interface field appearing in ForceSendFields will be sent to the 1298 // server regardless of whether the field is empty or not. This may be 1299 // used to include empty fields in Patch requests. 1300 ForceSendFields []string `json:"-"` 1301 1302 // NullFields is a list of field names (e.g. "Day") to include in API 1303 // requests with the JSON null value. By default, fields with empty 1304 // values are omitted from API requests. However, any field with an 1305 // empty value appearing in NullFields will be sent to the server as 1306 // null. It is an error if a field in this list has a non-empty value. 1307 // This may be used to include null fields in Patch requests. 1308 NullFields []string `json:"-"` 1309} 1310 1311func (s *Date) MarshalJSON() ([]byte, error) { 1312 type NoMethod Date 1313 raw := NoMethod(*s) 1314 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1315} 1316 1317// DriveFile: Representation of a Google Drive file. 1318type DriveFile struct { 1319 // AlternateLink: URL that can be used to access the Drive 1320 // item. 1321 // 1322 // Read-only. 1323 AlternateLink string `json:"alternateLink,omitempty"` 1324 1325 // Id: Drive API resource ID. 1326 Id string `json:"id,omitempty"` 1327 1328 // ThumbnailUrl: URL of a thumbnail image of the Drive item. 1329 // 1330 // Read-only. 1331 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1332 1333 // Title: Title of the Drive item. 1334 // 1335 // Read-only. 1336 Title string `json:"title,omitempty"` 1337 1338 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1339 // unconditionally include in API requests. By default, fields with 1340 // empty values are omitted from API requests. However, any non-pointer, 1341 // non-interface field appearing in ForceSendFields will be sent to the 1342 // server regardless of whether the field is empty or not. This may be 1343 // used to include empty fields in Patch requests. 1344 ForceSendFields []string `json:"-"` 1345 1346 // NullFields is a list of field names (e.g. "AlternateLink") to include 1347 // in API requests with the JSON null value. By default, fields with 1348 // empty values are omitted from API requests. However, any field with 1349 // an empty value appearing in NullFields will be sent to the server as 1350 // null. It is an error if a field in this list has a non-empty value. 1351 // This may be used to include null fields in Patch requests. 1352 NullFields []string `json:"-"` 1353} 1354 1355func (s *DriveFile) MarshalJSON() ([]byte, error) { 1356 type NoMethod DriveFile 1357 raw := NoMethod(*s) 1358 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1359} 1360 1361// DriveFolder: Representation of a Google Drive folder. 1362type DriveFolder struct { 1363 // AlternateLink: URL that can be used to access the Drive 1364 // folder. 1365 // 1366 // Read-only. 1367 AlternateLink string `json:"alternateLink,omitempty"` 1368 1369 // Id: Drive API resource ID. 1370 Id string `json:"id,omitempty"` 1371 1372 // Title: Title of the Drive folder. 1373 // 1374 // Read-only. 1375 Title string `json:"title,omitempty"` 1376 1377 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1378 // unconditionally include in API requests. By default, fields with 1379 // empty values are omitted from API requests. However, any non-pointer, 1380 // non-interface field appearing in ForceSendFields will be sent to the 1381 // server regardless of whether the field is empty or not. This may be 1382 // used to include empty fields in Patch requests. 1383 ForceSendFields []string `json:"-"` 1384 1385 // NullFields is a list of field names (e.g. "AlternateLink") to include 1386 // in API requests with the JSON null value. By default, fields with 1387 // empty values are omitted from API requests. However, any field with 1388 // an empty value appearing in NullFields will be sent to the server as 1389 // null. It is an error if a field in this list has a non-empty value. 1390 // This may be used to include null fields in Patch requests. 1391 NullFields []string `json:"-"` 1392} 1393 1394func (s *DriveFolder) MarshalJSON() ([]byte, error) { 1395 type NoMethod DriveFolder 1396 raw := NoMethod(*s) 1397 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1398} 1399 1400// Empty: A generic empty message that you can re-use to avoid defining 1401// duplicated 1402// empty messages in your APIs. A typical example is to use it as the 1403// request 1404// or the response type of an API method. For instance: 1405// 1406// service Foo { 1407// rpc Bar(google.protobuf.Empty) returns 1408// (google.protobuf.Empty); 1409// } 1410// 1411// The JSON representation for `Empty` is empty JSON object `{}`. 1412type Empty struct { 1413 // ServerResponse contains the HTTP response code and headers from the 1414 // server. 1415 googleapi.ServerResponse `json:"-"` 1416} 1417 1418// Feed: A class of notifications that an application can register to 1419// receive. 1420// For example: "all roster changes for a domain". 1421type Feed struct { 1422 // CourseRosterChangesInfo: Information about a `Feed` with a 1423 // `feed_type` of `COURSE_ROSTER_CHANGES`. 1424 // This field must be specified if `feed_type` is 1425 // `COURSE_ROSTER_CHANGES`. 1426 CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"` 1427 1428 // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1429 // of `COURSE_WORK_CHANGES`. 1430 // This field must be specified if `feed_type` is `COURSE_WORK_CHANGES`. 1431 CourseWorkChangesInfo *CourseWorkChangesInfo `json:"courseWorkChangesInfo,omitempty"` 1432 1433 // FeedType: The type of feed. 1434 // 1435 // Possible values: 1436 // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided. 1437 // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular 1438 // domain. 1439 // 1440 // Notifications will be generated whenever a user joins or leaves a 1441 // course. 1442 // 1443 // No notifications will be generated when an invitation is created 1444 // or 1445 // deleted, but notifications will be generated when a user joins a 1446 // course 1447 // by accepting an invitation. 1448 // "COURSE_ROSTER_CHANGES" - All roster changes for a particular 1449 // course. 1450 // 1451 // Notifications will be generated whenever a user joins or leaves a 1452 // course. 1453 // 1454 // No notifications will be generated when an invitation is created 1455 // or 1456 // deleted, but notifications will be generated when a user joins a 1457 // course 1458 // by accepting an invitation. 1459 // "COURSE_WORK_CHANGES" - All course work activity for a particular 1460 // course. 1461 // 1462 // Notifications will be generated when a CourseWork 1463 // or 1464 // StudentSubmission object is created or modified. No notification will 1465 // be 1466 // generated when a StudentSubmission object is created in connection 1467 // with 1468 // the creation or modification of its parent CourseWork object (but 1469 // a 1470 // notification will be generated for that CourseWork object's creation 1471 // or 1472 // modification). 1473 FeedType string `json:"feedType,omitempty"` 1474 1475 // ForceSendFields is a list of field names (e.g. 1476 // "CourseRosterChangesInfo") to unconditionally include in API 1477 // requests. By default, fields with empty values are omitted from API 1478 // requests. However, any non-pointer, non-interface field appearing in 1479 // ForceSendFields will be sent to the server regardless of whether the 1480 // field is empty or not. This may be used to include empty fields in 1481 // Patch requests. 1482 ForceSendFields []string `json:"-"` 1483 1484 // NullFields is a list of field names (e.g. "CourseRosterChangesInfo") 1485 // to include in API requests with the JSON null value. By default, 1486 // fields with empty values are omitted from API requests. However, any 1487 // field with an empty value appearing in NullFields will be sent to the 1488 // server as null. It is an error if a field in this list has a 1489 // non-empty value. This may be used to include null fields in Patch 1490 // requests. 1491 NullFields []string `json:"-"` 1492} 1493 1494func (s *Feed) MarshalJSON() ([]byte, error) { 1495 type NoMethod Feed 1496 raw := NoMethod(*s) 1497 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1498} 1499 1500// Form: Google Forms item. 1501type Form struct { 1502 // FormUrl: URL of the form. 1503 FormUrl string `json:"formUrl,omitempty"` 1504 1505 // ResponseUrl: URL of the form responses document. 1506 // Only set if respsonses have been recorded and only when 1507 // the 1508 // requesting user is an editor of the form. 1509 // 1510 // Read-only. 1511 ResponseUrl string `json:"responseUrl,omitempty"` 1512 1513 // ThumbnailUrl: URL of a thumbnail image of the Form. 1514 // 1515 // Read-only. 1516 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1517 1518 // Title: Title of the Form. 1519 // 1520 // Read-only. 1521 Title string `json:"title,omitempty"` 1522 1523 // ForceSendFields is a list of field names (e.g. "FormUrl") to 1524 // unconditionally include in API requests. By default, fields with 1525 // empty values are omitted from API requests. However, any non-pointer, 1526 // non-interface field appearing in ForceSendFields will be sent to the 1527 // server regardless of whether the field is empty or not. This may be 1528 // used to include empty fields in Patch requests. 1529 ForceSendFields []string `json:"-"` 1530 1531 // NullFields is a list of field names (e.g. "FormUrl") to include in 1532 // API requests with the JSON null value. By default, fields with empty 1533 // values are omitted from API requests. However, any field with an 1534 // empty value appearing in NullFields will be sent to the server as 1535 // null. It is an error if a field in this list has a non-empty value. 1536 // This may be used to include null fields in Patch requests. 1537 NullFields []string `json:"-"` 1538} 1539 1540func (s *Form) MarshalJSON() ([]byte, error) { 1541 type NoMethod Form 1542 raw := NoMethod(*s) 1543 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1544} 1545 1546// GlobalPermission: Global user permission description. 1547type GlobalPermission struct { 1548 // Permission: Permission value. 1549 // 1550 // Possible values: 1551 // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not 1552 // returned and is not a 1553 // valid value. 1554 // "CREATE_COURSE" - User is permitted to create a course. 1555 Permission string `json:"permission,omitempty"` 1556 1557 // ForceSendFields is a list of field names (e.g. "Permission") to 1558 // unconditionally include in API requests. By default, fields with 1559 // empty values are omitted from API requests. However, any non-pointer, 1560 // non-interface field appearing in ForceSendFields will be sent to the 1561 // server regardless of whether the field is empty or not. This may be 1562 // used to include empty fields in Patch requests. 1563 ForceSendFields []string `json:"-"` 1564 1565 // NullFields is a list of field names (e.g. "Permission") to include in 1566 // API requests with the JSON null value. By default, fields with empty 1567 // values are omitted from API requests. However, any field with an 1568 // empty value appearing in NullFields will be sent to the server as 1569 // null. It is an error if a field in this list has a non-empty value. 1570 // This may be used to include null fields in Patch requests. 1571 NullFields []string `json:"-"` 1572} 1573 1574func (s *GlobalPermission) MarshalJSON() ([]byte, error) { 1575 type NoMethod GlobalPermission 1576 raw := NoMethod(*s) 1577 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1578} 1579 1580// GradeHistory: The history of each grade on this submission. 1581type GradeHistory struct { 1582 // ActorUserId: The teacher who made the grade change. 1583 ActorUserId string `json:"actorUserId,omitempty"` 1584 1585 // GradeChangeType: The type of grade change at this time in the 1586 // submission grade history. 1587 // 1588 // Possible values: 1589 // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This 1590 // should never be returned. 1591 // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of 1592 // the draft grade. 1593 // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator 1594 // of the assigned grade. 1595 // "MAX_POINTS_CHANGE" - A change in the denominator of the grade. 1596 GradeChangeType string `json:"gradeChangeType,omitempty"` 1597 1598 // GradeTimestamp: When the grade of the submission was changed. 1599 GradeTimestamp string `json:"gradeTimestamp,omitempty"` 1600 1601 // MaxPoints: The denominator of the grade at this time in the 1602 // submission grade 1603 // history. 1604 MaxPoints float64 `json:"maxPoints,omitempty"` 1605 1606 // PointsEarned: The numerator of the grade at this time in the 1607 // submission grade history. 1608 PointsEarned float64 `json:"pointsEarned,omitempty"` 1609 1610 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 1611 // unconditionally include in API requests. By default, fields with 1612 // empty values are omitted from API requests. However, any non-pointer, 1613 // non-interface field appearing in ForceSendFields will be sent to the 1614 // server regardless of whether the field is empty or not. This may be 1615 // used to include empty fields in Patch requests. 1616 ForceSendFields []string `json:"-"` 1617 1618 // NullFields is a list of field names (e.g. "ActorUserId") to include 1619 // in API requests with the JSON null value. By default, fields with 1620 // empty values are omitted from API requests. However, any field with 1621 // an empty value appearing in NullFields will be sent to the server as 1622 // null. It is an error if a field in this list has a non-empty value. 1623 // This may be used to include null fields in Patch requests. 1624 NullFields []string `json:"-"` 1625} 1626 1627func (s *GradeHistory) MarshalJSON() ([]byte, error) { 1628 type NoMethod GradeHistory 1629 raw := NoMethod(*s) 1630 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1631} 1632 1633func (s *GradeHistory) UnmarshalJSON(data []byte) error { 1634 type NoMethod GradeHistory 1635 var s1 struct { 1636 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1637 PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"` 1638 *NoMethod 1639 } 1640 s1.NoMethod = (*NoMethod)(s) 1641 if err := json.Unmarshal(data, &s1); err != nil { 1642 return err 1643 } 1644 s.MaxPoints = float64(s1.MaxPoints) 1645 s.PointsEarned = float64(s1.PointsEarned) 1646 return nil 1647} 1648 1649// Guardian: Association between a student and a guardian of that 1650// student. The guardian 1651// may receive information about the student's course work. 1652type Guardian struct { 1653 // GuardianId: Identifier for the guardian. 1654 GuardianId string `json:"guardianId,omitempty"` 1655 1656 // GuardianProfile: User profile for the guardian. 1657 GuardianProfile *UserProfile `json:"guardianProfile,omitempty"` 1658 1659 // InvitedEmailAddress: The email address to which the initial guardian 1660 // invitation was sent. 1661 // This field is only visible to domain administrators. 1662 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1663 1664 // StudentId: Identifier for the student to whom the guardian 1665 // relationship applies. 1666 StudentId string `json:"studentId,omitempty"` 1667 1668 // ServerResponse contains the HTTP response code and headers from the 1669 // server. 1670 googleapi.ServerResponse `json:"-"` 1671 1672 // ForceSendFields is a list of field names (e.g. "GuardianId") to 1673 // unconditionally include in API requests. By default, fields with 1674 // empty values are omitted from API requests. However, any non-pointer, 1675 // non-interface field appearing in ForceSendFields will be sent to the 1676 // server regardless of whether the field is empty or not. This may be 1677 // used to include empty fields in Patch requests. 1678 ForceSendFields []string `json:"-"` 1679 1680 // NullFields is a list of field names (e.g. "GuardianId") to include in 1681 // API requests with the JSON null value. By default, fields with empty 1682 // values are omitted from API requests. However, any field with an 1683 // empty value appearing in NullFields will be sent to the server as 1684 // null. It is an error if a field in this list has a non-empty value. 1685 // This may be used to include null fields in Patch requests. 1686 NullFields []string `json:"-"` 1687} 1688 1689func (s *Guardian) MarshalJSON() ([]byte, error) { 1690 type NoMethod Guardian 1691 raw := NoMethod(*s) 1692 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1693} 1694 1695// GuardianInvitation: An invitation to become the guardian of a 1696// specified user, sent to a specified 1697// email address. 1698type GuardianInvitation struct { 1699 // CreationTime: The time that this invitation was created. 1700 // 1701 // Read-only. 1702 CreationTime string `json:"creationTime,omitempty"` 1703 1704 // InvitationId: Unique identifier for this invitation. 1705 // 1706 // Read-only. 1707 InvitationId string `json:"invitationId,omitempty"` 1708 1709 // InvitedEmailAddress: Email address that the invitation was sent 1710 // to. 1711 // This field is only visible to domain administrators. 1712 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1713 1714 // State: The state that this invitation is in. 1715 // 1716 // Possible values: 1717 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 1718 // "PENDING" - The invitation is active and awaiting a response. 1719 // "COMPLETE" - The invitation is no longer active. It may have been 1720 // accepted, declined, 1721 // withdrawn or it may have expired. 1722 State string `json:"state,omitempty"` 1723 1724 // StudentId: ID of the student (in standard format) 1725 StudentId string `json:"studentId,omitempty"` 1726 1727 // ServerResponse contains the HTTP response code and headers from the 1728 // server. 1729 googleapi.ServerResponse `json:"-"` 1730 1731 // ForceSendFields is a list of field names (e.g. "CreationTime") to 1732 // unconditionally include in API requests. By default, fields with 1733 // empty values are omitted from API requests. However, any non-pointer, 1734 // non-interface field appearing in ForceSendFields will be sent to the 1735 // server regardless of whether the field is empty or not. This may be 1736 // used to include empty fields in Patch requests. 1737 ForceSendFields []string `json:"-"` 1738 1739 // NullFields is a list of field names (e.g. "CreationTime") to include 1740 // in API requests with the JSON null value. By default, fields with 1741 // empty values are omitted from API requests. However, any field with 1742 // an empty value appearing in NullFields will be sent to the server as 1743 // null. It is an error if a field in this list has a non-empty value. 1744 // This may be used to include null fields in Patch requests. 1745 NullFields []string `json:"-"` 1746} 1747 1748func (s *GuardianInvitation) MarshalJSON() ([]byte, error) { 1749 type NoMethod GuardianInvitation 1750 raw := NoMethod(*s) 1751 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1752} 1753 1754// IndividualStudentsOptions: Assignee details about a 1755// coursework/announcement. 1756// This field is set if and only if `assigneeMode` is 1757// `INDIVIDUAL_STUDENTS`. 1758type IndividualStudentsOptions struct { 1759 // StudentIds: Identifiers for the students that have access to 1760 // the 1761 // coursework/announcement. 1762 StudentIds []string `json:"studentIds,omitempty"` 1763 1764 // ForceSendFields is a list of field names (e.g. "StudentIds") to 1765 // unconditionally include in API requests. By default, fields with 1766 // empty values are omitted from API requests. However, any non-pointer, 1767 // non-interface field appearing in ForceSendFields will be sent to the 1768 // server regardless of whether the field is empty or not. This may be 1769 // used to include empty fields in Patch requests. 1770 ForceSendFields []string `json:"-"` 1771 1772 // NullFields is a list of field names (e.g. "StudentIds") to include in 1773 // API requests with the JSON null value. By default, fields with empty 1774 // values are omitted from API requests. However, any field with an 1775 // empty value appearing in NullFields will be sent to the server as 1776 // null. It is an error if a field in this list has a non-empty value. 1777 // This may be used to include null fields in Patch requests. 1778 NullFields []string `json:"-"` 1779} 1780 1781func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) { 1782 type NoMethod IndividualStudentsOptions 1783 raw := NoMethod(*s) 1784 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1785} 1786 1787// Invitation: An invitation to join a course. 1788type Invitation struct { 1789 // CourseId: Identifier of the course to invite the user to. 1790 CourseId string `json:"courseId,omitempty"` 1791 1792 // Id: Identifier assigned by Classroom. 1793 // 1794 // Read-only. 1795 Id string `json:"id,omitempty"` 1796 1797 // Role: Role to invite the user to have. 1798 // Must not be `COURSE_ROLE_UNSPECIFIED`. 1799 // 1800 // Possible values: 1801 // "COURSE_ROLE_UNSPECIFIED" - No course role. 1802 // "STUDENT" - Student in the course. 1803 // "TEACHER" - Teacher of the course. 1804 // "OWNER" - Owner of the course. 1805 Role string `json:"role,omitempty"` 1806 1807 // UserId: Identifier of the invited user. 1808 // 1809 // When specified as a parameter of a request, this identifier can be 1810 // set to 1811 // one of the following: 1812 // 1813 // * the numeric identifier for the user 1814 // * the email address of the user 1815 // * the string literal "me", indicating the requesting user 1816 UserId string `json:"userId,omitempty"` 1817 1818 // ServerResponse contains the HTTP response code and headers from the 1819 // server. 1820 googleapi.ServerResponse `json:"-"` 1821 1822 // ForceSendFields is a list of field names (e.g. "CourseId") to 1823 // unconditionally include in API requests. By default, fields with 1824 // empty values are omitted from API requests. However, any non-pointer, 1825 // non-interface field appearing in ForceSendFields will be sent to the 1826 // server regardless of whether the field is empty or not. This may be 1827 // used to include empty fields in Patch requests. 1828 ForceSendFields []string `json:"-"` 1829 1830 // NullFields is a list of field names (e.g. "CourseId") to include in 1831 // API requests with the JSON null value. By default, fields with empty 1832 // values are omitted from API requests. However, any field with an 1833 // empty value appearing in NullFields will be sent to the server as 1834 // null. It is an error if a field in this list has a non-empty value. 1835 // This may be used to include null fields in Patch requests. 1836 NullFields []string `json:"-"` 1837} 1838 1839func (s *Invitation) MarshalJSON() ([]byte, error) { 1840 type NoMethod Invitation 1841 raw := NoMethod(*s) 1842 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1843} 1844 1845// Link: URL item. 1846type Link struct { 1847 // ThumbnailUrl: URL of a thumbnail image of the target URL. 1848 // 1849 // Read-only. 1850 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1851 1852 // Title: Title of the target of the URL. 1853 // 1854 // Read-only. 1855 Title string `json:"title,omitempty"` 1856 1857 // Url: URL to link to. 1858 // This must be a valid UTF-8 string containing between 1 and 2024 1859 // characters. 1860 Url string `json:"url,omitempty"` 1861 1862 // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to 1863 // unconditionally include in API requests. By default, fields with 1864 // empty values are omitted from API requests. However, any non-pointer, 1865 // non-interface field appearing in ForceSendFields will be sent to the 1866 // server regardless of whether the field is empty or not. This may be 1867 // used to include empty fields in Patch requests. 1868 ForceSendFields []string `json:"-"` 1869 1870 // NullFields is a list of field names (e.g. "ThumbnailUrl") to include 1871 // in API requests with the JSON null value. By default, fields with 1872 // empty values are omitted from API requests. However, any field with 1873 // an empty value appearing in NullFields will be sent to the server as 1874 // null. It is an error if a field in this list has a non-empty value. 1875 // This may be used to include null fields in Patch requests. 1876 NullFields []string `json:"-"` 1877} 1878 1879func (s *Link) MarshalJSON() ([]byte, error) { 1880 type NoMethod Link 1881 raw := NoMethod(*s) 1882 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1883} 1884 1885// ListAnnouncementsResponse: Response when listing course work. 1886type ListAnnouncementsResponse struct { 1887 // Announcements: Announcement items that match the request. 1888 Announcements []*Announcement `json:"announcements,omitempty"` 1889 1890 // NextPageToken: Token identifying the next page of results to return. 1891 // If empty, no further 1892 // results are available. 1893 NextPageToken string `json:"nextPageToken,omitempty"` 1894 1895 // ServerResponse contains the HTTP response code and headers from the 1896 // server. 1897 googleapi.ServerResponse `json:"-"` 1898 1899 // ForceSendFields is a list of field names (e.g. "Announcements") to 1900 // unconditionally include in API requests. By default, fields with 1901 // empty values are omitted from API requests. However, any non-pointer, 1902 // non-interface field appearing in ForceSendFields will be sent to the 1903 // server regardless of whether the field is empty or not. This may be 1904 // used to include empty fields in Patch requests. 1905 ForceSendFields []string `json:"-"` 1906 1907 // NullFields is a list of field names (e.g. "Announcements") to include 1908 // in API requests with the JSON null value. By default, fields with 1909 // empty values are omitted from API requests. However, any field with 1910 // an empty value appearing in NullFields will be sent to the server as 1911 // null. It is an error if a field in this list has a non-empty value. 1912 // This may be used to include null fields in Patch requests. 1913 NullFields []string `json:"-"` 1914} 1915 1916func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) { 1917 type NoMethod ListAnnouncementsResponse 1918 raw := NoMethod(*s) 1919 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1920} 1921 1922// ListCourseAliasesResponse: Response when listing course aliases. 1923type ListCourseAliasesResponse struct { 1924 // Aliases: The course aliases. 1925 Aliases []*CourseAlias `json:"aliases,omitempty"` 1926 1927 // NextPageToken: Token identifying the next page of results to return. 1928 // If empty, no further 1929 // results are available. 1930 NextPageToken string `json:"nextPageToken,omitempty"` 1931 1932 // ServerResponse contains the HTTP response code and headers from the 1933 // server. 1934 googleapi.ServerResponse `json:"-"` 1935 1936 // ForceSendFields is a list of field names (e.g. "Aliases") to 1937 // unconditionally include in API requests. By default, fields with 1938 // empty values are omitted from API requests. However, any non-pointer, 1939 // non-interface field appearing in ForceSendFields will be sent to the 1940 // server regardless of whether the field is empty or not. This may be 1941 // used to include empty fields in Patch requests. 1942 ForceSendFields []string `json:"-"` 1943 1944 // NullFields is a list of field names (e.g. "Aliases") to include in 1945 // API requests with the JSON null value. By default, fields with empty 1946 // values are omitted from API requests. However, any field with an 1947 // empty value appearing in NullFields will be sent to the server as 1948 // null. It is an error if a field in this list has a non-empty value. 1949 // This may be used to include null fields in Patch requests. 1950 NullFields []string `json:"-"` 1951} 1952 1953func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) { 1954 type NoMethod ListCourseAliasesResponse 1955 raw := NoMethod(*s) 1956 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1957} 1958 1959// ListCourseWorkResponse: Response when listing course work. 1960type ListCourseWorkResponse struct { 1961 // CourseWork: Course work items that match the request. 1962 CourseWork []*CourseWork `json:"courseWork,omitempty"` 1963 1964 // NextPageToken: Token identifying the next page of results to return. 1965 // If empty, no further 1966 // results are available. 1967 NextPageToken string `json:"nextPageToken,omitempty"` 1968 1969 // ServerResponse contains the HTTP response code and headers from the 1970 // server. 1971 googleapi.ServerResponse `json:"-"` 1972 1973 // ForceSendFields is a list of field names (e.g. "CourseWork") to 1974 // unconditionally include in API requests. By default, fields with 1975 // empty values are omitted from API requests. However, any non-pointer, 1976 // non-interface field appearing in ForceSendFields will be sent to the 1977 // server regardless of whether the field is empty or not. This may be 1978 // used to include empty fields in Patch requests. 1979 ForceSendFields []string `json:"-"` 1980 1981 // NullFields is a list of field names (e.g. "CourseWork") to include in 1982 // API requests with the JSON null value. By default, fields with empty 1983 // values are omitted from API requests. However, any field with an 1984 // empty value appearing in NullFields will be sent to the server as 1985 // null. It is an error if a field in this list has a non-empty value. 1986 // This may be used to include null fields in Patch requests. 1987 NullFields []string `json:"-"` 1988} 1989 1990func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) { 1991 type NoMethod ListCourseWorkResponse 1992 raw := NoMethod(*s) 1993 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1994} 1995 1996// ListCoursesResponse: Response when listing courses. 1997type ListCoursesResponse struct { 1998 // Courses: Courses that match the list request. 1999 Courses []*Course `json:"courses,omitempty"` 2000 2001 // NextPageToken: Token identifying the next page of results to return. 2002 // If empty, no further 2003 // results are available. 2004 NextPageToken string `json:"nextPageToken,omitempty"` 2005 2006 // ServerResponse contains the HTTP response code and headers from the 2007 // server. 2008 googleapi.ServerResponse `json:"-"` 2009 2010 // ForceSendFields is a list of field names (e.g. "Courses") to 2011 // unconditionally include in API requests. By default, fields with 2012 // empty values are omitted from API requests. However, any non-pointer, 2013 // non-interface field appearing in ForceSendFields will be sent to the 2014 // server regardless of whether the field is empty or not. This may be 2015 // used to include empty fields in Patch requests. 2016 ForceSendFields []string `json:"-"` 2017 2018 // NullFields is a list of field names (e.g. "Courses") to include in 2019 // API requests with the JSON null value. By default, fields with empty 2020 // values are omitted from API requests. However, any field with an 2021 // empty value appearing in NullFields will be sent to the server as 2022 // null. It is an error if a field in this list has a non-empty value. 2023 // This may be used to include null fields in Patch requests. 2024 NullFields []string `json:"-"` 2025} 2026 2027func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) { 2028 type NoMethod ListCoursesResponse 2029 raw := NoMethod(*s) 2030 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2031} 2032 2033// ListGuardianInvitationsResponse: Response when listing guardian 2034// invitations. 2035type ListGuardianInvitationsResponse struct { 2036 // GuardianInvitations: Guardian invitations that matched the list 2037 // request. 2038 GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"` 2039 2040 // NextPageToken: Token identifying the next page of results to return. 2041 // If empty, no further 2042 // results are available. 2043 NextPageToken string `json:"nextPageToken,omitempty"` 2044 2045 // ServerResponse contains the HTTP response code and headers from the 2046 // server. 2047 googleapi.ServerResponse `json:"-"` 2048 2049 // ForceSendFields is a list of field names (e.g. "GuardianInvitations") 2050 // to unconditionally include in API requests. By default, fields with 2051 // empty values are omitted from API requests. However, any non-pointer, 2052 // non-interface field appearing in ForceSendFields will be sent to the 2053 // server regardless of whether the field is empty or not. This may be 2054 // used to include empty fields in Patch requests. 2055 ForceSendFields []string `json:"-"` 2056 2057 // NullFields is a list of field names (e.g. "GuardianInvitations") to 2058 // include in API requests with the JSON null value. By default, fields 2059 // with empty values are omitted from API requests. However, any field 2060 // with an empty value appearing in NullFields will be sent to the 2061 // server as null. It is an error if a field in this list has a 2062 // non-empty value. This may be used to include null fields in Patch 2063 // requests. 2064 NullFields []string `json:"-"` 2065} 2066 2067func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) { 2068 type NoMethod ListGuardianInvitationsResponse 2069 raw := NoMethod(*s) 2070 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2071} 2072 2073// ListGuardiansResponse: Response when listing guardians. 2074type ListGuardiansResponse struct { 2075 // Guardians: Guardians on this page of results that met the criteria 2076 // specified in 2077 // the request. 2078 Guardians []*Guardian `json:"guardians,omitempty"` 2079 2080 // NextPageToken: Token identifying the next page of results to return. 2081 // If empty, no further 2082 // results are available. 2083 NextPageToken string `json:"nextPageToken,omitempty"` 2084 2085 // ServerResponse contains the HTTP response code and headers from the 2086 // server. 2087 googleapi.ServerResponse `json:"-"` 2088 2089 // ForceSendFields is a list of field names (e.g. "Guardians") to 2090 // unconditionally include in API requests. By default, fields with 2091 // empty values are omitted from API requests. However, any non-pointer, 2092 // non-interface field appearing in ForceSendFields will be sent to the 2093 // server regardless of whether the field is empty or not. This may be 2094 // used to include empty fields in Patch requests. 2095 ForceSendFields []string `json:"-"` 2096 2097 // NullFields is a list of field names (e.g. "Guardians") to include in 2098 // API requests with the JSON null value. By default, fields with empty 2099 // values are omitted from API requests. However, any field with an 2100 // empty value appearing in NullFields will be sent to the server as 2101 // null. It is an error if a field in this list has a non-empty value. 2102 // This may be used to include null fields in Patch requests. 2103 NullFields []string `json:"-"` 2104} 2105 2106func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) { 2107 type NoMethod ListGuardiansResponse 2108 raw := NoMethod(*s) 2109 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2110} 2111 2112// ListInvitationsResponse: Response when listing invitations. 2113type ListInvitationsResponse struct { 2114 // Invitations: Invitations that match the list request. 2115 Invitations []*Invitation `json:"invitations,omitempty"` 2116 2117 // NextPageToken: Token identifying the next page of results to return. 2118 // If empty, no further 2119 // results are available. 2120 NextPageToken string `json:"nextPageToken,omitempty"` 2121 2122 // ServerResponse contains the HTTP response code and headers from the 2123 // server. 2124 googleapi.ServerResponse `json:"-"` 2125 2126 // ForceSendFields is a list of field names (e.g. "Invitations") to 2127 // unconditionally include in API requests. By default, fields with 2128 // empty values are omitted from API requests. However, any non-pointer, 2129 // non-interface field appearing in ForceSendFields will be sent to the 2130 // server regardless of whether the field is empty or not. This may be 2131 // used to include empty fields in Patch requests. 2132 ForceSendFields []string `json:"-"` 2133 2134 // NullFields is a list of field names (e.g. "Invitations") to include 2135 // in API requests with the JSON null value. By default, fields with 2136 // empty values are omitted from API requests. However, any field with 2137 // an empty value appearing in NullFields will be sent to the server as 2138 // null. It is an error if a field in this list has a non-empty value. 2139 // This may be used to include null fields in Patch requests. 2140 NullFields []string `json:"-"` 2141} 2142 2143func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) { 2144 type NoMethod ListInvitationsResponse 2145 raw := NoMethod(*s) 2146 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2147} 2148 2149// ListStudentSubmissionsResponse: Response when listing student 2150// submissions. 2151type ListStudentSubmissionsResponse struct { 2152 // NextPageToken: Token identifying the next page of results to return. 2153 // If empty, no further 2154 // results are available. 2155 NextPageToken string `json:"nextPageToken,omitempty"` 2156 2157 // StudentSubmissions: Student work that matches the request. 2158 StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"` 2159 2160 // ServerResponse contains the HTTP response code and headers from the 2161 // server. 2162 googleapi.ServerResponse `json:"-"` 2163 2164 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2165 // unconditionally include in API requests. By default, fields with 2166 // empty values are omitted from API requests. However, any non-pointer, 2167 // non-interface field appearing in ForceSendFields will be sent to the 2168 // server regardless of whether the field is empty or not. This may be 2169 // used to include empty fields in Patch requests. 2170 ForceSendFields []string `json:"-"` 2171 2172 // NullFields is a list of field names (e.g. "NextPageToken") to include 2173 // in API requests with the JSON null value. By default, fields with 2174 // empty values are omitted from API requests. However, any field with 2175 // an empty value appearing in NullFields will be sent to the server as 2176 // null. It is an error if a field in this list has a non-empty value. 2177 // This may be used to include null fields in Patch requests. 2178 NullFields []string `json:"-"` 2179} 2180 2181func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) { 2182 type NoMethod ListStudentSubmissionsResponse 2183 raw := NoMethod(*s) 2184 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2185} 2186 2187// ListStudentsResponse: Response when listing students. 2188type ListStudentsResponse struct { 2189 // NextPageToken: Token identifying the next page of results to return. 2190 // If empty, no further 2191 // results are available. 2192 NextPageToken string `json:"nextPageToken,omitempty"` 2193 2194 // Students: Students who match the list request. 2195 Students []*Student `json:"students,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 *ListStudentsResponse) MarshalJSON() ([]byte, error) { 2219 type NoMethod ListStudentsResponse 2220 raw := NoMethod(*s) 2221 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2222} 2223 2224// ListTeachersResponse: Response when listing teachers. 2225type ListTeachersResponse struct { 2226 // NextPageToken: Token identifying the next page of results to return. 2227 // If empty, no further 2228 // results are available. 2229 NextPageToken string `json:"nextPageToken,omitempty"` 2230 2231 // Teachers: Teachers who match the list request. 2232 Teachers []*Teacher `json:"teachers,omitempty"` 2233 2234 // ServerResponse contains the HTTP response code and headers from the 2235 // server. 2236 googleapi.ServerResponse `json:"-"` 2237 2238 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2239 // unconditionally include in API requests. By default, fields with 2240 // empty values are omitted from API requests. However, any non-pointer, 2241 // non-interface field appearing in ForceSendFields will be sent to the 2242 // server regardless of whether the field is empty or not. This may be 2243 // used to include empty fields in Patch requests. 2244 ForceSendFields []string `json:"-"` 2245 2246 // NullFields is a list of field names (e.g. "NextPageToken") to include 2247 // in API requests with the JSON null value. By default, fields with 2248 // empty values are omitted from API requests. However, any field with 2249 // an empty value appearing in NullFields will be sent to the server as 2250 // null. It is an error if a field in this list has a non-empty value. 2251 // This may be used to include null fields in Patch requests. 2252 NullFields []string `json:"-"` 2253} 2254 2255func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) { 2256 type NoMethod ListTeachersResponse 2257 raw := NoMethod(*s) 2258 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2259} 2260 2261// ListTopicResponse: Response when listing topics. 2262type ListTopicResponse struct { 2263 // NextPageToken: Token identifying the next page of results to return. 2264 // If empty, no further 2265 // results are available. 2266 NextPageToken string `json:"nextPageToken,omitempty"` 2267 2268 // Topic: Topic items that match the request. 2269 Topic []*Topic `json:"topic,omitempty"` 2270 2271 // ServerResponse contains the HTTP response code and headers from the 2272 // server. 2273 googleapi.ServerResponse `json:"-"` 2274 2275 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2276 // unconditionally include in API requests. By default, fields with 2277 // empty values are omitted from API requests. However, any non-pointer, 2278 // non-interface field appearing in ForceSendFields will be sent to the 2279 // server regardless of whether the field is empty or not. This may be 2280 // used to include empty fields in Patch requests. 2281 ForceSendFields []string `json:"-"` 2282 2283 // NullFields is a list of field names (e.g. "NextPageToken") to include 2284 // in API requests with the JSON null value. By default, fields with 2285 // empty values are omitted from API requests. However, any field with 2286 // an empty value appearing in NullFields will be sent to the server as 2287 // null. It is an error if a field in this list has a non-empty value. 2288 // This may be used to include null fields in Patch requests. 2289 NullFields []string `json:"-"` 2290} 2291 2292func (s *ListTopicResponse) MarshalJSON() ([]byte, error) { 2293 type NoMethod ListTopicResponse 2294 raw := NoMethod(*s) 2295 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2296} 2297 2298// Material: Material attached to course work. 2299// 2300// When creating attachments, setting the `form` field is not supported. 2301type Material struct { 2302 // DriveFile: Google Drive file material. 2303 DriveFile *SharedDriveFile `json:"driveFile,omitempty"` 2304 2305 // Form: Google Forms material. 2306 Form *Form `json:"form,omitempty"` 2307 2308 // Link: Link material. On creation, this is upgraded to a more 2309 // appropriate type 2310 // if possible, and this is reflected in the response. 2311 Link *Link `json:"link,omitempty"` 2312 2313 // YoutubeVideo: YouTube video material. 2314 YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"` 2315 2316 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2317 // unconditionally include in API requests. By default, fields with 2318 // empty values are omitted from API requests. However, any non-pointer, 2319 // non-interface field appearing in ForceSendFields will be sent to the 2320 // server regardless of whether the field is empty or not. This may be 2321 // used to include empty fields in Patch requests. 2322 ForceSendFields []string `json:"-"` 2323 2324 // NullFields is a list of field names (e.g. "DriveFile") to include in 2325 // API requests with the JSON null value. By default, fields with empty 2326 // values are omitted from API requests. However, any field with an 2327 // empty value appearing in NullFields will be sent to the server as 2328 // null. It is an error if a field in this list has a non-empty value. 2329 // This may be used to include null fields in Patch requests. 2330 NullFields []string `json:"-"` 2331} 2332 2333func (s *Material) MarshalJSON() ([]byte, error) { 2334 type NoMethod Material 2335 raw := NoMethod(*s) 2336 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2337} 2338 2339// ModifyAnnouncementAssigneesRequest: Request to modify assignee mode 2340// and options of an announcement. 2341type ModifyAnnouncementAssigneesRequest struct { 2342 // AssigneeMode: Mode of the announcement describing whether it is 2343 // accessible by all 2344 // students or specified individual students. 2345 // 2346 // Possible values: 2347 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2348 // returned. 2349 // "ALL_STUDENTS" - All students can see the item. 2350 // This is the default state. 2351 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2352 AssigneeMode string `json:"assigneeMode,omitempty"` 2353 2354 // ModifyIndividualStudentsOptions: Set which students can view or 2355 // cannot view the announcement. 2356 // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2357 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2358 2359 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2360 // unconditionally include in API requests. By default, fields with 2361 // empty values are omitted from API requests. However, any non-pointer, 2362 // non-interface field appearing in ForceSendFields will be sent to the 2363 // server regardless of whether the field is empty or not. This may be 2364 // used to include empty fields in Patch requests. 2365 ForceSendFields []string `json:"-"` 2366 2367 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2368 // in API requests with the JSON null value. By default, fields with 2369 // empty values are omitted from API requests. However, any field with 2370 // an empty value appearing in NullFields will be sent to the server as 2371 // null. It is an error if a field in this list has a non-empty value. 2372 // This may be used to include null fields in Patch requests. 2373 NullFields []string `json:"-"` 2374} 2375 2376func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) { 2377 type NoMethod ModifyAnnouncementAssigneesRequest 2378 raw := NoMethod(*s) 2379 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2380} 2381 2382// ModifyAttachmentsRequest: Request to modify the attachments of a 2383// student submission. 2384type ModifyAttachmentsRequest struct { 2385 // AddAttachments: Attachments to add. 2386 // A student submission may not have more than 20 attachments. 2387 // 2388 // Form attachments are not supported. 2389 AddAttachments []*Attachment `json:"addAttachments,omitempty"` 2390 2391 // ForceSendFields is a list of field names (e.g. "AddAttachments") to 2392 // unconditionally include in API requests. By default, fields with 2393 // empty values are omitted from API requests. However, any non-pointer, 2394 // non-interface field appearing in ForceSendFields will be sent to the 2395 // server regardless of whether the field is empty or not. This may be 2396 // used to include empty fields in Patch requests. 2397 ForceSendFields []string `json:"-"` 2398 2399 // NullFields is a list of field names (e.g. "AddAttachments") to 2400 // include in API requests with the JSON null value. By default, fields 2401 // with empty values are omitted from API requests. However, any field 2402 // with an empty value appearing in NullFields will be sent to the 2403 // server as null. It is an error if a field in this list has a 2404 // non-empty value. This may be used to include null fields in Patch 2405 // requests. 2406 NullFields []string `json:"-"` 2407} 2408 2409func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) { 2410 type NoMethod ModifyAttachmentsRequest 2411 raw := NoMethod(*s) 2412 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2413} 2414 2415// ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and 2416// options of a coursework. 2417type ModifyCourseWorkAssigneesRequest struct { 2418 // AssigneeMode: Mode of the coursework describing whether it will be 2419 // assigned to all 2420 // students or specified individual students. 2421 // 2422 // Possible values: 2423 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2424 // returned. 2425 // "ALL_STUDENTS" - All students can see the item. 2426 // This is the default state. 2427 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2428 AssigneeMode string `json:"assigneeMode,omitempty"` 2429 2430 // ModifyIndividualStudentsOptions: Set which students are assigned or 2431 // not assigned to the coursework. 2432 // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2433 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2434 2435 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2436 // unconditionally include in API requests. By default, fields with 2437 // empty values are omitted from API requests. However, any non-pointer, 2438 // non-interface field appearing in ForceSendFields will be sent to the 2439 // server regardless of whether the field is empty or not. This may be 2440 // used to include empty fields in Patch requests. 2441 ForceSendFields []string `json:"-"` 2442 2443 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2444 // in API requests with the JSON null value. By default, fields with 2445 // empty values are omitted from API requests. However, any field with 2446 // an empty value appearing in NullFields will be sent to the server as 2447 // null. It is an error if a field in this list has a non-empty value. 2448 // This may be used to include null fields in Patch requests. 2449 NullFields []string `json:"-"` 2450} 2451 2452func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) { 2453 type NoMethod ModifyCourseWorkAssigneesRequest 2454 raw := NoMethod(*s) 2455 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2456} 2457 2458// ModifyIndividualStudentsOptions: Contains fields to add or remove 2459// students from a course work or announcement 2460// where the `assigneeMode` is set to `INDIVIDUAL_STUDENTS`. 2461type ModifyIndividualStudentsOptions struct { 2462 // AddStudentIds: IDs of students to be added as having access to 2463 // this 2464 // coursework/announcement. 2465 AddStudentIds []string `json:"addStudentIds,omitempty"` 2466 2467 // RemoveStudentIds: IDs of students to be removed from having access to 2468 // this 2469 // coursework/announcement. 2470 RemoveStudentIds []string `json:"removeStudentIds,omitempty"` 2471 2472 // ForceSendFields is a list of field names (e.g. "AddStudentIds") to 2473 // unconditionally include in API requests. By default, fields with 2474 // empty values are omitted from API requests. However, any non-pointer, 2475 // non-interface field appearing in ForceSendFields will be sent to the 2476 // server regardless of whether the field is empty or not. This may be 2477 // used to include empty fields in Patch requests. 2478 ForceSendFields []string `json:"-"` 2479 2480 // NullFields is a list of field names (e.g. "AddStudentIds") to include 2481 // in API requests with the JSON null value. By default, fields with 2482 // empty values are omitted from API requests. However, any field with 2483 // an empty value appearing in NullFields will be sent to the server as 2484 // null. It is an error if a field in this list has a non-empty value. 2485 // This may be used to include null fields in Patch requests. 2486 NullFields []string `json:"-"` 2487} 2488 2489func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) { 2490 type NoMethod ModifyIndividualStudentsOptions 2491 raw := NoMethod(*s) 2492 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2493} 2494 2495// MultipleChoiceQuestion: Additional details for multiple-choice 2496// questions. 2497type MultipleChoiceQuestion struct { 2498 // Choices: Possible choices. 2499 Choices []string `json:"choices,omitempty"` 2500 2501 // ForceSendFields is a list of field names (e.g. "Choices") to 2502 // unconditionally include in API requests. By default, fields with 2503 // empty values are omitted from API requests. However, any non-pointer, 2504 // non-interface field appearing in ForceSendFields will be sent to the 2505 // server regardless of whether the field is empty or not. This may be 2506 // used to include empty fields in Patch requests. 2507 ForceSendFields []string `json:"-"` 2508 2509 // NullFields is a list of field names (e.g. "Choices") to include in 2510 // API requests with the JSON null value. By default, fields with empty 2511 // values are omitted from API requests. However, any field with an 2512 // empty value appearing in NullFields will be sent to the server as 2513 // null. It is an error if a field in this list has a non-empty value. 2514 // This may be used to include null fields in Patch requests. 2515 NullFields []string `json:"-"` 2516} 2517 2518func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) { 2519 type NoMethod MultipleChoiceQuestion 2520 raw := NoMethod(*s) 2521 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2522} 2523 2524// MultipleChoiceSubmission: Student work for a multiple-choice 2525// question. 2526type MultipleChoiceSubmission struct { 2527 // Answer: Student's select choice. 2528 Answer string `json:"answer,omitempty"` 2529 2530 // ForceSendFields is a list of field names (e.g. "Answer") to 2531 // unconditionally include in API requests. By default, fields with 2532 // empty values are omitted from API requests. However, any non-pointer, 2533 // non-interface field appearing in ForceSendFields will be sent to the 2534 // server regardless of whether the field is empty or not. This may be 2535 // used to include empty fields in Patch requests. 2536 ForceSendFields []string `json:"-"` 2537 2538 // NullFields is a list of field names (e.g. "Answer") to include in API 2539 // requests with the JSON null value. By default, fields with empty 2540 // values are omitted from API requests. However, any field with an 2541 // empty value appearing in NullFields will be sent to the server as 2542 // null. It is an error if a field in this list has a non-empty value. 2543 // This may be used to include null fields in Patch requests. 2544 NullFields []string `json:"-"` 2545} 2546 2547func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) { 2548 type NoMethod MultipleChoiceSubmission 2549 raw := NoMethod(*s) 2550 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2551} 2552 2553// Name: Details of the user's name. 2554type Name struct { 2555 // FamilyName: The user's last name. 2556 // 2557 // Read-only. 2558 FamilyName string `json:"familyName,omitempty"` 2559 2560 // FullName: The user's full name formed by concatenating the first and 2561 // last name 2562 // values. 2563 // 2564 // Read-only. 2565 FullName string `json:"fullName,omitempty"` 2566 2567 // GivenName: The user's first name. 2568 // 2569 // Read-only. 2570 GivenName string `json:"givenName,omitempty"` 2571 2572 // ForceSendFields is a list of field names (e.g. "FamilyName") to 2573 // unconditionally include in API requests. By default, fields with 2574 // empty values are omitted from API requests. However, any non-pointer, 2575 // non-interface field appearing in ForceSendFields will be sent to the 2576 // server regardless of whether the field is empty or not. This may be 2577 // used to include empty fields in Patch requests. 2578 ForceSendFields []string `json:"-"` 2579 2580 // NullFields is a list of field names (e.g. "FamilyName") to include in 2581 // API requests with the JSON null value. By default, fields with empty 2582 // values are omitted from API requests. However, any field with an 2583 // empty value appearing in NullFields will be sent to the server as 2584 // null. It is an error if a field in this list has a non-empty value. 2585 // This may be used to include null fields in Patch requests. 2586 NullFields []string `json:"-"` 2587} 2588 2589func (s *Name) MarshalJSON() ([]byte, error) { 2590 type NoMethod Name 2591 raw := NoMethod(*s) 2592 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2593} 2594 2595// ReclaimStudentSubmissionRequest: Request to reclaim a student 2596// submission. 2597type ReclaimStudentSubmissionRequest struct { 2598} 2599 2600// Registration: An instruction to Classroom to send notifications from 2601// the `feed` to the 2602// provided destination. 2603type Registration struct { 2604 // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to 2605 // be sent to. 2606 CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"` 2607 2608 // ExpiryTime: The time until which the `Registration` is 2609 // effective. 2610 // 2611 // This is a read-only field assigned by the server. 2612 ExpiryTime string `json:"expiryTime,omitempty"` 2613 2614 // Feed: Specification for the class of notifications that Classroom 2615 // should deliver 2616 // to the destination. 2617 Feed *Feed `json:"feed,omitempty"` 2618 2619 // RegistrationId: A server-generated unique identifier for this 2620 // `Registration`. 2621 // 2622 // Read-only. 2623 RegistrationId string `json:"registrationId,omitempty"` 2624 2625 // ServerResponse contains the HTTP response code and headers from the 2626 // server. 2627 googleapi.ServerResponse `json:"-"` 2628 2629 // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to 2630 // unconditionally include in API requests. By default, fields with 2631 // empty values are omitted from API requests. However, any non-pointer, 2632 // non-interface field appearing in ForceSendFields will be sent to the 2633 // server regardless of whether the field is empty or not. This may be 2634 // used to include empty fields in Patch requests. 2635 ForceSendFields []string `json:"-"` 2636 2637 // NullFields is a list of field names (e.g. "CloudPubsubTopic") to 2638 // include in API requests with the JSON null value. By default, fields 2639 // with empty values are omitted from API requests. However, any field 2640 // with an empty value appearing in NullFields will be sent to the 2641 // server as null. It is an error if a field in this list has a 2642 // non-empty value. This may be used to include null fields in Patch 2643 // requests. 2644 NullFields []string `json:"-"` 2645} 2646 2647func (s *Registration) MarshalJSON() ([]byte, error) { 2648 type NoMethod Registration 2649 raw := NoMethod(*s) 2650 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2651} 2652 2653// ReturnStudentSubmissionRequest: Request to return a student 2654// submission. 2655type ReturnStudentSubmissionRequest struct { 2656} 2657 2658// SharedDriveFile: Drive file that is used as material for course work. 2659type SharedDriveFile struct { 2660 // DriveFile: Drive file details. 2661 DriveFile *DriveFile `json:"driveFile,omitempty"` 2662 2663 // ShareMode: Mechanism by which students access the Drive item. 2664 // 2665 // Possible values: 2666 // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never 2667 // be returned. 2668 // "VIEW" - Students can view the shared file. 2669 // "EDIT" - Students can edit the shared file. 2670 // "STUDENT_COPY" - Students have a personal copy of the shared file. 2671 ShareMode string `json:"shareMode,omitempty"` 2672 2673 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2674 // unconditionally include in API requests. By default, fields with 2675 // empty values are omitted from API requests. However, any non-pointer, 2676 // non-interface field appearing in ForceSendFields will be sent to the 2677 // server regardless of whether the field is empty or not. This may be 2678 // used to include empty fields in Patch requests. 2679 ForceSendFields []string `json:"-"` 2680 2681 // NullFields is a list of field names (e.g. "DriveFile") to include in 2682 // API requests with the JSON null value. By default, fields with empty 2683 // values are omitted from API requests. However, any field with an 2684 // empty value appearing in NullFields will be sent to the server as 2685 // null. It is an error if a field in this list has a non-empty value. 2686 // This may be used to include null fields in Patch requests. 2687 NullFields []string `json:"-"` 2688} 2689 2690func (s *SharedDriveFile) MarshalJSON() ([]byte, error) { 2691 type NoMethod SharedDriveFile 2692 raw := NoMethod(*s) 2693 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2694} 2695 2696// ShortAnswerSubmission: Student work for a short answer question. 2697type ShortAnswerSubmission struct { 2698 // Answer: Student response to a short-answer question. 2699 Answer string `json:"answer,omitempty"` 2700 2701 // ForceSendFields is a list of field names (e.g. "Answer") 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. "Answer") to include in API 2710 // 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 *ShortAnswerSubmission) MarshalJSON() ([]byte, error) { 2719 type NoMethod ShortAnswerSubmission 2720 raw := NoMethod(*s) 2721 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2722} 2723 2724// StateHistory: The history of each state this submission has been in. 2725type StateHistory struct { 2726 // ActorUserId: The teacher or student who made the change. 2727 ActorUserId string `json:"actorUserId,omitempty"` 2728 2729 // State: The workflow pipeline stage. 2730 // 2731 // Possible values: 2732 // "STATE_UNSPECIFIED" - No state specified. This should never be 2733 // returned. 2734 // "CREATED" - The Submission has been created. 2735 // "TURNED_IN" - The student has turned in an assigned document, which 2736 // may or may not be 2737 // a template. 2738 // "RETURNED" - The teacher has returned the assigned document to the 2739 // student. 2740 // "RECLAIMED_BY_STUDENT" - The student turned in the assigned 2741 // document, and then chose to 2742 // "unsubmit" the assignment, giving the student control again as 2743 // the 2744 // owner. 2745 // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their 2746 // submission after turning it in. Currently, 2747 // only used by Questions, when the student edits their answer. 2748 State string `json:"state,omitempty"` 2749 2750 // StateTimestamp: When the submission entered this state. 2751 StateTimestamp string `json:"stateTimestamp,omitempty"` 2752 2753 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 2754 // unconditionally include in API requests. By default, fields with 2755 // empty values are omitted from API requests. However, any non-pointer, 2756 // non-interface field appearing in ForceSendFields will be sent to the 2757 // server regardless of whether the field is empty or not. This may be 2758 // used to include empty fields in Patch requests. 2759 ForceSendFields []string `json:"-"` 2760 2761 // NullFields is a list of field names (e.g. "ActorUserId") to include 2762 // in API requests with the JSON null value. By default, fields with 2763 // empty values are omitted from API requests. However, any field with 2764 // an empty value appearing in NullFields will be sent to the server as 2765 // null. It is an error if a field in this list has a non-empty value. 2766 // This may be used to include null fields in Patch requests. 2767 NullFields []string `json:"-"` 2768} 2769 2770func (s *StateHistory) MarshalJSON() ([]byte, error) { 2771 type NoMethod StateHistory 2772 raw := NoMethod(*s) 2773 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2774} 2775 2776// Student: Student in a course. 2777type Student struct { 2778 // CourseId: Identifier of the course. 2779 // 2780 // Read-only. 2781 CourseId string `json:"courseId,omitempty"` 2782 2783 // Profile: Global user information for the student. 2784 // 2785 // Read-only. 2786 Profile *UserProfile `json:"profile,omitempty"` 2787 2788 // StudentWorkFolder: Information about a Drive Folder for this 2789 // student's work in this course. 2790 // Only visible to the student and domain administrators. 2791 // 2792 // Read-only. 2793 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 2794 2795 // UserId: Identifier of the user. 2796 // 2797 // When specified as a parameter of a request, this identifier can be 2798 // one of 2799 // the following: 2800 // 2801 // * the numeric identifier for the user 2802 // * the email address of the user 2803 // * the string literal "me", indicating the requesting user 2804 UserId string `json:"userId,omitempty"` 2805 2806 // ServerResponse contains the HTTP response code and headers from the 2807 // server. 2808 googleapi.ServerResponse `json:"-"` 2809 2810 // ForceSendFields is a list of field names (e.g. "CourseId") to 2811 // unconditionally include in API requests. By default, fields with 2812 // empty values are omitted from API requests. However, any non-pointer, 2813 // non-interface field appearing in ForceSendFields will be sent to the 2814 // server regardless of whether the field is empty or not. This may be 2815 // used to include empty fields in Patch requests. 2816 ForceSendFields []string `json:"-"` 2817 2818 // NullFields is a list of field names (e.g. "CourseId") to include in 2819 // API requests with the JSON null value. By default, fields with empty 2820 // values are omitted from API requests. However, any field with an 2821 // empty value appearing in NullFields will be sent to the server as 2822 // null. It is an error if a field in this list has a non-empty value. 2823 // This may be used to include null fields in Patch requests. 2824 NullFields []string `json:"-"` 2825} 2826 2827func (s *Student) MarshalJSON() ([]byte, error) { 2828 type NoMethod Student 2829 raw := NoMethod(*s) 2830 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2831} 2832 2833// StudentSubmission: Student submission for course 2834// work. 2835// 2836// StudentSubmission items are generated when a CourseWork item is 2837// created. 2838// 2839// StudentSubmissions that have never been accessed (i.e. with `state` = 2840// NEW) 2841// may not have a creation time or update time. 2842type StudentSubmission struct { 2843 // AlternateLink: Absolute link to the submission in the Classroom web 2844 // UI. 2845 // 2846 // Read-only. 2847 AlternateLink string `json:"alternateLink,omitempty"` 2848 2849 // AssignedGrade: Optional grade. If unset, no grade was set. 2850 // This value must be non-negative. Decimal (that is, non-integer) 2851 // values are 2852 // allowed, but are rounded to two decimal places. 2853 // 2854 // This may be modified only by course teachers. 2855 AssignedGrade float64 `json:"assignedGrade,omitempty"` 2856 2857 // AssignmentSubmission: Submission content when course_work_type is 2858 // ASSIGNMENT. 2859 // 2860 // Students can modify this content using 2861 // ModifyAttachments. 2862 AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"` 2863 2864 // AssociatedWithDeveloper: Whether this student submission is 2865 // associated with the Developer Console 2866 // project making the request. 2867 // 2868 // See CreateCourseWork for more 2869 // details. 2870 // 2871 // Read-only. 2872 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 2873 2874 // CourseId: Identifier of the course. 2875 // 2876 // Read-only. 2877 CourseId string `json:"courseId,omitempty"` 2878 2879 // CourseWorkId: Identifier for the course work this corresponds 2880 // to. 2881 // 2882 // Read-only. 2883 CourseWorkId string `json:"courseWorkId,omitempty"` 2884 2885 // CourseWorkType: Type of course work this submission is 2886 // for. 2887 // 2888 // Read-only. 2889 // 2890 // Possible values: 2891 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 2892 // never returned. 2893 // "ASSIGNMENT" - An assignment. 2894 // "SHORT_ANSWER_QUESTION" - A short answer question. 2895 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 2896 CourseWorkType string `json:"courseWorkType,omitempty"` 2897 2898 // CreationTime: Creation time of this submission. 2899 // This may be unset if the student has not accessed this 2900 // item. 2901 // 2902 // Read-only. 2903 CreationTime string `json:"creationTime,omitempty"` 2904 2905 // DraftGrade: Optional pending grade. If unset, no grade was set. 2906 // This value must be non-negative. Decimal (that is, non-integer) 2907 // values are 2908 // allowed, but are rounded to two decimal places. 2909 // 2910 // This is only visible to and modifiable by course teachers. 2911 DraftGrade float64 `json:"draftGrade,omitempty"` 2912 2913 // Id: Classroom-assigned Identifier for the student submission. 2914 // This is unique among submissions for the relevant course 2915 // work. 2916 // 2917 // Read-only. 2918 Id string `json:"id,omitempty"` 2919 2920 // Late: Whether this submission is late. 2921 // 2922 // Read-only. 2923 Late bool `json:"late,omitempty"` 2924 2925 // MultipleChoiceSubmission: Submission content when course_work_type is 2926 // MULTIPLE_CHOICE_QUESTION. 2927 MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"` 2928 2929 // ShortAnswerSubmission: Submission content when course_work_type is 2930 // SHORT_ANSWER_QUESTION. 2931 ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"` 2932 2933 // State: State of this submission. 2934 // 2935 // Read-only. 2936 // 2937 // Possible values: 2938 // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 2939 // never be returned. 2940 // "NEW" - The student has never accessed this submission. Attachments 2941 // are not 2942 // returned and timestamps is not set. 2943 // "CREATED" - Has been created. 2944 // "TURNED_IN" - Has been turned in to the teacher. 2945 // "RETURNED" - Has been returned to the student. 2946 // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 2947 // assignment. 2948 State string `json:"state,omitempty"` 2949 2950 // SubmissionHistory: The history of the submission (includes state and 2951 // grade histories). 2952 // 2953 // Read-only. 2954 SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"` 2955 2956 // UpdateTime: Last update time of this submission. 2957 // This may be unset if the student has not accessed this 2958 // item. 2959 // 2960 // Read-only. 2961 UpdateTime string `json:"updateTime,omitempty"` 2962 2963 // UserId: Identifier for the student that owns this 2964 // submission. 2965 // 2966 // Read-only. 2967 UserId string `json:"userId,omitempty"` 2968 2969 // ServerResponse contains the HTTP response code and headers from the 2970 // server. 2971 googleapi.ServerResponse `json:"-"` 2972 2973 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 2974 // unconditionally include in API requests. By default, fields with 2975 // empty values are omitted from API requests. However, any non-pointer, 2976 // non-interface field appearing in ForceSendFields will be sent to the 2977 // server regardless of whether the field is empty or not. This may be 2978 // used to include empty fields in Patch requests. 2979 ForceSendFields []string `json:"-"` 2980 2981 // NullFields is a list of field names (e.g. "AlternateLink") to include 2982 // in API requests with the JSON null value. By default, fields with 2983 // empty values are omitted from API requests. However, any field with 2984 // an empty value appearing in NullFields will be sent to the server as 2985 // null. It is an error if a field in this list has a non-empty value. 2986 // This may be used to include null fields in Patch requests. 2987 NullFields []string `json:"-"` 2988} 2989 2990func (s *StudentSubmission) MarshalJSON() ([]byte, error) { 2991 type NoMethod StudentSubmission 2992 raw := NoMethod(*s) 2993 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2994} 2995 2996func (s *StudentSubmission) UnmarshalJSON(data []byte) error { 2997 type NoMethod StudentSubmission 2998 var s1 struct { 2999 AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"` 3000 DraftGrade gensupport.JSONFloat64 `json:"draftGrade"` 3001 *NoMethod 3002 } 3003 s1.NoMethod = (*NoMethod)(s) 3004 if err := json.Unmarshal(data, &s1); err != nil { 3005 return err 3006 } 3007 s.AssignedGrade = float64(s1.AssignedGrade) 3008 s.DraftGrade = float64(s1.DraftGrade) 3009 return nil 3010} 3011 3012// SubmissionHistory: The history of the submission. This currently 3013// includes state and grade 3014// histories. 3015type SubmissionHistory struct { 3016 // GradeHistory: The grade history information of the submission, if 3017 // present. 3018 GradeHistory *GradeHistory `json:"gradeHistory,omitempty"` 3019 3020 // StateHistory: The state history information of the submission, if 3021 // present. 3022 StateHistory *StateHistory `json:"stateHistory,omitempty"` 3023 3024 // ForceSendFields is a list of field names (e.g. "GradeHistory") to 3025 // unconditionally include in API requests. By default, fields with 3026 // empty values are omitted from API requests. However, any non-pointer, 3027 // non-interface field appearing in ForceSendFields will be sent to the 3028 // server regardless of whether the field is empty or not. This may be 3029 // used to include empty fields in Patch requests. 3030 ForceSendFields []string `json:"-"` 3031 3032 // NullFields is a list of field names (e.g. "GradeHistory") to include 3033 // in API requests with the JSON null value. By default, fields with 3034 // empty values are omitted from API requests. However, any field with 3035 // an empty value appearing in NullFields will be sent to the server as 3036 // null. It is an error if a field in this list has a non-empty value. 3037 // This may be used to include null fields in Patch requests. 3038 NullFields []string `json:"-"` 3039} 3040 3041func (s *SubmissionHistory) MarshalJSON() ([]byte, error) { 3042 type NoMethod SubmissionHistory 3043 raw := NoMethod(*s) 3044 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3045} 3046 3047// Teacher: Teacher of a course. 3048type Teacher struct { 3049 // CourseId: Identifier of the course. 3050 // 3051 // Read-only. 3052 CourseId string `json:"courseId,omitempty"` 3053 3054 // Profile: Global user information for the teacher. 3055 // 3056 // Read-only. 3057 Profile *UserProfile `json:"profile,omitempty"` 3058 3059 // UserId: Identifier of the user. 3060 // 3061 // When specified as a parameter of a request, this identifier can be 3062 // one of 3063 // the following: 3064 // 3065 // * the numeric identifier for the user 3066 // * the email address of the user 3067 // * the string literal "me", indicating the requesting user 3068 UserId string `json:"userId,omitempty"` 3069 3070 // ServerResponse contains the HTTP response code and headers from the 3071 // server. 3072 googleapi.ServerResponse `json:"-"` 3073 3074 // ForceSendFields is a list of field names (e.g. "CourseId") to 3075 // unconditionally include in API requests. By default, fields with 3076 // empty values are omitted from API requests. However, any non-pointer, 3077 // non-interface field appearing in ForceSendFields will be sent to the 3078 // server regardless of whether the field is empty or not. This may be 3079 // used to include empty fields in Patch requests. 3080 ForceSendFields []string `json:"-"` 3081 3082 // NullFields is a list of field names (e.g. "CourseId") to include in 3083 // API requests with the JSON null value. By default, fields with empty 3084 // values are omitted from API requests. However, any field with an 3085 // empty value appearing in NullFields will be sent to the server as 3086 // null. It is an error if a field in this list has a non-empty value. 3087 // This may be used to include null fields in Patch requests. 3088 NullFields []string `json:"-"` 3089} 3090 3091func (s *Teacher) MarshalJSON() ([]byte, error) { 3092 type NoMethod Teacher 3093 raw := NoMethod(*s) 3094 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3095} 3096 3097// TimeOfDay: Represents a time of day. The date and time zone are 3098// either not significant 3099// or are specified elsewhere. An API may choose to allow leap seconds. 3100// Related 3101// types are google.type.Date and `google.protobuf.Timestamp`. 3102type TimeOfDay struct { 3103 // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API 3104 // may choose 3105 // to allow the value "24:00:00" for scenarios like business closing 3106 // time. 3107 Hours int64 `json:"hours,omitempty"` 3108 3109 // Minutes: Minutes of hour of day. Must be from 0 to 59. 3110 Minutes int64 `json:"minutes,omitempty"` 3111 3112 // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to 3113 // 999,999,999. 3114 Nanos int64 `json:"nanos,omitempty"` 3115 3116 // Seconds: Seconds of minutes of the time. Must normally be from 0 to 3117 // 59. An API may 3118 // allow the value 60 if it allows leap-seconds. 3119 Seconds int64 `json:"seconds,omitempty"` 3120 3121 // ForceSendFields is a list of field names (e.g. "Hours") to 3122 // unconditionally include in API requests. By default, fields with 3123 // empty values are omitted from API requests. However, any non-pointer, 3124 // non-interface field appearing in ForceSendFields will be sent to the 3125 // server regardless of whether the field is empty or not. This may be 3126 // used to include empty fields in Patch requests. 3127 ForceSendFields []string `json:"-"` 3128 3129 // NullFields is a list of field names (e.g. "Hours") to include in API 3130 // requests with the JSON null value. By default, fields with empty 3131 // values are omitted from API requests. However, any field with an 3132 // empty value appearing in NullFields will be sent to the server as 3133 // null. It is an error if a field in this list has a non-empty value. 3134 // This may be used to include null fields in Patch requests. 3135 NullFields []string `json:"-"` 3136} 3137 3138func (s *TimeOfDay) MarshalJSON() ([]byte, error) { 3139 type NoMethod TimeOfDay 3140 raw := NoMethod(*s) 3141 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3142} 3143 3144// Topic: Topic created by a teacher for the course 3145type Topic struct { 3146 // CourseId: Identifier of the course. 3147 // 3148 // Read-only. 3149 CourseId string `json:"courseId,omitempty"` 3150 3151 // Name: The name of the topic, generated by the user. 3152 // Leading and trailing whitespaces, if any, are trimmed. Also, 3153 // multiple 3154 // consecutive whitespaces are collapsed into one inside the name. 3155 // The 3156 // result must be a non-empty string. Topic names are case sensitive, 3157 // and must 3158 // be no longer than 100 characters. 3159 Name string `json:"name,omitempty"` 3160 3161 // TopicId: Unique identifier for the topic. 3162 // 3163 // Read-only. 3164 TopicId string `json:"topicId,omitempty"` 3165 3166 // UpdateTime: The time the topic was last updated by the 3167 // system. 3168 // 3169 // Read-only. 3170 UpdateTime string `json:"updateTime,omitempty"` 3171 3172 // ServerResponse contains the HTTP response code and headers from the 3173 // server. 3174 googleapi.ServerResponse `json:"-"` 3175 3176 // ForceSendFields is a list of field names (e.g. "CourseId") to 3177 // unconditionally include in API requests. By default, fields with 3178 // empty values are omitted from API requests. However, any non-pointer, 3179 // non-interface field appearing in ForceSendFields will be sent to the 3180 // server regardless of whether the field is empty or not. This may be 3181 // used to include empty fields in Patch requests. 3182 ForceSendFields []string `json:"-"` 3183 3184 // NullFields is a list of field names (e.g. "CourseId") to include in 3185 // API requests with the JSON null value. By default, fields with empty 3186 // values are omitted from API requests. However, any field with an 3187 // empty value appearing in NullFields will be sent to the server as 3188 // null. It is an error if a field in this list has a non-empty value. 3189 // This may be used to include null fields in Patch requests. 3190 NullFields []string `json:"-"` 3191} 3192 3193func (s *Topic) MarshalJSON() ([]byte, error) { 3194 type NoMethod Topic 3195 raw := NoMethod(*s) 3196 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3197} 3198 3199// TurnInStudentSubmissionRequest: Request to turn in a student 3200// submission. 3201type TurnInStudentSubmissionRequest struct { 3202} 3203 3204// UserProfile: Global information for a user. 3205type UserProfile struct { 3206 // EmailAddress: Email address of the user. 3207 // 3208 // Read-only. 3209 EmailAddress string `json:"emailAddress,omitempty"` 3210 3211 // Id: Identifier of the user. 3212 // 3213 // Read-only. 3214 Id string `json:"id,omitempty"` 3215 3216 // Name: Name of the user. 3217 // 3218 // Read-only. 3219 Name *Name `json:"name,omitempty"` 3220 3221 // Permissions: Global permissions of the user. 3222 // 3223 // Read-only. 3224 Permissions []*GlobalPermission `json:"permissions,omitempty"` 3225 3226 // PhotoUrl: URL of user's profile photo. 3227 // 3228 // Read-only. 3229 PhotoUrl string `json:"photoUrl,omitempty"` 3230 3231 // VerifiedTeacher: Represents whether a G Suite for Education user's 3232 // domain administrator has 3233 // explicitly verified them as being a teacher. If the user is not a 3234 // member of 3235 // a G Suite for Education domain, than this field is always 3236 // false. 3237 // 3238 // Read-only 3239 VerifiedTeacher bool `json:"verifiedTeacher,omitempty"` 3240 3241 // ServerResponse contains the HTTP response code and headers from the 3242 // server. 3243 googleapi.ServerResponse `json:"-"` 3244 3245 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 3246 // unconditionally include in API requests. By default, fields with 3247 // empty values are omitted from API requests. However, any non-pointer, 3248 // non-interface field appearing in ForceSendFields will be sent to the 3249 // server regardless of whether the field is empty or not. This may be 3250 // used to include empty fields in Patch requests. 3251 ForceSendFields []string `json:"-"` 3252 3253 // NullFields is a list of field names (e.g. "EmailAddress") to include 3254 // in API requests with the JSON null value. By default, fields with 3255 // empty values are omitted from API requests. However, any field with 3256 // an empty value appearing in NullFields will be sent to the server as 3257 // null. It is an error if a field in this list has a non-empty value. 3258 // This may be used to include null fields in Patch requests. 3259 NullFields []string `json:"-"` 3260} 3261 3262func (s *UserProfile) MarshalJSON() ([]byte, error) { 3263 type NoMethod UserProfile 3264 raw := NoMethod(*s) 3265 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3266} 3267 3268// YouTubeVideo: YouTube video item. 3269type YouTubeVideo struct { 3270 // AlternateLink: URL that can be used to view the YouTube 3271 // video. 3272 // 3273 // Read-only. 3274 AlternateLink string `json:"alternateLink,omitempty"` 3275 3276 // Id: YouTube API resource ID. 3277 Id string `json:"id,omitempty"` 3278 3279 // ThumbnailUrl: URL of a thumbnail image of the YouTube 3280 // video. 3281 // 3282 // Read-only. 3283 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 3284 3285 // Title: Title of the YouTube video. 3286 // 3287 // Read-only. 3288 Title string `json:"title,omitempty"` 3289 3290 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 3291 // unconditionally include in API requests. By default, fields with 3292 // empty values are omitted from API requests. However, any non-pointer, 3293 // non-interface field appearing in ForceSendFields will be sent to the 3294 // server regardless of whether the field is empty or not. This may be 3295 // used to include empty fields in Patch requests. 3296 ForceSendFields []string `json:"-"` 3297 3298 // NullFields is a list of field names (e.g. "AlternateLink") to include 3299 // in API requests with the JSON null value. By default, fields with 3300 // empty values are omitted from API requests. However, any field with 3301 // an empty value appearing in NullFields will be sent to the server as 3302 // null. It is an error if a field in this list has a non-empty value. 3303 // This may be used to include null fields in Patch requests. 3304 NullFields []string `json:"-"` 3305} 3306 3307func (s *YouTubeVideo) MarshalJSON() ([]byte, error) { 3308 type NoMethod YouTubeVideo 3309 raw := NoMethod(*s) 3310 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3311} 3312 3313// method id "classroom.courses.create": 3314 3315type CoursesCreateCall struct { 3316 s *Service 3317 course *Course 3318 urlParams_ gensupport.URLParams 3319 ctx_ context.Context 3320 header_ http.Header 3321} 3322 3323// Create: Creates a course. 3324// 3325// The user specified in `ownerId` is the owner of the created 3326// course 3327// and added as a teacher. 3328// 3329// This method returns the following error codes: 3330// 3331// * `PERMISSION_DENIED` if the requesting user is not permitted to 3332// create 3333// courses or for access errors. 3334// * `NOT_FOUND` if the primary teacher is not a valid user. 3335// * `FAILED_PRECONDITION` if the course owner's account is disabled or 3336// for 3337// the following request errors: 3338// * UserGroupsMembershipLimitReached 3339// * `ALREADY_EXISTS` if an alias was specified in the `id` and 3340// already exists. 3341func (r *CoursesService) Create(course *Course) *CoursesCreateCall { 3342 c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3343 c.course = course 3344 return c 3345} 3346 3347// Fields allows partial responses to be retrieved. See 3348// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3349// for more information. 3350func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall { 3351 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3352 return c 3353} 3354 3355// Context sets the context to be used in this call's Do method. Any 3356// pending HTTP request will be aborted if the provided context is 3357// canceled. 3358func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall { 3359 c.ctx_ = ctx 3360 return c 3361} 3362 3363// Header returns an http.Header that can be modified by the caller to 3364// add HTTP headers to the request. 3365func (c *CoursesCreateCall) Header() http.Header { 3366 if c.header_ == nil { 3367 c.header_ = make(http.Header) 3368 } 3369 return c.header_ 3370} 3371 3372func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) { 3373 reqHeaders := make(http.Header) 3374 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3375 for k, v := range c.header_ { 3376 reqHeaders[k] = v 3377 } 3378 reqHeaders.Set("User-Agent", c.s.userAgent()) 3379 var body io.Reader = nil 3380 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3381 if err != nil { 3382 return nil, err 3383 } 3384 reqHeaders.Set("Content-Type", "application/json") 3385 c.urlParams_.Set("alt", alt) 3386 c.urlParams_.Set("prettyPrint", "false") 3387 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3388 urls += "?" + c.urlParams_.Encode() 3389 req, err := http.NewRequest("POST", urls, body) 3390 if err != nil { 3391 return nil, err 3392 } 3393 req.Header = reqHeaders 3394 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3395} 3396 3397// Do executes the "classroom.courses.create" call. 3398// Exactly one of *Course or error will be non-nil. Any non-2xx status 3399// code is an error. Response headers are in either 3400// *Course.ServerResponse.Header or (if a response was returned at all) 3401// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3402// check whether the returned error was because http.StatusNotModified 3403// was returned. 3404func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3405 gensupport.SetOptions(c.urlParams_, opts...) 3406 res, err := c.doRequest("json") 3407 if res != nil && res.StatusCode == http.StatusNotModified { 3408 if res.Body != nil { 3409 res.Body.Close() 3410 } 3411 return nil, &googleapi.Error{ 3412 Code: res.StatusCode, 3413 Header: res.Header, 3414 } 3415 } 3416 if err != nil { 3417 return nil, err 3418 } 3419 defer googleapi.CloseBody(res) 3420 if err := googleapi.CheckResponse(res); err != nil { 3421 return nil, err 3422 } 3423 ret := &Course{ 3424 ServerResponse: googleapi.ServerResponse{ 3425 Header: res.Header, 3426 HTTPStatusCode: res.StatusCode, 3427 }, 3428 } 3429 target := &ret 3430 if err := gensupport.DecodeResponse(target, res); err != nil { 3431 return nil, err 3432 } 3433 return ret, nil 3434 // { 3435 // "description": "Creates a course.\n\nThe user specified in `ownerId` is the owner of the created course\nand added as a teacher.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\ncourses or for access errors.\n* `NOT_FOUND` if the primary teacher is not a valid user.\n* `FAILED_PRECONDITION` if the course owner's account is disabled or for\nthe following request errors:\n * UserGroupsMembershipLimitReached\n* `ALREADY_EXISTS` if an alias was specified in the `id` and\nalready exists.", 3436 // "flatPath": "v1/courses", 3437 // "httpMethod": "POST", 3438 // "id": "classroom.courses.create", 3439 // "parameterOrder": [], 3440 // "parameters": {}, 3441 // "path": "v1/courses", 3442 // "request": { 3443 // "$ref": "Course" 3444 // }, 3445 // "response": { 3446 // "$ref": "Course" 3447 // }, 3448 // "scopes": [ 3449 // "https://www.googleapis.com/auth/classroom.courses" 3450 // ] 3451 // } 3452 3453} 3454 3455// method id "classroom.courses.delete": 3456 3457type CoursesDeleteCall struct { 3458 s *Service 3459 id string 3460 urlParams_ gensupport.URLParams 3461 ctx_ context.Context 3462 header_ http.Header 3463} 3464 3465// Delete: Deletes a course. 3466// 3467// This method returns the following error codes: 3468// 3469// * `PERMISSION_DENIED` if the requesting user is not permitted to 3470// delete the 3471// requested course or for access errors. 3472// * `NOT_FOUND` if no course exists with the requested ID. 3473func (r *CoursesService) Delete(id string) *CoursesDeleteCall { 3474 c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3475 c.id = id 3476 return c 3477} 3478 3479// Fields allows partial responses to be retrieved. See 3480// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3481// for more information. 3482func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall { 3483 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3484 return c 3485} 3486 3487// Context sets the context to be used in this call's Do method. Any 3488// pending HTTP request will be aborted if the provided context is 3489// canceled. 3490func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall { 3491 c.ctx_ = ctx 3492 return c 3493} 3494 3495// Header returns an http.Header that can be modified by the caller to 3496// add HTTP headers to the request. 3497func (c *CoursesDeleteCall) Header() http.Header { 3498 if c.header_ == nil { 3499 c.header_ = make(http.Header) 3500 } 3501 return c.header_ 3502} 3503 3504func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) { 3505 reqHeaders := make(http.Header) 3506 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3507 for k, v := range c.header_ { 3508 reqHeaders[k] = v 3509 } 3510 reqHeaders.Set("User-Agent", c.s.userAgent()) 3511 var body io.Reader = nil 3512 c.urlParams_.Set("alt", alt) 3513 c.urlParams_.Set("prettyPrint", "false") 3514 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3515 urls += "?" + c.urlParams_.Encode() 3516 req, err := http.NewRequest("DELETE", urls, body) 3517 if err != nil { 3518 return nil, err 3519 } 3520 req.Header = reqHeaders 3521 googleapi.Expand(req.URL, map[string]string{ 3522 "id": c.id, 3523 }) 3524 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3525} 3526 3527// Do executes the "classroom.courses.delete" call. 3528// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3529// code is an error. Response headers are in either 3530// *Empty.ServerResponse.Header or (if a response was returned at all) 3531// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3532// check whether the returned error was because http.StatusNotModified 3533// was returned. 3534func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3535 gensupport.SetOptions(c.urlParams_, opts...) 3536 res, err := c.doRequest("json") 3537 if res != nil && res.StatusCode == http.StatusNotModified { 3538 if res.Body != nil { 3539 res.Body.Close() 3540 } 3541 return nil, &googleapi.Error{ 3542 Code: res.StatusCode, 3543 Header: res.Header, 3544 } 3545 } 3546 if err != nil { 3547 return nil, err 3548 } 3549 defer googleapi.CloseBody(res) 3550 if err := googleapi.CheckResponse(res); err != nil { 3551 return nil, err 3552 } 3553 ret := &Empty{ 3554 ServerResponse: googleapi.ServerResponse{ 3555 Header: res.Header, 3556 HTTPStatusCode: res.StatusCode, 3557 }, 3558 } 3559 target := &ret 3560 if err := gensupport.DecodeResponse(target, res); err != nil { 3561 return nil, err 3562 } 3563 return ret, nil 3564 // { 3565 // "description": "Deletes a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.", 3566 // "flatPath": "v1/courses/{id}", 3567 // "httpMethod": "DELETE", 3568 // "id": "classroom.courses.delete", 3569 // "parameterOrder": [ 3570 // "id" 3571 // ], 3572 // "parameters": { 3573 // "id": { 3574 // "description": "Identifier of the course to delete.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3575 // "location": "path", 3576 // "required": true, 3577 // "type": "string" 3578 // } 3579 // }, 3580 // "path": "v1/courses/{id}", 3581 // "response": { 3582 // "$ref": "Empty" 3583 // }, 3584 // "scopes": [ 3585 // "https://www.googleapis.com/auth/classroom.courses" 3586 // ] 3587 // } 3588 3589} 3590 3591// method id "classroom.courses.get": 3592 3593type CoursesGetCall struct { 3594 s *Service 3595 id string 3596 urlParams_ gensupport.URLParams 3597 ifNoneMatch_ string 3598 ctx_ context.Context 3599 header_ http.Header 3600} 3601 3602// Get: Returns a course. 3603// 3604// This method returns the following error codes: 3605// 3606// * `PERMISSION_DENIED` if the requesting user is not permitted to 3607// access the 3608// requested course or for access errors. 3609// * `NOT_FOUND` if no course exists with the requested ID. 3610func (r *CoursesService) Get(id string) *CoursesGetCall { 3611 c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3612 c.id = id 3613 return c 3614} 3615 3616// Fields allows partial responses to be retrieved. See 3617// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3618// for more information. 3619func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall { 3620 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3621 return c 3622} 3623 3624// IfNoneMatch sets the optional parameter which makes the operation 3625// fail if the object's ETag matches the given value. This is useful for 3626// getting updates only after the object has changed since the last 3627// request. Use googleapi.IsNotModified to check whether the response 3628// error from Do is the result of In-None-Match. 3629func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall { 3630 c.ifNoneMatch_ = entityTag 3631 return c 3632} 3633 3634// Context sets the context to be used in this call's Do method. Any 3635// pending HTTP request will be aborted if the provided context is 3636// canceled. 3637func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall { 3638 c.ctx_ = ctx 3639 return c 3640} 3641 3642// Header returns an http.Header that can be modified by the caller to 3643// add HTTP headers to the request. 3644func (c *CoursesGetCall) Header() http.Header { 3645 if c.header_ == nil { 3646 c.header_ = make(http.Header) 3647 } 3648 return c.header_ 3649} 3650 3651func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) { 3652 reqHeaders := make(http.Header) 3653 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3654 for k, v := range c.header_ { 3655 reqHeaders[k] = v 3656 } 3657 reqHeaders.Set("User-Agent", c.s.userAgent()) 3658 if c.ifNoneMatch_ != "" { 3659 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3660 } 3661 var body io.Reader = nil 3662 c.urlParams_.Set("alt", alt) 3663 c.urlParams_.Set("prettyPrint", "false") 3664 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3665 urls += "?" + c.urlParams_.Encode() 3666 req, err := http.NewRequest("GET", urls, body) 3667 if err != nil { 3668 return nil, err 3669 } 3670 req.Header = reqHeaders 3671 googleapi.Expand(req.URL, map[string]string{ 3672 "id": c.id, 3673 }) 3674 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3675} 3676 3677// Do executes the "classroom.courses.get" call. 3678// Exactly one of *Course or error will be non-nil. Any non-2xx status 3679// code is an error. Response headers are in either 3680// *Course.ServerResponse.Header or (if a response was returned at all) 3681// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3682// check whether the returned error was because http.StatusNotModified 3683// was returned. 3684func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3685 gensupport.SetOptions(c.urlParams_, opts...) 3686 res, err := c.doRequest("json") 3687 if res != nil && res.StatusCode == http.StatusNotModified { 3688 if res.Body != nil { 3689 res.Body.Close() 3690 } 3691 return nil, &googleapi.Error{ 3692 Code: res.StatusCode, 3693 Header: res.Header, 3694 } 3695 } 3696 if err != nil { 3697 return nil, err 3698 } 3699 defer googleapi.CloseBody(res) 3700 if err := googleapi.CheckResponse(res); err != nil { 3701 return nil, err 3702 } 3703 ret := &Course{ 3704 ServerResponse: googleapi.ServerResponse{ 3705 Header: res.Header, 3706 HTTPStatusCode: res.StatusCode, 3707 }, 3708 } 3709 target := &ret 3710 if err := gensupport.DecodeResponse(target, res); err != nil { 3711 return nil, err 3712 } 3713 return ret, nil 3714 // { 3715 // "description": "Returns a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.", 3716 // "flatPath": "v1/courses/{id}", 3717 // "httpMethod": "GET", 3718 // "id": "classroom.courses.get", 3719 // "parameterOrder": [ 3720 // "id" 3721 // ], 3722 // "parameters": { 3723 // "id": { 3724 // "description": "Identifier of the course to return.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3725 // "location": "path", 3726 // "required": true, 3727 // "type": "string" 3728 // } 3729 // }, 3730 // "path": "v1/courses/{id}", 3731 // "response": { 3732 // "$ref": "Course" 3733 // }, 3734 // "scopes": [ 3735 // "https://www.googleapis.com/auth/classroom.courses", 3736 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3737 // ] 3738 // } 3739 3740} 3741 3742// method id "classroom.courses.list": 3743 3744type CoursesListCall struct { 3745 s *Service 3746 urlParams_ gensupport.URLParams 3747 ifNoneMatch_ string 3748 ctx_ context.Context 3749 header_ http.Header 3750} 3751 3752// List: Returns a list of courses that the requesting user is permitted 3753// to view, 3754// restricted to those that match the request. Returned courses are 3755// ordered by 3756// creation time, with the most recently created coming first. 3757// 3758// This method returns the following error codes: 3759// 3760// * `PERMISSION_DENIED` for access errors. 3761// * `INVALID_ARGUMENT` if the query argument is malformed. 3762// * `NOT_FOUND` if any users specified in the query arguments do not 3763// exist. 3764func (r *CoursesService) List() *CoursesListCall { 3765 c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3766 return c 3767} 3768 3769// CourseStates sets the optional parameter "courseStates": Restricts 3770// returned courses to those in one of the specified states 3771// The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED. 3772// 3773// Possible values: 3774// "COURSE_STATE_UNSPECIFIED" 3775// "ACTIVE" 3776// "ARCHIVED" 3777// "PROVISIONED" 3778// "DECLINED" 3779// "SUSPENDED" 3780func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall { 3781 c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...)) 3782 return c 3783} 3784 3785// PageSize sets the optional parameter "pageSize": Maximum number of 3786// items to return. Zero or unspecified indicates that the 3787// server may assign a maximum. 3788// 3789// The server may return fewer than the specified number of results. 3790func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall { 3791 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3792 return c 3793} 3794 3795// PageToken sets the optional parameter "pageToken": 3796// nextPageToken 3797// value returned from a previous 3798// list call, 3799// indicating that the subsequent page of results should be 3800// returned. 3801// 3802// The list request must be 3803// otherwise identical to the one that resulted in this token. 3804func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall { 3805 c.urlParams_.Set("pageToken", pageToken) 3806 return c 3807} 3808 3809// StudentId sets the optional parameter "studentId": Restricts returned 3810// courses to those having a student with the specified 3811// identifier. The identifier can be one of the following: 3812// 3813// * the numeric identifier for the user 3814// * the email address of the user 3815// * the string literal "me", indicating the requesting user 3816func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall { 3817 c.urlParams_.Set("studentId", studentId) 3818 return c 3819} 3820 3821// TeacherId sets the optional parameter "teacherId": Restricts returned 3822// courses to those having a teacher with the specified 3823// identifier. The identifier can be one of the following: 3824// 3825// * the numeric identifier for the user 3826// * the email address of the user 3827// * the string literal "me", indicating the requesting user 3828func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall { 3829 c.urlParams_.Set("teacherId", teacherId) 3830 return c 3831} 3832 3833// Fields allows partial responses to be retrieved. See 3834// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3835// for more information. 3836func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall { 3837 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3838 return c 3839} 3840 3841// IfNoneMatch sets the optional parameter which makes the operation 3842// fail if the object's ETag matches the given value. This is useful for 3843// getting updates only after the object has changed since the last 3844// request. Use googleapi.IsNotModified to check whether the response 3845// error from Do is the result of In-None-Match. 3846func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall { 3847 c.ifNoneMatch_ = entityTag 3848 return c 3849} 3850 3851// Context sets the context to be used in this call's Do method. Any 3852// pending HTTP request will be aborted if the provided context is 3853// canceled. 3854func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall { 3855 c.ctx_ = ctx 3856 return c 3857} 3858 3859// Header returns an http.Header that can be modified by the caller to 3860// add HTTP headers to the request. 3861func (c *CoursesListCall) Header() http.Header { 3862 if c.header_ == nil { 3863 c.header_ = make(http.Header) 3864 } 3865 return c.header_ 3866} 3867 3868func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) { 3869 reqHeaders := make(http.Header) 3870 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3871 for k, v := range c.header_ { 3872 reqHeaders[k] = v 3873 } 3874 reqHeaders.Set("User-Agent", c.s.userAgent()) 3875 if c.ifNoneMatch_ != "" { 3876 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3877 } 3878 var body io.Reader = nil 3879 c.urlParams_.Set("alt", alt) 3880 c.urlParams_.Set("prettyPrint", "false") 3881 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3882 urls += "?" + c.urlParams_.Encode() 3883 req, err := http.NewRequest("GET", urls, body) 3884 if err != nil { 3885 return nil, err 3886 } 3887 req.Header = reqHeaders 3888 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3889} 3890 3891// Do executes the "classroom.courses.list" call. 3892// Exactly one of *ListCoursesResponse or error will be non-nil. Any 3893// non-2xx status code is an error. Response headers are in either 3894// *ListCoursesResponse.ServerResponse.Header or (if a response was 3895// returned at all) in error.(*googleapi.Error).Header. Use 3896// googleapi.IsNotModified to check whether the returned error was 3897// because http.StatusNotModified was returned. 3898func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) { 3899 gensupport.SetOptions(c.urlParams_, opts...) 3900 res, err := c.doRequest("json") 3901 if res != nil && res.StatusCode == http.StatusNotModified { 3902 if res.Body != nil { 3903 res.Body.Close() 3904 } 3905 return nil, &googleapi.Error{ 3906 Code: res.StatusCode, 3907 Header: res.Header, 3908 } 3909 } 3910 if err != nil { 3911 return nil, err 3912 } 3913 defer googleapi.CloseBody(res) 3914 if err := googleapi.CheckResponse(res); err != nil { 3915 return nil, err 3916 } 3917 ret := &ListCoursesResponse{ 3918 ServerResponse: googleapi.ServerResponse{ 3919 Header: res.Header, 3920 HTTPStatusCode: res.StatusCode, 3921 }, 3922 } 3923 target := &ret 3924 if err := gensupport.DecodeResponse(target, res); err != nil { 3925 return nil, err 3926 } 3927 return ret, nil 3928 // { 3929 // "description": "Returns a list of courses that the requesting user is permitted to view,\nrestricted to those that match the request. Returned courses are ordered by\ncreation time, with the most recently created coming first.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` for access errors.\n* `INVALID_ARGUMENT` if the query argument is malformed.\n* `NOT_FOUND` if any users specified in the query arguments do not exist.", 3930 // "flatPath": "v1/courses", 3931 // "httpMethod": "GET", 3932 // "id": "classroom.courses.list", 3933 // "parameterOrder": [], 3934 // "parameters": { 3935 // "courseStates": { 3936 // "description": "Restricts returned courses to those in one of the specified states\nThe default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.", 3937 // "enum": [ 3938 // "COURSE_STATE_UNSPECIFIED", 3939 // "ACTIVE", 3940 // "ARCHIVED", 3941 // "PROVISIONED", 3942 // "DECLINED", 3943 // "SUSPENDED" 3944 // ], 3945 // "location": "query", 3946 // "repeated": true, 3947 // "type": "string" 3948 // }, 3949 // "pageSize": { 3950 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 3951 // "format": "int32", 3952 // "location": "query", 3953 // "type": "integer" 3954 // }, 3955 // "pageToken": { 3956 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.", 3957 // "location": "query", 3958 // "type": "string" 3959 // }, 3960 // "studentId": { 3961 // "description": "Restricts returned courses to those having a student with the specified\nidentifier. The identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 3962 // "location": "query", 3963 // "type": "string" 3964 // }, 3965 // "teacherId": { 3966 // "description": "Restricts returned courses to those having a teacher with the specified\nidentifier. The identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 3967 // "location": "query", 3968 // "type": "string" 3969 // } 3970 // }, 3971 // "path": "v1/courses", 3972 // "response": { 3973 // "$ref": "ListCoursesResponse" 3974 // }, 3975 // "scopes": [ 3976 // "https://www.googleapis.com/auth/classroom.courses", 3977 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3978 // ] 3979 // } 3980 3981} 3982 3983// Pages invokes f for each page of results. 3984// A non-nil error returned from f will halt the iteration. 3985// The provided context supersedes any context provided to the Context method. 3986func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error { 3987 c.ctx_ = ctx 3988 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3989 for { 3990 x, err := c.Do() 3991 if err != nil { 3992 return err 3993 } 3994 if err := f(x); err != nil { 3995 return err 3996 } 3997 if x.NextPageToken == "" { 3998 return nil 3999 } 4000 c.PageToken(x.NextPageToken) 4001 } 4002} 4003 4004// method id "classroom.courses.patch": 4005 4006type CoursesPatchCall struct { 4007 s *Service 4008 id string 4009 course *Course 4010 urlParams_ gensupport.URLParams 4011 ctx_ context.Context 4012 header_ http.Header 4013} 4014 4015// Patch: Updates one or more fields in a course. 4016// 4017// This method returns the following error codes: 4018// 4019// * `PERMISSION_DENIED` if the requesting user is not permitted to 4020// modify the 4021// requested course or for access errors. 4022// * `NOT_FOUND` if no course exists with the requested ID. 4023// * `INVALID_ARGUMENT` if invalid fields are specified in the update 4024// mask or 4025// if no update mask is supplied. 4026// * `FAILED_PRECONDITION` for the following request errors: 4027// * CourseNotModifiable 4028func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall { 4029 c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4030 c.id = id 4031 c.course = course 4032 return c 4033} 4034 4035// UpdateMask sets the optional parameter "updateMask": Mask that 4036// identifies which fields on the course to update. 4037// This field is required to do an update. The update will fail if 4038// invalid 4039// fields are specified. The following fields are valid: 4040// 4041// * `name` 4042// * `section` 4043// * `descriptionHeading` 4044// * `description` 4045// * `room` 4046// * `courseState` 4047// * `ownerId` 4048// 4049// Note: patches to ownerId are treated as being effective immediately, 4050// but in 4051// practice it may take some time for the ownership transfer of all 4052// affected 4053// resources to complete. 4054// 4055// When set in a query parameter, this field should be specified 4056// as 4057// 4058// `updateMask=<field1>,<field2>,...` 4059func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall { 4060 c.urlParams_.Set("updateMask", updateMask) 4061 return c 4062} 4063 4064// Fields allows partial responses to be retrieved. See 4065// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4066// for more information. 4067func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall { 4068 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4069 return c 4070} 4071 4072// Context sets the context to be used in this call's Do method. Any 4073// pending HTTP request will be aborted if the provided context is 4074// canceled. 4075func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall { 4076 c.ctx_ = ctx 4077 return c 4078} 4079 4080// Header returns an http.Header that can be modified by the caller to 4081// add HTTP headers to the request. 4082func (c *CoursesPatchCall) Header() http.Header { 4083 if c.header_ == nil { 4084 c.header_ = make(http.Header) 4085 } 4086 return c.header_ 4087} 4088 4089func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) { 4090 reqHeaders := make(http.Header) 4091 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4092 for k, v := range c.header_ { 4093 reqHeaders[k] = v 4094 } 4095 reqHeaders.Set("User-Agent", c.s.userAgent()) 4096 var body io.Reader = nil 4097 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4098 if err != nil { 4099 return nil, err 4100 } 4101 reqHeaders.Set("Content-Type", "application/json") 4102 c.urlParams_.Set("alt", alt) 4103 c.urlParams_.Set("prettyPrint", "false") 4104 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4105 urls += "?" + c.urlParams_.Encode() 4106 req, err := http.NewRequest("PATCH", urls, body) 4107 if err != nil { 4108 return nil, err 4109 } 4110 req.Header = reqHeaders 4111 googleapi.Expand(req.URL, map[string]string{ 4112 "id": c.id, 4113 }) 4114 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4115} 4116 4117// Do executes the "classroom.courses.patch" call. 4118// Exactly one of *Course or error will be non-nil. Any non-2xx status 4119// code is an error. Response headers are in either 4120// *Course.ServerResponse.Header or (if a response was returned at all) 4121// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4122// check whether the returned error was because http.StatusNotModified 4123// was returned. 4124func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4125 gensupport.SetOptions(c.urlParams_, opts...) 4126 res, err := c.doRequest("json") 4127 if res != nil && res.StatusCode == http.StatusNotModified { 4128 if res.Body != nil { 4129 res.Body.Close() 4130 } 4131 return nil, &googleapi.Error{ 4132 Code: res.StatusCode, 4133 Header: res.Header, 4134 } 4135 } 4136 if err != nil { 4137 return nil, err 4138 } 4139 defer googleapi.CloseBody(res) 4140 if err := googleapi.CheckResponse(res); err != nil { 4141 return nil, err 4142 } 4143 ret := &Course{ 4144 ServerResponse: googleapi.ServerResponse{ 4145 Header: res.Header, 4146 HTTPStatusCode: res.StatusCode, 4147 }, 4148 } 4149 target := &ret 4150 if err := gensupport.DecodeResponse(target, res); err != nil { 4151 return nil, err 4152 } 4153 return ret, nil 4154 // { 4155 // "description": "Updates one or more fields in a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to modify the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.\n* `INVALID_ARGUMENT` if invalid fields are specified in the update mask or\nif no update mask is supplied.\n* `FAILED_PRECONDITION` for the following request errors:\n * CourseNotModifiable", 4156 // "flatPath": "v1/courses/{id}", 4157 // "httpMethod": "PATCH", 4158 // "id": "classroom.courses.patch", 4159 // "parameterOrder": [ 4160 // "id" 4161 // ], 4162 // "parameters": { 4163 // "id": { 4164 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4165 // "location": "path", 4166 // "required": true, 4167 // "type": "string" 4168 // }, 4169 // "updateMask": { 4170 // "description": "Mask that identifies which fields on the course to update.\nThis field is required to do an update. The update will fail if invalid\nfields are specified. The following fields are valid:\n\n* `name`\n* `section`\n* `descriptionHeading`\n* `description`\n* `room`\n* `courseState`\n* `ownerId`\n\nNote: patches to ownerId are treated as being effective immediately, but in\npractice it may take some time for the ownership transfer of all affected\nresources to complete.\n\nWhen set in a query parameter, this field should be specified as\n\n`updateMask=\u003cfield1\u003e,\u003cfield2\u003e,...`", 4171 // "format": "google-fieldmask", 4172 // "location": "query", 4173 // "type": "string" 4174 // } 4175 // }, 4176 // "path": "v1/courses/{id}", 4177 // "request": { 4178 // "$ref": "Course" 4179 // }, 4180 // "response": { 4181 // "$ref": "Course" 4182 // }, 4183 // "scopes": [ 4184 // "https://www.googleapis.com/auth/classroom.courses" 4185 // ] 4186 // } 4187 4188} 4189 4190// method id "classroom.courses.update": 4191 4192type CoursesUpdateCall struct { 4193 s *Service 4194 id string 4195 course *Course 4196 urlParams_ gensupport.URLParams 4197 ctx_ context.Context 4198 header_ http.Header 4199} 4200 4201// Update: Updates a course. 4202// 4203// This method returns the following error codes: 4204// 4205// * `PERMISSION_DENIED` if the requesting user is not permitted to 4206// modify the 4207// requested course or for access errors. 4208// * `NOT_FOUND` if no course exists with the requested ID. 4209// * `FAILED_PRECONDITION` for the following request errors: 4210// * CourseNotModifiable 4211func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall { 4212 c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4213 c.id = id 4214 c.course = course 4215 return c 4216} 4217 4218// Fields allows partial responses to be retrieved. See 4219// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4220// for more information. 4221func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall { 4222 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4223 return c 4224} 4225 4226// Context sets the context to be used in this call's Do method. Any 4227// pending HTTP request will be aborted if the provided context is 4228// canceled. 4229func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall { 4230 c.ctx_ = ctx 4231 return c 4232} 4233 4234// Header returns an http.Header that can be modified by the caller to 4235// add HTTP headers to the request. 4236func (c *CoursesUpdateCall) Header() http.Header { 4237 if c.header_ == nil { 4238 c.header_ = make(http.Header) 4239 } 4240 return c.header_ 4241} 4242 4243func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) { 4244 reqHeaders := make(http.Header) 4245 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4246 for k, v := range c.header_ { 4247 reqHeaders[k] = v 4248 } 4249 reqHeaders.Set("User-Agent", c.s.userAgent()) 4250 var body io.Reader = nil 4251 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4252 if err != nil { 4253 return nil, err 4254 } 4255 reqHeaders.Set("Content-Type", "application/json") 4256 c.urlParams_.Set("alt", alt) 4257 c.urlParams_.Set("prettyPrint", "false") 4258 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4259 urls += "?" + c.urlParams_.Encode() 4260 req, err := http.NewRequest("PUT", urls, body) 4261 if err != nil { 4262 return nil, err 4263 } 4264 req.Header = reqHeaders 4265 googleapi.Expand(req.URL, map[string]string{ 4266 "id": c.id, 4267 }) 4268 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4269} 4270 4271// Do executes the "classroom.courses.update" call. 4272// Exactly one of *Course or error will be non-nil. Any non-2xx status 4273// code is an error. Response headers are in either 4274// *Course.ServerResponse.Header or (if a response was returned at all) 4275// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4276// check whether the returned error was because http.StatusNotModified 4277// was returned. 4278func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4279 gensupport.SetOptions(c.urlParams_, opts...) 4280 res, err := c.doRequest("json") 4281 if res != nil && res.StatusCode == http.StatusNotModified { 4282 if res.Body != nil { 4283 res.Body.Close() 4284 } 4285 return nil, &googleapi.Error{ 4286 Code: res.StatusCode, 4287 Header: res.Header, 4288 } 4289 } 4290 if err != nil { 4291 return nil, err 4292 } 4293 defer googleapi.CloseBody(res) 4294 if err := googleapi.CheckResponse(res); err != nil { 4295 return nil, err 4296 } 4297 ret := &Course{ 4298 ServerResponse: googleapi.ServerResponse{ 4299 Header: res.Header, 4300 HTTPStatusCode: res.StatusCode, 4301 }, 4302 } 4303 target := &ret 4304 if err := gensupport.DecodeResponse(target, res); err != nil { 4305 return nil, err 4306 } 4307 return ret, nil 4308 // { 4309 // "description": "Updates a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to modify the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.\n* `FAILED_PRECONDITION` for the following request errors:\n * CourseNotModifiable", 4310 // "flatPath": "v1/courses/{id}", 4311 // "httpMethod": "PUT", 4312 // "id": "classroom.courses.update", 4313 // "parameterOrder": [ 4314 // "id" 4315 // ], 4316 // "parameters": { 4317 // "id": { 4318 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4319 // "location": "path", 4320 // "required": true, 4321 // "type": "string" 4322 // } 4323 // }, 4324 // "path": "v1/courses/{id}", 4325 // "request": { 4326 // "$ref": "Course" 4327 // }, 4328 // "response": { 4329 // "$ref": "Course" 4330 // }, 4331 // "scopes": [ 4332 // "https://www.googleapis.com/auth/classroom.courses" 4333 // ] 4334 // } 4335 4336} 4337 4338// method id "classroom.courses.aliases.create": 4339 4340type CoursesAliasesCreateCall struct { 4341 s *Service 4342 courseId string 4343 coursealias *CourseAlias 4344 urlParams_ gensupport.URLParams 4345 ctx_ context.Context 4346 header_ http.Header 4347} 4348 4349// Create: Creates an alias for a course. 4350// 4351// This method returns the following error codes: 4352// 4353// * `PERMISSION_DENIED` if the requesting user is not permitted to 4354// create the 4355// alias or for access errors. 4356// * `NOT_FOUND` if the course does not exist. 4357// * `ALREADY_EXISTS` if the alias already exists. 4358// * `FAILED_PRECONDITION` if the alias requested does not make sense 4359// for the 4360// requesting user or course (for example, if a user not in a domain 4361// attempts to access a domain-scoped alias). 4362func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall { 4363 c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4364 c.courseId = courseId 4365 c.coursealias = coursealias 4366 return c 4367} 4368 4369// Fields allows partial responses to be retrieved. See 4370// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4371// for more information. 4372func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall { 4373 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4374 return c 4375} 4376 4377// Context sets the context to be used in this call's Do method. Any 4378// pending HTTP request will be aborted if the provided context is 4379// canceled. 4380func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall { 4381 c.ctx_ = ctx 4382 return c 4383} 4384 4385// Header returns an http.Header that can be modified by the caller to 4386// add HTTP headers to the request. 4387func (c *CoursesAliasesCreateCall) Header() http.Header { 4388 if c.header_ == nil { 4389 c.header_ = make(http.Header) 4390 } 4391 return c.header_ 4392} 4393 4394func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) { 4395 reqHeaders := make(http.Header) 4396 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4397 for k, v := range c.header_ { 4398 reqHeaders[k] = v 4399 } 4400 reqHeaders.Set("User-Agent", c.s.userAgent()) 4401 var body io.Reader = nil 4402 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias) 4403 if err != nil { 4404 return nil, err 4405 } 4406 reqHeaders.Set("Content-Type", "application/json") 4407 c.urlParams_.Set("alt", alt) 4408 c.urlParams_.Set("prettyPrint", "false") 4409 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4410 urls += "?" + c.urlParams_.Encode() 4411 req, err := http.NewRequest("POST", urls, body) 4412 if err != nil { 4413 return nil, err 4414 } 4415 req.Header = reqHeaders 4416 googleapi.Expand(req.URL, map[string]string{ 4417 "courseId": c.courseId, 4418 }) 4419 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4420} 4421 4422// Do executes the "classroom.courses.aliases.create" call. 4423// Exactly one of *CourseAlias or error will be non-nil. Any non-2xx 4424// status code is an error. Response headers are in either 4425// *CourseAlias.ServerResponse.Header or (if a response was returned at 4426// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4427// to check whether the returned error was because 4428// http.StatusNotModified was returned. 4429func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) { 4430 gensupport.SetOptions(c.urlParams_, opts...) 4431 res, err := c.doRequest("json") 4432 if res != nil && res.StatusCode == http.StatusNotModified { 4433 if res.Body != nil { 4434 res.Body.Close() 4435 } 4436 return nil, &googleapi.Error{ 4437 Code: res.StatusCode, 4438 Header: res.Header, 4439 } 4440 } 4441 if err != nil { 4442 return nil, err 4443 } 4444 defer googleapi.CloseBody(res) 4445 if err := googleapi.CheckResponse(res); err != nil { 4446 return nil, err 4447 } 4448 ret := &CourseAlias{ 4449 ServerResponse: googleapi.ServerResponse{ 4450 Header: res.Header, 4451 HTTPStatusCode: res.StatusCode, 4452 }, 4453 } 4454 target := &ret 4455 if err := gensupport.DecodeResponse(target, res); err != nil { 4456 return nil, err 4457 } 4458 return ret, nil 4459 // { 4460 // "description": "Creates an alias for a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create the\nalias or for access errors.\n* `NOT_FOUND` if the course does not exist.\n* `ALREADY_EXISTS` if the alias already exists.\n* `FAILED_PRECONDITION` if the alias requested does not make sense for the\n requesting user or course (for example, if a user not in a domain\n attempts to access a domain-scoped alias).", 4461 // "flatPath": "v1/courses/{courseId}/aliases", 4462 // "httpMethod": "POST", 4463 // "id": "classroom.courses.aliases.create", 4464 // "parameterOrder": [ 4465 // "courseId" 4466 // ], 4467 // "parameters": { 4468 // "courseId": { 4469 // "description": "Identifier of the course to alias.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4470 // "location": "path", 4471 // "required": true, 4472 // "type": "string" 4473 // } 4474 // }, 4475 // "path": "v1/courses/{courseId}/aliases", 4476 // "request": { 4477 // "$ref": "CourseAlias" 4478 // }, 4479 // "response": { 4480 // "$ref": "CourseAlias" 4481 // }, 4482 // "scopes": [ 4483 // "https://www.googleapis.com/auth/classroom.courses" 4484 // ] 4485 // } 4486 4487} 4488 4489// method id "classroom.courses.aliases.delete": 4490 4491type CoursesAliasesDeleteCall struct { 4492 s *Service 4493 courseId string 4494 aliasid string 4495 urlParams_ gensupport.URLParams 4496 ctx_ context.Context 4497 header_ http.Header 4498} 4499 4500// Delete: Deletes an alias of a course. 4501// 4502// This method returns the following error codes: 4503// 4504// * `PERMISSION_DENIED` if the requesting user is not permitted to 4505// remove the 4506// alias or for access errors. 4507// * `NOT_FOUND` if the alias does not exist. 4508// * `FAILED_PRECONDITION` if the alias requested does not make sense 4509// for the 4510// requesting user or course (for example, if a user not in a domain 4511// attempts to delete a domain-scoped alias). 4512func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall { 4513 c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4514 c.courseId = courseId 4515 c.aliasid = aliasid 4516 return c 4517} 4518 4519// Fields allows partial responses to be retrieved. See 4520// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4521// for more information. 4522func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall { 4523 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4524 return c 4525} 4526 4527// Context sets the context to be used in this call's Do method. Any 4528// pending HTTP request will be aborted if the provided context is 4529// canceled. 4530func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall { 4531 c.ctx_ = ctx 4532 return c 4533} 4534 4535// Header returns an http.Header that can be modified by the caller to 4536// add HTTP headers to the request. 4537func (c *CoursesAliasesDeleteCall) Header() http.Header { 4538 if c.header_ == nil { 4539 c.header_ = make(http.Header) 4540 } 4541 return c.header_ 4542} 4543 4544func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) { 4545 reqHeaders := make(http.Header) 4546 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4547 for k, v := range c.header_ { 4548 reqHeaders[k] = v 4549 } 4550 reqHeaders.Set("User-Agent", c.s.userAgent()) 4551 var body io.Reader = nil 4552 c.urlParams_.Set("alt", alt) 4553 c.urlParams_.Set("prettyPrint", "false") 4554 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}") 4555 urls += "?" + c.urlParams_.Encode() 4556 req, err := http.NewRequest("DELETE", urls, body) 4557 if err != nil { 4558 return nil, err 4559 } 4560 req.Header = reqHeaders 4561 googleapi.Expand(req.URL, map[string]string{ 4562 "courseId": c.courseId, 4563 "alias": c.aliasid, 4564 }) 4565 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4566} 4567 4568// Do executes the "classroom.courses.aliases.delete" call. 4569// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4570// code is an error. Response headers are in either 4571// *Empty.ServerResponse.Header or (if a response was returned at all) 4572// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4573// check whether the returned error was because http.StatusNotModified 4574// was returned. 4575func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4576 gensupport.SetOptions(c.urlParams_, opts...) 4577 res, err := c.doRequest("json") 4578 if res != nil && res.StatusCode == http.StatusNotModified { 4579 if res.Body != nil { 4580 res.Body.Close() 4581 } 4582 return nil, &googleapi.Error{ 4583 Code: res.StatusCode, 4584 Header: res.Header, 4585 } 4586 } 4587 if err != nil { 4588 return nil, err 4589 } 4590 defer googleapi.CloseBody(res) 4591 if err := googleapi.CheckResponse(res); err != nil { 4592 return nil, err 4593 } 4594 ret := &Empty{ 4595 ServerResponse: googleapi.ServerResponse{ 4596 Header: res.Header, 4597 HTTPStatusCode: res.StatusCode, 4598 }, 4599 } 4600 target := &ret 4601 if err := gensupport.DecodeResponse(target, res); err != nil { 4602 return nil, err 4603 } 4604 return ret, nil 4605 // { 4606 // "description": "Deletes an alias of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to remove the\nalias or for access errors.\n* `NOT_FOUND` if the alias does not exist.\n* `FAILED_PRECONDITION` if the alias requested does not make sense for the\n requesting user or course (for example, if a user not in a domain\n attempts to delete a domain-scoped alias).", 4607 // "flatPath": "v1/courses/{courseId}/aliases/{alias}", 4608 // "httpMethod": "DELETE", 4609 // "id": "classroom.courses.aliases.delete", 4610 // "parameterOrder": [ 4611 // "courseId", 4612 // "alias" 4613 // ], 4614 // "parameters": { 4615 // "alias": { 4616 // "description": "Alias to delete.\nThis may not be the Classroom-assigned identifier.", 4617 // "location": "path", 4618 // "required": true, 4619 // "type": "string" 4620 // }, 4621 // "courseId": { 4622 // "description": "Identifier of the course whose alias should be deleted.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4623 // "location": "path", 4624 // "required": true, 4625 // "type": "string" 4626 // } 4627 // }, 4628 // "path": "v1/courses/{courseId}/aliases/{alias}", 4629 // "response": { 4630 // "$ref": "Empty" 4631 // }, 4632 // "scopes": [ 4633 // "https://www.googleapis.com/auth/classroom.courses" 4634 // ] 4635 // } 4636 4637} 4638 4639// method id "classroom.courses.aliases.list": 4640 4641type CoursesAliasesListCall struct { 4642 s *Service 4643 courseId string 4644 urlParams_ gensupport.URLParams 4645 ifNoneMatch_ string 4646 ctx_ context.Context 4647 header_ http.Header 4648} 4649 4650// List: Returns a list of aliases for a course. 4651// 4652// This method returns the following error codes: 4653// 4654// * `PERMISSION_DENIED` if the requesting user is not permitted to 4655// access the 4656// course or for access errors. 4657// * `NOT_FOUND` if the course does not exist. 4658func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall { 4659 c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4660 c.courseId = courseId 4661 return c 4662} 4663 4664// PageSize sets the optional parameter "pageSize": Maximum number of 4665// items to return. Zero or unspecified indicates that the 4666// server may assign a maximum. 4667// 4668// The server may return fewer than the specified number of results. 4669func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall { 4670 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4671 return c 4672} 4673 4674// PageToken sets the optional parameter "pageToken": 4675// nextPageToken 4676// value returned from a previous 4677// list call, 4678// indicating that the subsequent page of results should be 4679// returned. 4680// 4681// The list request 4682// must be otherwise identical to the one that resulted in this token. 4683func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall { 4684 c.urlParams_.Set("pageToken", pageToken) 4685 return c 4686} 4687 4688// Fields allows partial responses to be retrieved. See 4689// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4690// for more information. 4691func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall { 4692 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4693 return c 4694} 4695 4696// IfNoneMatch sets the optional parameter which makes the operation 4697// fail if the object's ETag matches the given value. This is useful for 4698// getting updates only after the object has changed since the last 4699// request. Use googleapi.IsNotModified to check whether the response 4700// error from Do is the result of In-None-Match. 4701func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall { 4702 c.ifNoneMatch_ = entityTag 4703 return c 4704} 4705 4706// Context sets the context to be used in this call's Do method. Any 4707// pending HTTP request will be aborted if the provided context is 4708// canceled. 4709func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall { 4710 c.ctx_ = ctx 4711 return c 4712} 4713 4714// Header returns an http.Header that can be modified by the caller to 4715// add HTTP headers to the request. 4716func (c *CoursesAliasesListCall) Header() http.Header { 4717 if c.header_ == nil { 4718 c.header_ = make(http.Header) 4719 } 4720 return c.header_ 4721} 4722 4723func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) { 4724 reqHeaders := make(http.Header) 4725 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4726 for k, v := range c.header_ { 4727 reqHeaders[k] = v 4728 } 4729 reqHeaders.Set("User-Agent", c.s.userAgent()) 4730 if c.ifNoneMatch_ != "" { 4731 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4732 } 4733 var body io.Reader = nil 4734 c.urlParams_.Set("alt", alt) 4735 c.urlParams_.Set("prettyPrint", "false") 4736 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4737 urls += "?" + c.urlParams_.Encode() 4738 req, err := http.NewRequest("GET", urls, body) 4739 if err != nil { 4740 return nil, err 4741 } 4742 req.Header = reqHeaders 4743 googleapi.Expand(req.URL, map[string]string{ 4744 "courseId": c.courseId, 4745 }) 4746 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4747} 4748 4749// Do executes the "classroom.courses.aliases.list" call. 4750// Exactly one of *ListCourseAliasesResponse or error will be non-nil. 4751// Any non-2xx status code is an error. Response headers are in either 4752// *ListCourseAliasesResponse.ServerResponse.Header or (if a response 4753// was returned at all) in error.(*googleapi.Error).Header. Use 4754// googleapi.IsNotModified to check whether the returned error was 4755// because http.StatusNotModified was returned. 4756func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) { 4757 gensupport.SetOptions(c.urlParams_, opts...) 4758 res, err := c.doRequest("json") 4759 if res != nil && res.StatusCode == http.StatusNotModified { 4760 if res.Body != nil { 4761 res.Body.Close() 4762 } 4763 return nil, &googleapi.Error{ 4764 Code: res.StatusCode, 4765 Header: res.Header, 4766 } 4767 } 4768 if err != nil { 4769 return nil, err 4770 } 4771 defer googleapi.CloseBody(res) 4772 if err := googleapi.CheckResponse(res); err != nil { 4773 return nil, err 4774 } 4775 ret := &ListCourseAliasesResponse{ 4776 ServerResponse: googleapi.ServerResponse{ 4777 Header: res.Header, 4778 HTTPStatusCode: res.StatusCode, 4779 }, 4780 } 4781 target := &ret 4782 if err := gensupport.DecodeResponse(target, res); err != nil { 4783 return nil, err 4784 } 4785 return ret, nil 4786 // { 4787 // "description": "Returns a list of aliases for a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\ncourse or for access errors.\n* `NOT_FOUND` if the course does not exist.", 4788 // "flatPath": "v1/courses/{courseId}/aliases", 4789 // "httpMethod": "GET", 4790 // "id": "classroom.courses.aliases.list", 4791 // "parameterOrder": [ 4792 // "courseId" 4793 // ], 4794 // "parameters": { 4795 // "courseId": { 4796 // "description": "The identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4797 // "location": "path", 4798 // "required": true, 4799 // "type": "string" 4800 // }, 4801 // "pageSize": { 4802 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 4803 // "format": "int32", 4804 // "location": "query", 4805 // "type": "integer" 4806 // }, 4807 // "pageToken": { 4808 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 4809 // "location": "query", 4810 // "type": "string" 4811 // } 4812 // }, 4813 // "path": "v1/courses/{courseId}/aliases", 4814 // "response": { 4815 // "$ref": "ListCourseAliasesResponse" 4816 // }, 4817 // "scopes": [ 4818 // "https://www.googleapis.com/auth/classroom.courses", 4819 // "https://www.googleapis.com/auth/classroom.courses.readonly" 4820 // ] 4821 // } 4822 4823} 4824 4825// Pages invokes f for each page of results. 4826// A non-nil error returned from f will halt the iteration. 4827// The provided context supersedes any context provided to the Context method. 4828func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error { 4829 c.ctx_ = ctx 4830 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4831 for { 4832 x, err := c.Do() 4833 if err != nil { 4834 return err 4835 } 4836 if err := f(x); err != nil { 4837 return err 4838 } 4839 if x.NextPageToken == "" { 4840 return nil 4841 } 4842 c.PageToken(x.NextPageToken) 4843 } 4844} 4845 4846// method id "classroom.courses.announcements.create": 4847 4848type CoursesAnnouncementsCreateCall struct { 4849 s *Service 4850 courseId string 4851 announcement *Announcement 4852 urlParams_ gensupport.URLParams 4853 ctx_ context.Context 4854 header_ http.Header 4855} 4856 4857// Create: Creates an announcement. 4858// 4859// This method returns the following error codes: 4860// 4861// * `PERMISSION_DENIED` if the requesting user is not permitted to 4862// access the 4863// requested course, create announcements in the requested course, share 4864// a 4865// Drive attachment, or for access errors. 4866// * `INVALID_ARGUMENT` if the request is malformed. 4867// * `NOT_FOUND` if the requested course does not exist. 4868// * `FAILED_PRECONDITION` for the following request error: 4869// * AttachmentNotVisible 4870func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall { 4871 c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4872 c.courseId = courseId 4873 c.announcement = announcement 4874 return c 4875} 4876 4877// Fields allows partial responses to be retrieved. See 4878// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4879// for more information. 4880func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall { 4881 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4882 return c 4883} 4884 4885// Context sets the context to be used in this call's Do method. Any 4886// pending HTTP request will be aborted if the provided context is 4887// canceled. 4888func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall { 4889 c.ctx_ = ctx 4890 return c 4891} 4892 4893// Header returns an http.Header that can be modified by the caller to 4894// add HTTP headers to the request. 4895func (c *CoursesAnnouncementsCreateCall) Header() http.Header { 4896 if c.header_ == nil { 4897 c.header_ = make(http.Header) 4898 } 4899 return c.header_ 4900} 4901 4902func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) { 4903 reqHeaders := make(http.Header) 4904 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4905 for k, v := range c.header_ { 4906 reqHeaders[k] = v 4907 } 4908 reqHeaders.Set("User-Agent", c.s.userAgent()) 4909 var body io.Reader = nil 4910 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 4911 if err != nil { 4912 return nil, err 4913 } 4914 reqHeaders.Set("Content-Type", "application/json") 4915 c.urlParams_.Set("alt", alt) 4916 c.urlParams_.Set("prettyPrint", "false") 4917 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 4918 urls += "?" + c.urlParams_.Encode() 4919 req, err := http.NewRequest("POST", urls, body) 4920 if err != nil { 4921 return nil, err 4922 } 4923 req.Header = reqHeaders 4924 googleapi.Expand(req.URL, map[string]string{ 4925 "courseId": c.courseId, 4926 }) 4927 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4928} 4929 4930// Do executes the "classroom.courses.announcements.create" call. 4931// Exactly one of *Announcement or error will be non-nil. Any non-2xx 4932// status code is an error. Response headers are in either 4933// *Announcement.ServerResponse.Header or (if a response was returned at 4934// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4935// to check whether the returned error was because 4936// http.StatusNotModified was returned. 4937func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 4938 gensupport.SetOptions(c.urlParams_, opts...) 4939 res, err := c.doRequest("json") 4940 if res != nil && res.StatusCode == http.StatusNotModified { 4941 if res.Body != nil { 4942 res.Body.Close() 4943 } 4944 return nil, &googleapi.Error{ 4945 Code: res.StatusCode, 4946 Header: res.Header, 4947 } 4948 } 4949 if err != nil { 4950 return nil, err 4951 } 4952 defer googleapi.CloseBody(res) 4953 if err := googleapi.CheckResponse(res); err != nil { 4954 return nil, err 4955 } 4956 ret := &Announcement{ 4957 ServerResponse: googleapi.ServerResponse{ 4958 Header: res.Header, 4959 HTTPStatusCode: res.StatusCode, 4960 }, 4961 } 4962 target := &ret 4963 if err := gensupport.DecodeResponse(target, res); err != nil { 4964 return nil, err 4965 } 4966 return ret, nil 4967 // { 4968 // "description": "Creates an announcement.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, create announcements in the requested course, share a\nDrive attachment, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.\n* `FAILED_PRECONDITION` for the following request error:\n * AttachmentNotVisible", 4969 // "flatPath": "v1/courses/{courseId}/announcements", 4970 // "httpMethod": "POST", 4971 // "id": "classroom.courses.announcements.create", 4972 // "parameterOrder": [ 4973 // "courseId" 4974 // ], 4975 // "parameters": { 4976 // "courseId": { 4977 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4978 // "location": "path", 4979 // "required": true, 4980 // "type": "string" 4981 // } 4982 // }, 4983 // "path": "v1/courses/{courseId}/announcements", 4984 // "request": { 4985 // "$ref": "Announcement" 4986 // }, 4987 // "response": { 4988 // "$ref": "Announcement" 4989 // }, 4990 // "scopes": [ 4991 // "https://www.googleapis.com/auth/classroom.announcements" 4992 // ] 4993 // } 4994 4995} 4996 4997// method id "classroom.courses.announcements.delete": 4998 4999type CoursesAnnouncementsDeleteCall struct { 5000 s *Service 5001 courseId string 5002 id string 5003 urlParams_ gensupport.URLParams 5004 ctx_ context.Context 5005 header_ http.Header 5006} 5007 5008// Delete: Deletes an announcement. 5009// 5010// This request must be made by the Developer Console project of 5011// the 5012// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5013// used to 5014// create the corresponding announcement item. 5015// 5016// This method returns the following error codes: 5017// 5018// * `PERMISSION_DENIED` if the requesting developer project did not 5019// create 5020// the corresponding announcement, if the requesting user is not 5021// permitted 5022// to delete the requested course or for access errors. 5023// * `FAILED_PRECONDITION` if the requested announcement has already 5024// been 5025// deleted. 5026// * `NOT_FOUND` if no course exists with the requested ID. 5027func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall { 5028 c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5029 c.courseId = courseId 5030 c.id = id 5031 return c 5032} 5033 5034// Fields allows partial responses to be retrieved. See 5035// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5036// for more information. 5037func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall { 5038 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5039 return c 5040} 5041 5042// Context sets the context to be used in this call's Do method. Any 5043// pending HTTP request will be aborted if the provided context is 5044// canceled. 5045func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall { 5046 c.ctx_ = ctx 5047 return c 5048} 5049 5050// Header returns an http.Header that can be modified by the caller to 5051// add HTTP headers to the request. 5052func (c *CoursesAnnouncementsDeleteCall) Header() http.Header { 5053 if c.header_ == nil { 5054 c.header_ = make(http.Header) 5055 } 5056 return c.header_ 5057} 5058 5059func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) { 5060 reqHeaders := make(http.Header) 5061 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5062 for k, v := range c.header_ { 5063 reqHeaders[k] = v 5064 } 5065 reqHeaders.Set("User-Agent", c.s.userAgent()) 5066 var body io.Reader = nil 5067 c.urlParams_.Set("alt", alt) 5068 c.urlParams_.Set("prettyPrint", "false") 5069 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5070 urls += "?" + c.urlParams_.Encode() 5071 req, err := http.NewRequest("DELETE", urls, body) 5072 if err != nil { 5073 return nil, err 5074 } 5075 req.Header = reqHeaders 5076 googleapi.Expand(req.URL, map[string]string{ 5077 "courseId": c.courseId, 5078 "id": c.id, 5079 }) 5080 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5081} 5082 5083// Do executes the "classroom.courses.announcements.delete" call. 5084// Exactly one of *Empty or error will be non-nil. Any non-2xx status 5085// code is an error. Response headers are in either 5086// *Empty.ServerResponse.Header or (if a response was returned at all) 5087// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5088// check whether the returned error was because http.StatusNotModified 5089// was returned. 5090func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 5091 gensupport.SetOptions(c.urlParams_, opts...) 5092 res, err := c.doRequest("json") 5093 if res != nil && res.StatusCode == http.StatusNotModified { 5094 if res.Body != nil { 5095 res.Body.Close() 5096 } 5097 return nil, &googleapi.Error{ 5098 Code: res.StatusCode, 5099 Header: res.Header, 5100 } 5101 } 5102 if err != nil { 5103 return nil, err 5104 } 5105 defer googleapi.CloseBody(res) 5106 if err := googleapi.CheckResponse(res); err != nil { 5107 return nil, err 5108 } 5109 ret := &Empty{ 5110 ServerResponse: googleapi.ServerResponse{ 5111 Header: res.Header, 5112 HTTPStatusCode: res.StatusCode, 5113 }, 5114 } 5115 target := &ret 5116 if err := gensupport.DecodeResponse(target, res); err != nil { 5117 return nil, err 5118 } 5119 return ret, nil 5120 // { 5121 // "description": "Deletes an announcement.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding announcement item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding announcement, if the requesting user is not permitted\nto delete the requested course or for access errors.\n* `FAILED_PRECONDITION` if the requested announcement has already been\ndeleted.\n* `NOT_FOUND` if no course exists with the requested ID.", 5122 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5123 // "httpMethod": "DELETE", 5124 // "id": "classroom.courses.announcements.delete", 5125 // "parameterOrder": [ 5126 // "courseId", 5127 // "id" 5128 // ], 5129 // "parameters": { 5130 // "courseId": { 5131 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5132 // "location": "path", 5133 // "required": true, 5134 // "type": "string" 5135 // }, 5136 // "id": { 5137 // "description": "Identifier of the announcement to delete.\nThis identifier is a Classroom-assigned identifier.", 5138 // "location": "path", 5139 // "required": true, 5140 // "type": "string" 5141 // } 5142 // }, 5143 // "path": "v1/courses/{courseId}/announcements/{id}", 5144 // "response": { 5145 // "$ref": "Empty" 5146 // }, 5147 // "scopes": [ 5148 // "https://www.googleapis.com/auth/classroom.announcements" 5149 // ] 5150 // } 5151 5152} 5153 5154// method id "classroom.courses.announcements.get": 5155 5156type CoursesAnnouncementsGetCall struct { 5157 s *Service 5158 courseId string 5159 id string 5160 urlParams_ gensupport.URLParams 5161 ifNoneMatch_ string 5162 ctx_ context.Context 5163 header_ http.Header 5164} 5165 5166// Get: Returns an announcement. 5167// 5168// This method returns the following error codes: 5169// 5170// * `PERMISSION_DENIED` if the requesting user is not permitted to 5171// access the 5172// requested course or announcement, or for access errors. 5173// * `INVALID_ARGUMENT` if the request is malformed. 5174// * `NOT_FOUND` if the requested course or announcement does not exist. 5175func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall { 5176 c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5177 c.courseId = courseId 5178 c.id = id 5179 return c 5180} 5181 5182// Fields allows partial responses to be retrieved. See 5183// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5184// for more information. 5185func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall { 5186 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5187 return c 5188} 5189 5190// IfNoneMatch sets the optional parameter which makes the operation 5191// fail if the object's ETag matches the given value. This is useful for 5192// getting updates only after the object has changed since the last 5193// request. Use googleapi.IsNotModified to check whether the response 5194// error from Do is the result of In-None-Match. 5195func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall { 5196 c.ifNoneMatch_ = entityTag 5197 return c 5198} 5199 5200// Context sets the context to be used in this call's Do method. Any 5201// pending HTTP request will be aborted if the provided context is 5202// canceled. 5203func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall { 5204 c.ctx_ = ctx 5205 return c 5206} 5207 5208// Header returns an http.Header that can be modified by the caller to 5209// add HTTP headers to the request. 5210func (c *CoursesAnnouncementsGetCall) Header() http.Header { 5211 if c.header_ == nil { 5212 c.header_ = make(http.Header) 5213 } 5214 return c.header_ 5215} 5216 5217func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) { 5218 reqHeaders := make(http.Header) 5219 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5220 for k, v := range c.header_ { 5221 reqHeaders[k] = v 5222 } 5223 reqHeaders.Set("User-Agent", c.s.userAgent()) 5224 if c.ifNoneMatch_ != "" { 5225 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5226 } 5227 var body io.Reader = nil 5228 c.urlParams_.Set("alt", alt) 5229 c.urlParams_.Set("prettyPrint", "false") 5230 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5231 urls += "?" + c.urlParams_.Encode() 5232 req, err := http.NewRequest("GET", urls, body) 5233 if err != nil { 5234 return nil, err 5235 } 5236 req.Header = reqHeaders 5237 googleapi.Expand(req.URL, map[string]string{ 5238 "courseId": c.courseId, 5239 "id": c.id, 5240 }) 5241 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5242} 5243 5244// Do executes the "classroom.courses.announcements.get" call. 5245// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5246// status code is an error. Response headers are in either 5247// *Announcement.ServerResponse.Header or (if a response was returned at 5248// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5249// to check whether the returned error was because 5250// http.StatusNotModified was returned. 5251func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5252 gensupport.SetOptions(c.urlParams_, opts...) 5253 res, err := c.doRequest("json") 5254 if res != nil && res.StatusCode == http.StatusNotModified { 5255 if res.Body != nil { 5256 res.Body.Close() 5257 } 5258 return nil, &googleapi.Error{ 5259 Code: res.StatusCode, 5260 Header: res.Header, 5261 } 5262 } 5263 if err != nil { 5264 return nil, err 5265 } 5266 defer googleapi.CloseBody(res) 5267 if err := googleapi.CheckResponse(res); err != nil { 5268 return nil, err 5269 } 5270 ret := &Announcement{ 5271 ServerResponse: googleapi.ServerResponse{ 5272 Header: res.Header, 5273 HTTPStatusCode: res.StatusCode, 5274 }, 5275 } 5276 target := &ret 5277 if err := gensupport.DecodeResponse(target, res); err != nil { 5278 return nil, err 5279 } 5280 return ret, nil 5281 // { 5282 // "description": "Returns an announcement.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or announcement, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or announcement does not exist.", 5283 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5284 // "httpMethod": "GET", 5285 // "id": "classroom.courses.announcements.get", 5286 // "parameterOrder": [ 5287 // "courseId", 5288 // "id" 5289 // ], 5290 // "parameters": { 5291 // "courseId": { 5292 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5293 // "location": "path", 5294 // "required": true, 5295 // "type": "string" 5296 // }, 5297 // "id": { 5298 // "description": "Identifier of the announcement.", 5299 // "location": "path", 5300 // "required": true, 5301 // "type": "string" 5302 // } 5303 // }, 5304 // "path": "v1/courses/{courseId}/announcements/{id}", 5305 // "response": { 5306 // "$ref": "Announcement" 5307 // }, 5308 // "scopes": [ 5309 // "https://www.googleapis.com/auth/classroom.announcements", 5310 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5311 // ] 5312 // } 5313 5314} 5315 5316// method id "classroom.courses.announcements.list": 5317 5318type CoursesAnnouncementsListCall struct { 5319 s *Service 5320 courseId string 5321 urlParams_ gensupport.URLParams 5322 ifNoneMatch_ string 5323 ctx_ context.Context 5324 header_ http.Header 5325} 5326 5327// List: Returns a list of announcements that the requester is permitted 5328// to view. 5329// 5330// Course students may only view `PUBLISHED` announcements. Course 5331// teachers 5332// and domain administrators may view all announcements. 5333// 5334// This method returns the following error codes: 5335// 5336// * `PERMISSION_DENIED` if the requesting user is not permitted to 5337// access 5338// the requested course or for access errors. 5339// * `INVALID_ARGUMENT` if the request is malformed. 5340// * `NOT_FOUND` if the requested course does not exist. 5341func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall { 5342 c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5343 c.courseId = courseId 5344 return c 5345} 5346 5347// AnnouncementStates sets the optional parameter "announcementStates": 5348// Restriction on the `state` of announcements returned. 5349// If this argument is left unspecified, the default value is 5350// `PUBLISHED`. 5351// 5352// Possible values: 5353// "ANNOUNCEMENT_STATE_UNSPECIFIED" 5354// "PUBLISHED" 5355// "DRAFT" 5356// "DELETED" 5357func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall { 5358 c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...)) 5359 return c 5360} 5361 5362// OrderBy sets the optional parameter "orderBy": Optional sort ordering 5363// for results. A comma-separated list of fields with 5364// an optional sort direction keyword. Supported field is 5365// `updateTime`. 5366// Supported direction keywords are `asc` and `desc`. 5367// If not specified, `updateTime desc` is the default 5368// behavior. 5369// Examples: `updateTime asc`, `updateTime` 5370func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall { 5371 c.urlParams_.Set("orderBy", orderBy) 5372 return c 5373} 5374 5375// PageSize sets the optional parameter "pageSize": Maximum number of 5376// items to return. Zero or unspecified indicates that the 5377// server may assign a maximum. 5378// 5379// The server may return fewer than the specified number of results. 5380func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall { 5381 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5382 return c 5383} 5384 5385// PageToken sets the optional parameter "pageToken": 5386// nextPageToken 5387// value returned from a previous 5388// list call, 5389// indicating that the subsequent page of results should be 5390// returned. 5391// 5392// The list request 5393// must be otherwise identical to the one that resulted in this token. 5394func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall { 5395 c.urlParams_.Set("pageToken", pageToken) 5396 return c 5397} 5398 5399// Fields allows partial responses to be retrieved. See 5400// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5401// for more information. 5402func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall { 5403 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5404 return c 5405} 5406 5407// IfNoneMatch sets the optional parameter which makes the operation 5408// fail if the object's ETag matches the given value. This is useful for 5409// getting updates only after the object has changed since the last 5410// request. Use googleapi.IsNotModified to check whether the response 5411// error from Do is the result of In-None-Match. 5412func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall { 5413 c.ifNoneMatch_ = entityTag 5414 return c 5415} 5416 5417// Context sets the context to be used in this call's Do method. Any 5418// pending HTTP request will be aborted if the provided context is 5419// canceled. 5420func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall { 5421 c.ctx_ = ctx 5422 return c 5423} 5424 5425// Header returns an http.Header that can be modified by the caller to 5426// add HTTP headers to the request. 5427func (c *CoursesAnnouncementsListCall) Header() http.Header { 5428 if c.header_ == nil { 5429 c.header_ = make(http.Header) 5430 } 5431 return c.header_ 5432} 5433 5434func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) { 5435 reqHeaders := make(http.Header) 5436 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5437 for k, v := range c.header_ { 5438 reqHeaders[k] = v 5439 } 5440 reqHeaders.Set("User-Agent", c.s.userAgent()) 5441 if c.ifNoneMatch_ != "" { 5442 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5443 } 5444 var body io.Reader = nil 5445 c.urlParams_.Set("alt", alt) 5446 c.urlParams_.Set("prettyPrint", "false") 5447 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 5448 urls += "?" + c.urlParams_.Encode() 5449 req, err := http.NewRequest("GET", urls, body) 5450 if err != nil { 5451 return nil, err 5452 } 5453 req.Header = reqHeaders 5454 googleapi.Expand(req.URL, map[string]string{ 5455 "courseId": c.courseId, 5456 }) 5457 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5458} 5459 5460// Do executes the "classroom.courses.announcements.list" call. 5461// Exactly one of *ListAnnouncementsResponse or error will be non-nil. 5462// Any non-2xx status code is an error. Response headers are in either 5463// *ListAnnouncementsResponse.ServerResponse.Header or (if a response 5464// was returned at all) in error.(*googleapi.Error).Header. Use 5465// googleapi.IsNotModified to check whether the returned error was 5466// because http.StatusNotModified was returned. 5467func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) { 5468 gensupport.SetOptions(c.urlParams_, opts...) 5469 res, err := c.doRequest("json") 5470 if res != nil && res.StatusCode == http.StatusNotModified { 5471 if res.Body != nil { 5472 res.Body.Close() 5473 } 5474 return nil, &googleapi.Error{ 5475 Code: res.StatusCode, 5476 Header: res.Header, 5477 } 5478 } 5479 if err != nil { 5480 return nil, err 5481 } 5482 defer googleapi.CloseBody(res) 5483 if err := googleapi.CheckResponse(res); err != nil { 5484 return nil, err 5485 } 5486 ret := &ListAnnouncementsResponse{ 5487 ServerResponse: googleapi.ServerResponse{ 5488 Header: res.Header, 5489 HTTPStatusCode: res.StatusCode, 5490 }, 5491 } 5492 target := &ret 5493 if err := gensupport.DecodeResponse(target, res); err != nil { 5494 return nil, err 5495 } 5496 return ret, nil 5497 // { 5498 // "description": "Returns a list of announcements that the requester is permitted to view.\n\nCourse students may only view `PUBLISHED` announcements. Course teachers\nand domain administrators may view all announcements.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthe requested course or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.", 5499 // "flatPath": "v1/courses/{courseId}/announcements", 5500 // "httpMethod": "GET", 5501 // "id": "classroom.courses.announcements.list", 5502 // "parameterOrder": [ 5503 // "courseId" 5504 // ], 5505 // "parameters": { 5506 // "announcementStates": { 5507 // "description": "Restriction on the `state` of announcements returned.\nIf this argument is left unspecified, the default value is `PUBLISHED`.", 5508 // "enum": [ 5509 // "ANNOUNCEMENT_STATE_UNSPECIFIED", 5510 // "PUBLISHED", 5511 // "DRAFT", 5512 // "DELETED" 5513 // ], 5514 // "location": "query", 5515 // "repeated": true, 5516 // "type": "string" 5517 // }, 5518 // "courseId": { 5519 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5520 // "location": "path", 5521 // "required": true, 5522 // "type": "string" 5523 // }, 5524 // "orderBy": { 5525 // "description": "Optional sort ordering for results. A comma-separated list of fields with\nan optional sort direction keyword. Supported field is `updateTime`.\nSupported direction keywords are `asc` and `desc`.\nIf not specified, `updateTime desc` is the default behavior.\nExamples: `updateTime asc`, `updateTime`", 5526 // "location": "query", 5527 // "type": "string" 5528 // }, 5529 // "pageSize": { 5530 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 5531 // "format": "int32", 5532 // "location": "query", 5533 // "type": "integer" 5534 // }, 5535 // "pageToken": { 5536 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 5537 // "location": "query", 5538 // "type": "string" 5539 // } 5540 // }, 5541 // "path": "v1/courses/{courseId}/announcements", 5542 // "response": { 5543 // "$ref": "ListAnnouncementsResponse" 5544 // }, 5545 // "scopes": [ 5546 // "https://www.googleapis.com/auth/classroom.announcements", 5547 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5548 // ] 5549 // } 5550 5551} 5552 5553// Pages invokes f for each page of results. 5554// A non-nil error returned from f will halt the iteration. 5555// The provided context supersedes any context provided to the Context method. 5556func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error { 5557 c.ctx_ = ctx 5558 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5559 for { 5560 x, err := c.Do() 5561 if err != nil { 5562 return err 5563 } 5564 if err := f(x); err != nil { 5565 return err 5566 } 5567 if x.NextPageToken == "" { 5568 return nil 5569 } 5570 c.PageToken(x.NextPageToken) 5571 } 5572} 5573 5574// method id "classroom.courses.announcements.modifyAssignees": 5575 5576type CoursesAnnouncementsModifyAssigneesCall struct { 5577 s *Service 5578 courseId string 5579 id string 5580 modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest 5581 urlParams_ gensupport.URLParams 5582 ctx_ context.Context 5583 header_ http.Header 5584} 5585 5586// ModifyAssignees: Modifies assignee mode and options of an 5587// announcement. 5588// 5589// Only a teacher of the course that contains the announcement may 5590// call this method. 5591// 5592// This method returns the following error codes: 5593// 5594// * `PERMISSION_DENIED` if the requesting user is not permitted to 5595// access the 5596// requested course or course work or for access errors. 5597// * `INVALID_ARGUMENT` if the request is malformed. 5598// * `NOT_FOUND` if the requested course or course work does not exist. 5599func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall { 5600 c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5601 c.courseId = courseId 5602 c.id = id 5603 c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest 5604 return c 5605} 5606 5607// Fields allows partial responses to be retrieved. See 5608// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5609// for more information. 5610func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall { 5611 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5612 return c 5613} 5614 5615// Context sets the context to be used in this call's Do method. Any 5616// pending HTTP request will be aborted if the provided context is 5617// canceled. 5618func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall { 5619 c.ctx_ = ctx 5620 return c 5621} 5622 5623// Header returns an http.Header that can be modified by the caller to 5624// add HTTP headers to the request. 5625func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header { 5626 if c.header_ == nil { 5627 c.header_ = make(http.Header) 5628 } 5629 return c.header_ 5630} 5631 5632func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 5633 reqHeaders := make(http.Header) 5634 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5635 for k, v := range c.header_ { 5636 reqHeaders[k] = v 5637 } 5638 reqHeaders.Set("User-Agent", c.s.userAgent()) 5639 var body io.Reader = nil 5640 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest) 5641 if err != nil { 5642 return nil, err 5643 } 5644 reqHeaders.Set("Content-Type", "application/json") 5645 c.urlParams_.Set("alt", alt) 5646 c.urlParams_.Set("prettyPrint", "false") 5647 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees") 5648 urls += "?" + c.urlParams_.Encode() 5649 req, err := http.NewRequest("POST", urls, body) 5650 if err != nil { 5651 return nil, err 5652 } 5653 req.Header = reqHeaders 5654 googleapi.Expand(req.URL, map[string]string{ 5655 "courseId": c.courseId, 5656 "id": c.id, 5657 }) 5658 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5659} 5660 5661// Do executes the "classroom.courses.announcements.modifyAssignees" call. 5662// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5663// status code is an error. Response headers are in either 5664// *Announcement.ServerResponse.Header or (if a response was returned at 5665// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5666// to check whether the returned error was because 5667// http.StatusNotModified was returned. 5668func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5669 gensupport.SetOptions(c.urlParams_, opts...) 5670 res, err := c.doRequest("json") 5671 if res != nil && res.StatusCode == http.StatusNotModified { 5672 if res.Body != nil { 5673 res.Body.Close() 5674 } 5675 return nil, &googleapi.Error{ 5676 Code: res.StatusCode, 5677 Header: res.Header, 5678 } 5679 } 5680 if err != nil { 5681 return nil, err 5682 } 5683 defer googleapi.CloseBody(res) 5684 if err := googleapi.CheckResponse(res); err != nil { 5685 return nil, err 5686 } 5687 ret := &Announcement{ 5688 ServerResponse: googleapi.ServerResponse{ 5689 Header: res.Header, 5690 HTTPStatusCode: res.StatusCode, 5691 }, 5692 } 5693 target := &ret 5694 if err := gensupport.DecodeResponse(target, res); err != nil { 5695 return nil, err 5696 } 5697 return ret, nil 5698 // { 5699 // "description": "Modifies assignee mode and options of an announcement.\n\nOnly a teacher of the course that contains the announcement may\ncall this method.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or course work does not exist.", 5700 // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5701 // "httpMethod": "POST", 5702 // "id": "classroom.courses.announcements.modifyAssignees", 5703 // "parameterOrder": [ 5704 // "courseId", 5705 // "id" 5706 // ], 5707 // "parameters": { 5708 // "courseId": { 5709 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5710 // "location": "path", 5711 // "required": true, 5712 // "type": "string" 5713 // }, 5714 // "id": { 5715 // "description": "Identifier of the announcement.", 5716 // "location": "path", 5717 // "required": true, 5718 // "type": "string" 5719 // } 5720 // }, 5721 // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5722 // "request": { 5723 // "$ref": "ModifyAnnouncementAssigneesRequest" 5724 // }, 5725 // "response": { 5726 // "$ref": "Announcement" 5727 // }, 5728 // "scopes": [ 5729 // "https://www.googleapis.com/auth/classroom.announcements" 5730 // ] 5731 // } 5732 5733} 5734 5735// method id "classroom.courses.announcements.patch": 5736 5737type CoursesAnnouncementsPatchCall struct { 5738 s *Service 5739 courseId string 5740 id string 5741 announcement *Announcement 5742 urlParams_ gensupport.URLParams 5743 ctx_ context.Context 5744 header_ http.Header 5745} 5746 5747// Patch: Updates one or more fields of an announcement. 5748// 5749// This method returns the following error codes: 5750// 5751// * `PERMISSION_DENIED` if the requesting developer project did not 5752// create 5753// the corresponding announcement or for access errors. 5754// * `INVALID_ARGUMENT` if the request is malformed. 5755// * `FAILED_PRECONDITION` if the requested announcement has already 5756// been 5757// deleted. 5758// * `NOT_FOUND` if the requested course or announcement does not exist 5759func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall { 5760 c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5761 c.courseId = courseId 5762 c.id = id 5763 c.announcement = announcement 5764 return c 5765} 5766 5767// UpdateMask sets the optional parameter "updateMask": Mask that 5768// identifies which fields on the announcement to update. 5769// This field is required to do an update. The update fails if 5770// invalid 5771// fields are specified. If a field supports empty values, it can be 5772// cleared 5773// by specifying it in the update mask and not in the Announcement 5774// object. If 5775// a field that does not support empty values is included in the update 5776// mask 5777// and not set in the Announcement object, an `INVALID_ARGUMENT` error 5778// is 5779// returned. 5780// 5781// The following fields may be specified by teachers: 5782// 5783// * `text` 5784// * `state` 5785// * `scheduled_time` 5786func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall { 5787 c.urlParams_.Set("updateMask", updateMask) 5788 return c 5789} 5790 5791// Fields allows partial responses to be retrieved. See 5792// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5793// for more information. 5794func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall { 5795 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5796 return c 5797} 5798 5799// Context sets the context to be used in this call's Do method. Any 5800// pending HTTP request will be aborted if the provided context is 5801// canceled. 5802func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall { 5803 c.ctx_ = ctx 5804 return c 5805} 5806 5807// Header returns an http.Header that can be modified by the caller to 5808// add HTTP headers to the request. 5809func (c *CoursesAnnouncementsPatchCall) Header() http.Header { 5810 if c.header_ == nil { 5811 c.header_ = make(http.Header) 5812 } 5813 return c.header_ 5814} 5815 5816func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) { 5817 reqHeaders := make(http.Header) 5818 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5819 for k, v := range c.header_ { 5820 reqHeaders[k] = v 5821 } 5822 reqHeaders.Set("User-Agent", c.s.userAgent()) 5823 var body io.Reader = nil 5824 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 5825 if err != nil { 5826 return nil, err 5827 } 5828 reqHeaders.Set("Content-Type", "application/json") 5829 c.urlParams_.Set("alt", alt) 5830 c.urlParams_.Set("prettyPrint", "false") 5831 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5832 urls += "?" + c.urlParams_.Encode() 5833 req, err := http.NewRequest("PATCH", urls, body) 5834 if err != nil { 5835 return nil, err 5836 } 5837 req.Header = reqHeaders 5838 googleapi.Expand(req.URL, map[string]string{ 5839 "courseId": c.courseId, 5840 "id": c.id, 5841 }) 5842 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5843} 5844 5845// Do executes the "classroom.courses.announcements.patch" call. 5846// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5847// status code is an error. Response headers are in either 5848// *Announcement.ServerResponse.Header or (if a response was returned at 5849// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5850// to check whether the returned error was because 5851// http.StatusNotModified was returned. 5852func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5853 gensupport.SetOptions(c.urlParams_, opts...) 5854 res, err := c.doRequest("json") 5855 if res != nil && res.StatusCode == http.StatusNotModified { 5856 if res.Body != nil { 5857 res.Body.Close() 5858 } 5859 return nil, &googleapi.Error{ 5860 Code: res.StatusCode, 5861 Header: res.Header, 5862 } 5863 } 5864 if err != nil { 5865 return nil, err 5866 } 5867 defer googleapi.CloseBody(res) 5868 if err := googleapi.CheckResponse(res); err != nil { 5869 return nil, err 5870 } 5871 ret := &Announcement{ 5872 ServerResponse: googleapi.ServerResponse{ 5873 Header: res.Header, 5874 HTTPStatusCode: res.StatusCode, 5875 }, 5876 } 5877 target := &ret 5878 if err := gensupport.DecodeResponse(target, res); err != nil { 5879 return nil, err 5880 } 5881 return ret, nil 5882 // { 5883 // "description": "Updates one or more fields of an announcement.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding announcement or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `FAILED_PRECONDITION` if the requested announcement has already been\ndeleted.\n* `NOT_FOUND` if the requested course or announcement does not exist", 5884 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5885 // "httpMethod": "PATCH", 5886 // "id": "classroom.courses.announcements.patch", 5887 // "parameterOrder": [ 5888 // "courseId", 5889 // "id" 5890 // ], 5891 // "parameters": { 5892 // "courseId": { 5893 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5894 // "location": "path", 5895 // "required": true, 5896 // "type": "string" 5897 // }, 5898 // "id": { 5899 // "description": "Identifier of the announcement.", 5900 // "location": "path", 5901 // "required": true, 5902 // "type": "string" 5903 // }, 5904 // "updateMask": { 5905 // "description": "Mask that identifies which fields on the announcement to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified. If a field supports empty values, it can be cleared\nby specifying it in the update mask and not in the Announcement object. If\na field that does not support empty values is included in the update mask\nand not set in the Announcement object, an `INVALID_ARGUMENT` error is\nreturned.\n\nThe following fields may be specified by teachers:\n\n* `text`\n* `state`\n* `scheduled_time`", 5906 // "format": "google-fieldmask", 5907 // "location": "query", 5908 // "type": "string" 5909 // } 5910 // }, 5911 // "path": "v1/courses/{courseId}/announcements/{id}", 5912 // "request": { 5913 // "$ref": "Announcement" 5914 // }, 5915 // "response": { 5916 // "$ref": "Announcement" 5917 // }, 5918 // "scopes": [ 5919 // "https://www.googleapis.com/auth/classroom.announcements" 5920 // ] 5921 // } 5922 5923} 5924 5925// method id "classroom.courses.courseWork.create": 5926 5927type CoursesCourseWorkCreateCall struct { 5928 s *Service 5929 courseId string 5930 coursework *CourseWork 5931 urlParams_ gensupport.URLParams 5932 ctx_ context.Context 5933 header_ http.Header 5934} 5935 5936// Create: Creates course work. 5937// 5938// The resulting course work (and corresponding student submissions) 5939// are 5940// associated with the Developer Console project of the 5941// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5942// used to 5943// make the request. Classroom API requests to modify course work and 5944// student 5945// submissions must be made with an OAuth client ID from the 5946// associated 5947// Developer Console project. 5948// 5949// This method returns the following error codes: 5950// 5951// * `PERMISSION_DENIED` if the requesting user is not permitted to 5952// access the 5953// requested course, create course work in the requested course, share 5954// a 5955// Drive attachment, or for access errors. 5956// * `INVALID_ARGUMENT` if the request is malformed. 5957// * `NOT_FOUND` if the requested course does not exist. 5958// * `FAILED_PRECONDITION` for the following request error: 5959// * AttachmentNotVisible 5960func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall { 5961 c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5962 c.courseId = courseId 5963 c.coursework = coursework 5964 return c 5965} 5966 5967// Fields allows partial responses to be retrieved. See 5968// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5969// for more information. 5970func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall { 5971 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5972 return c 5973} 5974 5975// Context sets the context to be used in this call's Do method. Any 5976// pending HTTP request will be aborted if the provided context is 5977// canceled. 5978func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall { 5979 c.ctx_ = ctx 5980 return c 5981} 5982 5983// Header returns an http.Header that can be modified by the caller to 5984// add HTTP headers to the request. 5985func (c *CoursesCourseWorkCreateCall) Header() http.Header { 5986 if c.header_ == nil { 5987 c.header_ = make(http.Header) 5988 } 5989 return c.header_ 5990} 5991 5992func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) { 5993 reqHeaders := make(http.Header) 5994 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5995 for k, v := range c.header_ { 5996 reqHeaders[k] = v 5997 } 5998 reqHeaders.Set("User-Agent", c.s.userAgent()) 5999 var body io.Reader = nil 6000 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6001 if err != nil { 6002 return nil, err 6003 } 6004 reqHeaders.Set("Content-Type", "application/json") 6005 c.urlParams_.Set("alt", alt) 6006 c.urlParams_.Set("prettyPrint", "false") 6007 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6008 urls += "?" + c.urlParams_.Encode() 6009 req, err := http.NewRequest("POST", urls, body) 6010 if err != nil { 6011 return nil, err 6012 } 6013 req.Header = reqHeaders 6014 googleapi.Expand(req.URL, map[string]string{ 6015 "courseId": c.courseId, 6016 }) 6017 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6018} 6019 6020// Do executes the "classroom.courses.courseWork.create" call. 6021// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6022// status code is an error. Response headers are in either 6023// *CourseWork.ServerResponse.Header or (if a response was returned at 6024// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6025// to check whether the returned error was because 6026// http.StatusNotModified was returned. 6027func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6028 gensupport.SetOptions(c.urlParams_, opts...) 6029 res, err := c.doRequest("json") 6030 if res != nil && res.StatusCode == http.StatusNotModified { 6031 if res.Body != nil { 6032 res.Body.Close() 6033 } 6034 return nil, &googleapi.Error{ 6035 Code: res.StatusCode, 6036 Header: res.Header, 6037 } 6038 } 6039 if err != nil { 6040 return nil, err 6041 } 6042 defer googleapi.CloseBody(res) 6043 if err := googleapi.CheckResponse(res); err != nil { 6044 return nil, err 6045 } 6046 ret := &CourseWork{ 6047 ServerResponse: googleapi.ServerResponse{ 6048 Header: res.Header, 6049 HTTPStatusCode: res.StatusCode, 6050 }, 6051 } 6052 target := &ret 6053 if err := gensupport.DecodeResponse(target, res); err != nil { 6054 return nil, err 6055 } 6056 return ret, nil 6057 // { 6058 // "description": "Creates course work.\n\nThe resulting course work (and corresponding student submissions) are\nassociated with the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\nmake the request. Classroom API requests to modify course work and student\nsubmissions must be made with an OAuth client ID from the associated\nDeveloper Console project.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, create course work in the requested course, share a\nDrive attachment, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.\n* `FAILED_PRECONDITION` for the following request error:\n * AttachmentNotVisible", 6059 // "flatPath": "v1/courses/{courseId}/courseWork", 6060 // "httpMethod": "POST", 6061 // "id": "classroom.courses.courseWork.create", 6062 // "parameterOrder": [ 6063 // "courseId" 6064 // ], 6065 // "parameters": { 6066 // "courseId": { 6067 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6068 // "location": "path", 6069 // "required": true, 6070 // "type": "string" 6071 // } 6072 // }, 6073 // "path": "v1/courses/{courseId}/courseWork", 6074 // "request": { 6075 // "$ref": "CourseWork" 6076 // }, 6077 // "response": { 6078 // "$ref": "CourseWork" 6079 // }, 6080 // "scopes": [ 6081 // "https://www.googleapis.com/auth/classroom.coursework.students" 6082 // ] 6083 // } 6084 6085} 6086 6087// method id "classroom.courses.courseWork.delete": 6088 6089type CoursesCourseWorkDeleteCall struct { 6090 s *Service 6091 courseId string 6092 id string 6093 urlParams_ gensupport.URLParams 6094 ctx_ context.Context 6095 header_ http.Header 6096} 6097 6098// Delete: Deletes a course work. 6099// 6100// This request must be made by the Developer Console project of 6101// the 6102// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6103// used to 6104// create the corresponding course work item. 6105// 6106// This method returns the following error codes: 6107// 6108// * `PERMISSION_DENIED` if the requesting developer project did not 6109// create 6110// the corresponding course work, if the requesting user is not 6111// permitted 6112// to delete the requested course or for access errors. 6113// * `FAILED_PRECONDITION` if the requested course work has already 6114// been 6115// deleted. 6116// * `NOT_FOUND` if no course exists with the requested ID. 6117func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall { 6118 c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6119 c.courseId = courseId 6120 c.id = id 6121 return c 6122} 6123 6124// Fields allows partial responses to be retrieved. See 6125// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6126// for more information. 6127func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall { 6128 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6129 return c 6130} 6131 6132// Context sets the context to be used in this call's Do method. Any 6133// pending HTTP request will be aborted if the provided context is 6134// canceled. 6135func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall { 6136 c.ctx_ = ctx 6137 return c 6138} 6139 6140// Header returns an http.Header that can be modified by the caller to 6141// add HTTP headers to the request. 6142func (c *CoursesCourseWorkDeleteCall) Header() http.Header { 6143 if c.header_ == nil { 6144 c.header_ = make(http.Header) 6145 } 6146 return c.header_ 6147} 6148 6149func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) { 6150 reqHeaders := make(http.Header) 6151 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6152 for k, v := range c.header_ { 6153 reqHeaders[k] = v 6154 } 6155 reqHeaders.Set("User-Agent", c.s.userAgent()) 6156 var body io.Reader = nil 6157 c.urlParams_.Set("alt", alt) 6158 c.urlParams_.Set("prettyPrint", "false") 6159 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6160 urls += "?" + c.urlParams_.Encode() 6161 req, err := http.NewRequest("DELETE", urls, body) 6162 if err != nil { 6163 return nil, err 6164 } 6165 req.Header = reqHeaders 6166 googleapi.Expand(req.URL, map[string]string{ 6167 "courseId": c.courseId, 6168 "id": c.id, 6169 }) 6170 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6171} 6172 6173// Do executes the "classroom.courses.courseWork.delete" call. 6174// Exactly one of *Empty or error will be non-nil. Any non-2xx status 6175// code is an error. Response headers are in either 6176// *Empty.ServerResponse.Header or (if a response was returned at all) 6177// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6178// check whether the returned error was because http.StatusNotModified 6179// was returned. 6180func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 6181 gensupport.SetOptions(c.urlParams_, opts...) 6182 res, err := c.doRequest("json") 6183 if res != nil && res.StatusCode == http.StatusNotModified { 6184 if res.Body != nil { 6185 res.Body.Close() 6186 } 6187 return nil, &googleapi.Error{ 6188 Code: res.StatusCode, 6189 Header: res.Header, 6190 } 6191 } 6192 if err != nil { 6193 return nil, err 6194 } 6195 defer googleapi.CloseBody(res) 6196 if err := googleapi.CheckResponse(res); err != nil { 6197 return nil, err 6198 } 6199 ret := &Empty{ 6200 ServerResponse: googleapi.ServerResponse{ 6201 Header: res.Header, 6202 HTTPStatusCode: res.StatusCode, 6203 }, 6204 } 6205 target := &ret 6206 if err := gensupport.DecodeResponse(target, res); err != nil { 6207 return nil, err 6208 } 6209 return ret, nil 6210 // { 6211 // "description": "Deletes a course work.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding course work, if the requesting user is not permitted\nto delete the requested course or for access errors.\n* `FAILED_PRECONDITION` if the requested course work has already been\ndeleted.\n* `NOT_FOUND` if no course exists with the requested ID.", 6212 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6213 // "httpMethod": "DELETE", 6214 // "id": "classroom.courses.courseWork.delete", 6215 // "parameterOrder": [ 6216 // "courseId", 6217 // "id" 6218 // ], 6219 // "parameters": { 6220 // "courseId": { 6221 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6222 // "location": "path", 6223 // "required": true, 6224 // "type": "string" 6225 // }, 6226 // "id": { 6227 // "description": "Identifier of the course work to delete.\nThis identifier is a Classroom-assigned identifier.", 6228 // "location": "path", 6229 // "required": true, 6230 // "type": "string" 6231 // } 6232 // }, 6233 // "path": "v1/courses/{courseId}/courseWork/{id}", 6234 // "response": { 6235 // "$ref": "Empty" 6236 // }, 6237 // "scopes": [ 6238 // "https://www.googleapis.com/auth/classroom.coursework.students" 6239 // ] 6240 // } 6241 6242} 6243 6244// method id "classroom.courses.courseWork.get": 6245 6246type CoursesCourseWorkGetCall struct { 6247 s *Service 6248 courseId string 6249 id string 6250 urlParams_ gensupport.URLParams 6251 ifNoneMatch_ string 6252 ctx_ context.Context 6253 header_ http.Header 6254} 6255 6256// Get: Returns course work. 6257// 6258// This method returns the following error codes: 6259// 6260// * `PERMISSION_DENIED` if the requesting user is not permitted to 6261// access the 6262// requested course or course work, or for access errors. 6263// * `INVALID_ARGUMENT` if the request is malformed. 6264// * `NOT_FOUND` if the requested course or course work does not exist. 6265func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall { 6266 c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6267 c.courseId = courseId 6268 c.id = id 6269 return c 6270} 6271 6272// Fields allows partial responses to be retrieved. See 6273// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6274// for more information. 6275func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall { 6276 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6277 return c 6278} 6279 6280// IfNoneMatch sets the optional parameter which makes the operation 6281// fail if the object's ETag matches the given value. This is useful for 6282// getting updates only after the object has changed since the last 6283// request. Use googleapi.IsNotModified to check whether the response 6284// error from Do is the result of In-None-Match. 6285func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall { 6286 c.ifNoneMatch_ = entityTag 6287 return c 6288} 6289 6290// Context sets the context to be used in this call's Do method. Any 6291// pending HTTP request will be aborted if the provided context is 6292// canceled. 6293func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall { 6294 c.ctx_ = ctx 6295 return c 6296} 6297 6298// Header returns an http.Header that can be modified by the caller to 6299// add HTTP headers to the request. 6300func (c *CoursesCourseWorkGetCall) Header() http.Header { 6301 if c.header_ == nil { 6302 c.header_ = make(http.Header) 6303 } 6304 return c.header_ 6305} 6306 6307func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) { 6308 reqHeaders := make(http.Header) 6309 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6310 for k, v := range c.header_ { 6311 reqHeaders[k] = v 6312 } 6313 reqHeaders.Set("User-Agent", c.s.userAgent()) 6314 if c.ifNoneMatch_ != "" { 6315 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6316 } 6317 var body io.Reader = nil 6318 c.urlParams_.Set("alt", alt) 6319 c.urlParams_.Set("prettyPrint", "false") 6320 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6321 urls += "?" + c.urlParams_.Encode() 6322 req, err := http.NewRequest("GET", urls, body) 6323 if err != nil { 6324 return nil, err 6325 } 6326 req.Header = reqHeaders 6327 googleapi.Expand(req.URL, map[string]string{ 6328 "courseId": c.courseId, 6329 "id": c.id, 6330 }) 6331 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6332} 6333 6334// Do executes the "classroom.courses.courseWork.get" call. 6335// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6336// status code is an error. Response headers are in either 6337// *CourseWork.ServerResponse.Header or (if a response was returned at 6338// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6339// to check whether the returned error was because 6340// http.StatusNotModified was returned. 6341func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6342 gensupport.SetOptions(c.urlParams_, opts...) 6343 res, err := c.doRequest("json") 6344 if res != nil && res.StatusCode == http.StatusNotModified { 6345 if res.Body != nil { 6346 res.Body.Close() 6347 } 6348 return nil, &googleapi.Error{ 6349 Code: res.StatusCode, 6350 Header: res.Header, 6351 } 6352 } 6353 if err != nil { 6354 return nil, err 6355 } 6356 defer googleapi.CloseBody(res) 6357 if err := googleapi.CheckResponse(res); err != nil { 6358 return nil, err 6359 } 6360 ret := &CourseWork{ 6361 ServerResponse: googleapi.ServerResponse{ 6362 Header: res.Header, 6363 HTTPStatusCode: res.StatusCode, 6364 }, 6365 } 6366 target := &ret 6367 if err := gensupport.DecodeResponse(target, res); err != nil { 6368 return nil, err 6369 } 6370 return ret, nil 6371 // { 6372 // "description": "Returns course work.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or course work does not exist.", 6373 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6374 // "httpMethod": "GET", 6375 // "id": "classroom.courses.courseWork.get", 6376 // "parameterOrder": [ 6377 // "courseId", 6378 // "id" 6379 // ], 6380 // "parameters": { 6381 // "courseId": { 6382 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6383 // "location": "path", 6384 // "required": true, 6385 // "type": "string" 6386 // }, 6387 // "id": { 6388 // "description": "Identifier of the course work.", 6389 // "location": "path", 6390 // "required": true, 6391 // "type": "string" 6392 // } 6393 // }, 6394 // "path": "v1/courses/{courseId}/courseWork/{id}", 6395 // "response": { 6396 // "$ref": "CourseWork" 6397 // }, 6398 // "scopes": [ 6399 // "https://www.googleapis.com/auth/classroom.coursework.me", 6400 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6401 // "https://www.googleapis.com/auth/classroom.coursework.students", 6402 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6403 // ] 6404 // } 6405 6406} 6407 6408// method id "classroom.courses.courseWork.list": 6409 6410type CoursesCourseWorkListCall struct { 6411 s *Service 6412 courseId string 6413 urlParams_ gensupport.URLParams 6414 ifNoneMatch_ string 6415 ctx_ context.Context 6416 header_ http.Header 6417} 6418 6419// List: Returns a list of course work that the requester is permitted 6420// to view. 6421// 6422// Course students may only view `PUBLISHED` course work. Course 6423// teachers 6424// and domain administrators may view all course work. 6425// 6426// This method returns the following error codes: 6427// 6428// * `PERMISSION_DENIED` if the requesting user is not permitted to 6429// access 6430// the requested course or for access errors. 6431// * `INVALID_ARGUMENT` if the request is malformed. 6432// * `NOT_FOUND` if the requested course does not exist. 6433func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall { 6434 c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6435 c.courseId = courseId 6436 return c 6437} 6438 6439// CourseWorkStates sets the optional parameter "courseWorkStates": 6440// Restriction on the work status to return. Only courseWork that 6441// matches 6442// is returned. If unspecified, items with a work status of 6443// `PUBLISHED` 6444// is returned. 6445// 6446// Possible values: 6447// "COURSE_WORK_STATE_UNSPECIFIED" 6448// "PUBLISHED" 6449// "DRAFT" 6450// "DELETED" 6451func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall { 6452 c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...)) 6453 return c 6454} 6455 6456// OrderBy sets the optional parameter "orderBy": Optional sort ordering 6457// for results. A comma-separated list of fields with 6458// an optional sort direction keyword. Supported fields are 6459// `updateTime` 6460// and `dueDate`. Supported direction keywords are `asc` and `desc`. 6461// If not specified, `updateTime desc` is the default 6462// behavior. 6463// Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc` 6464func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall { 6465 c.urlParams_.Set("orderBy", orderBy) 6466 return c 6467} 6468 6469// PageSize sets the optional parameter "pageSize": Maximum number of 6470// items to return. Zero or unspecified indicates that the 6471// server may assign a maximum. 6472// 6473// The server may return fewer than the specified number of results. 6474func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall { 6475 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6476 return c 6477} 6478 6479// PageToken sets the optional parameter "pageToken": 6480// nextPageToken 6481// value returned from a previous 6482// list call, 6483// indicating that the subsequent page of results should be 6484// returned. 6485// 6486// The list request 6487// must be otherwise identical to the one that resulted in this token. 6488func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall { 6489 c.urlParams_.Set("pageToken", pageToken) 6490 return c 6491} 6492 6493// Fields allows partial responses to be retrieved. See 6494// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6495// for more information. 6496func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall { 6497 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6498 return c 6499} 6500 6501// IfNoneMatch sets the optional parameter which makes the operation 6502// fail if the object's ETag matches the given value. This is useful for 6503// getting updates only after the object has changed since the last 6504// request. Use googleapi.IsNotModified to check whether the response 6505// error from Do is the result of In-None-Match. 6506func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall { 6507 c.ifNoneMatch_ = entityTag 6508 return c 6509} 6510 6511// Context sets the context to be used in this call's Do method. Any 6512// pending HTTP request will be aborted if the provided context is 6513// canceled. 6514func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall { 6515 c.ctx_ = ctx 6516 return c 6517} 6518 6519// Header returns an http.Header that can be modified by the caller to 6520// add HTTP headers to the request. 6521func (c *CoursesCourseWorkListCall) Header() http.Header { 6522 if c.header_ == nil { 6523 c.header_ = make(http.Header) 6524 } 6525 return c.header_ 6526} 6527 6528func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) { 6529 reqHeaders := make(http.Header) 6530 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6531 for k, v := range c.header_ { 6532 reqHeaders[k] = v 6533 } 6534 reqHeaders.Set("User-Agent", c.s.userAgent()) 6535 if c.ifNoneMatch_ != "" { 6536 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6537 } 6538 var body io.Reader = nil 6539 c.urlParams_.Set("alt", alt) 6540 c.urlParams_.Set("prettyPrint", "false") 6541 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6542 urls += "?" + c.urlParams_.Encode() 6543 req, err := http.NewRequest("GET", urls, body) 6544 if err != nil { 6545 return nil, err 6546 } 6547 req.Header = reqHeaders 6548 googleapi.Expand(req.URL, map[string]string{ 6549 "courseId": c.courseId, 6550 }) 6551 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6552} 6553 6554// Do executes the "classroom.courses.courseWork.list" call. 6555// Exactly one of *ListCourseWorkResponse or error will be non-nil. Any 6556// non-2xx status code is an error. Response headers are in either 6557// *ListCourseWorkResponse.ServerResponse.Header or (if a response was 6558// returned at all) in error.(*googleapi.Error).Header. Use 6559// googleapi.IsNotModified to check whether the returned error was 6560// because http.StatusNotModified was returned. 6561func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) { 6562 gensupport.SetOptions(c.urlParams_, opts...) 6563 res, err := c.doRequest("json") 6564 if res != nil && res.StatusCode == http.StatusNotModified { 6565 if res.Body != nil { 6566 res.Body.Close() 6567 } 6568 return nil, &googleapi.Error{ 6569 Code: res.StatusCode, 6570 Header: res.Header, 6571 } 6572 } 6573 if err != nil { 6574 return nil, err 6575 } 6576 defer googleapi.CloseBody(res) 6577 if err := googleapi.CheckResponse(res); err != nil { 6578 return nil, err 6579 } 6580 ret := &ListCourseWorkResponse{ 6581 ServerResponse: googleapi.ServerResponse{ 6582 Header: res.Header, 6583 HTTPStatusCode: res.StatusCode, 6584 }, 6585 } 6586 target := &ret 6587 if err := gensupport.DecodeResponse(target, res); err != nil { 6588 return nil, err 6589 } 6590 return ret, nil 6591 // { 6592 // "description": "Returns a list of course work that the requester is permitted to view.\n\nCourse students may only view `PUBLISHED` course work. Course teachers\nand domain administrators may view all course work.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthe requested course or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.", 6593 // "flatPath": "v1/courses/{courseId}/courseWork", 6594 // "httpMethod": "GET", 6595 // "id": "classroom.courses.courseWork.list", 6596 // "parameterOrder": [ 6597 // "courseId" 6598 // ], 6599 // "parameters": { 6600 // "courseId": { 6601 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6602 // "location": "path", 6603 // "required": true, 6604 // "type": "string" 6605 // }, 6606 // "courseWorkStates": { 6607 // "description": "Restriction on the work status to return. Only courseWork that matches\nis returned. If unspecified, items with a work status of `PUBLISHED`\nis returned.", 6608 // "enum": [ 6609 // "COURSE_WORK_STATE_UNSPECIFIED", 6610 // "PUBLISHED", 6611 // "DRAFT", 6612 // "DELETED" 6613 // ], 6614 // "location": "query", 6615 // "repeated": true, 6616 // "type": "string" 6617 // }, 6618 // "orderBy": { 6619 // "description": "Optional sort ordering for results. A comma-separated list of fields with\nan optional sort direction keyword. Supported fields are `updateTime`\nand `dueDate`. Supported direction keywords are `asc` and `desc`.\nIf not specified, `updateTime desc` is the default behavior.\nExamples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc`", 6620 // "location": "query", 6621 // "type": "string" 6622 // }, 6623 // "pageSize": { 6624 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 6625 // "format": "int32", 6626 // "location": "query", 6627 // "type": "integer" 6628 // }, 6629 // "pageToken": { 6630 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 6631 // "location": "query", 6632 // "type": "string" 6633 // } 6634 // }, 6635 // "path": "v1/courses/{courseId}/courseWork", 6636 // "response": { 6637 // "$ref": "ListCourseWorkResponse" 6638 // }, 6639 // "scopes": [ 6640 // "https://www.googleapis.com/auth/classroom.coursework.me", 6641 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6642 // "https://www.googleapis.com/auth/classroom.coursework.students", 6643 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6644 // ] 6645 // } 6646 6647} 6648 6649// Pages invokes f for each page of results. 6650// A non-nil error returned from f will halt the iteration. 6651// The provided context supersedes any context provided to the Context method. 6652func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error { 6653 c.ctx_ = ctx 6654 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6655 for { 6656 x, err := c.Do() 6657 if err != nil { 6658 return err 6659 } 6660 if err := f(x); err != nil { 6661 return err 6662 } 6663 if x.NextPageToken == "" { 6664 return nil 6665 } 6666 c.PageToken(x.NextPageToken) 6667 } 6668} 6669 6670// method id "classroom.courses.courseWork.modifyAssignees": 6671 6672type CoursesCourseWorkModifyAssigneesCall struct { 6673 s *Service 6674 courseId string 6675 id string 6676 modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest 6677 urlParams_ gensupport.URLParams 6678 ctx_ context.Context 6679 header_ http.Header 6680} 6681 6682// ModifyAssignees: Modifies assignee mode and options of a 6683// coursework. 6684// 6685// Only a teacher of the course that contains the coursework may 6686// call this method. 6687// 6688// This method returns the following error codes: 6689// 6690// * `PERMISSION_DENIED` if the requesting user is not permitted to 6691// access the 6692// requested course or course work or for access errors. 6693// * `INVALID_ARGUMENT` if the request is malformed. 6694// * `NOT_FOUND` if the requested course or course work does not exist. 6695func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall { 6696 c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6697 c.courseId = courseId 6698 c.id = id 6699 c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest 6700 return c 6701} 6702 6703// Fields allows partial responses to be retrieved. See 6704// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6705// for more information. 6706func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall { 6707 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6708 return c 6709} 6710 6711// Context sets the context to be used in this call's Do method. Any 6712// pending HTTP request will be aborted if the provided context is 6713// canceled. 6714func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall { 6715 c.ctx_ = ctx 6716 return c 6717} 6718 6719// Header returns an http.Header that can be modified by the caller to 6720// add HTTP headers to the request. 6721func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header { 6722 if c.header_ == nil { 6723 c.header_ = make(http.Header) 6724 } 6725 return c.header_ 6726} 6727 6728func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 6729 reqHeaders := make(http.Header) 6730 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6731 for k, v := range c.header_ { 6732 reqHeaders[k] = v 6733 } 6734 reqHeaders.Set("User-Agent", c.s.userAgent()) 6735 var body io.Reader = nil 6736 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest) 6737 if err != nil { 6738 return nil, err 6739 } 6740 reqHeaders.Set("Content-Type", "application/json") 6741 c.urlParams_.Set("alt", alt) 6742 c.urlParams_.Set("prettyPrint", "false") 6743 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees") 6744 urls += "?" + c.urlParams_.Encode() 6745 req, err := http.NewRequest("POST", urls, body) 6746 if err != nil { 6747 return nil, err 6748 } 6749 req.Header = reqHeaders 6750 googleapi.Expand(req.URL, map[string]string{ 6751 "courseId": c.courseId, 6752 "id": c.id, 6753 }) 6754 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6755} 6756 6757// Do executes the "classroom.courses.courseWork.modifyAssignees" call. 6758// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6759// status code is an error. Response headers are in either 6760// *CourseWork.ServerResponse.Header or (if a response was returned at 6761// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6762// to check whether the returned error was because 6763// http.StatusNotModified was returned. 6764func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6765 gensupport.SetOptions(c.urlParams_, opts...) 6766 res, err := c.doRequest("json") 6767 if res != nil && res.StatusCode == http.StatusNotModified { 6768 if res.Body != nil { 6769 res.Body.Close() 6770 } 6771 return nil, &googleapi.Error{ 6772 Code: res.StatusCode, 6773 Header: res.Header, 6774 } 6775 } 6776 if err != nil { 6777 return nil, err 6778 } 6779 defer googleapi.CloseBody(res) 6780 if err := googleapi.CheckResponse(res); err != nil { 6781 return nil, err 6782 } 6783 ret := &CourseWork{ 6784 ServerResponse: googleapi.ServerResponse{ 6785 Header: res.Header, 6786 HTTPStatusCode: res.StatusCode, 6787 }, 6788 } 6789 target := &ret 6790 if err := gensupport.DecodeResponse(target, res); err != nil { 6791 return nil, err 6792 } 6793 return ret, nil 6794 // { 6795 // "description": "Modifies assignee mode and options of a coursework.\n\nOnly a teacher of the course that contains the coursework may\ncall this method.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or course work does not exist.", 6796 // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6797 // "httpMethod": "POST", 6798 // "id": "classroom.courses.courseWork.modifyAssignees", 6799 // "parameterOrder": [ 6800 // "courseId", 6801 // "id" 6802 // ], 6803 // "parameters": { 6804 // "courseId": { 6805 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6806 // "location": "path", 6807 // "required": true, 6808 // "type": "string" 6809 // }, 6810 // "id": { 6811 // "description": "Identifier of the coursework.", 6812 // "location": "path", 6813 // "required": true, 6814 // "type": "string" 6815 // } 6816 // }, 6817 // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6818 // "request": { 6819 // "$ref": "ModifyCourseWorkAssigneesRequest" 6820 // }, 6821 // "response": { 6822 // "$ref": "CourseWork" 6823 // }, 6824 // "scopes": [ 6825 // "https://www.googleapis.com/auth/classroom.coursework.students" 6826 // ] 6827 // } 6828 6829} 6830 6831// method id "classroom.courses.courseWork.patch": 6832 6833type CoursesCourseWorkPatchCall struct { 6834 s *Service 6835 courseId string 6836 id string 6837 coursework *CourseWork 6838 urlParams_ gensupport.URLParams 6839 ctx_ context.Context 6840 header_ http.Header 6841} 6842 6843// Patch: Updates one or more fields of a course work. 6844// 6845// See google.classroom.v1.CourseWork for details 6846// of which fields may be updated and who may change them. 6847// 6848// This request must be made by the Developer Console project of 6849// the 6850// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6851// used to 6852// create the corresponding course work item. 6853// 6854// This method returns the following error codes: 6855// 6856// * `PERMISSION_DENIED` if the requesting developer project did not 6857// create 6858// the corresponding course work, if the user is not permitted to make 6859// the 6860// requested modification to the student submission, or for 6861// access errors. 6862// * `INVALID_ARGUMENT` if the request is malformed. 6863// * `FAILED_PRECONDITION` if the requested course work has already 6864// been 6865// deleted. 6866// * `NOT_FOUND` if the requested course, course work, or student 6867// submission 6868// does not exist. 6869func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall { 6870 c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6871 c.courseId = courseId 6872 c.id = id 6873 c.coursework = coursework 6874 return c 6875} 6876 6877// UpdateMask sets the optional parameter "updateMask": Mask that 6878// identifies which fields on the course work to update. 6879// This field is required to do an update. The update fails if 6880// invalid 6881// fields are specified. If a field supports empty values, it can be 6882// cleared 6883// by specifying it in the update mask and not in the CourseWork object. 6884// If a 6885// field that does not support empty values is included in the update 6886// mask and 6887// not set in the CourseWork object, an `INVALID_ARGUMENT` error 6888// is 6889// returned. 6890// 6891// The following fields may be specified by teachers: 6892// 6893// * `title` 6894// * `description` 6895// * `state` 6896// * `due_date` 6897// * `due_time` 6898// * `max_points` 6899// * `scheduled_time` 6900// * `submission_modification_mode` 6901// * `topic_id` 6902func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall { 6903 c.urlParams_.Set("updateMask", updateMask) 6904 return c 6905} 6906 6907// Fields allows partial responses to be retrieved. See 6908// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6909// for more information. 6910func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall { 6911 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6912 return c 6913} 6914 6915// Context sets the context to be used in this call's Do method. Any 6916// pending HTTP request will be aborted if the provided context is 6917// canceled. 6918func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall { 6919 c.ctx_ = ctx 6920 return c 6921} 6922 6923// Header returns an http.Header that can be modified by the caller to 6924// add HTTP headers to the request. 6925func (c *CoursesCourseWorkPatchCall) Header() http.Header { 6926 if c.header_ == nil { 6927 c.header_ = make(http.Header) 6928 } 6929 return c.header_ 6930} 6931 6932func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) { 6933 reqHeaders := make(http.Header) 6934 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6935 for k, v := range c.header_ { 6936 reqHeaders[k] = v 6937 } 6938 reqHeaders.Set("User-Agent", c.s.userAgent()) 6939 var body io.Reader = nil 6940 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6941 if err != nil { 6942 return nil, err 6943 } 6944 reqHeaders.Set("Content-Type", "application/json") 6945 c.urlParams_.Set("alt", alt) 6946 c.urlParams_.Set("prettyPrint", "false") 6947 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6948 urls += "?" + c.urlParams_.Encode() 6949 req, err := http.NewRequest("PATCH", urls, body) 6950 if err != nil { 6951 return nil, err 6952 } 6953 req.Header = reqHeaders 6954 googleapi.Expand(req.URL, map[string]string{ 6955 "courseId": c.courseId, 6956 "id": c.id, 6957 }) 6958 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6959} 6960 6961// Do executes the "classroom.courses.courseWork.patch" call. 6962// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6963// status code is an error. Response headers are in either 6964// *CourseWork.ServerResponse.Header or (if a response was returned at 6965// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6966// to check whether the returned error was because 6967// http.StatusNotModified was returned. 6968func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6969 gensupport.SetOptions(c.urlParams_, opts...) 6970 res, err := c.doRequest("json") 6971 if res != nil && res.StatusCode == http.StatusNotModified { 6972 if res.Body != nil { 6973 res.Body.Close() 6974 } 6975 return nil, &googleapi.Error{ 6976 Code: res.StatusCode, 6977 Header: res.Header, 6978 } 6979 } 6980 if err != nil { 6981 return nil, err 6982 } 6983 defer googleapi.CloseBody(res) 6984 if err := googleapi.CheckResponse(res); err != nil { 6985 return nil, err 6986 } 6987 ret := &CourseWork{ 6988 ServerResponse: googleapi.ServerResponse{ 6989 Header: res.Header, 6990 HTTPStatusCode: res.StatusCode, 6991 }, 6992 } 6993 target := &ret 6994 if err := gensupport.DecodeResponse(target, res); err != nil { 6995 return nil, err 6996 } 6997 return ret, nil 6998 // { 6999 // "description": "Updates one or more fields of a course work.\n\nSee google.classroom.v1.CourseWork for details\nof which fields may be updated and who may change them.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding course work, if the user is not permitted to make the\nrequested modification to the student submission, or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `FAILED_PRECONDITION` if the requested course work has already been\ndeleted.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 7000 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 7001 // "httpMethod": "PATCH", 7002 // "id": "classroom.courses.courseWork.patch", 7003 // "parameterOrder": [ 7004 // "courseId", 7005 // "id" 7006 // ], 7007 // "parameters": { 7008 // "courseId": { 7009 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7010 // "location": "path", 7011 // "required": true, 7012 // "type": "string" 7013 // }, 7014 // "id": { 7015 // "description": "Identifier of the course work.", 7016 // "location": "path", 7017 // "required": true, 7018 // "type": "string" 7019 // }, 7020 // "updateMask": { 7021 // "description": "Mask that identifies which fields on the course work to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified. If a field supports empty values, it can be cleared\nby specifying it in the update mask and not in the CourseWork object. If a\nfield that does not support empty values is included in the update mask and\nnot set in the CourseWork object, an `INVALID_ARGUMENT` error is\nreturned.\n\nThe following fields may be specified by teachers:\n\n* `title`\n* `description`\n* `state`\n* `due_date`\n* `due_time`\n* `max_points`\n* `scheduled_time`\n* `submission_modification_mode`\n* `topic_id`", 7022 // "format": "google-fieldmask", 7023 // "location": "query", 7024 // "type": "string" 7025 // } 7026 // }, 7027 // "path": "v1/courses/{courseId}/courseWork/{id}", 7028 // "request": { 7029 // "$ref": "CourseWork" 7030 // }, 7031 // "response": { 7032 // "$ref": "CourseWork" 7033 // }, 7034 // "scopes": [ 7035 // "https://www.googleapis.com/auth/classroom.coursework.students" 7036 // ] 7037 // } 7038 7039} 7040 7041// method id "classroom.courses.courseWork.studentSubmissions.get": 7042 7043type CoursesCourseWorkStudentSubmissionsGetCall struct { 7044 s *Service 7045 courseId string 7046 courseWorkId string 7047 id string 7048 urlParams_ gensupport.URLParams 7049 ifNoneMatch_ string 7050 ctx_ context.Context 7051 header_ http.Header 7052} 7053 7054// Get: Returns a student submission. 7055// 7056// * `PERMISSION_DENIED` if the requesting user is not permitted to 7057// access the 7058// requested course, course work, or student submission or for 7059// access errors. 7060// * `INVALID_ARGUMENT` if the request is malformed. 7061// * `NOT_FOUND` if the requested course, course work, or student 7062// submission 7063// does not exist. 7064func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall { 7065 c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7066 c.courseId = courseId 7067 c.courseWorkId = courseWorkId 7068 c.id = id 7069 return c 7070} 7071 7072// Fields allows partial responses to be retrieved. See 7073// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7074// for more information. 7075func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall { 7076 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7077 return c 7078} 7079 7080// IfNoneMatch sets the optional parameter which makes the operation 7081// fail if the object's ETag matches the given value. This is useful for 7082// getting updates only after the object has changed since the last 7083// request. Use googleapi.IsNotModified to check whether the response 7084// error from Do is the result of In-None-Match. 7085func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall { 7086 c.ifNoneMatch_ = entityTag 7087 return c 7088} 7089 7090// Context sets the context to be used in this call's Do method. Any 7091// pending HTTP request will be aborted if the provided context is 7092// canceled. 7093func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall { 7094 c.ctx_ = ctx 7095 return c 7096} 7097 7098// Header returns an http.Header that can be modified by the caller to 7099// add HTTP headers to the request. 7100func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header { 7101 if c.header_ == nil { 7102 c.header_ = make(http.Header) 7103 } 7104 return c.header_ 7105} 7106 7107func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) { 7108 reqHeaders := make(http.Header) 7109 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7110 for k, v := range c.header_ { 7111 reqHeaders[k] = v 7112 } 7113 reqHeaders.Set("User-Agent", c.s.userAgent()) 7114 if c.ifNoneMatch_ != "" { 7115 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7116 } 7117 var body io.Reader = nil 7118 c.urlParams_.Set("alt", alt) 7119 c.urlParams_.Set("prettyPrint", "false") 7120 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7121 urls += "?" + c.urlParams_.Encode() 7122 req, err := http.NewRequest("GET", urls, body) 7123 if err != nil { 7124 return nil, err 7125 } 7126 req.Header = reqHeaders 7127 googleapi.Expand(req.URL, map[string]string{ 7128 "courseId": c.courseId, 7129 "courseWorkId": c.courseWorkId, 7130 "id": c.id, 7131 }) 7132 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7133} 7134 7135// Do executes the "classroom.courses.courseWork.studentSubmissions.get" call. 7136// Exactly one of *StudentSubmission or error will be non-nil. Any 7137// non-2xx status code is an error. Response headers are in either 7138// *StudentSubmission.ServerResponse.Header or (if a response was 7139// returned at all) in error.(*googleapi.Error).Header. Use 7140// googleapi.IsNotModified to check whether the returned error was 7141// because http.StatusNotModified was returned. 7142func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7143 gensupport.SetOptions(c.urlParams_, opts...) 7144 res, err := c.doRequest("json") 7145 if res != nil && res.StatusCode == http.StatusNotModified { 7146 if res.Body != nil { 7147 res.Body.Close() 7148 } 7149 return nil, &googleapi.Error{ 7150 Code: res.StatusCode, 7151 Header: res.Header, 7152 } 7153 } 7154 if err != nil { 7155 return nil, err 7156 } 7157 defer googleapi.CloseBody(res) 7158 if err := googleapi.CheckResponse(res); err != nil { 7159 return nil, err 7160 } 7161 ret := &StudentSubmission{ 7162 ServerResponse: googleapi.ServerResponse{ 7163 Header: res.Header, 7164 HTTPStatusCode: res.StatusCode, 7165 }, 7166 } 7167 target := &ret 7168 if err := gensupport.DecodeResponse(target, res); err != nil { 7169 return nil, err 7170 } 7171 return ret, nil 7172 // { 7173 // "description": "Returns a student submission.\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, course work, or student submission or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 7174 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7175 // "httpMethod": "GET", 7176 // "id": "classroom.courses.courseWork.studentSubmissions.get", 7177 // "parameterOrder": [ 7178 // "courseId", 7179 // "courseWorkId", 7180 // "id" 7181 // ], 7182 // "parameters": { 7183 // "courseId": { 7184 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7185 // "location": "path", 7186 // "required": true, 7187 // "type": "string" 7188 // }, 7189 // "courseWorkId": { 7190 // "description": "Identifier of the course work.", 7191 // "location": "path", 7192 // "required": true, 7193 // "type": "string" 7194 // }, 7195 // "id": { 7196 // "description": "Identifier of the student submission.", 7197 // "location": "path", 7198 // "required": true, 7199 // "type": "string" 7200 // } 7201 // }, 7202 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7203 // "response": { 7204 // "$ref": "StudentSubmission" 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// method id "classroom.courses.courseWork.studentSubmissions.list": 7219 7220type CoursesCourseWorkStudentSubmissionsListCall struct { 7221 s *Service 7222 courseId string 7223 courseWorkId string 7224 urlParams_ gensupport.URLParams 7225 ifNoneMatch_ string 7226 ctx_ context.Context 7227 header_ http.Header 7228} 7229 7230// List: Returns a list of student submissions that the requester is 7231// permitted to 7232// view, factoring in the OAuth scopes of the request. 7233// `-` may be specified as the `course_work_id` to include 7234// student 7235// submissions for multiple course work items. 7236// 7237// Course students may only view their own work. Course teachers 7238// and domain administrators may view all student submissions. 7239// 7240// This method returns the following error codes: 7241// 7242// * `PERMISSION_DENIED` if the requesting user is not permitted to 7243// access the 7244// requested course or course work, or for access errors. 7245// * `INVALID_ARGUMENT` if the request is malformed. 7246// * `NOT_FOUND` if the requested course does not exist. 7247func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall { 7248 c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7249 c.courseId = courseId 7250 c.courseWorkId = courseWorkId 7251 return c 7252} 7253 7254// Late sets the optional parameter "late": Requested lateness value. If 7255// specified, returned student submissions are 7256// restricted by the requested value. 7257// If unspecified, submissions are returned regardless of `late` value. 7258// 7259// Possible values: 7260// "LATE_VALUES_UNSPECIFIED" 7261// "LATE_ONLY" 7262// "NOT_LATE_ONLY" 7263func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall { 7264 c.urlParams_.Set("late", late) 7265 return c 7266} 7267 7268// PageSize sets the optional parameter "pageSize": Maximum number of 7269// items to return. Zero or unspecified indicates that the 7270// server may assign a maximum. 7271// 7272// The server may return fewer than the specified number of results. 7273func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall { 7274 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 7275 return c 7276} 7277 7278// PageToken sets the optional parameter "pageToken": 7279// nextPageToken 7280// value returned from a previous 7281// list call, 7282// indicating that the subsequent page of results should be 7283// returned. 7284// 7285// The list request 7286// must be otherwise identical to the one that resulted in this token. 7287func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall { 7288 c.urlParams_.Set("pageToken", pageToken) 7289 return c 7290} 7291 7292// States sets the optional parameter "states": Requested submission 7293// states. If specified, returned student submissions 7294// match one of the specified submission states. 7295// 7296// Possible values: 7297// "SUBMISSION_STATE_UNSPECIFIED" 7298// "NEW" 7299// "CREATED" 7300// "TURNED_IN" 7301// "RETURNED" 7302// "RECLAIMED_BY_STUDENT" 7303func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall { 7304 c.urlParams_.SetMulti("states", append([]string{}, states...)) 7305 return c 7306} 7307 7308// UserId sets the optional parameter "userId": Optional argument to 7309// restrict returned student work to those owned by the 7310// student with the specified identifier. The identifier can be one of 7311// the 7312// following: 7313// 7314// * the numeric identifier for the user 7315// * the email address of the user 7316// * the string literal "me", indicating the requesting user 7317func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall { 7318 c.urlParams_.Set("userId", userId) 7319 return c 7320} 7321 7322// Fields allows partial responses to be retrieved. See 7323// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7324// for more information. 7325func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall { 7326 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7327 return c 7328} 7329 7330// IfNoneMatch sets the optional parameter which makes the operation 7331// fail if the object's ETag matches the given value. This is useful for 7332// getting updates only after the object has changed since the last 7333// request. Use googleapi.IsNotModified to check whether the response 7334// error from Do is the result of In-None-Match. 7335func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall { 7336 c.ifNoneMatch_ = entityTag 7337 return c 7338} 7339 7340// Context sets the context to be used in this call's Do method. Any 7341// pending HTTP request will be aborted if the provided context is 7342// canceled. 7343func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall { 7344 c.ctx_ = ctx 7345 return c 7346} 7347 7348// Header returns an http.Header that can be modified by the caller to 7349// add HTTP headers to the request. 7350func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header { 7351 if c.header_ == nil { 7352 c.header_ = make(http.Header) 7353 } 7354 return c.header_ 7355} 7356 7357func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) { 7358 reqHeaders := make(http.Header) 7359 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7360 for k, v := range c.header_ { 7361 reqHeaders[k] = v 7362 } 7363 reqHeaders.Set("User-Agent", c.s.userAgent()) 7364 if c.ifNoneMatch_ != "" { 7365 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7366 } 7367 var body io.Reader = nil 7368 c.urlParams_.Set("alt", alt) 7369 c.urlParams_.Set("prettyPrint", "false") 7370 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions") 7371 urls += "?" + c.urlParams_.Encode() 7372 req, err := http.NewRequest("GET", urls, body) 7373 if err != nil { 7374 return nil, err 7375 } 7376 req.Header = reqHeaders 7377 googleapi.Expand(req.URL, map[string]string{ 7378 "courseId": c.courseId, 7379 "courseWorkId": c.courseWorkId, 7380 }) 7381 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7382} 7383 7384// Do executes the "classroom.courses.courseWork.studentSubmissions.list" call. 7385// Exactly one of *ListStudentSubmissionsResponse or error will be 7386// non-nil. Any non-2xx status code is an error. Response headers are in 7387// either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a 7388// response was returned at all) in error.(*googleapi.Error).Header. Use 7389// googleapi.IsNotModified to check whether the returned error was 7390// because http.StatusNotModified was returned. 7391func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) { 7392 gensupport.SetOptions(c.urlParams_, opts...) 7393 res, err := c.doRequest("json") 7394 if res != nil && res.StatusCode == http.StatusNotModified { 7395 if res.Body != nil { 7396 res.Body.Close() 7397 } 7398 return nil, &googleapi.Error{ 7399 Code: res.StatusCode, 7400 Header: res.Header, 7401 } 7402 } 7403 if err != nil { 7404 return nil, err 7405 } 7406 defer googleapi.CloseBody(res) 7407 if err := googleapi.CheckResponse(res); err != nil { 7408 return nil, err 7409 } 7410 ret := &ListStudentSubmissionsResponse{ 7411 ServerResponse: googleapi.ServerResponse{ 7412 Header: res.Header, 7413 HTTPStatusCode: res.StatusCode, 7414 }, 7415 } 7416 target := &ret 7417 if err := gensupport.DecodeResponse(target, res); err != nil { 7418 return nil, err 7419 } 7420 return ret, nil 7421 // { 7422 // "description": "Returns a list of student submissions that the requester is permitted to\nview, factoring in the OAuth scopes of the request.\n`-` may be specified as the `course_work_id` to include student\nsubmissions for multiple course work items.\n\nCourse students may only view their own work. Course teachers\nand domain administrators may view all student submissions.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.", 7423 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7424 // "httpMethod": "GET", 7425 // "id": "classroom.courses.courseWork.studentSubmissions.list", 7426 // "parameterOrder": [ 7427 // "courseId", 7428 // "courseWorkId" 7429 // ], 7430 // "parameters": { 7431 // "courseId": { 7432 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7433 // "location": "path", 7434 // "required": true, 7435 // "type": "string" 7436 // }, 7437 // "courseWorkId": { 7438 // "description": "Identifier of the student work to request.\nThis may be set to the string literal `\"-\"` to request student work for\nall course work in the specified course.", 7439 // "location": "path", 7440 // "required": true, 7441 // "type": "string" 7442 // }, 7443 // "late": { 7444 // "description": "Requested lateness value. If specified, returned student submissions are\nrestricted by the requested value.\nIf unspecified, submissions are returned regardless of `late` value.", 7445 // "enum": [ 7446 // "LATE_VALUES_UNSPECIFIED", 7447 // "LATE_ONLY", 7448 // "NOT_LATE_ONLY" 7449 // ], 7450 // "location": "query", 7451 // "type": "string" 7452 // }, 7453 // "pageSize": { 7454 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 7455 // "format": "int32", 7456 // "location": "query", 7457 // "type": "integer" 7458 // }, 7459 // "pageToken": { 7460 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 7461 // "location": "query", 7462 // "type": "string" 7463 // }, 7464 // "states": { 7465 // "description": "Requested submission states. If specified, returned student submissions\nmatch one of the specified submission states.", 7466 // "enum": [ 7467 // "SUBMISSION_STATE_UNSPECIFIED", 7468 // "NEW", 7469 // "CREATED", 7470 // "TURNED_IN", 7471 // "RETURNED", 7472 // "RECLAIMED_BY_STUDENT" 7473 // ], 7474 // "location": "query", 7475 // "repeated": true, 7476 // "type": "string" 7477 // }, 7478 // "userId": { 7479 // "description": "Optional argument to restrict returned student work to those owned by the\nstudent with the specified identifier. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 7480 // "location": "query", 7481 // "type": "string" 7482 // } 7483 // }, 7484 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7485 // "response": { 7486 // "$ref": "ListStudentSubmissionsResponse" 7487 // }, 7488 // "scopes": [ 7489 // "https://www.googleapis.com/auth/classroom.coursework.me", 7490 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7491 // "https://www.googleapis.com/auth/classroom.coursework.students", 7492 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7493 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7494 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7495 // ] 7496 // } 7497 7498} 7499 7500// Pages invokes f for each page of results. 7501// A non-nil error returned from f will halt the iteration. 7502// The provided context supersedes any context provided to the Context method. 7503func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error { 7504 c.ctx_ = ctx 7505 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7506 for { 7507 x, err := c.Do() 7508 if err != nil { 7509 return err 7510 } 7511 if err := f(x); err != nil { 7512 return err 7513 } 7514 if x.NextPageToken == "" { 7515 return nil 7516 } 7517 c.PageToken(x.NextPageToken) 7518 } 7519} 7520 7521// method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments": 7522 7523type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct { 7524 s *Service 7525 courseId string 7526 courseWorkId string 7527 id string 7528 modifyattachmentsrequest *ModifyAttachmentsRequest 7529 urlParams_ gensupport.URLParams 7530 ctx_ context.Context 7531 header_ http.Header 7532} 7533 7534// ModifyAttachments: Modifies attachments of student 7535// submission. 7536// 7537// Attachments may only be added to student submissions belonging to 7538// course 7539// work objects with a `workType` of `ASSIGNMENT`. 7540// 7541// This request must be made by the Developer Console project of 7542// the 7543// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7544// used to 7545// create the corresponding course work item. 7546// 7547// This method returns the following error codes: 7548// 7549// * `PERMISSION_DENIED` if the requesting user is not permitted to 7550// access the 7551// requested course or course work, if the user is not permitted to 7552// modify 7553// attachments on the requested student submission, or for 7554// access errors. 7555// * `INVALID_ARGUMENT` if the request is malformed. 7556// * `NOT_FOUND` if the requested course, course work, or student 7557// submission 7558// does not exist. 7559func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7560 c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7561 c.courseId = courseId 7562 c.courseWorkId = courseWorkId 7563 c.id = id 7564 c.modifyattachmentsrequest = modifyattachmentsrequest 7565 return c 7566} 7567 7568// Fields allows partial responses to be retrieved. See 7569// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7570// for more information. 7571func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7572 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7573 return c 7574} 7575 7576// Context sets the context to be used in this call's Do method. Any 7577// pending HTTP request will be aborted if the provided context is 7578// canceled. 7579func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7580 c.ctx_ = ctx 7581 return c 7582} 7583 7584// Header returns an http.Header that can be modified by the caller to 7585// add HTTP headers to the request. 7586func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header { 7587 if c.header_ == nil { 7588 c.header_ = make(http.Header) 7589 } 7590 return c.header_ 7591} 7592 7593func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) { 7594 reqHeaders := make(http.Header) 7595 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7596 for k, v := range c.header_ { 7597 reqHeaders[k] = v 7598 } 7599 reqHeaders.Set("User-Agent", c.s.userAgent()) 7600 var body io.Reader = nil 7601 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest) 7602 if err != nil { 7603 return nil, err 7604 } 7605 reqHeaders.Set("Content-Type", "application/json") 7606 c.urlParams_.Set("alt", alt) 7607 c.urlParams_.Set("prettyPrint", "false") 7608 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments") 7609 urls += "?" + c.urlParams_.Encode() 7610 req, err := http.NewRequest("POST", urls, body) 7611 if err != nil { 7612 return nil, err 7613 } 7614 req.Header = reqHeaders 7615 googleapi.Expand(req.URL, map[string]string{ 7616 "courseId": c.courseId, 7617 "courseWorkId": c.courseWorkId, 7618 "id": c.id, 7619 }) 7620 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7621} 7622 7623// Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call. 7624// Exactly one of *StudentSubmission or error will be non-nil. Any 7625// non-2xx status code is an error. Response headers are in either 7626// *StudentSubmission.ServerResponse.Header or (if a response was 7627// returned at all) in error.(*googleapi.Error).Header. Use 7628// googleapi.IsNotModified to check whether the returned error was 7629// because http.StatusNotModified was returned. 7630func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7631 gensupport.SetOptions(c.urlParams_, opts...) 7632 res, err := c.doRequest("json") 7633 if res != nil && res.StatusCode == http.StatusNotModified { 7634 if res.Body != nil { 7635 res.Body.Close() 7636 } 7637 return nil, &googleapi.Error{ 7638 Code: res.StatusCode, 7639 Header: res.Header, 7640 } 7641 } 7642 if err != nil { 7643 return nil, err 7644 } 7645 defer googleapi.CloseBody(res) 7646 if err := googleapi.CheckResponse(res); err != nil { 7647 return nil, err 7648 } 7649 ret := &StudentSubmission{ 7650 ServerResponse: googleapi.ServerResponse{ 7651 Header: res.Header, 7652 HTTPStatusCode: res.StatusCode, 7653 }, 7654 } 7655 target := &ret 7656 if err := gensupport.DecodeResponse(target, res); err != nil { 7657 return nil, err 7658 } 7659 return ret, nil 7660 // { 7661 // "description": "Modifies attachments of student submission.\n\nAttachments may only be added to student submissions belonging to course\nwork objects with a `workType` of `ASSIGNMENT`.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, if the user is not permitted to modify\nattachments on the requested student submission, or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 7662 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7663 // "httpMethod": "POST", 7664 // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments", 7665 // "parameterOrder": [ 7666 // "courseId", 7667 // "courseWorkId", 7668 // "id" 7669 // ], 7670 // "parameters": { 7671 // "courseId": { 7672 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7673 // "location": "path", 7674 // "required": true, 7675 // "type": "string" 7676 // }, 7677 // "courseWorkId": { 7678 // "description": "Identifier of the course work.", 7679 // "location": "path", 7680 // "required": true, 7681 // "type": "string" 7682 // }, 7683 // "id": { 7684 // "description": "Identifier of the student submission.", 7685 // "location": "path", 7686 // "required": true, 7687 // "type": "string" 7688 // } 7689 // }, 7690 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7691 // "request": { 7692 // "$ref": "ModifyAttachmentsRequest" 7693 // }, 7694 // "response": { 7695 // "$ref": "StudentSubmission" 7696 // }, 7697 // "scopes": [ 7698 // "https://www.googleapis.com/auth/classroom.coursework.me", 7699 // "https://www.googleapis.com/auth/classroom.coursework.students" 7700 // ] 7701 // } 7702 7703} 7704 7705// method id "classroom.courses.courseWork.studentSubmissions.patch": 7706 7707type CoursesCourseWorkStudentSubmissionsPatchCall struct { 7708 s *Service 7709 courseId string 7710 courseWorkId string 7711 id string 7712 studentsubmission *StudentSubmission 7713 urlParams_ gensupport.URLParams 7714 ctx_ context.Context 7715 header_ http.Header 7716} 7717 7718// Patch: Updates one or more fields of a student submission. 7719// 7720// See google.classroom.v1.StudentSubmission for details 7721// of which fields may be updated and who may change them. 7722// 7723// This request must be made by the Developer Console project of 7724// the 7725// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7726// used to 7727// create the corresponding course work item. 7728// 7729// This method returns the following error codes: 7730// 7731// * `PERMISSION_DENIED` if the requesting developer project did not 7732// create 7733// the corresponding course work, if the user is not permitted to make 7734// the 7735// requested modification to the student submission, or for 7736// access errors. 7737// * `INVALID_ARGUMENT` if the request is malformed. 7738// * `NOT_FOUND` if the requested course, course work, or student 7739// submission 7740// does not exist. 7741func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall { 7742 c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7743 c.courseId = courseId 7744 c.courseWorkId = courseWorkId 7745 c.id = id 7746 c.studentsubmission = studentsubmission 7747 return c 7748} 7749 7750// UpdateMask sets the optional parameter "updateMask": Mask that 7751// identifies which fields on the student submission to update. 7752// This field is required to do an update. The update fails if 7753// invalid 7754// fields are specified. 7755// 7756// The following fields may be specified by teachers: 7757// 7758// * `draft_grade` 7759// * `assigned_grade` 7760func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall { 7761 c.urlParams_.Set("updateMask", updateMask) 7762 return c 7763} 7764 7765// Fields allows partial responses to be retrieved. See 7766// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7767// for more information. 7768func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall { 7769 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7770 return c 7771} 7772 7773// Context sets the context to be used in this call's Do method. Any 7774// pending HTTP request will be aborted if the provided context is 7775// canceled. 7776func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall { 7777 c.ctx_ = ctx 7778 return c 7779} 7780 7781// Header returns an http.Header that can be modified by the caller to 7782// add HTTP headers to the request. 7783func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header { 7784 if c.header_ == nil { 7785 c.header_ = make(http.Header) 7786 } 7787 return c.header_ 7788} 7789 7790func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) { 7791 reqHeaders := make(http.Header) 7792 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7793 for k, v := range c.header_ { 7794 reqHeaders[k] = v 7795 } 7796 reqHeaders.Set("User-Agent", c.s.userAgent()) 7797 var body io.Reader = nil 7798 body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission) 7799 if err != nil { 7800 return nil, err 7801 } 7802 reqHeaders.Set("Content-Type", "application/json") 7803 c.urlParams_.Set("alt", alt) 7804 c.urlParams_.Set("prettyPrint", "false") 7805 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7806 urls += "?" + c.urlParams_.Encode() 7807 req, err := http.NewRequest("PATCH", urls, body) 7808 if err != nil { 7809 return nil, err 7810 } 7811 req.Header = reqHeaders 7812 googleapi.Expand(req.URL, map[string]string{ 7813 "courseId": c.courseId, 7814 "courseWorkId": c.courseWorkId, 7815 "id": c.id, 7816 }) 7817 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7818} 7819 7820// Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call. 7821// Exactly one of *StudentSubmission or error will be non-nil. Any 7822// non-2xx status code is an error. Response headers are in either 7823// *StudentSubmission.ServerResponse.Header or (if a response was 7824// returned at all) in error.(*googleapi.Error).Header. Use 7825// googleapi.IsNotModified to check whether the returned error was 7826// because http.StatusNotModified was returned. 7827func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7828 gensupport.SetOptions(c.urlParams_, opts...) 7829 res, err := c.doRequest("json") 7830 if res != nil && res.StatusCode == http.StatusNotModified { 7831 if res.Body != nil { 7832 res.Body.Close() 7833 } 7834 return nil, &googleapi.Error{ 7835 Code: res.StatusCode, 7836 Header: res.Header, 7837 } 7838 } 7839 if err != nil { 7840 return nil, err 7841 } 7842 defer googleapi.CloseBody(res) 7843 if err := googleapi.CheckResponse(res); err != nil { 7844 return nil, err 7845 } 7846 ret := &StudentSubmission{ 7847 ServerResponse: googleapi.ServerResponse{ 7848 Header: res.Header, 7849 HTTPStatusCode: res.StatusCode, 7850 }, 7851 } 7852 target := &ret 7853 if err := gensupport.DecodeResponse(target, res); err != nil { 7854 return nil, err 7855 } 7856 return ret, nil 7857 // { 7858 // "description": "Updates one or more fields of a student submission.\n\nSee google.classroom.v1.StudentSubmission for details\nof which fields may be updated and who may change them.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding course work, if the user is not permitted to make the\nrequested modification to the student submission, or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 7859 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7860 // "httpMethod": "PATCH", 7861 // "id": "classroom.courses.courseWork.studentSubmissions.patch", 7862 // "parameterOrder": [ 7863 // "courseId", 7864 // "courseWorkId", 7865 // "id" 7866 // ], 7867 // "parameters": { 7868 // "courseId": { 7869 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7870 // "location": "path", 7871 // "required": true, 7872 // "type": "string" 7873 // }, 7874 // "courseWorkId": { 7875 // "description": "Identifier of the course work.", 7876 // "location": "path", 7877 // "required": true, 7878 // "type": "string" 7879 // }, 7880 // "id": { 7881 // "description": "Identifier of the student submission.", 7882 // "location": "path", 7883 // "required": true, 7884 // "type": "string" 7885 // }, 7886 // "updateMask": { 7887 // "description": "Mask that identifies which fields on the student submission to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified.\n\nThe following fields may be specified by teachers:\n\n* `draft_grade`\n* `assigned_grade`", 7888 // "format": "google-fieldmask", 7889 // "location": "query", 7890 // "type": "string" 7891 // } 7892 // }, 7893 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7894 // "request": { 7895 // "$ref": "StudentSubmission" 7896 // }, 7897 // "response": { 7898 // "$ref": "StudentSubmission" 7899 // }, 7900 // "scopes": [ 7901 // "https://www.googleapis.com/auth/classroom.coursework.me", 7902 // "https://www.googleapis.com/auth/classroom.coursework.students" 7903 // ] 7904 // } 7905 7906} 7907 7908// method id "classroom.courses.courseWork.studentSubmissions.reclaim": 7909 7910type CoursesCourseWorkStudentSubmissionsReclaimCall struct { 7911 s *Service 7912 courseId string 7913 courseWorkId string 7914 id string 7915 reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest 7916 urlParams_ gensupport.URLParams 7917 ctx_ context.Context 7918 header_ http.Header 7919} 7920 7921// Reclaim: Reclaims a student submission on behalf of the student that 7922// owns it. 7923// 7924// Reclaiming a student submission transfers ownership of attached 7925// Drive 7926// files to the student and updates the submission state. 7927// 7928// Only the student that owns the requested student submission may call 7929// this 7930// method, and only for a student submission that has been turned 7931// in. 7932// 7933// This request must be made by the Developer Console project of 7934// the 7935// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7936// used to 7937// create the corresponding course work item. 7938// 7939// This method returns the following error codes: 7940// 7941// * `PERMISSION_DENIED` if the requesting user is not permitted to 7942// access the 7943// requested course or course work, unsubmit the requested student 7944// submission, 7945// or for access errors. 7946// * `FAILED_PRECONDITION` if the student submission has not been turned 7947// in. 7948// * `INVALID_ARGUMENT` if the request is malformed. 7949// * `NOT_FOUND` if the requested course, course work, or student 7950// submission 7951// does not exist. 7952func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7953 c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7954 c.courseId = courseId 7955 c.courseWorkId = courseWorkId 7956 c.id = id 7957 c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest 7958 return c 7959} 7960 7961// Fields allows partial responses to be retrieved. See 7962// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7963// for more information. 7964func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7965 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7966 return c 7967} 7968 7969// Context sets the context to be used in this call's Do method. Any 7970// pending HTTP request will be aborted if the provided context is 7971// canceled. 7972func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7973 c.ctx_ = ctx 7974 return c 7975} 7976 7977// Header returns an http.Header that can be modified by the caller to 7978// add HTTP headers to the request. 7979func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header { 7980 if c.header_ == nil { 7981 c.header_ = make(http.Header) 7982 } 7983 return c.header_ 7984} 7985 7986func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) { 7987 reqHeaders := make(http.Header) 7988 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7989 for k, v := range c.header_ { 7990 reqHeaders[k] = v 7991 } 7992 reqHeaders.Set("User-Agent", c.s.userAgent()) 7993 var body io.Reader = nil 7994 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest) 7995 if err != nil { 7996 return nil, err 7997 } 7998 reqHeaders.Set("Content-Type", "application/json") 7999 c.urlParams_.Set("alt", alt) 8000 c.urlParams_.Set("prettyPrint", "false") 8001 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim") 8002 urls += "?" + c.urlParams_.Encode() 8003 req, err := http.NewRequest("POST", urls, body) 8004 if err != nil { 8005 return nil, err 8006 } 8007 req.Header = reqHeaders 8008 googleapi.Expand(req.URL, map[string]string{ 8009 "courseId": c.courseId, 8010 "courseWorkId": c.courseWorkId, 8011 "id": c.id, 8012 }) 8013 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8014} 8015 8016// Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call. 8017// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8018// code is an error. Response headers are in either 8019// *Empty.ServerResponse.Header or (if a response was returned at all) 8020// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8021// check whether the returned error was because http.StatusNotModified 8022// was returned. 8023func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8024 gensupport.SetOptions(c.urlParams_, opts...) 8025 res, err := c.doRequest("json") 8026 if res != nil && res.StatusCode == http.StatusNotModified { 8027 if res.Body != nil { 8028 res.Body.Close() 8029 } 8030 return nil, &googleapi.Error{ 8031 Code: res.StatusCode, 8032 Header: res.Header, 8033 } 8034 } 8035 if err != nil { 8036 return nil, err 8037 } 8038 defer googleapi.CloseBody(res) 8039 if err := googleapi.CheckResponse(res); err != nil { 8040 return nil, err 8041 } 8042 ret := &Empty{ 8043 ServerResponse: googleapi.ServerResponse{ 8044 Header: res.Header, 8045 HTTPStatusCode: res.StatusCode, 8046 }, 8047 } 8048 target := &ret 8049 if err := gensupport.DecodeResponse(target, res); err != nil { 8050 return nil, err 8051 } 8052 return ret, nil 8053 // { 8054 // "description": "Reclaims a student submission on behalf of the student that owns it.\n\nReclaiming a student submission transfers ownership of attached Drive\nfiles to the student and updates the submission state.\n\nOnly the student that owns the requested student submission may call this\nmethod, and only for a student submission that has been turned in.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, unsubmit the requested student submission,\nor for access errors.\n* `FAILED_PRECONDITION` if the student submission has not been turned in.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 8055 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8056 // "httpMethod": "POST", 8057 // "id": "classroom.courses.courseWork.studentSubmissions.reclaim", 8058 // "parameterOrder": [ 8059 // "courseId", 8060 // "courseWorkId", 8061 // "id" 8062 // ], 8063 // "parameters": { 8064 // "courseId": { 8065 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8066 // "location": "path", 8067 // "required": true, 8068 // "type": "string" 8069 // }, 8070 // "courseWorkId": { 8071 // "description": "Identifier of the course work.", 8072 // "location": "path", 8073 // "required": true, 8074 // "type": "string" 8075 // }, 8076 // "id": { 8077 // "description": "Identifier of the student submission.", 8078 // "location": "path", 8079 // "required": true, 8080 // "type": "string" 8081 // } 8082 // }, 8083 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8084 // "request": { 8085 // "$ref": "ReclaimStudentSubmissionRequest" 8086 // }, 8087 // "response": { 8088 // "$ref": "Empty" 8089 // }, 8090 // "scopes": [ 8091 // "https://www.googleapis.com/auth/classroom.coursework.me" 8092 // ] 8093 // } 8094 8095} 8096 8097// method id "classroom.courses.courseWork.studentSubmissions.return": 8098 8099type CoursesCourseWorkStudentSubmissionsReturnCall struct { 8100 s *Service 8101 courseId string 8102 courseWorkId string 8103 id string 8104 returnstudentsubmissionrequest *ReturnStudentSubmissionRequest 8105 urlParams_ gensupport.URLParams 8106 ctx_ context.Context 8107 header_ http.Header 8108} 8109 8110// Return: Returns a student submission. 8111// 8112// Returning a student submission transfers ownership of attached 8113// Drive 8114// files to the student and may also update the submission state. 8115// Unlike the Classroom application, returning a student submission does 8116// not 8117// set assignedGrade to the draftGrade value. 8118// 8119// Only a teacher of the course that contains the requested student 8120// submission 8121// may call this method. 8122// 8123// This request must be made by the Developer Console project of 8124// the 8125// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8126// used to 8127// create the corresponding course work item. 8128// 8129// This method returns the following error codes: 8130// 8131// * `PERMISSION_DENIED` if the requesting user is not permitted to 8132// access the 8133// requested course or course work, return the requested student 8134// submission, 8135// or for access errors. 8136// * `INVALID_ARGUMENT` if the request is malformed. 8137// * `NOT_FOUND` if the requested course, course work, or student 8138// submission 8139// does not exist. 8140func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall { 8141 c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8142 c.courseId = courseId 8143 c.courseWorkId = courseWorkId 8144 c.id = id 8145 c.returnstudentsubmissionrequest = returnstudentsubmissionrequest 8146 return c 8147} 8148 8149// Fields allows partial responses to be retrieved. See 8150// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8151// for more information. 8152func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall { 8153 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8154 return c 8155} 8156 8157// Context sets the context to be used in this call's Do method. Any 8158// pending HTTP request will be aborted if the provided context is 8159// canceled. 8160func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall { 8161 c.ctx_ = ctx 8162 return c 8163} 8164 8165// Header returns an http.Header that can be modified by the caller to 8166// add HTTP headers to the request. 8167func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header { 8168 if c.header_ == nil { 8169 c.header_ = make(http.Header) 8170 } 8171 return c.header_ 8172} 8173 8174func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) { 8175 reqHeaders := make(http.Header) 8176 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8177 for k, v := range c.header_ { 8178 reqHeaders[k] = v 8179 } 8180 reqHeaders.Set("User-Agent", c.s.userAgent()) 8181 var body io.Reader = nil 8182 body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest) 8183 if err != nil { 8184 return nil, err 8185 } 8186 reqHeaders.Set("Content-Type", "application/json") 8187 c.urlParams_.Set("alt", alt) 8188 c.urlParams_.Set("prettyPrint", "false") 8189 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return") 8190 urls += "?" + c.urlParams_.Encode() 8191 req, err := http.NewRequest("POST", urls, body) 8192 if err != nil { 8193 return nil, err 8194 } 8195 req.Header = reqHeaders 8196 googleapi.Expand(req.URL, map[string]string{ 8197 "courseId": c.courseId, 8198 "courseWorkId": c.courseWorkId, 8199 "id": c.id, 8200 }) 8201 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8202} 8203 8204// Do executes the "classroom.courses.courseWork.studentSubmissions.return" call. 8205// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8206// code is an error. Response headers are in either 8207// *Empty.ServerResponse.Header or (if a response was returned at all) 8208// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8209// check whether the returned error was because http.StatusNotModified 8210// was returned. 8211func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8212 gensupport.SetOptions(c.urlParams_, opts...) 8213 res, err := c.doRequest("json") 8214 if res != nil && res.StatusCode == http.StatusNotModified { 8215 if res.Body != nil { 8216 res.Body.Close() 8217 } 8218 return nil, &googleapi.Error{ 8219 Code: res.StatusCode, 8220 Header: res.Header, 8221 } 8222 } 8223 if err != nil { 8224 return nil, err 8225 } 8226 defer googleapi.CloseBody(res) 8227 if err := googleapi.CheckResponse(res); err != nil { 8228 return nil, err 8229 } 8230 ret := &Empty{ 8231 ServerResponse: googleapi.ServerResponse{ 8232 Header: res.Header, 8233 HTTPStatusCode: res.StatusCode, 8234 }, 8235 } 8236 target := &ret 8237 if err := gensupport.DecodeResponse(target, res); err != nil { 8238 return nil, err 8239 } 8240 return ret, nil 8241 // { 8242 // "description": "Returns a student submission.\n\nReturning a student submission transfers ownership of attached Drive\nfiles to the student and may also update the submission state.\nUnlike the Classroom application, returning a student submission does not\nset assignedGrade to the draftGrade value.\n\nOnly a teacher of the course that contains the requested student submission\nmay call this method.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, return the requested student submission,\nor for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 8243 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8244 // "httpMethod": "POST", 8245 // "id": "classroom.courses.courseWork.studentSubmissions.return", 8246 // "parameterOrder": [ 8247 // "courseId", 8248 // "courseWorkId", 8249 // "id" 8250 // ], 8251 // "parameters": { 8252 // "courseId": { 8253 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8254 // "location": "path", 8255 // "required": true, 8256 // "type": "string" 8257 // }, 8258 // "courseWorkId": { 8259 // "description": "Identifier of the course work.", 8260 // "location": "path", 8261 // "required": true, 8262 // "type": "string" 8263 // }, 8264 // "id": { 8265 // "description": "Identifier of the student submission.", 8266 // "location": "path", 8267 // "required": true, 8268 // "type": "string" 8269 // } 8270 // }, 8271 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8272 // "request": { 8273 // "$ref": "ReturnStudentSubmissionRequest" 8274 // }, 8275 // "response": { 8276 // "$ref": "Empty" 8277 // }, 8278 // "scopes": [ 8279 // "https://www.googleapis.com/auth/classroom.coursework.students" 8280 // ] 8281 // } 8282 8283} 8284 8285// method id "classroom.courses.courseWork.studentSubmissions.turnIn": 8286 8287type CoursesCourseWorkStudentSubmissionsTurnInCall struct { 8288 s *Service 8289 courseId string 8290 courseWorkId string 8291 id string 8292 turninstudentsubmissionrequest *TurnInStudentSubmissionRequest 8293 urlParams_ gensupport.URLParams 8294 ctx_ context.Context 8295 header_ http.Header 8296} 8297 8298// TurnIn: Turns in a student submission. 8299// 8300// Turning in a student submission transfers ownership of attached 8301// Drive 8302// files to the teacher and may also update the submission state. 8303// 8304// This may only be called by the student that owns the specified 8305// student 8306// submission. 8307// 8308// This request must be made by the Developer Console project of 8309// the 8310// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8311// used to 8312// create the corresponding course work item. 8313// 8314// This method returns the following error codes: 8315// 8316// * `PERMISSION_DENIED` if the requesting user is not permitted to 8317// access the 8318// requested course or course work, turn in the requested student 8319// submission, 8320// or for access errors. 8321// * `INVALID_ARGUMENT` if the request is malformed. 8322// * `NOT_FOUND` if the requested course, course work, or student 8323// submission 8324// does not exist. 8325func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8326 c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8327 c.courseId = courseId 8328 c.courseWorkId = courseWorkId 8329 c.id = id 8330 c.turninstudentsubmissionrequest = turninstudentsubmissionrequest 8331 return c 8332} 8333 8334// Fields allows partial responses to be retrieved. See 8335// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8336// for more information. 8337func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8338 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8339 return c 8340} 8341 8342// Context sets the context to be used in this call's Do method. Any 8343// pending HTTP request will be aborted if the provided context is 8344// canceled. 8345func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8346 c.ctx_ = ctx 8347 return c 8348} 8349 8350// Header returns an http.Header that can be modified by the caller to 8351// add HTTP headers to the request. 8352func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header { 8353 if c.header_ == nil { 8354 c.header_ = make(http.Header) 8355 } 8356 return c.header_ 8357} 8358 8359func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) { 8360 reqHeaders := make(http.Header) 8361 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8362 for k, v := range c.header_ { 8363 reqHeaders[k] = v 8364 } 8365 reqHeaders.Set("User-Agent", c.s.userAgent()) 8366 var body io.Reader = nil 8367 body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest) 8368 if err != nil { 8369 return nil, err 8370 } 8371 reqHeaders.Set("Content-Type", "application/json") 8372 c.urlParams_.Set("alt", alt) 8373 c.urlParams_.Set("prettyPrint", "false") 8374 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn") 8375 urls += "?" + c.urlParams_.Encode() 8376 req, err := http.NewRequest("POST", urls, body) 8377 if err != nil { 8378 return nil, err 8379 } 8380 req.Header = reqHeaders 8381 googleapi.Expand(req.URL, map[string]string{ 8382 "courseId": c.courseId, 8383 "courseWorkId": c.courseWorkId, 8384 "id": c.id, 8385 }) 8386 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8387} 8388 8389// Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call. 8390// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8391// code is an error. Response headers are in either 8392// *Empty.ServerResponse.Header or (if a response was returned at all) 8393// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8394// check whether the returned error was because http.StatusNotModified 8395// was returned. 8396func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8397 gensupport.SetOptions(c.urlParams_, opts...) 8398 res, err := c.doRequest("json") 8399 if res != nil && res.StatusCode == http.StatusNotModified { 8400 if res.Body != nil { 8401 res.Body.Close() 8402 } 8403 return nil, &googleapi.Error{ 8404 Code: res.StatusCode, 8405 Header: res.Header, 8406 } 8407 } 8408 if err != nil { 8409 return nil, err 8410 } 8411 defer googleapi.CloseBody(res) 8412 if err := googleapi.CheckResponse(res); err != nil { 8413 return nil, err 8414 } 8415 ret := &Empty{ 8416 ServerResponse: googleapi.ServerResponse{ 8417 Header: res.Header, 8418 HTTPStatusCode: res.StatusCode, 8419 }, 8420 } 8421 target := &ret 8422 if err := gensupport.DecodeResponse(target, res); err != nil { 8423 return nil, err 8424 } 8425 return ret, nil 8426 // { 8427 // "description": "Turns in a student submission.\n\nTurning in a student submission transfers ownership of attached Drive\nfiles to the teacher and may also update the submission state.\n\nThis may only be called by the student that owns the specified student\nsubmission.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, turn in the requested student submission,\nor for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.", 8428 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8429 // "httpMethod": "POST", 8430 // "id": "classroom.courses.courseWork.studentSubmissions.turnIn", 8431 // "parameterOrder": [ 8432 // "courseId", 8433 // "courseWorkId", 8434 // "id" 8435 // ], 8436 // "parameters": { 8437 // "courseId": { 8438 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8439 // "location": "path", 8440 // "required": true, 8441 // "type": "string" 8442 // }, 8443 // "courseWorkId": { 8444 // "description": "Identifier of the course work.", 8445 // "location": "path", 8446 // "required": true, 8447 // "type": "string" 8448 // }, 8449 // "id": { 8450 // "description": "Identifier of the student submission.", 8451 // "location": "path", 8452 // "required": true, 8453 // "type": "string" 8454 // } 8455 // }, 8456 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8457 // "request": { 8458 // "$ref": "TurnInStudentSubmissionRequest" 8459 // }, 8460 // "response": { 8461 // "$ref": "Empty" 8462 // }, 8463 // "scopes": [ 8464 // "https://www.googleapis.com/auth/classroom.coursework.me" 8465 // ] 8466 // } 8467 8468} 8469 8470// method id "classroom.courses.students.create": 8471 8472type CoursesStudentsCreateCall struct { 8473 s *Service 8474 courseId string 8475 student *Student 8476 urlParams_ gensupport.URLParams 8477 ctx_ context.Context 8478 header_ http.Header 8479} 8480 8481// Create: Adds a user as a student of a course. 8482// 8483// This method returns the following error codes: 8484// 8485// * `PERMISSION_DENIED` if the requesting user is not permitted to 8486// create 8487// students in this course or for access errors. 8488// * `NOT_FOUND` if the requested course ID does not exist. 8489// * `FAILED_PRECONDITION` if the requested user's account is 8490// disabled, 8491// for the following request errors: 8492// * CourseMemberLimitReached 8493// * CourseNotModifiable 8494// * UserGroupsMembershipLimitReached 8495// * `ALREADY_EXISTS` if the user is already a student or teacher in 8496// the 8497// course. 8498func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall { 8499 c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8500 c.courseId = courseId 8501 c.student = student 8502 return c 8503} 8504 8505// EnrollmentCode sets the optional parameter "enrollmentCode": 8506// Enrollment code of the course to create the student in. 8507// This code is required if userId 8508// corresponds to the requesting user; it may be omitted if the 8509// requesting 8510// user has administrative permissions to create students for any user. 8511func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall { 8512 c.urlParams_.Set("enrollmentCode", enrollmentCode) 8513 return c 8514} 8515 8516// Fields allows partial responses to be retrieved. See 8517// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8518// for more information. 8519func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall { 8520 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8521 return c 8522} 8523 8524// Context sets the context to be used in this call's Do method. Any 8525// pending HTTP request will be aborted if the provided context is 8526// canceled. 8527func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall { 8528 c.ctx_ = ctx 8529 return c 8530} 8531 8532// Header returns an http.Header that can be modified by the caller to 8533// add HTTP headers to the request. 8534func (c *CoursesStudentsCreateCall) Header() http.Header { 8535 if c.header_ == nil { 8536 c.header_ = make(http.Header) 8537 } 8538 return c.header_ 8539} 8540 8541func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) { 8542 reqHeaders := make(http.Header) 8543 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8544 for k, v := range c.header_ { 8545 reqHeaders[k] = v 8546 } 8547 reqHeaders.Set("User-Agent", c.s.userAgent()) 8548 var body io.Reader = nil 8549 body, err := googleapi.WithoutDataWrapper.JSONReader(c.student) 8550 if err != nil { 8551 return nil, err 8552 } 8553 reqHeaders.Set("Content-Type", "application/json") 8554 c.urlParams_.Set("alt", alt) 8555 c.urlParams_.Set("prettyPrint", "false") 8556 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 8557 urls += "?" + c.urlParams_.Encode() 8558 req, err := http.NewRequest("POST", urls, body) 8559 if err != nil { 8560 return nil, err 8561 } 8562 req.Header = reqHeaders 8563 googleapi.Expand(req.URL, map[string]string{ 8564 "courseId": c.courseId, 8565 }) 8566 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8567} 8568 8569// Do executes the "classroom.courses.students.create" call. 8570// Exactly one of *Student or error will be non-nil. Any non-2xx status 8571// code is an error. Response headers are in either 8572// *Student.ServerResponse.Header or (if a response was returned at all) 8573// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8574// check whether the returned error was because http.StatusNotModified 8575// was returned. 8576func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8577 gensupport.SetOptions(c.urlParams_, opts...) 8578 res, err := c.doRequest("json") 8579 if res != nil && res.StatusCode == http.StatusNotModified { 8580 if res.Body != nil { 8581 res.Body.Close() 8582 } 8583 return nil, &googleapi.Error{ 8584 Code: res.StatusCode, 8585 Header: res.Header, 8586 } 8587 } 8588 if err != nil { 8589 return nil, err 8590 } 8591 defer googleapi.CloseBody(res) 8592 if err := googleapi.CheckResponse(res); err != nil { 8593 return nil, err 8594 } 8595 ret := &Student{ 8596 ServerResponse: googleapi.ServerResponse{ 8597 Header: res.Header, 8598 HTTPStatusCode: res.StatusCode, 8599 }, 8600 } 8601 target := &ret 8602 if err := gensupport.DecodeResponse(target, res); err != nil { 8603 return nil, err 8604 } 8605 return ret, nil 8606 // { 8607 // "description": "Adds a user as a student of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\nstudents in this course or for access errors.\n* `NOT_FOUND` if the requested course ID does not exist.\n* `FAILED_PRECONDITION` if the requested user's account is disabled,\nfor the following request errors:\n * CourseMemberLimitReached\n * CourseNotModifiable\n * UserGroupsMembershipLimitReached\n* `ALREADY_EXISTS` if the user is already a student or teacher in the\ncourse.", 8608 // "flatPath": "v1/courses/{courseId}/students", 8609 // "httpMethod": "POST", 8610 // "id": "classroom.courses.students.create", 8611 // "parameterOrder": [ 8612 // "courseId" 8613 // ], 8614 // "parameters": { 8615 // "courseId": { 8616 // "description": "Identifier of the course to create the student in.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8617 // "location": "path", 8618 // "required": true, 8619 // "type": "string" 8620 // }, 8621 // "enrollmentCode": { 8622 // "description": "Enrollment code of the course to create the student in.\nThis code is required if userId\ncorresponds to the requesting user; it may be omitted if the requesting\nuser has administrative permissions to create students for any user.", 8623 // "location": "query", 8624 // "type": "string" 8625 // } 8626 // }, 8627 // "path": "v1/courses/{courseId}/students", 8628 // "request": { 8629 // "$ref": "Student" 8630 // }, 8631 // "response": { 8632 // "$ref": "Student" 8633 // }, 8634 // "scopes": [ 8635 // "https://www.googleapis.com/auth/classroom.profile.emails", 8636 // "https://www.googleapis.com/auth/classroom.profile.photos", 8637 // "https://www.googleapis.com/auth/classroom.rosters" 8638 // ] 8639 // } 8640 8641} 8642 8643// method id "classroom.courses.students.delete": 8644 8645type CoursesStudentsDeleteCall struct { 8646 s *Service 8647 courseId string 8648 userId string 8649 urlParams_ gensupport.URLParams 8650 ctx_ context.Context 8651 header_ http.Header 8652} 8653 8654// Delete: Deletes a student of a course. 8655// 8656// This method returns the following error codes: 8657// 8658// * `PERMISSION_DENIED` if the requesting user is not permitted to 8659// delete 8660// students of this course or for access errors. 8661// * `NOT_FOUND` if no student of this course has the requested ID or if 8662// the 8663// course does not exist. 8664func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall { 8665 c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8666 c.courseId = courseId 8667 c.userId = userId 8668 return c 8669} 8670 8671// Fields allows partial responses to be retrieved. See 8672// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8673// for more information. 8674func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall { 8675 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8676 return c 8677} 8678 8679// Context sets the context to be used in this call's Do method. Any 8680// pending HTTP request will be aborted if the provided context is 8681// canceled. 8682func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall { 8683 c.ctx_ = ctx 8684 return c 8685} 8686 8687// Header returns an http.Header that can be modified by the caller to 8688// add HTTP headers to the request. 8689func (c *CoursesStudentsDeleteCall) Header() http.Header { 8690 if c.header_ == nil { 8691 c.header_ = make(http.Header) 8692 } 8693 return c.header_ 8694} 8695 8696func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) { 8697 reqHeaders := make(http.Header) 8698 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8699 for k, v := range c.header_ { 8700 reqHeaders[k] = v 8701 } 8702 reqHeaders.Set("User-Agent", c.s.userAgent()) 8703 var body io.Reader = nil 8704 c.urlParams_.Set("alt", alt) 8705 c.urlParams_.Set("prettyPrint", "false") 8706 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8707 urls += "?" + c.urlParams_.Encode() 8708 req, err := http.NewRequest("DELETE", urls, body) 8709 if err != nil { 8710 return nil, err 8711 } 8712 req.Header = reqHeaders 8713 googleapi.Expand(req.URL, map[string]string{ 8714 "courseId": c.courseId, 8715 "userId": c.userId, 8716 }) 8717 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8718} 8719 8720// Do executes the "classroom.courses.students.delete" call. 8721// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8722// code is an error. Response headers are in either 8723// *Empty.ServerResponse.Header or (if a response was returned at all) 8724// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8725// check whether the returned error was because http.StatusNotModified 8726// was returned. 8727func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8728 gensupport.SetOptions(c.urlParams_, opts...) 8729 res, err := c.doRequest("json") 8730 if res != nil && res.StatusCode == http.StatusNotModified { 8731 if res.Body != nil { 8732 res.Body.Close() 8733 } 8734 return nil, &googleapi.Error{ 8735 Code: res.StatusCode, 8736 Header: res.Header, 8737 } 8738 } 8739 if err != nil { 8740 return nil, err 8741 } 8742 defer googleapi.CloseBody(res) 8743 if err := googleapi.CheckResponse(res); err != nil { 8744 return nil, err 8745 } 8746 ret := &Empty{ 8747 ServerResponse: googleapi.ServerResponse{ 8748 Header: res.Header, 8749 HTTPStatusCode: res.StatusCode, 8750 }, 8751 } 8752 target := &ret 8753 if err := gensupport.DecodeResponse(target, res); err != nil { 8754 return nil, err 8755 } 8756 return ret, nil 8757 // { 8758 // "description": "Deletes a student of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete\nstudents of this course or for access errors.\n* `NOT_FOUND` if no student of this course has the requested ID or if the\ncourse does not exist.", 8759 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8760 // "httpMethod": "DELETE", 8761 // "id": "classroom.courses.students.delete", 8762 // "parameterOrder": [ 8763 // "courseId", 8764 // "userId" 8765 // ], 8766 // "parameters": { 8767 // "courseId": { 8768 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8769 // "location": "path", 8770 // "required": true, 8771 // "type": "string" 8772 // }, 8773 // "userId": { 8774 // "description": "Identifier of the student to delete. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 8775 // "location": "path", 8776 // "required": true, 8777 // "type": "string" 8778 // } 8779 // }, 8780 // "path": "v1/courses/{courseId}/students/{userId}", 8781 // "response": { 8782 // "$ref": "Empty" 8783 // }, 8784 // "scopes": [ 8785 // "https://www.googleapis.com/auth/classroom.rosters" 8786 // ] 8787 // } 8788 8789} 8790 8791// method id "classroom.courses.students.get": 8792 8793type CoursesStudentsGetCall struct { 8794 s *Service 8795 courseId string 8796 userId string 8797 urlParams_ gensupport.URLParams 8798 ifNoneMatch_ string 8799 ctx_ context.Context 8800 header_ http.Header 8801} 8802 8803// Get: Returns a student of a course. 8804// 8805// This method returns the following error codes: 8806// 8807// * `PERMISSION_DENIED` if the requesting user is not permitted to 8808// view 8809// students of this course or for access errors. 8810// * `NOT_FOUND` if no student of this course has the requested ID or if 8811// the 8812// course does not exist. 8813func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall { 8814 c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8815 c.courseId = courseId 8816 c.userId = userId 8817 return c 8818} 8819 8820// Fields allows partial responses to be retrieved. See 8821// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8822// for more information. 8823func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall { 8824 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8825 return c 8826} 8827 8828// IfNoneMatch sets the optional parameter which makes the operation 8829// fail if the object's ETag matches the given value. This is useful for 8830// getting updates only after the object has changed since the last 8831// request. Use googleapi.IsNotModified to check whether the response 8832// error from Do is the result of In-None-Match. 8833func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall { 8834 c.ifNoneMatch_ = entityTag 8835 return c 8836} 8837 8838// Context sets the context to be used in this call's Do method. Any 8839// pending HTTP request will be aborted if the provided context is 8840// canceled. 8841func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall { 8842 c.ctx_ = ctx 8843 return c 8844} 8845 8846// Header returns an http.Header that can be modified by the caller to 8847// add HTTP headers to the request. 8848func (c *CoursesStudentsGetCall) Header() http.Header { 8849 if c.header_ == nil { 8850 c.header_ = make(http.Header) 8851 } 8852 return c.header_ 8853} 8854 8855func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) { 8856 reqHeaders := make(http.Header) 8857 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8858 for k, v := range c.header_ { 8859 reqHeaders[k] = v 8860 } 8861 reqHeaders.Set("User-Agent", c.s.userAgent()) 8862 if c.ifNoneMatch_ != "" { 8863 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8864 } 8865 var body io.Reader = nil 8866 c.urlParams_.Set("alt", alt) 8867 c.urlParams_.Set("prettyPrint", "false") 8868 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8869 urls += "?" + c.urlParams_.Encode() 8870 req, err := http.NewRequest("GET", urls, body) 8871 if err != nil { 8872 return nil, err 8873 } 8874 req.Header = reqHeaders 8875 googleapi.Expand(req.URL, map[string]string{ 8876 "courseId": c.courseId, 8877 "userId": c.userId, 8878 }) 8879 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8880} 8881 8882// Do executes the "classroom.courses.students.get" call. 8883// Exactly one of *Student or error will be non-nil. Any non-2xx status 8884// code is an error. Response headers are in either 8885// *Student.ServerResponse.Header or (if a response was returned at all) 8886// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8887// check whether the returned error was because http.StatusNotModified 8888// was returned. 8889func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8890 gensupport.SetOptions(c.urlParams_, opts...) 8891 res, err := c.doRequest("json") 8892 if res != nil && res.StatusCode == http.StatusNotModified { 8893 if res.Body != nil { 8894 res.Body.Close() 8895 } 8896 return nil, &googleapi.Error{ 8897 Code: res.StatusCode, 8898 Header: res.Header, 8899 } 8900 } 8901 if err != nil { 8902 return nil, err 8903 } 8904 defer googleapi.CloseBody(res) 8905 if err := googleapi.CheckResponse(res); err != nil { 8906 return nil, err 8907 } 8908 ret := &Student{ 8909 ServerResponse: googleapi.ServerResponse{ 8910 Header: res.Header, 8911 HTTPStatusCode: res.StatusCode, 8912 }, 8913 } 8914 target := &ret 8915 if err := gensupport.DecodeResponse(target, res); err != nil { 8916 return nil, err 8917 } 8918 return ret, nil 8919 // { 8920 // "description": "Returns a student of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view\nstudents of this course or for access errors.\n* `NOT_FOUND` if no student of this course has the requested ID or if the\ncourse does not exist.", 8921 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8922 // "httpMethod": "GET", 8923 // "id": "classroom.courses.students.get", 8924 // "parameterOrder": [ 8925 // "courseId", 8926 // "userId" 8927 // ], 8928 // "parameters": { 8929 // "courseId": { 8930 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8931 // "location": "path", 8932 // "required": true, 8933 // "type": "string" 8934 // }, 8935 // "userId": { 8936 // "description": "Identifier of the student to return. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 8937 // "location": "path", 8938 // "required": true, 8939 // "type": "string" 8940 // } 8941 // }, 8942 // "path": "v1/courses/{courseId}/students/{userId}", 8943 // "response": { 8944 // "$ref": "Student" 8945 // }, 8946 // "scopes": [ 8947 // "https://www.googleapis.com/auth/classroom.profile.emails", 8948 // "https://www.googleapis.com/auth/classroom.profile.photos", 8949 // "https://www.googleapis.com/auth/classroom.rosters", 8950 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 8951 // ] 8952 // } 8953 8954} 8955 8956// method id "classroom.courses.students.list": 8957 8958type CoursesStudentsListCall struct { 8959 s *Service 8960 courseId string 8961 urlParams_ gensupport.URLParams 8962 ifNoneMatch_ string 8963 ctx_ context.Context 8964 header_ http.Header 8965} 8966 8967// List: Returns a list of students of this course that the requester 8968// is permitted to view. 8969// 8970// This method returns the following error codes: 8971// 8972// * `NOT_FOUND` if the course does not exist. 8973// * `PERMISSION_DENIED` for access errors. 8974func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall { 8975 c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8976 c.courseId = courseId 8977 return c 8978} 8979 8980// PageSize sets the optional parameter "pageSize": Maximum number of 8981// items to return. Zero means no maximum. 8982// 8983// The server may return fewer than the specified number of results. 8984func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall { 8985 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8986 return c 8987} 8988 8989// PageToken sets the optional parameter "pageToken": 8990// nextPageToken 8991// value returned from a previous 8992// list call, indicating that 8993// the subsequent page of results should be returned. 8994// 8995// The list request must be 8996// otherwise identical to the one that resulted in this token. 8997func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall { 8998 c.urlParams_.Set("pageToken", pageToken) 8999 return c 9000} 9001 9002// Fields allows partial responses to be retrieved. See 9003// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9004// for more information. 9005func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall { 9006 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9007 return c 9008} 9009 9010// IfNoneMatch sets the optional parameter which makes the operation 9011// fail if the object's ETag matches the given value. This is useful for 9012// getting updates only after the object has changed since the last 9013// request. Use googleapi.IsNotModified to check whether the response 9014// error from Do is the result of In-None-Match. 9015func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall { 9016 c.ifNoneMatch_ = entityTag 9017 return c 9018} 9019 9020// Context sets the context to be used in this call's Do method. Any 9021// pending HTTP request will be aborted if the provided context is 9022// canceled. 9023func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall { 9024 c.ctx_ = ctx 9025 return c 9026} 9027 9028// Header returns an http.Header that can be modified by the caller to 9029// add HTTP headers to the request. 9030func (c *CoursesStudentsListCall) Header() http.Header { 9031 if c.header_ == nil { 9032 c.header_ = make(http.Header) 9033 } 9034 return c.header_ 9035} 9036 9037func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) { 9038 reqHeaders := make(http.Header) 9039 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9040 for k, v := range c.header_ { 9041 reqHeaders[k] = v 9042 } 9043 reqHeaders.Set("User-Agent", c.s.userAgent()) 9044 if c.ifNoneMatch_ != "" { 9045 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9046 } 9047 var body io.Reader = nil 9048 c.urlParams_.Set("alt", alt) 9049 c.urlParams_.Set("prettyPrint", "false") 9050 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9051 urls += "?" + c.urlParams_.Encode() 9052 req, err := http.NewRequest("GET", urls, body) 9053 if err != nil { 9054 return nil, err 9055 } 9056 req.Header = reqHeaders 9057 googleapi.Expand(req.URL, map[string]string{ 9058 "courseId": c.courseId, 9059 }) 9060 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9061} 9062 9063// Do executes the "classroom.courses.students.list" call. 9064// Exactly one of *ListStudentsResponse or error will be non-nil. Any 9065// non-2xx status code is an error. Response headers are in either 9066// *ListStudentsResponse.ServerResponse.Header or (if a response was 9067// returned at all) in error.(*googleapi.Error).Header. Use 9068// googleapi.IsNotModified to check whether the returned error was 9069// because http.StatusNotModified was returned. 9070func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) { 9071 gensupport.SetOptions(c.urlParams_, opts...) 9072 res, err := c.doRequest("json") 9073 if res != nil && res.StatusCode == http.StatusNotModified { 9074 if res.Body != nil { 9075 res.Body.Close() 9076 } 9077 return nil, &googleapi.Error{ 9078 Code: res.StatusCode, 9079 Header: res.Header, 9080 } 9081 } 9082 if err != nil { 9083 return nil, err 9084 } 9085 defer googleapi.CloseBody(res) 9086 if err := googleapi.CheckResponse(res); err != nil { 9087 return nil, err 9088 } 9089 ret := &ListStudentsResponse{ 9090 ServerResponse: googleapi.ServerResponse{ 9091 Header: res.Header, 9092 HTTPStatusCode: res.StatusCode, 9093 }, 9094 } 9095 target := &ret 9096 if err := gensupport.DecodeResponse(target, res); err != nil { 9097 return nil, err 9098 } 9099 return ret, nil 9100 // { 9101 // "description": "Returns a list of students of this course that the requester\nis permitted to view.\n\nThis method returns the following error codes:\n\n* `NOT_FOUND` if the course does not exist.\n* `PERMISSION_DENIED` for access errors.", 9102 // "flatPath": "v1/courses/{courseId}/students", 9103 // "httpMethod": "GET", 9104 // "id": "classroom.courses.students.list", 9105 // "parameterOrder": [ 9106 // "courseId" 9107 // ], 9108 // "parameters": { 9109 // "courseId": { 9110 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9111 // "location": "path", 9112 // "required": true, 9113 // "type": "string" 9114 // }, 9115 // "pageSize": { 9116 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9117 // "format": "int32", 9118 // "location": "query", 9119 // "type": "integer" 9120 // }, 9121 // "pageToken": { 9122 // "description": "nextPageToken\nvalue returned from a previous\nlist call, indicating that\nthe subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.", 9123 // "location": "query", 9124 // "type": "string" 9125 // } 9126 // }, 9127 // "path": "v1/courses/{courseId}/students", 9128 // "response": { 9129 // "$ref": "ListStudentsResponse" 9130 // }, 9131 // "scopes": [ 9132 // "https://www.googleapis.com/auth/classroom.profile.emails", 9133 // "https://www.googleapis.com/auth/classroom.profile.photos", 9134 // "https://www.googleapis.com/auth/classroom.rosters", 9135 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9136 // ] 9137 // } 9138 9139} 9140 9141// Pages invokes f for each page of results. 9142// A non-nil error returned from f will halt the iteration. 9143// The provided context supersedes any context provided to the Context method. 9144func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error { 9145 c.ctx_ = ctx 9146 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9147 for { 9148 x, err := c.Do() 9149 if err != nil { 9150 return err 9151 } 9152 if err := f(x); err != nil { 9153 return err 9154 } 9155 if x.NextPageToken == "" { 9156 return nil 9157 } 9158 c.PageToken(x.NextPageToken) 9159 } 9160} 9161 9162// method id "classroom.courses.teachers.create": 9163 9164type CoursesTeachersCreateCall struct { 9165 s *Service 9166 courseId string 9167 teacher *Teacher 9168 urlParams_ gensupport.URLParams 9169 ctx_ context.Context 9170 header_ http.Header 9171} 9172 9173// Create: Creates a teacher of a course. 9174// 9175// This method returns the following error codes: 9176// 9177// * `PERMISSION_DENIED` if the requesting user is not permitted to 9178// create 9179// teachers in this course or for access errors. 9180// * `NOT_FOUND` if the requested course ID does not exist. 9181// * `FAILED_PRECONDITION` if the requested user's account is 9182// disabled, 9183// for the following request errors: 9184// * CourseMemberLimitReached 9185// * CourseNotModifiable 9186// * CourseTeacherLimitReached 9187// * UserGroupsMembershipLimitReached 9188// * `ALREADY_EXISTS` if the user is already a teacher or student in 9189// the 9190// course. 9191func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall { 9192 c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9193 c.courseId = courseId 9194 c.teacher = teacher 9195 return c 9196} 9197 9198// Fields allows partial responses to be retrieved. See 9199// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9200// for more information. 9201func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall { 9202 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9203 return c 9204} 9205 9206// Context sets the context to be used in this call's Do method. Any 9207// pending HTTP request will be aborted if the provided context is 9208// canceled. 9209func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall { 9210 c.ctx_ = ctx 9211 return c 9212} 9213 9214// Header returns an http.Header that can be modified by the caller to 9215// add HTTP headers to the request. 9216func (c *CoursesTeachersCreateCall) Header() http.Header { 9217 if c.header_ == nil { 9218 c.header_ = make(http.Header) 9219 } 9220 return c.header_ 9221} 9222 9223func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) { 9224 reqHeaders := make(http.Header) 9225 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9226 for k, v := range c.header_ { 9227 reqHeaders[k] = v 9228 } 9229 reqHeaders.Set("User-Agent", c.s.userAgent()) 9230 var body io.Reader = nil 9231 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher) 9232 if err != nil { 9233 return nil, err 9234 } 9235 reqHeaders.Set("Content-Type", "application/json") 9236 c.urlParams_.Set("alt", alt) 9237 c.urlParams_.Set("prettyPrint", "false") 9238 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9239 urls += "?" + c.urlParams_.Encode() 9240 req, err := http.NewRequest("POST", urls, body) 9241 if err != nil { 9242 return nil, err 9243 } 9244 req.Header = reqHeaders 9245 googleapi.Expand(req.URL, map[string]string{ 9246 "courseId": c.courseId, 9247 }) 9248 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9249} 9250 9251// Do executes the "classroom.courses.teachers.create" call. 9252// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9253// code is an error. Response headers are in either 9254// *Teacher.ServerResponse.Header or (if a response was returned at all) 9255// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9256// check whether the returned error was because http.StatusNotModified 9257// was returned. 9258func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9259 gensupport.SetOptions(c.urlParams_, opts...) 9260 res, err := c.doRequest("json") 9261 if res != nil && res.StatusCode == http.StatusNotModified { 9262 if res.Body != nil { 9263 res.Body.Close() 9264 } 9265 return nil, &googleapi.Error{ 9266 Code: res.StatusCode, 9267 Header: res.Header, 9268 } 9269 } 9270 if err != nil { 9271 return nil, err 9272 } 9273 defer googleapi.CloseBody(res) 9274 if err := googleapi.CheckResponse(res); err != nil { 9275 return nil, err 9276 } 9277 ret := &Teacher{ 9278 ServerResponse: googleapi.ServerResponse{ 9279 Header: res.Header, 9280 HTTPStatusCode: res.StatusCode, 9281 }, 9282 } 9283 target := &ret 9284 if err := gensupport.DecodeResponse(target, res); err != nil { 9285 return nil, err 9286 } 9287 return ret, nil 9288 // { 9289 // "description": "Creates a teacher of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\nteachers in this course or for access errors.\n* `NOT_FOUND` if the requested course ID does not exist.\n* `FAILED_PRECONDITION` if the requested user's account is disabled,\nfor the following request errors:\n * CourseMemberLimitReached\n * CourseNotModifiable\n * CourseTeacherLimitReached\n * UserGroupsMembershipLimitReached\n* `ALREADY_EXISTS` if the user is already a teacher or student in the\ncourse.", 9290 // "flatPath": "v1/courses/{courseId}/teachers", 9291 // "httpMethod": "POST", 9292 // "id": "classroom.courses.teachers.create", 9293 // "parameterOrder": [ 9294 // "courseId" 9295 // ], 9296 // "parameters": { 9297 // "courseId": { 9298 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9299 // "location": "path", 9300 // "required": true, 9301 // "type": "string" 9302 // } 9303 // }, 9304 // "path": "v1/courses/{courseId}/teachers", 9305 // "request": { 9306 // "$ref": "Teacher" 9307 // }, 9308 // "response": { 9309 // "$ref": "Teacher" 9310 // }, 9311 // "scopes": [ 9312 // "https://www.googleapis.com/auth/classroom.profile.emails", 9313 // "https://www.googleapis.com/auth/classroom.profile.photos", 9314 // "https://www.googleapis.com/auth/classroom.rosters" 9315 // ] 9316 // } 9317 9318} 9319 9320// method id "classroom.courses.teachers.delete": 9321 9322type CoursesTeachersDeleteCall struct { 9323 s *Service 9324 courseId string 9325 userId string 9326 urlParams_ gensupport.URLParams 9327 ctx_ context.Context 9328 header_ http.Header 9329} 9330 9331// Delete: Deletes a teacher of a course. 9332// 9333// This method returns the following error codes: 9334// 9335// * `PERMISSION_DENIED` if the requesting user is not permitted to 9336// delete 9337// teachers of this course or for access errors. 9338// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9339// the 9340// course does not exist. 9341// * `FAILED_PRECONDITION` if the requested ID belongs to the primary 9342// teacher 9343// of this course. 9344func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall { 9345 c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9346 c.courseId = courseId 9347 c.userId = userId 9348 return c 9349} 9350 9351// Fields allows partial responses to be retrieved. See 9352// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9353// for more information. 9354func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall { 9355 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9356 return c 9357} 9358 9359// Context sets the context to be used in this call's Do method. Any 9360// pending HTTP request will be aborted if the provided context is 9361// canceled. 9362func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall { 9363 c.ctx_ = ctx 9364 return c 9365} 9366 9367// Header returns an http.Header that can be modified by the caller to 9368// add HTTP headers to the request. 9369func (c *CoursesTeachersDeleteCall) Header() http.Header { 9370 if c.header_ == nil { 9371 c.header_ = make(http.Header) 9372 } 9373 return c.header_ 9374} 9375 9376func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) { 9377 reqHeaders := make(http.Header) 9378 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9379 for k, v := range c.header_ { 9380 reqHeaders[k] = v 9381 } 9382 reqHeaders.Set("User-Agent", c.s.userAgent()) 9383 var body io.Reader = nil 9384 c.urlParams_.Set("alt", alt) 9385 c.urlParams_.Set("prettyPrint", "false") 9386 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9387 urls += "?" + c.urlParams_.Encode() 9388 req, err := http.NewRequest("DELETE", urls, body) 9389 if err != nil { 9390 return nil, err 9391 } 9392 req.Header = reqHeaders 9393 googleapi.Expand(req.URL, map[string]string{ 9394 "courseId": c.courseId, 9395 "userId": c.userId, 9396 }) 9397 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9398} 9399 9400// Do executes the "classroom.courses.teachers.delete" call. 9401// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9402// code is an error. Response headers are in either 9403// *Empty.ServerResponse.Header or (if a response was returned at all) 9404// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9405// check whether the returned error was because http.StatusNotModified 9406// was returned. 9407func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9408 gensupport.SetOptions(c.urlParams_, opts...) 9409 res, err := c.doRequest("json") 9410 if res != nil && res.StatusCode == http.StatusNotModified { 9411 if res.Body != nil { 9412 res.Body.Close() 9413 } 9414 return nil, &googleapi.Error{ 9415 Code: res.StatusCode, 9416 Header: res.Header, 9417 } 9418 } 9419 if err != nil { 9420 return nil, err 9421 } 9422 defer googleapi.CloseBody(res) 9423 if err := googleapi.CheckResponse(res); err != nil { 9424 return nil, err 9425 } 9426 ret := &Empty{ 9427 ServerResponse: googleapi.ServerResponse{ 9428 Header: res.Header, 9429 HTTPStatusCode: res.StatusCode, 9430 }, 9431 } 9432 target := &ret 9433 if err := gensupport.DecodeResponse(target, res); err != nil { 9434 return nil, err 9435 } 9436 return ret, nil 9437 // { 9438 // "description": "Deletes a teacher of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete\nteachers of this course or for access errors.\n* `NOT_FOUND` if no teacher of this course has the requested ID or if the\ncourse does not exist.\n* `FAILED_PRECONDITION` if the requested ID belongs to the primary teacher\nof this course.", 9439 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9440 // "httpMethod": "DELETE", 9441 // "id": "classroom.courses.teachers.delete", 9442 // "parameterOrder": [ 9443 // "courseId", 9444 // "userId" 9445 // ], 9446 // "parameters": { 9447 // "courseId": { 9448 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9449 // "location": "path", 9450 // "required": true, 9451 // "type": "string" 9452 // }, 9453 // "userId": { 9454 // "description": "Identifier of the teacher to delete. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 9455 // "location": "path", 9456 // "required": true, 9457 // "type": "string" 9458 // } 9459 // }, 9460 // "path": "v1/courses/{courseId}/teachers/{userId}", 9461 // "response": { 9462 // "$ref": "Empty" 9463 // }, 9464 // "scopes": [ 9465 // "https://www.googleapis.com/auth/classroom.rosters" 9466 // ] 9467 // } 9468 9469} 9470 9471// method id "classroom.courses.teachers.get": 9472 9473type CoursesTeachersGetCall struct { 9474 s *Service 9475 courseId string 9476 userId string 9477 urlParams_ gensupport.URLParams 9478 ifNoneMatch_ string 9479 ctx_ context.Context 9480 header_ http.Header 9481} 9482 9483// Get: Returns a teacher of a course. 9484// 9485// This method returns the following error codes: 9486// 9487// * `PERMISSION_DENIED` if the requesting user is not permitted to 9488// view 9489// teachers of this course or for access errors. 9490// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9491// the 9492// course does not exist. 9493func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall { 9494 c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9495 c.courseId = courseId 9496 c.userId = userId 9497 return c 9498} 9499 9500// Fields allows partial responses to be retrieved. See 9501// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9502// for more information. 9503func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall { 9504 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9505 return c 9506} 9507 9508// IfNoneMatch sets the optional parameter which makes the operation 9509// fail if the object's ETag matches the given value. This is useful for 9510// getting updates only after the object has changed since the last 9511// request. Use googleapi.IsNotModified to check whether the response 9512// error from Do is the result of In-None-Match. 9513func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall { 9514 c.ifNoneMatch_ = entityTag 9515 return c 9516} 9517 9518// Context sets the context to be used in this call's Do method. Any 9519// pending HTTP request will be aborted if the provided context is 9520// canceled. 9521func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall { 9522 c.ctx_ = ctx 9523 return c 9524} 9525 9526// Header returns an http.Header that can be modified by the caller to 9527// add HTTP headers to the request. 9528func (c *CoursesTeachersGetCall) Header() http.Header { 9529 if c.header_ == nil { 9530 c.header_ = make(http.Header) 9531 } 9532 return c.header_ 9533} 9534 9535func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) { 9536 reqHeaders := make(http.Header) 9537 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9538 for k, v := range c.header_ { 9539 reqHeaders[k] = v 9540 } 9541 reqHeaders.Set("User-Agent", c.s.userAgent()) 9542 if c.ifNoneMatch_ != "" { 9543 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9544 } 9545 var body io.Reader = nil 9546 c.urlParams_.Set("alt", alt) 9547 c.urlParams_.Set("prettyPrint", "false") 9548 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9549 urls += "?" + c.urlParams_.Encode() 9550 req, err := http.NewRequest("GET", urls, body) 9551 if err != nil { 9552 return nil, err 9553 } 9554 req.Header = reqHeaders 9555 googleapi.Expand(req.URL, map[string]string{ 9556 "courseId": c.courseId, 9557 "userId": c.userId, 9558 }) 9559 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9560} 9561 9562// Do executes the "classroom.courses.teachers.get" call. 9563// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9564// code is an error. Response headers are in either 9565// *Teacher.ServerResponse.Header or (if a response was returned at all) 9566// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9567// check whether the returned error was because http.StatusNotModified 9568// was returned. 9569func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9570 gensupport.SetOptions(c.urlParams_, opts...) 9571 res, err := c.doRequest("json") 9572 if res != nil && res.StatusCode == http.StatusNotModified { 9573 if res.Body != nil { 9574 res.Body.Close() 9575 } 9576 return nil, &googleapi.Error{ 9577 Code: res.StatusCode, 9578 Header: res.Header, 9579 } 9580 } 9581 if err != nil { 9582 return nil, err 9583 } 9584 defer googleapi.CloseBody(res) 9585 if err := googleapi.CheckResponse(res); err != nil { 9586 return nil, err 9587 } 9588 ret := &Teacher{ 9589 ServerResponse: googleapi.ServerResponse{ 9590 Header: res.Header, 9591 HTTPStatusCode: res.StatusCode, 9592 }, 9593 } 9594 target := &ret 9595 if err := gensupport.DecodeResponse(target, res); err != nil { 9596 return nil, err 9597 } 9598 return ret, nil 9599 // { 9600 // "description": "Returns a teacher of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view\nteachers of this course or for access errors.\n* `NOT_FOUND` if no teacher of this course has the requested ID or if the\ncourse does not exist.", 9601 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9602 // "httpMethod": "GET", 9603 // "id": "classroom.courses.teachers.get", 9604 // "parameterOrder": [ 9605 // "courseId", 9606 // "userId" 9607 // ], 9608 // "parameters": { 9609 // "courseId": { 9610 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9611 // "location": "path", 9612 // "required": true, 9613 // "type": "string" 9614 // }, 9615 // "userId": { 9616 // "description": "Identifier of the teacher to return. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 9617 // "location": "path", 9618 // "required": true, 9619 // "type": "string" 9620 // } 9621 // }, 9622 // "path": "v1/courses/{courseId}/teachers/{userId}", 9623 // "response": { 9624 // "$ref": "Teacher" 9625 // }, 9626 // "scopes": [ 9627 // "https://www.googleapis.com/auth/classroom.profile.emails", 9628 // "https://www.googleapis.com/auth/classroom.profile.photos", 9629 // "https://www.googleapis.com/auth/classroom.rosters", 9630 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9631 // ] 9632 // } 9633 9634} 9635 9636// method id "classroom.courses.teachers.list": 9637 9638type CoursesTeachersListCall struct { 9639 s *Service 9640 courseId string 9641 urlParams_ gensupport.URLParams 9642 ifNoneMatch_ string 9643 ctx_ context.Context 9644 header_ http.Header 9645} 9646 9647// List: Returns a list of teachers of this course that the requester 9648// is permitted to view. 9649// 9650// This method returns the following error codes: 9651// 9652// * `NOT_FOUND` if the course does not exist. 9653// * `PERMISSION_DENIED` for access errors. 9654func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall { 9655 c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9656 c.courseId = courseId 9657 return c 9658} 9659 9660// PageSize sets the optional parameter "pageSize": Maximum number of 9661// items to return. Zero means no maximum. 9662// 9663// The server may return fewer than the specified number of results. 9664func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall { 9665 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9666 return c 9667} 9668 9669// PageToken sets the optional parameter "pageToken": 9670// nextPageToken 9671// value returned from a previous 9672// list call, indicating that 9673// the subsequent page of results should be returned. 9674// 9675// The list request must be 9676// otherwise identical to the one that resulted in this token. 9677func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall { 9678 c.urlParams_.Set("pageToken", pageToken) 9679 return c 9680} 9681 9682// Fields allows partial responses to be retrieved. See 9683// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9684// for more information. 9685func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall { 9686 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9687 return c 9688} 9689 9690// IfNoneMatch sets the optional parameter which makes the operation 9691// fail if the object's ETag matches the given value. This is useful for 9692// getting updates only after the object has changed since the last 9693// request. Use googleapi.IsNotModified to check whether the response 9694// error from Do is the result of In-None-Match. 9695func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall { 9696 c.ifNoneMatch_ = entityTag 9697 return c 9698} 9699 9700// Context sets the context to be used in this call's Do method. Any 9701// pending HTTP request will be aborted if the provided context is 9702// canceled. 9703func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall { 9704 c.ctx_ = ctx 9705 return c 9706} 9707 9708// Header returns an http.Header that can be modified by the caller to 9709// add HTTP headers to the request. 9710func (c *CoursesTeachersListCall) Header() http.Header { 9711 if c.header_ == nil { 9712 c.header_ = make(http.Header) 9713 } 9714 return c.header_ 9715} 9716 9717func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) { 9718 reqHeaders := make(http.Header) 9719 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9720 for k, v := range c.header_ { 9721 reqHeaders[k] = v 9722 } 9723 reqHeaders.Set("User-Agent", c.s.userAgent()) 9724 if c.ifNoneMatch_ != "" { 9725 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9726 } 9727 var body io.Reader = nil 9728 c.urlParams_.Set("alt", alt) 9729 c.urlParams_.Set("prettyPrint", "false") 9730 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9731 urls += "?" + c.urlParams_.Encode() 9732 req, err := http.NewRequest("GET", urls, body) 9733 if err != nil { 9734 return nil, err 9735 } 9736 req.Header = reqHeaders 9737 googleapi.Expand(req.URL, map[string]string{ 9738 "courseId": c.courseId, 9739 }) 9740 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9741} 9742 9743// Do executes the "classroom.courses.teachers.list" call. 9744// Exactly one of *ListTeachersResponse or error will be non-nil. Any 9745// non-2xx status code is an error. Response headers are in either 9746// *ListTeachersResponse.ServerResponse.Header or (if a response was 9747// returned at all) in error.(*googleapi.Error).Header. Use 9748// googleapi.IsNotModified to check whether the returned error was 9749// because http.StatusNotModified was returned. 9750func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) { 9751 gensupport.SetOptions(c.urlParams_, opts...) 9752 res, err := c.doRequest("json") 9753 if res != nil && res.StatusCode == http.StatusNotModified { 9754 if res.Body != nil { 9755 res.Body.Close() 9756 } 9757 return nil, &googleapi.Error{ 9758 Code: res.StatusCode, 9759 Header: res.Header, 9760 } 9761 } 9762 if err != nil { 9763 return nil, err 9764 } 9765 defer googleapi.CloseBody(res) 9766 if err := googleapi.CheckResponse(res); err != nil { 9767 return nil, err 9768 } 9769 ret := &ListTeachersResponse{ 9770 ServerResponse: googleapi.ServerResponse{ 9771 Header: res.Header, 9772 HTTPStatusCode: res.StatusCode, 9773 }, 9774 } 9775 target := &ret 9776 if err := gensupport.DecodeResponse(target, res); err != nil { 9777 return nil, err 9778 } 9779 return ret, nil 9780 // { 9781 // "description": "Returns a list of teachers of this course that the requester\nis permitted to view.\n\nThis method returns the following error codes:\n\n* `NOT_FOUND` if the course does not exist.\n* `PERMISSION_DENIED` for access errors.", 9782 // "flatPath": "v1/courses/{courseId}/teachers", 9783 // "httpMethod": "GET", 9784 // "id": "classroom.courses.teachers.list", 9785 // "parameterOrder": [ 9786 // "courseId" 9787 // ], 9788 // "parameters": { 9789 // "courseId": { 9790 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9791 // "location": "path", 9792 // "required": true, 9793 // "type": "string" 9794 // }, 9795 // "pageSize": { 9796 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9797 // "format": "int32", 9798 // "location": "query", 9799 // "type": "integer" 9800 // }, 9801 // "pageToken": { 9802 // "description": "nextPageToken\nvalue returned from a previous\nlist call, indicating that\nthe subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.", 9803 // "location": "query", 9804 // "type": "string" 9805 // } 9806 // }, 9807 // "path": "v1/courses/{courseId}/teachers", 9808 // "response": { 9809 // "$ref": "ListTeachersResponse" 9810 // }, 9811 // "scopes": [ 9812 // "https://www.googleapis.com/auth/classroom.profile.emails", 9813 // "https://www.googleapis.com/auth/classroom.profile.photos", 9814 // "https://www.googleapis.com/auth/classroom.rosters", 9815 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9816 // ] 9817 // } 9818 9819} 9820 9821// Pages invokes f for each page of results. 9822// A non-nil error returned from f will halt the iteration. 9823// The provided context supersedes any context provided to the Context method. 9824func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error { 9825 c.ctx_ = ctx 9826 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9827 for { 9828 x, err := c.Do() 9829 if err != nil { 9830 return err 9831 } 9832 if err := f(x); err != nil { 9833 return err 9834 } 9835 if x.NextPageToken == "" { 9836 return nil 9837 } 9838 c.PageToken(x.NextPageToken) 9839 } 9840} 9841 9842// method id "classroom.courses.topics.create": 9843 9844type CoursesTopicsCreateCall struct { 9845 s *Service 9846 courseId string 9847 topic *Topic 9848 urlParams_ gensupport.URLParams 9849 ctx_ context.Context 9850 header_ http.Header 9851} 9852 9853// Create: Creates a topic. 9854// 9855// This method returns the following error codes: 9856// 9857// * `PERMISSION_DENIED` if the requesting user is not permitted to 9858// access the 9859// requested course, create a topic in the requested course, 9860// or for access errors. 9861// * `INVALID_ARGUMENT` if the request is malformed. 9862// * `NOT_FOUND` if the requested course does not exist. 9863func (r *CoursesTopicsService) Create(courseId string, topic *Topic) *CoursesTopicsCreateCall { 9864 c := &CoursesTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9865 c.courseId = courseId 9866 c.topic = topic 9867 return c 9868} 9869 9870// Fields allows partial responses to be retrieved. See 9871// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9872// for more information. 9873func (c *CoursesTopicsCreateCall) Fields(s ...googleapi.Field) *CoursesTopicsCreateCall { 9874 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9875 return c 9876} 9877 9878// Context sets the context to be used in this call's Do method. Any 9879// pending HTTP request will be aborted if the provided context is 9880// canceled. 9881func (c *CoursesTopicsCreateCall) Context(ctx context.Context) *CoursesTopicsCreateCall { 9882 c.ctx_ = ctx 9883 return c 9884} 9885 9886// Header returns an http.Header that can be modified by the caller to 9887// add HTTP headers to the request. 9888func (c *CoursesTopicsCreateCall) Header() http.Header { 9889 if c.header_ == nil { 9890 c.header_ = make(http.Header) 9891 } 9892 return c.header_ 9893} 9894 9895func (c *CoursesTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 9896 reqHeaders := make(http.Header) 9897 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9898 for k, v := range c.header_ { 9899 reqHeaders[k] = v 9900 } 9901 reqHeaders.Set("User-Agent", c.s.userAgent()) 9902 var body io.Reader = nil 9903 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 9904 if err != nil { 9905 return nil, err 9906 } 9907 reqHeaders.Set("Content-Type", "application/json") 9908 c.urlParams_.Set("alt", alt) 9909 c.urlParams_.Set("prettyPrint", "false") 9910 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 9911 urls += "?" + c.urlParams_.Encode() 9912 req, err := http.NewRequest("POST", urls, body) 9913 if err != nil { 9914 return nil, err 9915 } 9916 req.Header = reqHeaders 9917 googleapi.Expand(req.URL, map[string]string{ 9918 "courseId": c.courseId, 9919 }) 9920 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9921} 9922 9923// Do executes the "classroom.courses.topics.create" call. 9924// Exactly one of *Topic or error will be non-nil. Any non-2xx status 9925// code is an error. Response headers are in either 9926// *Topic.ServerResponse.Header or (if a response was returned at all) 9927// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9928// check whether the returned error was because http.StatusNotModified 9929// was returned. 9930func (c *CoursesTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 9931 gensupport.SetOptions(c.urlParams_, opts...) 9932 res, err := c.doRequest("json") 9933 if res != nil && res.StatusCode == http.StatusNotModified { 9934 if res.Body != nil { 9935 res.Body.Close() 9936 } 9937 return nil, &googleapi.Error{ 9938 Code: res.StatusCode, 9939 Header: res.Header, 9940 } 9941 } 9942 if err != nil { 9943 return nil, err 9944 } 9945 defer googleapi.CloseBody(res) 9946 if err := googleapi.CheckResponse(res); err != nil { 9947 return nil, err 9948 } 9949 ret := &Topic{ 9950 ServerResponse: googleapi.ServerResponse{ 9951 Header: res.Header, 9952 HTTPStatusCode: res.StatusCode, 9953 }, 9954 } 9955 target := &ret 9956 if err := gensupport.DecodeResponse(target, res); err != nil { 9957 return nil, err 9958 } 9959 return ret, nil 9960 // { 9961 // "description": "Creates a topic.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, create a topic in the requested course,\nor for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.", 9962 // "flatPath": "v1/courses/{courseId}/topics", 9963 // "httpMethod": "POST", 9964 // "id": "classroom.courses.topics.create", 9965 // "parameterOrder": [ 9966 // "courseId" 9967 // ], 9968 // "parameters": { 9969 // "courseId": { 9970 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9971 // "location": "path", 9972 // "required": true, 9973 // "type": "string" 9974 // } 9975 // }, 9976 // "path": "v1/courses/{courseId}/topics", 9977 // "request": { 9978 // "$ref": "Topic" 9979 // }, 9980 // "response": { 9981 // "$ref": "Topic" 9982 // }, 9983 // "scopes": [ 9984 // "https://www.googleapis.com/auth/classroom.topics" 9985 // ] 9986 // } 9987 9988} 9989 9990// method id "classroom.courses.topics.delete": 9991 9992type CoursesTopicsDeleteCall struct { 9993 s *Service 9994 courseId string 9995 id string 9996 urlParams_ gensupport.URLParams 9997 ctx_ context.Context 9998 header_ http.Header 9999} 10000 10001// Delete: Deletes a topic. 10002// 10003// This method returns the following error codes: 10004// 10005// * `PERMISSION_DENIED` if the requesting user is not allowed to delete 10006// the 10007// requested topic or for access errors. 10008// * `FAILED_PRECONDITION` if the requested topic has already 10009// been 10010// deleted. 10011// * `NOT_FOUND` if no course or topic exists with the requested ID. 10012func (r *CoursesTopicsService) Delete(courseId string, id string) *CoursesTopicsDeleteCall { 10013 c := &CoursesTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10014 c.courseId = courseId 10015 c.id = id 10016 return c 10017} 10018 10019// Fields allows partial responses to be retrieved. See 10020// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10021// for more information. 10022func (c *CoursesTopicsDeleteCall) Fields(s ...googleapi.Field) *CoursesTopicsDeleteCall { 10023 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10024 return c 10025} 10026 10027// Context sets the context to be used in this call's Do method. Any 10028// pending HTTP request will be aborted if the provided context is 10029// canceled. 10030func (c *CoursesTopicsDeleteCall) Context(ctx context.Context) *CoursesTopicsDeleteCall { 10031 c.ctx_ = ctx 10032 return c 10033} 10034 10035// Header returns an http.Header that can be modified by the caller to 10036// add HTTP headers to the request. 10037func (c *CoursesTopicsDeleteCall) Header() http.Header { 10038 if c.header_ == nil { 10039 c.header_ = make(http.Header) 10040 } 10041 return c.header_ 10042} 10043 10044func (c *CoursesTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 10045 reqHeaders := make(http.Header) 10046 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10047 for k, v := range c.header_ { 10048 reqHeaders[k] = v 10049 } 10050 reqHeaders.Set("User-Agent", c.s.userAgent()) 10051 var body io.Reader = nil 10052 c.urlParams_.Set("alt", alt) 10053 c.urlParams_.Set("prettyPrint", "false") 10054 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10055 urls += "?" + c.urlParams_.Encode() 10056 req, err := http.NewRequest("DELETE", urls, body) 10057 if err != nil { 10058 return nil, err 10059 } 10060 req.Header = reqHeaders 10061 googleapi.Expand(req.URL, map[string]string{ 10062 "courseId": c.courseId, 10063 "id": c.id, 10064 }) 10065 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10066} 10067 10068// Do executes the "classroom.courses.topics.delete" call. 10069// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10070// code is an error. Response headers are in either 10071// *Empty.ServerResponse.Header or (if a response was returned at all) 10072// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10073// check whether the returned error was because http.StatusNotModified 10074// was returned. 10075func (c *CoursesTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10076 gensupport.SetOptions(c.urlParams_, opts...) 10077 res, err := c.doRequest("json") 10078 if res != nil && res.StatusCode == http.StatusNotModified { 10079 if res.Body != nil { 10080 res.Body.Close() 10081 } 10082 return nil, &googleapi.Error{ 10083 Code: res.StatusCode, 10084 Header: res.Header, 10085 } 10086 } 10087 if err != nil { 10088 return nil, err 10089 } 10090 defer googleapi.CloseBody(res) 10091 if err := googleapi.CheckResponse(res); err != nil { 10092 return nil, err 10093 } 10094 ret := &Empty{ 10095 ServerResponse: googleapi.ServerResponse{ 10096 Header: res.Header, 10097 HTTPStatusCode: res.StatusCode, 10098 }, 10099 } 10100 target := &ret 10101 if err := gensupport.DecodeResponse(target, res); err != nil { 10102 return nil, err 10103 } 10104 return ret, nil 10105 // { 10106 // "description": "Deletes a topic.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not allowed to delete the\nrequested topic or for access errors.\n* `FAILED_PRECONDITION` if the requested topic has already been\ndeleted.\n* `NOT_FOUND` if no course or topic exists with the requested ID.", 10107 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10108 // "httpMethod": "DELETE", 10109 // "id": "classroom.courses.topics.delete", 10110 // "parameterOrder": [ 10111 // "courseId", 10112 // "id" 10113 // ], 10114 // "parameters": { 10115 // "courseId": { 10116 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10117 // "location": "path", 10118 // "required": true, 10119 // "type": "string" 10120 // }, 10121 // "id": { 10122 // "description": "Identifier of the topic to delete.", 10123 // "location": "path", 10124 // "required": true, 10125 // "type": "string" 10126 // } 10127 // }, 10128 // "path": "v1/courses/{courseId}/topics/{id}", 10129 // "response": { 10130 // "$ref": "Empty" 10131 // }, 10132 // "scopes": [ 10133 // "https://www.googleapis.com/auth/classroom.topics" 10134 // ] 10135 // } 10136 10137} 10138 10139// method id "classroom.courses.topics.get": 10140 10141type CoursesTopicsGetCall struct { 10142 s *Service 10143 courseId string 10144 id string 10145 urlParams_ gensupport.URLParams 10146 ifNoneMatch_ string 10147 ctx_ context.Context 10148 header_ http.Header 10149} 10150 10151// Get: Returns a topic. 10152// 10153// This method returns the following error codes: 10154// 10155// * `PERMISSION_DENIED` if the requesting user is not permitted to 10156// access the 10157// requested course or topic, or for access errors. 10158// * `INVALID_ARGUMENT` if the request is malformed. 10159// * `NOT_FOUND` if the requested course or topic does not exist. 10160func (r *CoursesTopicsService) Get(courseId string, id string) *CoursesTopicsGetCall { 10161 c := &CoursesTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10162 c.courseId = courseId 10163 c.id = id 10164 return c 10165} 10166 10167// Fields allows partial responses to be retrieved. See 10168// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10169// for more information. 10170func (c *CoursesTopicsGetCall) Fields(s ...googleapi.Field) *CoursesTopicsGetCall { 10171 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10172 return c 10173} 10174 10175// IfNoneMatch sets the optional parameter which makes the operation 10176// fail if the object's ETag matches the given value. This is useful for 10177// getting updates only after the object has changed since the last 10178// request. Use googleapi.IsNotModified to check whether the response 10179// error from Do is the result of In-None-Match. 10180func (c *CoursesTopicsGetCall) IfNoneMatch(entityTag string) *CoursesTopicsGetCall { 10181 c.ifNoneMatch_ = entityTag 10182 return c 10183} 10184 10185// Context sets the context to be used in this call's Do method. Any 10186// pending HTTP request will be aborted if the provided context is 10187// canceled. 10188func (c *CoursesTopicsGetCall) Context(ctx context.Context) *CoursesTopicsGetCall { 10189 c.ctx_ = ctx 10190 return c 10191} 10192 10193// Header returns an http.Header that can be modified by the caller to 10194// add HTTP headers to the request. 10195func (c *CoursesTopicsGetCall) Header() http.Header { 10196 if c.header_ == nil { 10197 c.header_ = make(http.Header) 10198 } 10199 return c.header_ 10200} 10201 10202func (c *CoursesTopicsGetCall) doRequest(alt string) (*http.Response, error) { 10203 reqHeaders := make(http.Header) 10204 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10205 for k, v := range c.header_ { 10206 reqHeaders[k] = v 10207 } 10208 reqHeaders.Set("User-Agent", c.s.userAgent()) 10209 if c.ifNoneMatch_ != "" { 10210 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10211 } 10212 var body io.Reader = nil 10213 c.urlParams_.Set("alt", alt) 10214 c.urlParams_.Set("prettyPrint", "false") 10215 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10216 urls += "?" + c.urlParams_.Encode() 10217 req, err := http.NewRequest("GET", urls, body) 10218 if err != nil { 10219 return nil, err 10220 } 10221 req.Header = reqHeaders 10222 googleapi.Expand(req.URL, map[string]string{ 10223 "courseId": c.courseId, 10224 "id": c.id, 10225 }) 10226 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10227} 10228 10229// Do executes the "classroom.courses.topics.get" call. 10230// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10231// code is an error. Response headers are in either 10232// *Topic.ServerResponse.Header or (if a response was returned at all) 10233// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10234// check whether the returned error was because http.StatusNotModified 10235// was returned. 10236func (c *CoursesTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10237 gensupport.SetOptions(c.urlParams_, opts...) 10238 res, err := c.doRequest("json") 10239 if res != nil && res.StatusCode == http.StatusNotModified { 10240 if res.Body != nil { 10241 res.Body.Close() 10242 } 10243 return nil, &googleapi.Error{ 10244 Code: res.StatusCode, 10245 Header: res.Header, 10246 } 10247 } 10248 if err != nil { 10249 return nil, err 10250 } 10251 defer googleapi.CloseBody(res) 10252 if err := googleapi.CheckResponse(res); err != nil { 10253 return nil, err 10254 } 10255 ret := &Topic{ 10256 ServerResponse: googleapi.ServerResponse{ 10257 Header: res.Header, 10258 HTTPStatusCode: res.StatusCode, 10259 }, 10260 } 10261 target := &ret 10262 if err := gensupport.DecodeResponse(target, res); err != nil { 10263 return nil, err 10264 } 10265 return ret, nil 10266 // { 10267 // "description": "Returns a topic.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or topic, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or topic does not exist.", 10268 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10269 // "httpMethod": "GET", 10270 // "id": "classroom.courses.topics.get", 10271 // "parameterOrder": [ 10272 // "courseId", 10273 // "id" 10274 // ], 10275 // "parameters": { 10276 // "courseId": { 10277 // "description": "Identifier of the course.", 10278 // "location": "path", 10279 // "required": true, 10280 // "type": "string" 10281 // }, 10282 // "id": { 10283 // "description": "Identifier of the topic.", 10284 // "location": "path", 10285 // "required": true, 10286 // "type": "string" 10287 // } 10288 // }, 10289 // "path": "v1/courses/{courseId}/topics/{id}", 10290 // "response": { 10291 // "$ref": "Topic" 10292 // }, 10293 // "scopes": [ 10294 // "https://www.googleapis.com/auth/classroom.topics", 10295 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10296 // ] 10297 // } 10298 10299} 10300 10301// method id "classroom.courses.topics.list": 10302 10303type CoursesTopicsListCall struct { 10304 s *Service 10305 courseId string 10306 urlParams_ gensupport.URLParams 10307 ifNoneMatch_ string 10308 ctx_ context.Context 10309 header_ http.Header 10310} 10311 10312// List: Returns the list of topics that the requester is permitted to 10313// view. 10314// 10315// This method returns the following error codes: 10316// 10317// * `PERMISSION_DENIED` if the requesting user is not permitted to 10318// access 10319// the requested course or for access errors. 10320// * `INVALID_ARGUMENT` if the request is malformed. 10321// * `NOT_FOUND` if the requested course does not exist. 10322func (r *CoursesTopicsService) List(courseId string) *CoursesTopicsListCall { 10323 c := &CoursesTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10324 c.courseId = courseId 10325 return c 10326} 10327 10328// PageSize sets the optional parameter "pageSize": Maximum number of 10329// items to return. Zero or unspecified indicates that the 10330// server may assign a maximum. 10331// 10332// The server may return fewer than the specified number of results. 10333func (c *CoursesTopicsListCall) PageSize(pageSize int64) *CoursesTopicsListCall { 10334 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10335 return c 10336} 10337 10338// PageToken sets the optional parameter "pageToken": 10339// nextPageToken 10340// value returned from a previous 10341// list call, 10342// indicating that the subsequent page of results should be 10343// returned. 10344// 10345// The list request 10346// must be otherwise identical to the one that resulted in this token. 10347func (c *CoursesTopicsListCall) PageToken(pageToken string) *CoursesTopicsListCall { 10348 c.urlParams_.Set("pageToken", pageToken) 10349 return c 10350} 10351 10352// Fields allows partial responses to be retrieved. See 10353// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10354// for more information. 10355func (c *CoursesTopicsListCall) Fields(s ...googleapi.Field) *CoursesTopicsListCall { 10356 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10357 return c 10358} 10359 10360// IfNoneMatch sets the optional parameter which makes the operation 10361// fail if the object's ETag matches the given value. This is useful for 10362// getting updates only after the object has changed since the last 10363// request. Use googleapi.IsNotModified to check whether the response 10364// error from Do is the result of In-None-Match. 10365func (c *CoursesTopicsListCall) IfNoneMatch(entityTag string) *CoursesTopicsListCall { 10366 c.ifNoneMatch_ = entityTag 10367 return c 10368} 10369 10370// Context sets the context to be used in this call's Do method. Any 10371// pending HTTP request will be aborted if the provided context is 10372// canceled. 10373func (c *CoursesTopicsListCall) Context(ctx context.Context) *CoursesTopicsListCall { 10374 c.ctx_ = ctx 10375 return c 10376} 10377 10378// Header returns an http.Header that can be modified by the caller to 10379// add HTTP headers to the request. 10380func (c *CoursesTopicsListCall) Header() http.Header { 10381 if c.header_ == nil { 10382 c.header_ = make(http.Header) 10383 } 10384 return c.header_ 10385} 10386 10387func (c *CoursesTopicsListCall) doRequest(alt string) (*http.Response, error) { 10388 reqHeaders := make(http.Header) 10389 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10390 for k, v := range c.header_ { 10391 reqHeaders[k] = v 10392 } 10393 reqHeaders.Set("User-Agent", c.s.userAgent()) 10394 if c.ifNoneMatch_ != "" { 10395 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10396 } 10397 var body io.Reader = nil 10398 c.urlParams_.Set("alt", alt) 10399 c.urlParams_.Set("prettyPrint", "false") 10400 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10401 urls += "?" + c.urlParams_.Encode() 10402 req, err := http.NewRequest("GET", urls, body) 10403 if err != nil { 10404 return nil, err 10405 } 10406 req.Header = reqHeaders 10407 googleapi.Expand(req.URL, map[string]string{ 10408 "courseId": c.courseId, 10409 }) 10410 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10411} 10412 10413// Do executes the "classroom.courses.topics.list" call. 10414// Exactly one of *ListTopicResponse or error will be non-nil. Any 10415// non-2xx status code is an error. Response headers are in either 10416// *ListTopicResponse.ServerResponse.Header or (if a response was 10417// returned at all) in error.(*googleapi.Error).Header. Use 10418// googleapi.IsNotModified to check whether the returned error was 10419// because http.StatusNotModified was returned. 10420func (c *CoursesTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicResponse, error) { 10421 gensupport.SetOptions(c.urlParams_, opts...) 10422 res, err := c.doRequest("json") 10423 if res != nil && res.StatusCode == http.StatusNotModified { 10424 if res.Body != nil { 10425 res.Body.Close() 10426 } 10427 return nil, &googleapi.Error{ 10428 Code: res.StatusCode, 10429 Header: res.Header, 10430 } 10431 } 10432 if err != nil { 10433 return nil, err 10434 } 10435 defer googleapi.CloseBody(res) 10436 if err := googleapi.CheckResponse(res); err != nil { 10437 return nil, err 10438 } 10439 ret := &ListTopicResponse{ 10440 ServerResponse: googleapi.ServerResponse{ 10441 Header: res.Header, 10442 HTTPStatusCode: res.StatusCode, 10443 }, 10444 } 10445 target := &ret 10446 if err := gensupport.DecodeResponse(target, res); err != nil { 10447 return nil, err 10448 } 10449 return ret, nil 10450 // { 10451 // "description": "Returns the list of topics that the requester is permitted to view.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthe requested course or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.", 10452 // "flatPath": "v1/courses/{courseId}/topics", 10453 // "httpMethod": "GET", 10454 // "id": "classroom.courses.topics.list", 10455 // "parameterOrder": [ 10456 // "courseId" 10457 // ], 10458 // "parameters": { 10459 // "courseId": { 10460 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10461 // "location": "path", 10462 // "required": true, 10463 // "type": "string" 10464 // }, 10465 // "pageSize": { 10466 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 10467 // "format": "int32", 10468 // "location": "query", 10469 // "type": "integer" 10470 // }, 10471 // "pageToken": { 10472 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 10473 // "location": "query", 10474 // "type": "string" 10475 // } 10476 // }, 10477 // "path": "v1/courses/{courseId}/topics", 10478 // "response": { 10479 // "$ref": "ListTopicResponse" 10480 // }, 10481 // "scopes": [ 10482 // "https://www.googleapis.com/auth/classroom.topics", 10483 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10484 // ] 10485 // } 10486 10487} 10488 10489// Pages invokes f for each page of results. 10490// A non-nil error returned from f will halt the iteration. 10491// The provided context supersedes any context provided to the Context method. 10492func (c *CoursesTopicsListCall) Pages(ctx context.Context, f func(*ListTopicResponse) error) error { 10493 c.ctx_ = ctx 10494 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10495 for { 10496 x, err := c.Do() 10497 if err != nil { 10498 return err 10499 } 10500 if err := f(x); err != nil { 10501 return err 10502 } 10503 if x.NextPageToken == "" { 10504 return nil 10505 } 10506 c.PageToken(x.NextPageToken) 10507 } 10508} 10509 10510// method id "classroom.courses.topics.patch": 10511 10512type CoursesTopicsPatchCall struct { 10513 s *Service 10514 courseId string 10515 id string 10516 topic *Topic 10517 urlParams_ gensupport.URLParams 10518 ctx_ context.Context 10519 header_ http.Header 10520} 10521 10522// Patch: Updates one or more fields of a topic. 10523// 10524// This method returns the following error codes: 10525// 10526// * `PERMISSION_DENIED` if the requesting developer project did not 10527// create 10528// the corresponding topic or for access errors. 10529// * `INVALID_ARGUMENT` if the request is malformed. 10530// * `NOT_FOUND` if the requested course or topic does not exist 10531func (r *CoursesTopicsService) Patch(courseId string, id string, topic *Topic) *CoursesTopicsPatchCall { 10532 c := &CoursesTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10533 c.courseId = courseId 10534 c.id = id 10535 c.topic = topic 10536 return c 10537} 10538 10539// UpdateMask sets the optional parameter "updateMask": Mask that 10540// identifies which fields on the topic to update. 10541// This field is required to do an update. The update fails if 10542// invalid 10543// fields are specified. If a field supports empty values, it can be 10544// cleared 10545// by specifying it in the update mask and not in the Topic object. If 10546// a 10547// field that does not support empty values is included in the update 10548// mask and 10549// not set in the Topic object, an `INVALID_ARGUMENT` error 10550// is 10551// returned. 10552// 10553// The following fields may be specified: 10554// 10555// * `name` 10556func (c *CoursesTopicsPatchCall) UpdateMask(updateMask string) *CoursesTopicsPatchCall { 10557 c.urlParams_.Set("updateMask", updateMask) 10558 return c 10559} 10560 10561// Fields allows partial responses to be retrieved. See 10562// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10563// for more information. 10564func (c *CoursesTopicsPatchCall) Fields(s ...googleapi.Field) *CoursesTopicsPatchCall { 10565 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10566 return c 10567} 10568 10569// Context sets the context to be used in this call's Do method. Any 10570// pending HTTP request will be aborted if the provided context is 10571// canceled. 10572func (c *CoursesTopicsPatchCall) Context(ctx context.Context) *CoursesTopicsPatchCall { 10573 c.ctx_ = ctx 10574 return c 10575} 10576 10577// Header returns an http.Header that can be modified by the caller to 10578// add HTTP headers to the request. 10579func (c *CoursesTopicsPatchCall) Header() http.Header { 10580 if c.header_ == nil { 10581 c.header_ = make(http.Header) 10582 } 10583 return c.header_ 10584} 10585 10586func (c *CoursesTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 10587 reqHeaders := make(http.Header) 10588 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10589 for k, v := range c.header_ { 10590 reqHeaders[k] = v 10591 } 10592 reqHeaders.Set("User-Agent", c.s.userAgent()) 10593 var body io.Reader = nil 10594 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 10595 if err != nil { 10596 return nil, err 10597 } 10598 reqHeaders.Set("Content-Type", "application/json") 10599 c.urlParams_.Set("alt", alt) 10600 c.urlParams_.Set("prettyPrint", "false") 10601 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10602 urls += "?" + c.urlParams_.Encode() 10603 req, err := http.NewRequest("PATCH", urls, body) 10604 if err != nil { 10605 return nil, err 10606 } 10607 req.Header = reqHeaders 10608 googleapi.Expand(req.URL, map[string]string{ 10609 "courseId": c.courseId, 10610 "id": c.id, 10611 }) 10612 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10613} 10614 10615// Do executes the "classroom.courses.topics.patch" call. 10616// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10617// code is an error. Response headers are in either 10618// *Topic.ServerResponse.Header or (if a response was returned at all) 10619// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10620// check whether the returned error was because http.StatusNotModified 10621// was returned. 10622func (c *CoursesTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10623 gensupport.SetOptions(c.urlParams_, opts...) 10624 res, err := c.doRequest("json") 10625 if res != nil && res.StatusCode == http.StatusNotModified { 10626 if res.Body != nil { 10627 res.Body.Close() 10628 } 10629 return nil, &googleapi.Error{ 10630 Code: res.StatusCode, 10631 Header: res.Header, 10632 } 10633 } 10634 if err != nil { 10635 return nil, err 10636 } 10637 defer googleapi.CloseBody(res) 10638 if err := googleapi.CheckResponse(res); err != nil { 10639 return nil, err 10640 } 10641 ret := &Topic{ 10642 ServerResponse: googleapi.ServerResponse{ 10643 Header: res.Header, 10644 HTTPStatusCode: res.StatusCode, 10645 }, 10646 } 10647 target := &ret 10648 if err := gensupport.DecodeResponse(target, res); err != nil { 10649 return nil, err 10650 } 10651 return ret, nil 10652 // { 10653 // "description": "Updates one or more fields of a topic.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding topic or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or topic does not exist", 10654 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10655 // "httpMethod": "PATCH", 10656 // "id": "classroom.courses.topics.patch", 10657 // "parameterOrder": [ 10658 // "courseId", 10659 // "id" 10660 // ], 10661 // "parameters": { 10662 // "courseId": { 10663 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10664 // "location": "path", 10665 // "required": true, 10666 // "type": "string" 10667 // }, 10668 // "id": { 10669 // "description": "Identifier of the topic.", 10670 // "location": "path", 10671 // "required": true, 10672 // "type": "string" 10673 // }, 10674 // "updateMask": { 10675 // "description": "Mask that identifies which fields on the topic to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified. If a field supports empty values, it can be cleared\nby specifying it in the update mask and not in the Topic object. If a\nfield that does not support empty values is included in the update mask and\nnot set in the Topic object, an `INVALID_ARGUMENT` error is\nreturned.\n\nThe following fields may be specified:\n\n* `name`", 10676 // "format": "google-fieldmask", 10677 // "location": "query", 10678 // "type": "string" 10679 // } 10680 // }, 10681 // "path": "v1/courses/{courseId}/topics/{id}", 10682 // "request": { 10683 // "$ref": "Topic" 10684 // }, 10685 // "response": { 10686 // "$ref": "Topic" 10687 // }, 10688 // "scopes": [ 10689 // "https://www.googleapis.com/auth/classroom.topics" 10690 // ] 10691 // } 10692 10693} 10694 10695// method id "classroom.invitations.accept": 10696 10697type InvitationsAcceptCall struct { 10698 s *Service 10699 id string 10700 urlParams_ gensupport.URLParams 10701 ctx_ context.Context 10702 header_ http.Header 10703} 10704 10705// Accept: Accepts an invitation, removing it and adding the invited 10706// user to the 10707// teachers or students (as appropriate) of the specified course. Only 10708// the 10709// invited user may accept an invitation. 10710// 10711// This method returns the following error codes: 10712// 10713// * `PERMISSION_DENIED` if the requesting user is not permitted to 10714// accept the 10715// requested invitation or for access errors. 10716// * `FAILED_PRECONDITION` for the following request errors: 10717// * CourseMemberLimitReached 10718// * CourseNotModifiable 10719// * CourseTeacherLimitReached 10720// * UserGroupsMembershipLimitReached 10721// * `NOT_FOUND` if no invitation exists with the requested ID. 10722func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall { 10723 c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10724 c.id = id 10725 return c 10726} 10727 10728// Fields allows partial responses to be retrieved. See 10729// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10730// for more information. 10731func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall { 10732 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10733 return c 10734} 10735 10736// Context sets the context to be used in this call's Do method. Any 10737// pending HTTP request will be aborted if the provided context is 10738// canceled. 10739func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall { 10740 c.ctx_ = ctx 10741 return c 10742} 10743 10744// Header returns an http.Header that can be modified by the caller to 10745// add HTTP headers to the request. 10746func (c *InvitationsAcceptCall) Header() http.Header { 10747 if c.header_ == nil { 10748 c.header_ = make(http.Header) 10749 } 10750 return c.header_ 10751} 10752 10753func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) { 10754 reqHeaders := make(http.Header) 10755 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10756 for k, v := range c.header_ { 10757 reqHeaders[k] = v 10758 } 10759 reqHeaders.Set("User-Agent", c.s.userAgent()) 10760 var body io.Reader = nil 10761 c.urlParams_.Set("alt", alt) 10762 c.urlParams_.Set("prettyPrint", "false") 10763 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept") 10764 urls += "?" + c.urlParams_.Encode() 10765 req, err := http.NewRequest("POST", urls, body) 10766 if err != nil { 10767 return nil, err 10768 } 10769 req.Header = reqHeaders 10770 googleapi.Expand(req.URL, map[string]string{ 10771 "id": c.id, 10772 }) 10773 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10774} 10775 10776// Do executes the "classroom.invitations.accept" call. 10777// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10778// code is an error. Response headers are in either 10779// *Empty.ServerResponse.Header or (if a response was returned at all) 10780// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10781// check whether the returned error was because http.StatusNotModified 10782// was returned. 10783func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10784 gensupport.SetOptions(c.urlParams_, opts...) 10785 res, err := c.doRequest("json") 10786 if res != nil && res.StatusCode == http.StatusNotModified { 10787 if res.Body != nil { 10788 res.Body.Close() 10789 } 10790 return nil, &googleapi.Error{ 10791 Code: res.StatusCode, 10792 Header: res.Header, 10793 } 10794 } 10795 if err != nil { 10796 return nil, err 10797 } 10798 defer googleapi.CloseBody(res) 10799 if err := googleapi.CheckResponse(res); err != nil { 10800 return nil, err 10801 } 10802 ret := &Empty{ 10803 ServerResponse: googleapi.ServerResponse{ 10804 Header: res.Header, 10805 HTTPStatusCode: res.StatusCode, 10806 }, 10807 } 10808 target := &ret 10809 if err := gensupport.DecodeResponse(target, res); err != nil { 10810 return nil, err 10811 } 10812 return ret, nil 10813 // { 10814 // "description": "Accepts an invitation, removing it and adding the invited user to the\nteachers or students (as appropriate) of the specified course. Only the\ninvited user may accept an invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to accept the\nrequested invitation or for access errors.\n* `FAILED_PRECONDITION` for the following request errors:\n * CourseMemberLimitReached\n * CourseNotModifiable\n * CourseTeacherLimitReached\n * UserGroupsMembershipLimitReached\n* `NOT_FOUND` if no invitation exists with the requested ID.", 10815 // "flatPath": "v1/invitations/{id}:accept", 10816 // "httpMethod": "POST", 10817 // "id": "classroom.invitations.accept", 10818 // "parameterOrder": [ 10819 // "id" 10820 // ], 10821 // "parameters": { 10822 // "id": { 10823 // "description": "Identifier of the invitation to accept.", 10824 // "location": "path", 10825 // "required": true, 10826 // "type": "string" 10827 // } 10828 // }, 10829 // "path": "v1/invitations/{id}:accept", 10830 // "response": { 10831 // "$ref": "Empty" 10832 // }, 10833 // "scopes": [ 10834 // "https://www.googleapis.com/auth/classroom.rosters" 10835 // ] 10836 // } 10837 10838} 10839 10840// method id "classroom.invitations.create": 10841 10842type InvitationsCreateCall struct { 10843 s *Service 10844 invitation *Invitation 10845 urlParams_ gensupport.URLParams 10846 ctx_ context.Context 10847 header_ http.Header 10848} 10849 10850// Create: Creates an invitation. Only one invitation for a user and 10851// course may exist 10852// at a time. Delete and re-create an invitation to make changes. 10853// 10854// This method returns the following error codes: 10855// 10856// * `PERMISSION_DENIED` if the requesting user is not permitted to 10857// create 10858// invitations for this course or for access errors. 10859// * `NOT_FOUND` if the course or the user does not exist. 10860// * `FAILED_PRECONDITION` if the requested user's account is disabled 10861// or if 10862// the user already has this role or a role with greater permissions. 10863// * `ALREADY_EXISTS` if an invitation for the specified user and 10864// course 10865// already exists. 10866func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall { 10867 c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10868 c.invitation = invitation 10869 return c 10870} 10871 10872// Fields allows partial responses to be retrieved. See 10873// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10874// for more information. 10875func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall { 10876 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10877 return c 10878} 10879 10880// Context sets the context to be used in this call's Do method. Any 10881// pending HTTP request will be aborted if the provided context is 10882// canceled. 10883func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall { 10884 c.ctx_ = ctx 10885 return c 10886} 10887 10888// Header returns an http.Header that can be modified by the caller to 10889// add HTTP headers to the request. 10890func (c *InvitationsCreateCall) Header() http.Header { 10891 if c.header_ == nil { 10892 c.header_ = make(http.Header) 10893 } 10894 return c.header_ 10895} 10896 10897func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 10898 reqHeaders := make(http.Header) 10899 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10900 for k, v := range c.header_ { 10901 reqHeaders[k] = v 10902 } 10903 reqHeaders.Set("User-Agent", c.s.userAgent()) 10904 var body io.Reader = nil 10905 body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation) 10906 if err != nil { 10907 return nil, err 10908 } 10909 reqHeaders.Set("Content-Type", "application/json") 10910 c.urlParams_.Set("alt", alt) 10911 c.urlParams_.Set("prettyPrint", "false") 10912 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 10913 urls += "?" + c.urlParams_.Encode() 10914 req, err := http.NewRequest("POST", urls, body) 10915 if err != nil { 10916 return nil, err 10917 } 10918 req.Header = reqHeaders 10919 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10920} 10921 10922// Do executes the "classroom.invitations.create" call. 10923// Exactly one of *Invitation or error will be non-nil. Any non-2xx 10924// status code is an error. Response headers are in either 10925// *Invitation.ServerResponse.Header or (if a response was returned at 10926// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10927// to check whether the returned error was because 10928// http.StatusNotModified was returned. 10929func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 10930 gensupport.SetOptions(c.urlParams_, opts...) 10931 res, err := c.doRequest("json") 10932 if res != nil && res.StatusCode == http.StatusNotModified { 10933 if res.Body != nil { 10934 res.Body.Close() 10935 } 10936 return nil, &googleapi.Error{ 10937 Code: res.StatusCode, 10938 Header: res.Header, 10939 } 10940 } 10941 if err != nil { 10942 return nil, err 10943 } 10944 defer googleapi.CloseBody(res) 10945 if err := googleapi.CheckResponse(res); err != nil { 10946 return nil, err 10947 } 10948 ret := &Invitation{ 10949 ServerResponse: googleapi.ServerResponse{ 10950 Header: res.Header, 10951 HTTPStatusCode: res.StatusCode, 10952 }, 10953 } 10954 target := &ret 10955 if err := gensupport.DecodeResponse(target, res); err != nil { 10956 return nil, err 10957 } 10958 return ret, nil 10959 // { 10960 // "description": "Creates an invitation. Only one invitation for a user and course may exist\nat a time. Delete and re-create an invitation to make changes.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\ninvitations for this course or for access errors.\n* `NOT_FOUND` if the course or the user does not exist.\n* `FAILED_PRECONDITION` if the requested user's account is disabled or if\nthe user already has this role or a role with greater permissions.\n* `ALREADY_EXISTS` if an invitation for the specified user and course\nalready exists.", 10961 // "flatPath": "v1/invitations", 10962 // "httpMethod": "POST", 10963 // "id": "classroom.invitations.create", 10964 // "parameterOrder": [], 10965 // "parameters": {}, 10966 // "path": "v1/invitations", 10967 // "request": { 10968 // "$ref": "Invitation" 10969 // }, 10970 // "response": { 10971 // "$ref": "Invitation" 10972 // }, 10973 // "scopes": [ 10974 // "https://www.googleapis.com/auth/classroom.rosters" 10975 // ] 10976 // } 10977 10978} 10979 10980// method id "classroom.invitations.delete": 10981 10982type InvitationsDeleteCall struct { 10983 s *Service 10984 id string 10985 urlParams_ gensupport.URLParams 10986 ctx_ context.Context 10987 header_ http.Header 10988} 10989 10990// Delete: Deletes an invitation. 10991// 10992// This method returns the following error codes: 10993// 10994// * `PERMISSION_DENIED` if the requesting user is not permitted to 10995// delete the 10996// requested invitation or for access errors. 10997// * `NOT_FOUND` if no invitation exists with the requested ID. 10998func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall { 10999 c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11000 c.id = id 11001 return c 11002} 11003 11004// Fields allows partial responses to be retrieved. See 11005// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11006// for more information. 11007func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall { 11008 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11009 return c 11010} 11011 11012// Context sets the context to be used in this call's Do method. Any 11013// pending HTTP request will be aborted if the provided context is 11014// canceled. 11015func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall { 11016 c.ctx_ = ctx 11017 return c 11018} 11019 11020// Header returns an http.Header that can be modified by the caller to 11021// add HTTP headers to the request. 11022func (c *InvitationsDeleteCall) Header() http.Header { 11023 if c.header_ == nil { 11024 c.header_ = make(http.Header) 11025 } 11026 return c.header_ 11027} 11028 11029func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11030 reqHeaders := make(http.Header) 11031 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11032 for k, v := range c.header_ { 11033 reqHeaders[k] = v 11034 } 11035 reqHeaders.Set("User-Agent", c.s.userAgent()) 11036 var body io.Reader = nil 11037 c.urlParams_.Set("alt", alt) 11038 c.urlParams_.Set("prettyPrint", "false") 11039 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11040 urls += "?" + c.urlParams_.Encode() 11041 req, err := http.NewRequest("DELETE", urls, body) 11042 if err != nil { 11043 return nil, err 11044 } 11045 req.Header = reqHeaders 11046 googleapi.Expand(req.URL, map[string]string{ 11047 "id": c.id, 11048 }) 11049 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11050} 11051 11052// Do executes the "classroom.invitations.delete" call. 11053// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11054// code is an error. Response headers are in either 11055// *Empty.ServerResponse.Header or (if a response was returned at all) 11056// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11057// check whether the returned error was because http.StatusNotModified 11058// was returned. 11059func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11060 gensupport.SetOptions(c.urlParams_, opts...) 11061 res, err := c.doRequest("json") 11062 if res != nil && res.StatusCode == http.StatusNotModified { 11063 if res.Body != nil { 11064 res.Body.Close() 11065 } 11066 return nil, &googleapi.Error{ 11067 Code: res.StatusCode, 11068 Header: res.Header, 11069 } 11070 } 11071 if err != nil { 11072 return nil, err 11073 } 11074 defer googleapi.CloseBody(res) 11075 if err := googleapi.CheckResponse(res); err != nil { 11076 return nil, err 11077 } 11078 ret := &Empty{ 11079 ServerResponse: googleapi.ServerResponse{ 11080 Header: res.Header, 11081 HTTPStatusCode: res.StatusCode, 11082 }, 11083 } 11084 target := &ret 11085 if err := gensupport.DecodeResponse(target, res); err != nil { 11086 return nil, err 11087 } 11088 return ret, nil 11089 // { 11090 // "description": "Deletes an invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete the\nrequested invitation or for access errors.\n* `NOT_FOUND` if no invitation exists with the requested ID.", 11091 // "flatPath": "v1/invitations/{id}", 11092 // "httpMethod": "DELETE", 11093 // "id": "classroom.invitations.delete", 11094 // "parameterOrder": [ 11095 // "id" 11096 // ], 11097 // "parameters": { 11098 // "id": { 11099 // "description": "Identifier of the invitation to delete.", 11100 // "location": "path", 11101 // "required": true, 11102 // "type": "string" 11103 // } 11104 // }, 11105 // "path": "v1/invitations/{id}", 11106 // "response": { 11107 // "$ref": "Empty" 11108 // }, 11109 // "scopes": [ 11110 // "https://www.googleapis.com/auth/classroom.rosters" 11111 // ] 11112 // } 11113 11114} 11115 11116// method id "classroom.invitations.get": 11117 11118type InvitationsGetCall struct { 11119 s *Service 11120 id string 11121 urlParams_ gensupport.URLParams 11122 ifNoneMatch_ string 11123 ctx_ context.Context 11124 header_ http.Header 11125} 11126 11127// Get: Returns an invitation. 11128// 11129// This method returns the following error codes: 11130// 11131// * `PERMISSION_DENIED` if the requesting user is not permitted to view 11132// the 11133// requested invitation or for access errors. 11134// * `NOT_FOUND` if no invitation exists with the requested ID. 11135func (r *InvitationsService) Get(id string) *InvitationsGetCall { 11136 c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11137 c.id = id 11138 return c 11139} 11140 11141// Fields allows partial responses to be retrieved. See 11142// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11143// for more information. 11144func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall { 11145 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11146 return c 11147} 11148 11149// IfNoneMatch sets the optional parameter which makes the operation 11150// fail if the object's ETag matches the given value. This is useful for 11151// getting updates only after the object has changed since the last 11152// request. Use googleapi.IsNotModified to check whether the response 11153// error from Do is the result of In-None-Match. 11154func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall { 11155 c.ifNoneMatch_ = entityTag 11156 return c 11157} 11158 11159// Context sets the context to be used in this call's Do method. Any 11160// pending HTTP request will be aborted if the provided context is 11161// canceled. 11162func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall { 11163 c.ctx_ = ctx 11164 return c 11165} 11166 11167// Header returns an http.Header that can be modified by the caller to 11168// add HTTP headers to the request. 11169func (c *InvitationsGetCall) Header() http.Header { 11170 if c.header_ == nil { 11171 c.header_ = make(http.Header) 11172 } 11173 return c.header_ 11174} 11175 11176func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) { 11177 reqHeaders := make(http.Header) 11178 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11179 for k, v := range c.header_ { 11180 reqHeaders[k] = v 11181 } 11182 reqHeaders.Set("User-Agent", c.s.userAgent()) 11183 if c.ifNoneMatch_ != "" { 11184 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11185 } 11186 var body io.Reader = nil 11187 c.urlParams_.Set("alt", alt) 11188 c.urlParams_.Set("prettyPrint", "false") 11189 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11190 urls += "?" + c.urlParams_.Encode() 11191 req, err := http.NewRequest("GET", urls, body) 11192 if err != nil { 11193 return nil, err 11194 } 11195 req.Header = reqHeaders 11196 googleapi.Expand(req.URL, map[string]string{ 11197 "id": c.id, 11198 }) 11199 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11200} 11201 11202// Do executes the "classroom.invitations.get" call. 11203// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11204// status code is an error. Response headers are in either 11205// *Invitation.ServerResponse.Header or (if a response was returned at 11206// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11207// to check whether the returned error was because 11208// http.StatusNotModified was returned. 11209func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11210 gensupport.SetOptions(c.urlParams_, opts...) 11211 res, err := c.doRequest("json") 11212 if res != nil && res.StatusCode == http.StatusNotModified { 11213 if res.Body != nil { 11214 res.Body.Close() 11215 } 11216 return nil, &googleapi.Error{ 11217 Code: res.StatusCode, 11218 Header: res.Header, 11219 } 11220 } 11221 if err != nil { 11222 return nil, err 11223 } 11224 defer googleapi.CloseBody(res) 11225 if err := googleapi.CheckResponse(res); err != nil { 11226 return nil, err 11227 } 11228 ret := &Invitation{ 11229 ServerResponse: googleapi.ServerResponse{ 11230 Header: res.Header, 11231 HTTPStatusCode: res.StatusCode, 11232 }, 11233 } 11234 target := &ret 11235 if err := gensupport.DecodeResponse(target, res); err != nil { 11236 return nil, err 11237 } 11238 return ret, nil 11239 // { 11240 // "description": "Returns an invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view the\nrequested invitation or for access errors.\n* `NOT_FOUND` if no invitation exists with the requested ID.", 11241 // "flatPath": "v1/invitations/{id}", 11242 // "httpMethod": "GET", 11243 // "id": "classroom.invitations.get", 11244 // "parameterOrder": [ 11245 // "id" 11246 // ], 11247 // "parameters": { 11248 // "id": { 11249 // "description": "Identifier of the invitation to return.", 11250 // "location": "path", 11251 // "required": true, 11252 // "type": "string" 11253 // } 11254 // }, 11255 // "path": "v1/invitations/{id}", 11256 // "response": { 11257 // "$ref": "Invitation" 11258 // }, 11259 // "scopes": [ 11260 // "https://www.googleapis.com/auth/classroom.rosters", 11261 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11262 // ] 11263 // } 11264 11265} 11266 11267// method id "classroom.invitations.list": 11268 11269type InvitationsListCall struct { 11270 s *Service 11271 urlParams_ gensupport.URLParams 11272 ifNoneMatch_ string 11273 ctx_ context.Context 11274 header_ http.Header 11275} 11276 11277// List: Returns a list of invitations that the requesting user is 11278// permitted to 11279// view, restricted to those that match the list request. 11280// 11281// *Note:* At least one of `user_id` or `course_id` must be supplied. 11282// Both 11283// fields can be supplied. 11284// 11285// This method returns the following error codes: 11286// 11287// * `PERMISSION_DENIED` for access errors. 11288func (r *InvitationsService) List() *InvitationsListCall { 11289 c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11290 return c 11291} 11292 11293// CourseId sets the optional parameter "courseId": Restricts returned 11294// invitations to those for a course with the specified 11295// identifier. 11296func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall { 11297 c.urlParams_.Set("courseId", courseId) 11298 return c 11299} 11300 11301// PageSize sets the optional parameter "pageSize": Maximum number of 11302// items to return. Zero means no maximum. 11303// 11304// The server may return fewer than the specified number of results. 11305func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall { 11306 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 11307 return c 11308} 11309 11310// PageToken sets the optional parameter "pageToken": 11311// nextPageToken 11312// value returned from a previous 11313// list call, indicating 11314// that the subsequent page of results should be returned. 11315// 11316// The list request must be 11317// otherwise identical to the one that resulted in this token. 11318func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall { 11319 c.urlParams_.Set("pageToken", pageToken) 11320 return c 11321} 11322 11323// UserId sets the optional parameter "userId": Restricts returned 11324// invitations to those for a specific user. The identifier 11325// can be one of the following: 11326// 11327// * the numeric identifier for the user 11328// * the email address of the user 11329// * the string literal "me", indicating the requesting user 11330func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall { 11331 c.urlParams_.Set("userId", userId) 11332 return c 11333} 11334 11335// Fields allows partial responses to be retrieved. See 11336// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11337// for more information. 11338func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall { 11339 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11340 return c 11341} 11342 11343// IfNoneMatch sets the optional parameter which makes the operation 11344// fail if the object's ETag matches the given value. This is useful for 11345// getting updates only after the object has changed since the last 11346// request. Use googleapi.IsNotModified to check whether the response 11347// error from Do is the result of In-None-Match. 11348func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall { 11349 c.ifNoneMatch_ = entityTag 11350 return c 11351} 11352 11353// Context sets the context to be used in this call's Do method. Any 11354// pending HTTP request will be aborted if the provided context is 11355// canceled. 11356func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall { 11357 c.ctx_ = ctx 11358 return c 11359} 11360 11361// Header returns an http.Header that can be modified by the caller to 11362// add HTTP headers to the request. 11363func (c *InvitationsListCall) Header() http.Header { 11364 if c.header_ == nil { 11365 c.header_ = make(http.Header) 11366 } 11367 return c.header_ 11368} 11369 11370func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) { 11371 reqHeaders := make(http.Header) 11372 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11373 for k, v := range c.header_ { 11374 reqHeaders[k] = v 11375 } 11376 reqHeaders.Set("User-Agent", c.s.userAgent()) 11377 if c.ifNoneMatch_ != "" { 11378 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11379 } 11380 var body io.Reader = nil 11381 c.urlParams_.Set("alt", alt) 11382 c.urlParams_.Set("prettyPrint", "false") 11383 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11384 urls += "?" + c.urlParams_.Encode() 11385 req, err := http.NewRequest("GET", urls, body) 11386 if err != nil { 11387 return nil, err 11388 } 11389 req.Header = reqHeaders 11390 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11391} 11392 11393// Do executes the "classroom.invitations.list" call. 11394// Exactly one of *ListInvitationsResponse or error will be non-nil. Any 11395// non-2xx status code is an error. Response headers are in either 11396// *ListInvitationsResponse.ServerResponse.Header or (if a response was 11397// returned at all) in error.(*googleapi.Error).Header. Use 11398// googleapi.IsNotModified to check whether the returned error was 11399// because http.StatusNotModified was returned. 11400func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) { 11401 gensupport.SetOptions(c.urlParams_, opts...) 11402 res, err := c.doRequest("json") 11403 if res != nil && res.StatusCode == http.StatusNotModified { 11404 if res.Body != nil { 11405 res.Body.Close() 11406 } 11407 return nil, &googleapi.Error{ 11408 Code: res.StatusCode, 11409 Header: res.Header, 11410 } 11411 } 11412 if err != nil { 11413 return nil, err 11414 } 11415 defer googleapi.CloseBody(res) 11416 if err := googleapi.CheckResponse(res); err != nil { 11417 return nil, err 11418 } 11419 ret := &ListInvitationsResponse{ 11420 ServerResponse: googleapi.ServerResponse{ 11421 Header: res.Header, 11422 HTTPStatusCode: res.StatusCode, 11423 }, 11424 } 11425 target := &ret 11426 if err := gensupport.DecodeResponse(target, res); err != nil { 11427 return nil, err 11428 } 11429 return ret, nil 11430 // { 11431 // "description": "Returns a list of invitations that the requesting user is permitted to\nview, restricted to those that match the list request.\n\n*Note:* At least one of `user_id` or `course_id` must be supplied. Both\nfields can be supplied.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` for access errors.", 11432 // "flatPath": "v1/invitations", 11433 // "httpMethod": "GET", 11434 // "id": "classroom.invitations.list", 11435 // "parameterOrder": [], 11436 // "parameters": { 11437 // "courseId": { 11438 // "description": "Restricts returned invitations to those for a course with the specified\nidentifier.", 11439 // "location": "query", 11440 // "type": "string" 11441 // }, 11442 // "pageSize": { 11443 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 11444 // "format": "int32", 11445 // "location": "query", 11446 // "type": "integer" 11447 // }, 11448 // "pageToken": { 11449 // "description": "nextPageToken\nvalue returned from a previous\nlist call, indicating\nthat the subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.", 11450 // "location": "query", 11451 // "type": "string" 11452 // }, 11453 // "userId": { 11454 // "description": "Restricts returned invitations to those for a specific user. The identifier\ncan be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 11455 // "location": "query", 11456 // "type": "string" 11457 // } 11458 // }, 11459 // "path": "v1/invitations", 11460 // "response": { 11461 // "$ref": "ListInvitationsResponse" 11462 // }, 11463 // "scopes": [ 11464 // "https://www.googleapis.com/auth/classroom.rosters", 11465 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11466 // ] 11467 // } 11468 11469} 11470 11471// Pages invokes f for each page of results. 11472// A non-nil error returned from f will halt the iteration. 11473// The provided context supersedes any context provided to the Context method. 11474func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error { 11475 c.ctx_ = ctx 11476 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 11477 for { 11478 x, err := c.Do() 11479 if err != nil { 11480 return err 11481 } 11482 if err := f(x); err != nil { 11483 return err 11484 } 11485 if x.NextPageToken == "" { 11486 return nil 11487 } 11488 c.PageToken(x.NextPageToken) 11489 } 11490} 11491 11492// method id "classroom.registrations.create": 11493 11494type RegistrationsCreateCall struct { 11495 s *Service 11496 registration *Registration 11497 urlParams_ gensupport.URLParams 11498 ctx_ context.Context 11499 header_ http.Header 11500} 11501 11502// Create: Creates a `Registration`, causing Classroom to start sending 11503// notifications 11504// from the provided `feed` to the destination provided in 11505// `cloudPubSubTopic`. 11506// 11507// Returns the created `Registration`. Currently, this will be the same 11508// as 11509// the argument, but with server-assigned fields such as `expiry_time` 11510// and 11511// `id` filled in. 11512// 11513// Note that any value specified for the `expiry_time` or `id` fields 11514// will be 11515// ignored. 11516// 11517// While Classroom may validate the `cloudPubSubTopic` and return errors 11518// on a 11519// best effort basis, it is the caller's responsibility to ensure that 11520// it 11521// exists and that Classroom has permission to publish to it. 11522// 11523// This method may return the following error codes: 11524// 11525// * `PERMISSION_DENIED` if: 11526// * the authenticated user does not have permission to receive 11527// notifications from the requested field; or 11528// * the credential provided does not include the appropriate scope 11529// for 11530// the requested feed. 11531// * another access error is encountered. 11532// * `INVALID_ARGUMENT` if: 11533// * no `cloudPubsubTopic` is specified, or the specified 11534// `cloudPubsubTopic` is not valid; or 11535// * no `feed` is specified, or the specified `feed` is not valid. 11536// * `NOT_FOUND` if: 11537// * the specified `feed` cannot be located, or the requesting user 11538// does 11539// not have permission to determine whether or not it exists; or 11540// * the specified `cloudPubsubTopic` cannot be located, or 11541// Classroom has 11542// not been granted permission to publish to it. 11543func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall { 11544 c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11545 c.registration = registration 11546 return c 11547} 11548 11549// Fields allows partial responses to be retrieved. See 11550// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11551// for more information. 11552func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall { 11553 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11554 return c 11555} 11556 11557// Context sets the context to be used in this call's Do method. Any 11558// pending HTTP request will be aborted if the provided context is 11559// canceled. 11560func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall { 11561 c.ctx_ = ctx 11562 return c 11563} 11564 11565// Header returns an http.Header that can be modified by the caller to 11566// add HTTP headers to the request. 11567func (c *RegistrationsCreateCall) Header() http.Header { 11568 if c.header_ == nil { 11569 c.header_ = make(http.Header) 11570 } 11571 return c.header_ 11572} 11573 11574func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) { 11575 reqHeaders := make(http.Header) 11576 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11577 for k, v := range c.header_ { 11578 reqHeaders[k] = v 11579 } 11580 reqHeaders.Set("User-Agent", c.s.userAgent()) 11581 var body io.Reader = nil 11582 body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration) 11583 if err != nil { 11584 return nil, err 11585 } 11586 reqHeaders.Set("Content-Type", "application/json") 11587 c.urlParams_.Set("alt", alt) 11588 c.urlParams_.Set("prettyPrint", "false") 11589 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations") 11590 urls += "?" + c.urlParams_.Encode() 11591 req, err := http.NewRequest("POST", urls, body) 11592 if err != nil { 11593 return nil, err 11594 } 11595 req.Header = reqHeaders 11596 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11597} 11598 11599// Do executes the "classroom.registrations.create" call. 11600// Exactly one of *Registration or error will be non-nil. Any non-2xx 11601// status code is an error. Response headers are in either 11602// *Registration.ServerResponse.Header or (if a response was returned at 11603// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11604// to check whether the returned error was because 11605// http.StatusNotModified was returned. 11606func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) { 11607 gensupport.SetOptions(c.urlParams_, opts...) 11608 res, err := c.doRequest("json") 11609 if res != nil && res.StatusCode == http.StatusNotModified { 11610 if res.Body != nil { 11611 res.Body.Close() 11612 } 11613 return nil, &googleapi.Error{ 11614 Code: res.StatusCode, 11615 Header: res.Header, 11616 } 11617 } 11618 if err != nil { 11619 return nil, err 11620 } 11621 defer googleapi.CloseBody(res) 11622 if err := googleapi.CheckResponse(res); err != nil { 11623 return nil, err 11624 } 11625 ret := &Registration{ 11626 ServerResponse: googleapi.ServerResponse{ 11627 Header: res.Header, 11628 HTTPStatusCode: res.StatusCode, 11629 }, 11630 } 11631 target := &ret 11632 if err := gensupport.DecodeResponse(target, res); err != nil { 11633 return nil, err 11634 } 11635 return ret, nil 11636 // { 11637 // "description": "Creates a `Registration`, causing Classroom to start sending notifications\nfrom the provided `feed` to the destination provided in `cloudPubSubTopic`.\n\nReturns the created `Registration`. Currently, this will be the same as\nthe argument, but with server-assigned fields such as `expiry_time` and\n`id` filled in.\n\nNote that any value specified for the `expiry_time` or `id` fields will be\nignored.\n\nWhile Classroom may validate the `cloudPubSubTopic` and return errors on a\nbest effort basis, it is the caller's responsibility to ensure that it\nexists and that Classroom has permission to publish to it.\n\nThis method may return the following error codes:\n\n* `PERMISSION_DENIED` if:\n * the authenticated user does not have permission to receive\n notifications from the requested field; or\n * the credential provided does not include the appropriate scope for\n the requested feed.\n * another access error is encountered.\n* `INVALID_ARGUMENT` if:\n * no `cloudPubsubTopic` is specified, or the specified\n `cloudPubsubTopic` is not valid; or\n * no `feed` is specified, or the specified `feed` is not valid.\n* `NOT_FOUND` if:\n * the specified `feed` cannot be located, or the requesting user does\n not have permission to determine whether or not it exists; or\n * the specified `cloudPubsubTopic` cannot be located, or Classroom has\n not been granted permission to publish to it.", 11638 // "flatPath": "v1/registrations", 11639 // "httpMethod": "POST", 11640 // "id": "classroom.registrations.create", 11641 // "parameterOrder": [], 11642 // "parameters": {}, 11643 // "path": "v1/registrations", 11644 // "request": { 11645 // "$ref": "Registration" 11646 // }, 11647 // "response": { 11648 // "$ref": "Registration" 11649 // }, 11650 // "scopes": [ 11651 // "https://www.googleapis.com/auth/classroom.push-notifications" 11652 // ] 11653 // } 11654 11655} 11656 11657// method id "classroom.registrations.delete": 11658 11659type RegistrationsDeleteCall struct { 11660 s *Service 11661 registrationId string 11662 urlParams_ gensupport.URLParams 11663 ctx_ context.Context 11664 header_ http.Header 11665} 11666 11667// Delete: Deletes a `Registration`, causing Classroom to stop sending 11668// notifications 11669// for that `Registration`. 11670func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall { 11671 c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11672 c.registrationId = registrationId 11673 return c 11674} 11675 11676// Fields allows partial responses to be retrieved. See 11677// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11678// for more information. 11679func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall { 11680 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11681 return c 11682} 11683 11684// Context sets the context to be used in this call's Do method. Any 11685// pending HTTP request will be aborted if the provided context is 11686// canceled. 11687func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall { 11688 c.ctx_ = ctx 11689 return c 11690} 11691 11692// Header returns an http.Header that can be modified by the caller to 11693// add HTTP headers to the request. 11694func (c *RegistrationsDeleteCall) Header() http.Header { 11695 if c.header_ == nil { 11696 c.header_ = make(http.Header) 11697 } 11698 return c.header_ 11699} 11700 11701func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11702 reqHeaders := make(http.Header) 11703 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11704 for k, v := range c.header_ { 11705 reqHeaders[k] = v 11706 } 11707 reqHeaders.Set("User-Agent", c.s.userAgent()) 11708 var body io.Reader = nil 11709 c.urlParams_.Set("alt", alt) 11710 c.urlParams_.Set("prettyPrint", "false") 11711 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}") 11712 urls += "?" + c.urlParams_.Encode() 11713 req, err := http.NewRequest("DELETE", urls, body) 11714 if err != nil { 11715 return nil, err 11716 } 11717 req.Header = reqHeaders 11718 googleapi.Expand(req.URL, map[string]string{ 11719 "registrationId": c.registrationId, 11720 }) 11721 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11722} 11723 11724// Do executes the "classroom.registrations.delete" call. 11725// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11726// code is an error. Response headers are in either 11727// *Empty.ServerResponse.Header or (if a response was returned at all) 11728// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11729// check whether the returned error was because http.StatusNotModified 11730// was returned. 11731func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11732 gensupport.SetOptions(c.urlParams_, opts...) 11733 res, err := c.doRequest("json") 11734 if res != nil && res.StatusCode == http.StatusNotModified { 11735 if res.Body != nil { 11736 res.Body.Close() 11737 } 11738 return nil, &googleapi.Error{ 11739 Code: res.StatusCode, 11740 Header: res.Header, 11741 } 11742 } 11743 if err != nil { 11744 return nil, err 11745 } 11746 defer googleapi.CloseBody(res) 11747 if err := googleapi.CheckResponse(res); err != nil { 11748 return nil, err 11749 } 11750 ret := &Empty{ 11751 ServerResponse: googleapi.ServerResponse{ 11752 Header: res.Header, 11753 HTTPStatusCode: res.StatusCode, 11754 }, 11755 } 11756 target := &ret 11757 if err := gensupport.DecodeResponse(target, res); err != nil { 11758 return nil, err 11759 } 11760 return ret, nil 11761 // { 11762 // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications\nfor that `Registration`.", 11763 // "flatPath": "v1/registrations/{registrationId}", 11764 // "httpMethod": "DELETE", 11765 // "id": "classroom.registrations.delete", 11766 // "parameterOrder": [ 11767 // "registrationId" 11768 // ], 11769 // "parameters": { 11770 // "registrationId": { 11771 // "description": "The `registration_id` of the `Registration` to be deleted.", 11772 // "location": "path", 11773 // "required": true, 11774 // "type": "string" 11775 // } 11776 // }, 11777 // "path": "v1/registrations/{registrationId}", 11778 // "response": { 11779 // "$ref": "Empty" 11780 // }, 11781 // "scopes": [ 11782 // "https://www.googleapis.com/auth/classroom.push-notifications" 11783 // ] 11784 // } 11785 11786} 11787 11788// method id "classroom.userProfiles.get": 11789 11790type UserProfilesGetCall struct { 11791 s *Service 11792 userId string 11793 urlParams_ gensupport.URLParams 11794 ifNoneMatch_ string 11795 ctx_ context.Context 11796 header_ http.Header 11797} 11798 11799// Get: Returns a user profile. 11800// 11801// This method returns the following error codes: 11802// 11803// * `PERMISSION_DENIED` if the requesting user is not permitted to 11804// access 11805// this user profile, if no profile exists with the requested ID, or 11806// for 11807// access errors. 11808func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall { 11809 c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11810 c.userId = userId 11811 return c 11812} 11813 11814// Fields allows partial responses to be retrieved. See 11815// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11816// for more information. 11817func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall { 11818 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11819 return c 11820} 11821 11822// IfNoneMatch sets the optional parameter which makes the operation 11823// fail if the object's ETag matches the given value. This is useful for 11824// getting updates only after the object has changed since the last 11825// request. Use googleapi.IsNotModified to check whether the response 11826// error from Do is the result of In-None-Match. 11827func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall { 11828 c.ifNoneMatch_ = entityTag 11829 return c 11830} 11831 11832// Context sets the context to be used in this call's Do method. Any 11833// pending HTTP request will be aborted if the provided context is 11834// canceled. 11835func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall { 11836 c.ctx_ = ctx 11837 return c 11838} 11839 11840// Header returns an http.Header that can be modified by the caller to 11841// add HTTP headers to the request. 11842func (c *UserProfilesGetCall) Header() http.Header { 11843 if c.header_ == nil { 11844 c.header_ = make(http.Header) 11845 } 11846 return c.header_ 11847} 11848 11849func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) { 11850 reqHeaders := make(http.Header) 11851 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11852 for k, v := range c.header_ { 11853 reqHeaders[k] = v 11854 } 11855 reqHeaders.Set("User-Agent", c.s.userAgent()) 11856 if c.ifNoneMatch_ != "" { 11857 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11858 } 11859 var body io.Reader = nil 11860 c.urlParams_.Set("alt", alt) 11861 c.urlParams_.Set("prettyPrint", "false") 11862 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}") 11863 urls += "?" + c.urlParams_.Encode() 11864 req, err := http.NewRequest("GET", urls, body) 11865 if err != nil { 11866 return nil, err 11867 } 11868 req.Header = reqHeaders 11869 googleapi.Expand(req.URL, map[string]string{ 11870 "userId": c.userId, 11871 }) 11872 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11873} 11874 11875// Do executes the "classroom.userProfiles.get" call. 11876// Exactly one of *UserProfile or error will be non-nil. Any non-2xx 11877// status code is an error. Response headers are in either 11878// *UserProfile.ServerResponse.Header or (if a response was returned at 11879// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11880// to check whether the returned error was because 11881// http.StatusNotModified was returned. 11882func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) { 11883 gensupport.SetOptions(c.urlParams_, opts...) 11884 res, err := c.doRequest("json") 11885 if res != nil && res.StatusCode == http.StatusNotModified { 11886 if res.Body != nil { 11887 res.Body.Close() 11888 } 11889 return nil, &googleapi.Error{ 11890 Code: res.StatusCode, 11891 Header: res.Header, 11892 } 11893 } 11894 if err != nil { 11895 return nil, err 11896 } 11897 defer googleapi.CloseBody(res) 11898 if err := googleapi.CheckResponse(res); err != nil { 11899 return nil, err 11900 } 11901 ret := &UserProfile{ 11902 ServerResponse: googleapi.ServerResponse{ 11903 Header: res.Header, 11904 HTTPStatusCode: res.StatusCode, 11905 }, 11906 } 11907 target := &ret 11908 if err := gensupport.DecodeResponse(target, res); err != nil { 11909 return nil, err 11910 } 11911 return ret, nil 11912 // { 11913 // "description": "Returns a user profile.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthis user profile, if no profile exists with the requested ID, or for\naccess errors.", 11914 // "flatPath": "v1/userProfiles/{userId}", 11915 // "httpMethod": "GET", 11916 // "id": "classroom.userProfiles.get", 11917 // "parameterOrder": [ 11918 // "userId" 11919 // ], 11920 // "parameters": { 11921 // "userId": { 11922 // "description": "Identifier of the profile to return. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 11923 // "location": "path", 11924 // "required": true, 11925 // "type": "string" 11926 // } 11927 // }, 11928 // "path": "v1/userProfiles/{userId}", 11929 // "response": { 11930 // "$ref": "UserProfile" 11931 // }, 11932 // "scopes": [ 11933 // "https://www.googleapis.com/auth/classroom.profile.emails", 11934 // "https://www.googleapis.com/auth/classroom.profile.photos", 11935 // "https://www.googleapis.com/auth/classroom.rosters", 11936 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11937 // ] 11938 // } 11939 11940} 11941 11942// method id "classroom.userProfiles.guardianInvitations.create": 11943 11944type UserProfilesGuardianInvitationsCreateCall struct { 11945 s *Service 11946 studentId string 11947 guardianinvitation *GuardianInvitation 11948 urlParams_ gensupport.URLParams 11949 ctx_ context.Context 11950 header_ http.Header 11951} 11952 11953// Create: Creates a guardian invitation, and sends an email to the 11954// guardian asking 11955// them to confirm that they are the student's guardian. 11956// 11957// Once the guardian accepts the invitation, their `state` will change 11958// to 11959// `COMPLETED` and they will start receiving guardian notifications. 11960// A 11961// `Guardian` resource will also be created to represent the active 11962// guardian. 11963// 11964// The request object must have the `student_id` 11965// and 11966// `invited_email_address` fields set. Failing to set these fields, 11967// or 11968// setting any other fields in the request, will result in an 11969// error. 11970// 11971// This method returns the following error codes: 11972// 11973// * `PERMISSION_DENIED` if the current user does not have permission 11974// to 11975// manage guardians, if the guardian in question has already rejected 11976// too many requests for that student, if guardians are not enabled 11977// for the 11978// domain in question, or for other access errors. 11979// * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the 11980// guardian 11981// link limit. 11982// * `INVALID_ARGUMENT` if the guardian email address is not valid (for 11983// example, if it is too long), or if the format of the student ID 11984// provided 11985// cannot be recognized (it is not an email address, nor a `user_id` 11986// from 11987// this API). This error will also be returned if read-only fields are 11988// set, 11989// or if the `state` field is set to to a value other than 11990// `PENDING`. 11991// * `NOT_FOUND` if the student ID provided is a valid student ID, but 11992// Classroom has no record of that student. 11993// * `ALREADY_EXISTS` if there is already a pending guardian invitation 11994// for 11995// the student and `invited_email_address` provided, or if the 11996// provided 11997// `invited_email_address` matches the Google account of an existing 11998// `Guardian` for this user. 11999func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall { 12000 c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12001 c.studentId = studentId 12002 c.guardianinvitation = guardianinvitation 12003 return c 12004} 12005 12006// Fields allows partial responses to be retrieved. See 12007// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12008// for more information. 12009func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall { 12010 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12011 return c 12012} 12013 12014// Context sets the context to be used in this call's Do method. Any 12015// pending HTTP request will be aborted if the provided context is 12016// canceled. 12017func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall { 12018 c.ctx_ = ctx 12019 return c 12020} 12021 12022// Header returns an http.Header that can be modified by the caller to 12023// add HTTP headers to the request. 12024func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header { 12025 if c.header_ == nil { 12026 c.header_ = make(http.Header) 12027 } 12028 return c.header_ 12029} 12030 12031func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 12032 reqHeaders := make(http.Header) 12033 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12034 for k, v := range c.header_ { 12035 reqHeaders[k] = v 12036 } 12037 reqHeaders.Set("User-Agent", c.s.userAgent()) 12038 var body io.Reader = nil 12039 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12040 if err != nil { 12041 return nil, err 12042 } 12043 reqHeaders.Set("Content-Type", "application/json") 12044 c.urlParams_.Set("alt", alt) 12045 c.urlParams_.Set("prettyPrint", "false") 12046 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12047 urls += "?" + c.urlParams_.Encode() 12048 req, err := http.NewRequest("POST", urls, body) 12049 if err != nil { 12050 return nil, err 12051 } 12052 req.Header = reqHeaders 12053 googleapi.Expand(req.URL, map[string]string{ 12054 "studentId": c.studentId, 12055 }) 12056 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12057} 12058 12059// Do executes the "classroom.userProfiles.guardianInvitations.create" call. 12060// Exactly one of *GuardianInvitation or error will be non-nil. Any 12061// non-2xx status code is an error. Response headers are in either 12062// *GuardianInvitation.ServerResponse.Header or (if a response was 12063// returned at all) in error.(*googleapi.Error).Header. Use 12064// googleapi.IsNotModified to check whether the returned error was 12065// because http.StatusNotModified was returned. 12066func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12067 gensupport.SetOptions(c.urlParams_, opts...) 12068 res, err := c.doRequest("json") 12069 if res != nil && res.StatusCode == http.StatusNotModified { 12070 if res.Body != nil { 12071 res.Body.Close() 12072 } 12073 return nil, &googleapi.Error{ 12074 Code: res.StatusCode, 12075 Header: res.Header, 12076 } 12077 } 12078 if err != nil { 12079 return nil, err 12080 } 12081 defer googleapi.CloseBody(res) 12082 if err := googleapi.CheckResponse(res); err != nil { 12083 return nil, err 12084 } 12085 ret := &GuardianInvitation{ 12086 ServerResponse: googleapi.ServerResponse{ 12087 Header: res.Header, 12088 HTTPStatusCode: res.StatusCode, 12089 }, 12090 } 12091 target := &ret 12092 if err := gensupport.DecodeResponse(target, res); err != nil { 12093 return nil, err 12094 } 12095 return ret, nil 12096 // { 12097 // "description": "Creates a guardian invitation, and sends an email to the guardian asking\nthem to confirm that they are the student's guardian.\n\nOnce the guardian accepts the invitation, their `state` will change to\n`COMPLETED` and they will start receiving guardian notifications. A\n`Guardian` resource will also be created to represent the active guardian.\n\nThe request object must have the `student_id` and\n`invited_email_address` fields set. Failing to set these fields, or\nsetting any other fields in the request, will result in an error.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the current user does not have permission to\n manage guardians, if the guardian in question has already rejected\n too many requests for that student, if guardians are not enabled for the\n domain in question, or for other access errors.\n* `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the guardian\n link limit.\n* `INVALID_ARGUMENT` if the guardian email address is not valid (for\n example, if it is too long), or if the format of the student ID provided\n cannot be recognized (it is not an email address, nor a `user_id` from\n this API). This error will also be returned if read-only fields are set,\n or if the `state` field is set to to a value other than `PENDING`.\n* `NOT_FOUND` if the student ID provided is a valid student ID, but\n Classroom has no record of that student.\n* `ALREADY_EXISTS` if there is already a pending guardian invitation for\n the student and `invited_email_address` provided, or if the provided\n `invited_email_address` matches the Google account of an existing\n `Guardian` for this user.", 12098 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12099 // "httpMethod": "POST", 12100 // "id": "classroom.userProfiles.guardianInvitations.create", 12101 // "parameterOrder": [ 12102 // "studentId" 12103 // ], 12104 // "parameters": { 12105 // "studentId": { 12106 // "description": "ID of the student (in standard format)", 12107 // "location": "path", 12108 // "required": true, 12109 // "type": "string" 12110 // } 12111 // }, 12112 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12113 // "request": { 12114 // "$ref": "GuardianInvitation" 12115 // }, 12116 // "response": { 12117 // "$ref": "GuardianInvitation" 12118 // }, 12119 // "scopes": [ 12120 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12121 // ] 12122 // } 12123 12124} 12125 12126// method id "classroom.userProfiles.guardianInvitations.get": 12127 12128type UserProfilesGuardianInvitationsGetCall struct { 12129 s *Service 12130 studentId string 12131 invitationId string 12132 urlParams_ gensupport.URLParams 12133 ifNoneMatch_ string 12134 ctx_ context.Context 12135 header_ http.Header 12136} 12137 12138// Get: Returns a specific guardian invitation. 12139// 12140// This method returns the following error codes: 12141// 12142// * `PERMISSION_DENIED` if the requesting user is not permitted to 12143// view 12144// guardian invitations for the student identified by the 12145// `student_id`, if 12146// guardians are not enabled for the domain in question, or for other 12147// access errors. 12148// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12149// cannot 12150// be recognized (it is not an email address, nor a `student_id` from 12151// the 12152// API, nor the literal string `me`). 12153// * `NOT_FOUND` if Classroom cannot find any record of the given 12154// student or 12155// `invitation_id`. May also be returned if the student exists, but 12156// the 12157// requesting user does not have access to see that student. 12158func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall { 12159 c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12160 c.studentId = studentId 12161 c.invitationId = invitationId 12162 return c 12163} 12164 12165// Fields allows partial responses to be retrieved. See 12166// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12167// for more information. 12168func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall { 12169 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12170 return c 12171} 12172 12173// IfNoneMatch sets the optional parameter which makes the operation 12174// fail if the object's ETag matches the given value. This is useful for 12175// getting updates only after the object has changed since the last 12176// request. Use googleapi.IsNotModified to check whether the response 12177// error from Do is the result of In-None-Match. 12178func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall { 12179 c.ifNoneMatch_ = entityTag 12180 return c 12181} 12182 12183// Context sets the context to be used in this call's Do method. Any 12184// pending HTTP request will be aborted if the provided context is 12185// canceled. 12186func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall { 12187 c.ctx_ = ctx 12188 return c 12189} 12190 12191// Header returns an http.Header that can be modified by the caller to 12192// add HTTP headers to the request. 12193func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header { 12194 if c.header_ == nil { 12195 c.header_ = make(http.Header) 12196 } 12197 return c.header_ 12198} 12199 12200func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) { 12201 reqHeaders := make(http.Header) 12202 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12203 for k, v := range c.header_ { 12204 reqHeaders[k] = v 12205 } 12206 reqHeaders.Set("User-Agent", c.s.userAgent()) 12207 if c.ifNoneMatch_ != "" { 12208 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12209 } 12210 var body io.Reader = nil 12211 c.urlParams_.Set("alt", alt) 12212 c.urlParams_.Set("prettyPrint", "false") 12213 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12214 urls += "?" + c.urlParams_.Encode() 12215 req, err := http.NewRequest("GET", urls, body) 12216 if err != nil { 12217 return nil, err 12218 } 12219 req.Header = reqHeaders 12220 googleapi.Expand(req.URL, map[string]string{ 12221 "studentId": c.studentId, 12222 "invitationId": c.invitationId, 12223 }) 12224 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12225} 12226 12227// Do executes the "classroom.userProfiles.guardianInvitations.get" call. 12228// Exactly one of *GuardianInvitation or error will be non-nil. Any 12229// non-2xx status code is an error. Response headers are in either 12230// *GuardianInvitation.ServerResponse.Header or (if a response was 12231// returned at all) in error.(*googleapi.Error).Header. Use 12232// googleapi.IsNotModified to check whether the returned error was 12233// because http.StatusNotModified was returned. 12234func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12235 gensupport.SetOptions(c.urlParams_, opts...) 12236 res, err := c.doRequest("json") 12237 if res != nil && res.StatusCode == http.StatusNotModified { 12238 if res.Body != nil { 12239 res.Body.Close() 12240 } 12241 return nil, &googleapi.Error{ 12242 Code: res.StatusCode, 12243 Header: res.Header, 12244 } 12245 } 12246 if err != nil { 12247 return nil, err 12248 } 12249 defer googleapi.CloseBody(res) 12250 if err := googleapi.CheckResponse(res); err != nil { 12251 return nil, err 12252 } 12253 ret := &GuardianInvitation{ 12254 ServerResponse: googleapi.ServerResponse{ 12255 Header: res.Header, 12256 HTTPStatusCode: res.StatusCode, 12257 }, 12258 } 12259 target := &ret 12260 if err := gensupport.DecodeResponse(target, res); err != nil { 12261 return nil, err 12262 } 12263 return ret, nil 12264 // { 12265 // "description": "Returns a specific guardian invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view\n guardian invitations for the student identified by the `student_id`, if\n guardians are not enabled for the domain in question, or for other\n access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`).\n* `NOT_FOUND` if Classroom cannot find any record of the given student or\n `invitation_id`. May also be returned if the student exists, but the\n requesting user does not have access to see that student.", 12266 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12267 // "httpMethod": "GET", 12268 // "id": "classroom.userProfiles.guardianInvitations.get", 12269 // "parameterOrder": [ 12270 // "studentId", 12271 // "invitationId" 12272 // ], 12273 // "parameters": { 12274 // "invitationId": { 12275 // "description": "The `id` field of the `GuardianInvitation` being requested.", 12276 // "location": "path", 12277 // "required": true, 12278 // "type": "string" 12279 // }, 12280 // "studentId": { 12281 // "description": "The ID of the student whose guardian invitation is being requested.", 12282 // "location": "path", 12283 // "required": true, 12284 // "type": "string" 12285 // } 12286 // }, 12287 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12288 // "response": { 12289 // "$ref": "GuardianInvitation" 12290 // }, 12291 // "scopes": [ 12292 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12293 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12294 // ] 12295 // } 12296 12297} 12298 12299// method id "classroom.userProfiles.guardianInvitations.list": 12300 12301type UserProfilesGuardianInvitationsListCall struct { 12302 s *Service 12303 studentId string 12304 urlParams_ gensupport.URLParams 12305 ifNoneMatch_ string 12306 ctx_ context.Context 12307 header_ http.Header 12308} 12309 12310// List: Returns a list of guardian invitations that the requesting user 12311// is 12312// permitted to view, filtered by the parameters provided. 12313// 12314// This method returns the following error codes: 12315// 12316// * `PERMISSION_DENIED` if a `student_id` is specified, and the 12317// requesting 12318// user is not permitted to view guardian invitations for that 12319// student, if 12320// "-" is specified as the `student_id` and the user is not a 12321// domain 12322// administrator, if guardians are not enabled for the domain in 12323// question, 12324// or for other access errors. 12325// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12326// cannot 12327// be recognized (it is not an email address, nor a `student_id` from 12328// the 12329// API, nor the literal string `me`). May also be returned if an 12330// invalid 12331// `page_token` or `state` is provided. 12332// * `NOT_FOUND` if a `student_id` is specified, and its format can be 12333// recognized, but Classroom has no record of that student. 12334func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall { 12335 c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12336 c.studentId = studentId 12337 return c 12338} 12339 12340// InvitedEmailAddress sets the optional parameter 12341// "invitedEmailAddress": If specified, only results with the specified 12342// `invited_email_address` 12343// are returned. 12344func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall { 12345 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 12346 return c 12347} 12348 12349// PageSize sets the optional parameter "pageSize": Maximum number of 12350// items to return. Zero or unspecified indicates that the 12351// server may assign a maximum. 12352// 12353// The server may return fewer than the specified number of results. 12354func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall { 12355 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 12356 return c 12357} 12358 12359// PageToken sets the optional parameter "pageToken": 12360// nextPageToken 12361// value returned from a previous 12362// list 12363// call, indicating that the subsequent page of results should be 12364// returned. 12365// 12366// The list 12367// request must be otherwise identical to the one that resulted in this 12368// token. 12369func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall { 12370 c.urlParams_.Set("pageToken", pageToken) 12371 return c 12372} 12373 12374// States sets the optional parameter "states": If specified, only 12375// results with the specified `state` values are 12376// returned. Otherwise, results with a `state` of `PENDING` are 12377// returned. 12378// 12379// Possible values: 12380// "GUARDIAN_INVITATION_STATE_UNSPECIFIED" 12381// "PENDING" 12382// "COMPLETE" 12383func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall { 12384 c.urlParams_.SetMulti("states", append([]string{}, states...)) 12385 return c 12386} 12387 12388// Fields allows partial responses to be retrieved. See 12389// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12390// for more information. 12391func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall { 12392 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12393 return c 12394} 12395 12396// IfNoneMatch sets the optional parameter which makes the operation 12397// fail if the object's ETag matches the given value. This is useful for 12398// getting updates only after the object has changed since the last 12399// request. Use googleapi.IsNotModified to check whether the response 12400// error from Do is the result of In-None-Match. 12401func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall { 12402 c.ifNoneMatch_ = entityTag 12403 return c 12404} 12405 12406// Context sets the context to be used in this call's Do method. Any 12407// pending HTTP request will be aborted if the provided context is 12408// canceled. 12409func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall { 12410 c.ctx_ = ctx 12411 return c 12412} 12413 12414// Header returns an http.Header that can be modified by the caller to 12415// add HTTP headers to the request. 12416func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header { 12417 if c.header_ == nil { 12418 c.header_ = make(http.Header) 12419 } 12420 return c.header_ 12421} 12422 12423func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) { 12424 reqHeaders := make(http.Header) 12425 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12426 for k, v := range c.header_ { 12427 reqHeaders[k] = v 12428 } 12429 reqHeaders.Set("User-Agent", c.s.userAgent()) 12430 if c.ifNoneMatch_ != "" { 12431 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12432 } 12433 var body io.Reader = nil 12434 c.urlParams_.Set("alt", alt) 12435 c.urlParams_.Set("prettyPrint", "false") 12436 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12437 urls += "?" + c.urlParams_.Encode() 12438 req, err := http.NewRequest("GET", urls, body) 12439 if err != nil { 12440 return nil, err 12441 } 12442 req.Header = reqHeaders 12443 googleapi.Expand(req.URL, map[string]string{ 12444 "studentId": c.studentId, 12445 }) 12446 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12447} 12448 12449// Do executes the "classroom.userProfiles.guardianInvitations.list" call. 12450// Exactly one of *ListGuardianInvitationsResponse or error will be 12451// non-nil. Any non-2xx status code is an error. Response headers are in 12452// either *ListGuardianInvitationsResponse.ServerResponse.Header or (if 12453// a response was returned at all) in error.(*googleapi.Error).Header. 12454// Use googleapi.IsNotModified to check whether the returned error was 12455// because http.StatusNotModified was returned. 12456func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) { 12457 gensupport.SetOptions(c.urlParams_, opts...) 12458 res, err := c.doRequest("json") 12459 if res != nil && res.StatusCode == http.StatusNotModified { 12460 if res.Body != nil { 12461 res.Body.Close() 12462 } 12463 return nil, &googleapi.Error{ 12464 Code: res.StatusCode, 12465 Header: res.Header, 12466 } 12467 } 12468 if err != nil { 12469 return nil, err 12470 } 12471 defer googleapi.CloseBody(res) 12472 if err := googleapi.CheckResponse(res); err != nil { 12473 return nil, err 12474 } 12475 ret := &ListGuardianInvitationsResponse{ 12476 ServerResponse: googleapi.ServerResponse{ 12477 Header: res.Header, 12478 HTTPStatusCode: res.StatusCode, 12479 }, 12480 } 12481 target := &ret 12482 if err := gensupport.DecodeResponse(target, res); err != nil { 12483 return nil, err 12484 } 12485 return ret, nil 12486 // { 12487 // "description": "Returns a list of guardian invitations that the requesting user is\npermitted to view, filtered by the parameters provided.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if a `student_id` is specified, and the requesting\n user is not permitted to view guardian invitations for that student, if\n `\"-\"` is specified as the `student_id` and the user is not a domain\n administrator, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`). May also be returned if an invalid\n `page_token` or `state` is provided.\n* `NOT_FOUND` if a `student_id` is specified, and its format can be\n recognized, but Classroom has no record of that student.", 12488 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12489 // "httpMethod": "GET", 12490 // "id": "classroom.userProfiles.guardianInvitations.list", 12491 // "parameterOrder": [ 12492 // "studentId" 12493 // ], 12494 // "parameters": { 12495 // "invitedEmailAddress": { 12496 // "description": "If specified, only results with the specified `invited_email_address`\nare returned.", 12497 // "location": "query", 12498 // "type": "string" 12499 // }, 12500 // "pageSize": { 12501 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 12502 // "format": "int32", 12503 // "location": "query", 12504 // "type": "integer" 12505 // }, 12506 // "pageToken": { 12507 // "description": "nextPageToken\nvalue returned from a previous\nlist\ncall, indicating that the subsequent page of results should be returned.\n\nThe list\nrequest must be otherwise identical to the one that resulted in this token.", 12508 // "location": "query", 12509 // "type": "string" 12510 // }, 12511 // "states": { 12512 // "description": "If specified, only results with the specified `state` values are\nreturned. Otherwise, results with a `state` of `PENDING` are returned.", 12513 // "enum": [ 12514 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED", 12515 // "PENDING", 12516 // "COMPLETE" 12517 // ], 12518 // "location": "query", 12519 // "repeated": true, 12520 // "type": "string" 12521 // }, 12522 // "studentId": { 12523 // "description": "The ID of the student whose guardian invitations are to be returned.\nThe identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user\n* the string literal `\"-\"`, indicating that results should be returned for\n all students that the requesting user is permitted to view guardian\n invitations.", 12524 // "location": "path", 12525 // "required": true, 12526 // "type": "string" 12527 // } 12528 // }, 12529 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12530 // "response": { 12531 // "$ref": "ListGuardianInvitationsResponse" 12532 // }, 12533 // "scopes": [ 12534 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12535 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12536 // ] 12537 // } 12538 12539} 12540 12541// Pages invokes f for each page of results. 12542// A non-nil error returned from f will halt the iteration. 12543// The provided context supersedes any context provided to the Context method. 12544func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error { 12545 c.ctx_ = ctx 12546 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12547 for { 12548 x, err := c.Do() 12549 if err != nil { 12550 return err 12551 } 12552 if err := f(x); err != nil { 12553 return err 12554 } 12555 if x.NextPageToken == "" { 12556 return nil 12557 } 12558 c.PageToken(x.NextPageToken) 12559 } 12560} 12561 12562// method id "classroom.userProfiles.guardianInvitations.patch": 12563 12564type UserProfilesGuardianInvitationsPatchCall struct { 12565 s *Service 12566 studentId string 12567 invitationId string 12568 guardianinvitation *GuardianInvitation 12569 urlParams_ gensupport.URLParams 12570 ctx_ context.Context 12571 header_ http.Header 12572} 12573 12574// Patch: Modifies a guardian invitation. 12575// 12576// Currently, the only valid modification is to change the `state` 12577// from 12578// `PENDING` to `COMPLETE`. This has the effect of withdrawing the 12579// invitation. 12580// 12581// This method returns the following error codes: 12582// 12583// * `PERMISSION_DENIED` if the current user does not have permission 12584// to 12585// manage guardians, if guardians are not enabled for the domain in 12586// question 12587// or for other access errors. 12588// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` 12589// state. 12590// * `INVALID_ARGUMENT` if the format of the student ID provided 12591// cannot be recognized (it is not an email address, nor a `user_id` 12592// from 12593// this API), or if the passed `GuardianInvitation` has a `state` 12594// other than 12595// `COMPLETE`, or if it modifies fields other than `state`. 12596// * `NOT_FOUND` if the student ID provided is a valid student ID, but 12597// Classroom has no record of that student, or if the `id` field does 12598// not 12599// refer to a guardian invitation known to Classroom. 12600func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall { 12601 c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12602 c.studentId = studentId 12603 c.invitationId = invitationId 12604 c.guardianinvitation = guardianinvitation 12605 return c 12606} 12607 12608// UpdateMask sets the optional parameter "updateMask": Mask that 12609// identifies which fields on the course to update. 12610// This field is required to do an update. The update fails if 12611// invalid 12612// fields are specified. The following fields are valid: 12613// 12614// * `state` 12615// 12616// When set in a query parameter, this field should be specified 12617// as 12618// 12619// `updateMask=<field1>,<field2>,...` 12620func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall { 12621 c.urlParams_.Set("updateMask", updateMask) 12622 return c 12623} 12624 12625// Fields allows partial responses to be retrieved. See 12626// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12627// for more information. 12628func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall { 12629 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12630 return c 12631} 12632 12633// Context sets the context to be used in this call's Do method. Any 12634// pending HTTP request will be aborted if the provided context is 12635// canceled. 12636func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall { 12637 c.ctx_ = ctx 12638 return c 12639} 12640 12641// Header returns an http.Header that can be modified by the caller to 12642// add HTTP headers to the request. 12643func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header { 12644 if c.header_ == nil { 12645 c.header_ = make(http.Header) 12646 } 12647 return c.header_ 12648} 12649 12650func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) { 12651 reqHeaders := make(http.Header) 12652 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12653 for k, v := range c.header_ { 12654 reqHeaders[k] = v 12655 } 12656 reqHeaders.Set("User-Agent", c.s.userAgent()) 12657 var body io.Reader = nil 12658 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12659 if err != nil { 12660 return nil, err 12661 } 12662 reqHeaders.Set("Content-Type", "application/json") 12663 c.urlParams_.Set("alt", alt) 12664 c.urlParams_.Set("prettyPrint", "false") 12665 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12666 urls += "?" + c.urlParams_.Encode() 12667 req, err := http.NewRequest("PATCH", urls, body) 12668 if err != nil { 12669 return nil, err 12670 } 12671 req.Header = reqHeaders 12672 googleapi.Expand(req.URL, map[string]string{ 12673 "studentId": c.studentId, 12674 "invitationId": c.invitationId, 12675 }) 12676 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12677} 12678 12679// Do executes the "classroom.userProfiles.guardianInvitations.patch" call. 12680// Exactly one of *GuardianInvitation or error will be non-nil. Any 12681// non-2xx status code is an error. Response headers are in either 12682// *GuardianInvitation.ServerResponse.Header or (if a response was 12683// returned at all) in error.(*googleapi.Error).Header. Use 12684// googleapi.IsNotModified to check whether the returned error was 12685// because http.StatusNotModified was returned. 12686func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12687 gensupport.SetOptions(c.urlParams_, opts...) 12688 res, err := c.doRequest("json") 12689 if res != nil && res.StatusCode == http.StatusNotModified { 12690 if res.Body != nil { 12691 res.Body.Close() 12692 } 12693 return nil, &googleapi.Error{ 12694 Code: res.StatusCode, 12695 Header: res.Header, 12696 } 12697 } 12698 if err != nil { 12699 return nil, err 12700 } 12701 defer googleapi.CloseBody(res) 12702 if err := googleapi.CheckResponse(res); err != nil { 12703 return nil, err 12704 } 12705 ret := &GuardianInvitation{ 12706 ServerResponse: googleapi.ServerResponse{ 12707 Header: res.Header, 12708 HTTPStatusCode: res.StatusCode, 12709 }, 12710 } 12711 target := &ret 12712 if err := gensupport.DecodeResponse(target, res); err != nil { 12713 return nil, err 12714 } 12715 return ret, nil 12716 // { 12717 // "description": "Modifies a guardian invitation.\n\nCurrently, the only valid modification is to change the `state` from\n`PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the current user does not have permission to\n manage guardians, if guardians are not enabled for the domain in question\n or for other access errors.\n* `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state.\n* `INVALID_ARGUMENT` if the format of the student ID provided\n cannot be recognized (it is not an email address, nor a `user_id` from\n this API), or if the passed `GuardianInvitation` has a `state` other than\n `COMPLETE`, or if it modifies fields other than `state`.\n* `NOT_FOUND` if the student ID provided is a valid student ID, but\n Classroom has no record of that student, or if the `id` field does not\n refer to a guardian invitation known to Classroom.", 12718 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12719 // "httpMethod": "PATCH", 12720 // "id": "classroom.userProfiles.guardianInvitations.patch", 12721 // "parameterOrder": [ 12722 // "studentId", 12723 // "invitationId" 12724 // ], 12725 // "parameters": { 12726 // "invitationId": { 12727 // "description": "The `id` field of the `GuardianInvitation` to be modified.", 12728 // "location": "path", 12729 // "required": true, 12730 // "type": "string" 12731 // }, 12732 // "studentId": { 12733 // "description": "The ID of the student whose guardian invitation is to be modified.", 12734 // "location": "path", 12735 // "required": true, 12736 // "type": "string" 12737 // }, 12738 // "updateMask": { 12739 // "description": "Mask that identifies which fields on the course to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified. The following fields are valid:\n\n* `state`\n\nWhen set in a query parameter, this field should be specified as\n\n`updateMask=\u003cfield1\u003e,\u003cfield2\u003e,...`", 12740 // "format": "google-fieldmask", 12741 // "location": "query", 12742 // "type": "string" 12743 // } 12744 // }, 12745 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12746 // "request": { 12747 // "$ref": "GuardianInvitation" 12748 // }, 12749 // "response": { 12750 // "$ref": "GuardianInvitation" 12751 // }, 12752 // "scopes": [ 12753 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12754 // ] 12755 // } 12756 12757} 12758 12759// method id "classroom.userProfiles.guardians.delete": 12760 12761type UserProfilesGuardiansDeleteCall struct { 12762 s *Service 12763 studentId string 12764 guardianId string 12765 urlParams_ gensupport.URLParams 12766 ctx_ context.Context 12767 header_ http.Header 12768} 12769 12770// Delete: Deletes a guardian. 12771// 12772// The guardian will no longer receive guardian notifications and the 12773// guardian 12774// will no longer be accessible via the API. 12775// 12776// This method returns the following error codes: 12777// 12778// * `PERMISSION_DENIED` if no user that matches the provided 12779// `student_id` 12780// is visible to the requesting user, if the requesting user is not 12781// permitted to manage guardians for the student identified by the 12782// `student_id`, if guardians are not enabled for the domain in 12783// question, 12784// or for other access errors. 12785// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12786// cannot 12787// be recognized (it is not an email address, nor a `student_id` from 12788// the 12789// API). 12790// * `NOT_FOUND` if the requesting user is permitted to modify guardians 12791// for 12792// the requested `student_id`, but no `Guardian` record exists for 12793// that 12794// student with the provided `guardian_id`. 12795func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall { 12796 c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12797 c.studentId = studentId 12798 c.guardianId = guardianId 12799 return c 12800} 12801 12802// Fields allows partial responses to be retrieved. See 12803// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12804// for more information. 12805func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall { 12806 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12807 return c 12808} 12809 12810// Context sets the context to be used in this call's Do method. Any 12811// pending HTTP request will be aborted if the provided context is 12812// canceled. 12813func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall { 12814 c.ctx_ = ctx 12815 return c 12816} 12817 12818// Header returns an http.Header that can be modified by the caller to 12819// add HTTP headers to the request. 12820func (c *UserProfilesGuardiansDeleteCall) Header() http.Header { 12821 if c.header_ == nil { 12822 c.header_ = make(http.Header) 12823 } 12824 return c.header_ 12825} 12826 12827func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) { 12828 reqHeaders := make(http.Header) 12829 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12830 for k, v := range c.header_ { 12831 reqHeaders[k] = v 12832 } 12833 reqHeaders.Set("User-Agent", c.s.userAgent()) 12834 var body io.Reader = nil 12835 c.urlParams_.Set("alt", alt) 12836 c.urlParams_.Set("prettyPrint", "false") 12837 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 12838 urls += "?" + c.urlParams_.Encode() 12839 req, err := http.NewRequest("DELETE", urls, body) 12840 if err != nil { 12841 return nil, err 12842 } 12843 req.Header = reqHeaders 12844 googleapi.Expand(req.URL, map[string]string{ 12845 "studentId": c.studentId, 12846 "guardianId": c.guardianId, 12847 }) 12848 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12849} 12850 12851// Do executes the "classroom.userProfiles.guardians.delete" call. 12852// Exactly one of *Empty or error will be non-nil. Any non-2xx status 12853// code is an error. Response headers are in either 12854// *Empty.ServerResponse.Header or (if a response was returned at all) 12855// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12856// check whether the returned error was because http.StatusNotModified 12857// was returned. 12858func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 12859 gensupport.SetOptions(c.urlParams_, opts...) 12860 res, err := c.doRequest("json") 12861 if res != nil && res.StatusCode == http.StatusNotModified { 12862 if res.Body != nil { 12863 res.Body.Close() 12864 } 12865 return nil, &googleapi.Error{ 12866 Code: res.StatusCode, 12867 Header: res.Header, 12868 } 12869 } 12870 if err != nil { 12871 return nil, err 12872 } 12873 defer googleapi.CloseBody(res) 12874 if err := googleapi.CheckResponse(res); err != nil { 12875 return nil, err 12876 } 12877 ret := &Empty{ 12878 ServerResponse: googleapi.ServerResponse{ 12879 Header: res.Header, 12880 HTTPStatusCode: res.StatusCode, 12881 }, 12882 } 12883 target := &ret 12884 if err := gensupport.DecodeResponse(target, res); err != nil { 12885 return nil, err 12886 } 12887 return ret, nil 12888 // { 12889 // "description": "Deletes a guardian.\n\nThe guardian will no longer receive guardian notifications and the guardian\nwill no longer be accessible via the API.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if no user that matches the provided `student_id`\n is visible to the requesting user, if the requesting user is not\n permitted to manage guardians for the student identified by the\n `student_id`, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API).\n* `NOT_FOUND` if the requesting user is permitted to modify guardians for\n the requested `student_id`, but no `Guardian` record exists for that\n student with the provided `guardian_id`.", 12890 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12891 // "httpMethod": "DELETE", 12892 // "id": "classroom.userProfiles.guardians.delete", 12893 // "parameterOrder": [ 12894 // "studentId", 12895 // "guardianId" 12896 // ], 12897 // "parameters": { 12898 // "guardianId": { 12899 // "description": "The `id` field from a `Guardian`.", 12900 // "location": "path", 12901 // "required": true, 12902 // "type": "string" 12903 // }, 12904 // "studentId": { 12905 // "description": "The student whose guardian is to be deleted. One of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 12906 // "location": "path", 12907 // "required": true, 12908 // "type": "string" 12909 // } 12910 // }, 12911 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12912 // "response": { 12913 // "$ref": "Empty" 12914 // }, 12915 // "scopes": [ 12916 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12917 // ] 12918 // } 12919 12920} 12921 12922// method id "classroom.userProfiles.guardians.get": 12923 12924type UserProfilesGuardiansGetCall struct { 12925 s *Service 12926 studentId string 12927 guardianId string 12928 urlParams_ gensupport.URLParams 12929 ifNoneMatch_ string 12930 ctx_ context.Context 12931 header_ http.Header 12932} 12933 12934// Get: Returns a specific guardian. 12935// 12936// This method returns the following error codes: 12937// 12938// * `PERMISSION_DENIED` if no user that matches the provided 12939// `student_id` 12940// is visible to the requesting user, if the requesting user is not 12941// permitted to view guardian information for the student identified 12942// by the 12943// `student_id`, if guardians are not enabled for the domain in 12944// question, 12945// or for other access errors. 12946// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12947// cannot 12948// be recognized (it is not an email address, nor a `student_id` from 12949// the 12950// API, nor the literal string `me`). 12951// * `NOT_FOUND` if the requesting user is permitted to view guardians 12952// for 12953// the requested `student_id`, but no `Guardian` record exists for 12954// that 12955// student that matches the provided `guardian_id`. 12956func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall { 12957 c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12958 c.studentId = studentId 12959 c.guardianId = guardianId 12960 return c 12961} 12962 12963// Fields allows partial responses to be retrieved. See 12964// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12965// for more information. 12966func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall { 12967 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12968 return c 12969} 12970 12971// IfNoneMatch sets the optional parameter which makes the operation 12972// fail if the object's ETag matches the given value. This is useful for 12973// getting updates only after the object has changed since the last 12974// request. Use googleapi.IsNotModified to check whether the response 12975// error from Do is the result of In-None-Match. 12976func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall { 12977 c.ifNoneMatch_ = entityTag 12978 return c 12979} 12980 12981// Context sets the context to be used in this call's Do method. Any 12982// pending HTTP request will be aborted if the provided context is 12983// canceled. 12984func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall { 12985 c.ctx_ = ctx 12986 return c 12987} 12988 12989// Header returns an http.Header that can be modified by the caller to 12990// add HTTP headers to the request. 12991func (c *UserProfilesGuardiansGetCall) Header() http.Header { 12992 if c.header_ == nil { 12993 c.header_ = make(http.Header) 12994 } 12995 return c.header_ 12996} 12997 12998func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) { 12999 reqHeaders := make(http.Header) 13000 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 13001 for k, v := range c.header_ { 13002 reqHeaders[k] = v 13003 } 13004 reqHeaders.Set("User-Agent", c.s.userAgent()) 13005 if c.ifNoneMatch_ != "" { 13006 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13007 } 13008 var body io.Reader = nil 13009 c.urlParams_.Set("alt", alt) 13010 c.urlParams_.Set("prettyPrint", "false") 13011 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13012 urls += "?" + c.urlParams_.Encode() 13013 req, err := http.NewRequest("GET", urls, body) 13014 if err != nil { 13015 return nil, err 13016 } 13017 req.Header = reqHeaders 13018 googleapi.Expand(req.URL, map[string]string{ 13019 "studentId": c.studentId, 13020 "guardianId": c.guardianId, 13021 }) 13022 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13023} 13024 13025// Do executes the "classroom.userProfiles.guardians.get" call. 13026// Exactly one of *Guardian or error will be non-nil. Any non-2xx status 13027// code is an error. Response headers are in either 13028// *Guardian.ServerResponse.Header or (if a response was returned at 13029// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13030// to check whether the returned error was because 13031// http.StatusNotModified was returned. 13032func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) { 13033 gensupport.SetOptions(c.urlParams_, opts...) 13034 res, err := c.doRequest("json") 13035 if res != nil && res.StatusCode == http.StatusNotModified { 13036 if res.Body != nil { 13037 res.Body.Close() 13038 } 13039 return nil, &googleapi.Error{ 13040 Code: res.StatusCode, 13041 Header: res.Header, 13042 } 13043 } 13044 if err != nil { 13045 return nil, err 13046 } 13047 defer googleapi.CloseBody(res) 13048 if err := googleapi.CheckResponse(res); err != nil { 13049 return nil, err 13050 } 13051 ret := &Guardian{ 13052 ServerResponse: googleapi.ServerResponse{ 13053 Header: res.Header, 13054 HTTPStatusCode: res.StatusCode, 13055 }, 13056 } 13057 target := &ret 13058 if err := gensupport.DecodeResponse(target, res); err != nil { 13059 return nil, err 13060 } 13061 return ret, nil 13062 // { 13063 // "description": "Returns a specific guardian.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if no user that matches the provided `student_id`\n is visible to the requesting user, if the requesting user is not\n permitted to view guardian information for the student identified by the\n `student_id`, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`).\n* `NOT_FOUND` if the requesting user is permitted to view guardians for\n the requested `student_id`, but no `Guardian` record exists for that\n student that matches the provided `guardian_id`.", 13064 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13065 // "httpMethod": "GET", 13066 // "id": "classroom.userProfiles.guardians.get", 13067 // "parameterOrder": [ 13068 // "studentId", 13069 // "guardianId" 13070 // ], 13071 // "parameters": { 13072 // "guardianId": { 13073 // "description": "The `id` field from a `Guardian`.", 13074 // "location": "path", 13075 // "required": true, 13076 // "type": "string" 13077 // }, 13078 // "studentId": { 13079 // "description": "The student whose guardian is being requested. One of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 13080 // "location": "path", 13081 // "required": true, 13082 // "type": "string" 13083 // } 13084 // }, 13085 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13086 // "response": { 13087 // "$ref": "Guardian" 13088 // }, 13089 // "scopes": [ 13090 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13091 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13092 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13093 // ] 13094 // } 13095 13096} 13097 13098// method id "classroom.userProfiles.guardians.list": 13099 13100type UserProfilesGuardiansListCall struct { 13101 s *Service 13102 studentId string 13103 urlParams_ gensupport.URLParams 13104 ifNoneMatch_ string 13105 ctx_ context.Context 13106 header_ http.Header 13107} 13108 13109// List: Returns a list of guardians that the requesting user is 13110// permitted to 13111// view, restricted to those that match the request. 13112// 13113// To list guardians for any student that the requesting user may 13114// view 13115// guardians for, use the literal character `-` for the student 13116// ID. 13117// 13118// This method returns the following error codes: 13119// 13120// * `PERMISSION_DENIED` if a `student_id` is specified, and the 13121// requesting 13122// user is not permitted to view guardian information for that 13123// student, if 13124// "-" is specified as the `student_id` and the user is not a 13125// domain 13126// administrator, if guardians are not enabled for the domain in 13127// question, 13128// if the `invited_email_address` filter is set by a user who is not 13129// a 13130// domain administrator, or for other access errors. 13131// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 13132// cannot 13133// be recognized (it is not an email address, nor a `student_id` from 13134// the 13135// API, nor the literal string `me`). May also be returned if an 13136// invalid 13137// `page_token` is provided. 13138// * `NOT_FOUND` if a `student_id` is specified, and its format can be 13139// recognized, but Classroom has no record of that student. 13140func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall { 13141 c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13142 c.studentId = studentId 13143 return c 13144} 13145 13146// InvitedEmailAddress sets the optional parameter 13147// "invitedEmailAddress": Filter results by the email address that the 13148// original invitation was sent 13149// to, resulting in this guardian link. 13150// This filter can only be used by domain administrators. 13151func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall { 13152 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 13153 return c 13154} 13155 13156// PageSize sets the optional parameter "pageSize": Maximum number of 13157// items to return. Zero or unspecified indicates that the 13158// server may assign a maximum. 13159// 13160// The server may return fewer than the specified number of results. 13161func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall { 13162 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 13163 return c 13164} 13165 13166// PageToken sets the optional parameter "pageToken": 13167// nextPageToken 13168// value returned from a previous 13169// list call, 13170// indicating that the subsequent page of results should be 13171// returned. 13172// 13173// The list request 13174// must be otherwise identical to the one that resulted in this token. 13175func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall { 13176 c.urlParams_.Set("pageToken", pageToken) 13177 return c 13178} 13179 13180// Fields allows partial responses to be retrieved. See 13181// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13182// for more information. 13183func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall { 13184 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13185 return c 13186} 13187 13188// IfNoneMatch sets the optional parameter which makes the operation 13189// fail if the object's ETag matches the given value. This is useful for 13190// getting updates only after the object has changed since the last 13191// request. Use googleapi.IsNotModified to check whether the response 13192// error from Do is the result of In-None-Match. 13193func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall { 13194 c.ifNoneMatch_ = entityTag 13195 return c 13196} 13197 13198// Context sets the context to be used in this call's Do method. Any 13199// pending HTTP request will be aborted if the provided context is 13200// canceled. 13201func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall { 13202 c.ctx_ = ctx 13203 return c 13204} 13205 13206// Header returns an http.Header that can be modified by the caller to 13207// add HTTP headers to the request. 13208func (c *UserProfilesGuardiansListCall) Header() http.Header { 13209 if c.header_ == nil { 13210 c.header_ = make(http.Header) 13211 } 13212 return c.header_ 13213} 13214 13215func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) { 13216 reqHeaders := make(http.Header) 13217 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 13218 for k, v := range c.header_ { 13219 reqHeaders[k] = v 13220 } 13221 reqHeaders.Set("User-Agent", c.s.userAgent()) 13222 if c.ifNoneMatch_ != "" { 13223 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13224 } 13225 var body io.Reader = nil 13226 c.urlParams_.Set("alt", alt) 13227 c.urlParams_.Set("prettyPrint", "false") 13228 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians") 13229 urls += "?" + c.urlParams_.Encode() 13230 req, err := http.NewRequest("GET", urls, body) 13231 if err != nil { 13232 return nil, err 13233 } 13234 req.Header = reqHeaders 13235 googleapi.Expand(req.URL, map[string]string{ 13236 "studentId": c.studentId, 13237 }) 13238 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13239} 13240 13241// Do executes the "classroom.userProfiles.guardians.list" call. 13242// Exactly one of *ListGuardiansResponse or error will be non-nil. Any 13243// non-2xx status code is an error. Response headers are in either 13244// *ListGuardiansResponse.ServerResponse.Header or (if a response was 13245// returned at all) in error.(*googleapi.Error).Header. Use 13246// googleapi.IsNotModified to check whether the returned error was 13247// because http.StatusNotModified was returned. 13248func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) { 13249 gensupport.SetOptions(c.urlParams_, opts...) 13250 res, err := c.doRequest("json") 13251 if res != nil && res.StatusCode == http.StatusNotModified { 13252 if res.Body != nil { 13253 res.Body.Close() 13254 } 13255 return nil, &googleapi.Error{ 13256 Code: res.StatusCode, 13257 Header: res.Header, 13258 } 13259 } 13260 if err != nil { 13261 return nil, err 13262 } 13263 defer googleapi.CloseBody(res) 13264 if err := googleapi.CheckResponse(res); err != nil { 13265 return nil, err 13266 } 13267 ret := &ListGuardiansResponse{ 13268 ServerResponse: googleapi.ServerResponse{ 13269 Header: res.Header, 13270 HTTPStatusCode: res.StatusCode, 13271 }, 13272 } 13273 target := &ret 13274 if err := gensupport.DecodeResponse(target, res); err != nil { 13275 return nil, err 13276 } 13277 return ret, nil 13278 // { 13279 // "description": "Returns a list of guardians that the requesting user is permitted to\nview, restricted to those that match the request.\n\nTo list guardians for any student that the requesting user may view\nguardians for, use the literal character `-` for the student ID.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if a `student_id` is specified, and the requesting\n user is not permitted to view guardian information for that student, if\n `\"-\"` is specified as the `student_id` and the user is not a domain\n administrator, if guardians are not enabled for the domain in question,\n if the `invited_email_address` filter is set by a user who is not a\n domain administrator, or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`). May also be returned if an invalid\n `page_token` is provided.\n* `NOT_FOUND` if a `student_id` is specified, and its format can be\n recognized, but Classroom has no record of that student.", 13280 // "flatPath": "v1/userProfiles/{studentId}/guardians", 13281 // "httpMethod": "GET", 13282 // "id": "classroom.userProfiles.guardians.list", 13283 // "parameterOrder": [ 13284 // "studentId" 13285 // ], 13286 // "parameters": { 13287 // "invitedEmailAddress": { 13288 // "description": "Filter results by the email address that the original invitation was sent\nto, resulting in this guardian link.\nThis filter can only be used by domain administrators.", 13289 // "location": "query", 13290 // "type": "string" 13291 // }, 13292 // "pageSize": { 13293 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 13294 // "format": "int32", 13295 // "location": "query", 13296 // "type": "integer" 13297 // }, 13298 // "pageToken": { 13299 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 13300 // "location": "query", 13301 // "type": "string" 13302 // }, 13303 // "studentId": { 13304 // "description": "Filter results by the student who the guardian is linked to.\nThe identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user\n* the string literal `\"-\"`, indicating that results should be returned for\n all students that the requesting user has access to view.", 13305 // "location": "path", 13306 // "required": true, 13307 // "type": "string" 13308 // } 13309 // }, 13310 // "path": "v1/userProfiles/{studentId}/guardians", 13311 // "response": { 13312 // "$ref": "ListGuardiansResponse" 13313 // }, 13314 // "scopes": [ 13315 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13316 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13317 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13318 // ] 13319 // } 13320 13321} 13322 13323// Pages invokes f for each page of results. 13324// A non-nil error returned from f will halt the iteration. 13325// The provided context supersedes any context provided to the Context method. 13326func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error { 13327 c.ctx_ = ctx 13328 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13329 for { 13330 x, err := c.Do() 13331 if err != nil { 13332 return err 13333 } 13334 if err := f(x); err != nil { 13335 return err 13336 } 13337 if x.NextPageToken == "" { 13338 return nil 13339 } 13340 c.PageToken(x.NextPageToken) 13341 } 13342} 13343