1// Copyright 2019 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 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "classroom:v1" 77const apiName = "classroom" 78const apiVersion = "v1" 79const basePath = "https://classroom.googleapis.com/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // View and manage announcements in Google Classroom 84 ClassroomAnnouncementsScope = "https://www.googleapis.com/auth/classroom.announcements" 85 86 // View announcements in Google Classroom 87 ClassroomAnnouncementsReadonlyScope = "https://www.googleapis.com/auth/classroom.announcements.readonly" 88 89 // Manage your Google Classroom classes 90 ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses" 91 92 // View your Google Classroom classes 93 ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly" 94 95 // Manage your course work and view your grades in Google Classroom 96 ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me" 97 98 // View your course work and grades in Google Classroom 99 ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly" 100 101 // Manage course work and grades for students in the Google Classroom 102 // classes you teach and view the course work and grades for classes you 103 // administer 104 ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students" 105 106 // View course work and grades for students in the Google Classroom 107 // classes you teach or administer 108 ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 109 110 // View your Google Classroom guardians 111 ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly" 112 113 // View and manage guardians for students in your Google Classroom 114 // classes 115 ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students" 116 117 // View guardians for students in your Google Classroom classes 118 ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 119 120 // View the email addresses of people in your classes 121 ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails" 122 123 // View the profile photos of people in your classes 124 ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos" 125 126 // Receive notifications about your Google Classroom data 127 ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications" 128 129 // Manage your Google Classroom class rosters 130 ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters" 131 132 // View your Google Classroom class rosters 133 ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly" 134 135 // View your course work and grades in Google Classroom 136 ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly" 137 138 // View course work and grades for students in the Google Classroom 139 // classes you teach or administer 140 ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 141 142 // See, create, and edit topics in Google Classroom 143 ClassroomTopicsScope = "https://www.googleapis.com/auth/classroom.topics" 144 145 // View topics in Google Classroom 146 ClassroomTopicsReadonlyScope = "https://www.googleapis.com/auth/classroom.topics.readonly" 147) 148 149// NewService creates a new Service. 150func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 151 scopesOption := option.WithScopes( 152 "https://www.googleapis.com/auth/classroom.announcements", 153 "https://www.googleapis.com/auth/classroom.announcements.readonly", 154 "https://www.googleapis.com/auth/classroom.courses", 155 "https://www.googleapis.com/auth/classroom.courses.readonly", 156 "https://www.googleapis.com/auth/classroom.coursework.me", 157 "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 158 "https://www.googleapis.com/auth/classroom.coursework.students", 159 "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 160 "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 161 "https://www.googleapis.com/auth/classroom.guardianlinks.students", 162 "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly", 163 "https://www.googleapis.com/auth/classroom.profile.emails", 164 "https://www.googleapis.com/auth/classroom.profile.photos", 165 "https://www.googleapis.com/auth/classroom.push-notifications", 166 "https://www.googleapis.com/auth/classroom.rosters", 167 "https://www.googleapis.com/auth/classroom.rosters.readonly", 168 "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 169 "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly", 170 "https://www.googleapis.com/auth/classroom.topics", 171 "https://www.googleapis.com/auth/classroom.topics.readonly", 172 ) 173 // NOTE: prepend, so we don't override user-specified scopes. 174 opts = append([]option.ClientOption{scopesOption}, opts...) 175 client, endpoint, err := htransport.NewClient(ctx, opts...) 176 if err != nil { 177 return nil, err 178 } 179 s, err := New(client) 180 if err != nil { 181 return nil, err 182 } 183 if endpoint != "" { 184 s.BasePath = endpoint 185 } 186 return s, nil 187} 188 189// New creates a new Service. It uses the provided http.Client for requests. 190// 191// Deprecated: please use NewService instead. 192// To provide a custom HTTP client, use option.WithHTTPClient. 193// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 194func New(client *http.Client) (*Service, error) { 195 if client == nil { 196 return nil, errors.New("client is nil") 197 } 198 s := &Service{client: client, BasePath: basePath} 199 s.Courses = NewCoursesService(s) 200 s.Invitations = NewInvitationsService(s) 201 s.Registrations = NewRegistrationsService(s) 202 s.UserProfiles = NewUserProfilesService(s) 203 return s, nil 204} 205 206type Service struct { 207 client *http.Client 208 BasePath string // API endpoint base URL 209 UserAgent string // optional additional User-Agent fragment 210 211 Courses *CoursesService 212 213 Invitations *InvitationsService 214 215 Registrations *RegistrationsService 216 217 UserProfiles *UserProfilesService 218} 219 220func (s *Service) userAgent() string { 221 if s.UserAgent == "" { 222 return googleapi.UserAgent 223 } 224 return googleapi.UserAgent + " " + s.UserAgent 225} 226 227func NewCoursesService(s *Service) *CoursesService { 228 rs := &CoursesService{s: s} 229 rs.Aliases = NewCoursesAliasesService(s) 230 rs.Announcements = NewCoursesAnnouncementsService(s) 231 rs.CourseWork = NewCoursesCourseWorkService(s) 232 rs.Students = NewCoursesStudentsService(s) 233 rs.Teachers = NewCoursesTeachersService(s) 234 rs.Topics = NewCoursesTopicsService(s) 235 return rs 236} 237 238type CoursesService struct { 239 s *Service 240 241 Aliases *CoursesAliasesService 242 243 Announcements *CoursesAnnouncementsService 244 245 CourseWork *CoursesCourseWorkService 246 247 Students *CoursesStudentsService 248 249 Teachers *CoursesTeachersService 250 251 Topics *CoursesTopicsService 252} 253 254func NewCoursesAliasesService(s *Service) *CoursesAliasesService { 255 rs := &CoursesAliasesService{s: s} 256 return rs 257} 258 259type CoursesAliasesService struct { 260 s *Service 261} 262 263func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService { 264 rs := &CoursesAnnouncementsService{s: s} 265 return rs 266} 267 268type CoursesAnnouncementsService struct { 269 s *Service 270} 271 272func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService { 273 rs := &CoursesCourseWorkService{s: s} 274 rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s) 275 return rs 276} 277 278type CoursesCourseWorkService struct { 279 s *Service 280 281 StudentSubmissions *CoursesCourseWorkStudentSubmissionsService 282} 283 284func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService { 285 rs := &CoursesCourseWorkStudentSubmissionsService{s: s} 286 return rs 287} 288 289type CoursesCourseWorkStudentSubmissionsService struct { 290 s *Service 291} 292 293func NewCoursesStudentsService(s *Service) *CoursesStudentsService { 294 rs := &CoursesStudentsService{s: s} 295 return rs 296} 297 298type CoursesStudentsService struct { 299 s *Service 300} 301 302func NewCoursesTeachersService(s *Service) *CoursesTeachersService { 303 rs := &CoursesTeachersService{s: s} 304 return rs 305} 306 307type CoursesTeachersService struct { 308 s *Service 309} 310 311func NewCoursesTopicsService(s *Service) *CoursesTopicsService { 312 rs := &CoursesTopicsService{s: s} 313 return rs 314} 315 316type CoursesTopicsService struct { 317 s *Service 318} 319 320func NewInvitationsService(s *Service) *InvitationsService { 321 rs := &InvitationsService{s: s} 322 return rs 323} 324 325type InvitationsService struct { 326 s *Service 327} 328 329func NewRegistrationsService(s *Service) *RegistrationsService { 330 rs := &RegistrationsService{s: s} 331 return rs 332} 333 334type RegistrationsService struct { 335 s *Service 336} 337 338func NewUserProfilesService(s *Service) *UserProfilesService { 339 rs := &UserProfilesService{s: s} 340 rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s) 341 rs.Guardians = NewUserProfilesGuardiansService(s) 342 return rs 343} 344 345type UserProfilesService struct { 346 s *Service 347 348 GuardianInvitations *UserProfilesGuardianInvitationsService 349 350 Guardians *UserProfilesGuardiansService 351} 352 353func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService { 354 rs := &UserProfilesGuardianInvitationsService{s: s} 355 return rs 356} 357 358type UserProfilesGuardianInvitationsService struct { 359 s *Service 360} 361 362func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService { 363 rs := &UserProfilesGuardiansService{s: s} 364 return rs 365} 366 367type UserProfilesGuardiansService struct { 368 s *Service 369} 370 371// Announcement: Announcement created by a teacher for students of the 372// course 373type Announcement struct { 374 // AlternateLink: Absolute link to this announcement in the Classroom 375 // web UI. 376 // This is only populated if `state` is `PUBLISHED`. 377 // 378 // Read-only. 379 AlternateLink string `json:"alternateLink,omitempty"` 380 381 // AssigneeMode: Assignee mode of the announcement. 382 // If unspecified, the default value is `ALL_STUDENTS`. 383 // 384 // Possible values: 385 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 386 // returned. 387 // "ALL_STUDENTS" - All students can see the item. 388 // This is the default state. 389 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 390 AssigneeMode string `json:"assigneeMode,omitempty"` 391 392 // CourseId: Identifier of the course. 393 // 394 // Read-only. 395 CourseId string `json:"courseId,omitempty"` 396 397 // CreationTime: Timestamp when this announcement was 398 // created. 399 // 400 // Read-only. 401 CreationTime string `json:"creationTime,omitempty"` 402 403 // CreatorUserId: Identifier for the user that created the 404 // announcement. 405 // 406 // Read-only. 407 CreatorUserId string `json:"creatorUserId,omitempty"` 408 409 // Id: Classroom-assigned identifier of this announcement, unique per 410 // course. 411 // 412 // Read-only. 413 Id string `json:"id,omitempty"` 414 415 // IndividualStudentsOptions: Identifiers of students with access to the 416 // announcement. 417 // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`. 418 // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only 419 // students 420 // specified in this field will be able to see the announcement. 421 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 422 423 // Materials: Additional materials. 424 // 425 // Announcements must have no more than 20 material items. 426 Materials []*Material `json:"materials,omitempty"` 427 428 // ScheduledTime: Optional timestamp when this announcement is scheduled 429 // to be published. 430 ScheduledTime string `json:"scheduledTime,omitempty"` 431 432 // State: Status of this announcement. 433 // If unspecified, the default state is `DRAFT`. 434 // 435 // Possible values: 436 // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 437 // never returned. 438 // "PUBLISHED" - Status for announcement that has been published. 439 // This is the default state. 440 // "DRAFT" - Status for an announcement that is not yet 441 // published. 442 // Announcement in this state is visible only to course teachers and 443 // domain 444 // administrators. 445 // "DELETED" - Status for announcement that was published but is now 446 // deleted. 447 // Announcement in this state is visible only to course teachers and 448 // domain 449 // administrators. 450 // Announcement in this state is deleted after some time. 451 State string `json:"state,omitempty"` 452 453 // Text: Description of this announcement. 454 // The text must be a valid UTF-8 string containing no more 455 // than 30,000 characters. 456 Text string `json:"text,omitempty"` 457 458 // UpdateTime: Timestamp of the most recent change to this 459 // announcement. 460 // 461 // Read-only. 462 UpdateTime string `json:"updateTime,omitempty"` 463 464 // ServerResponse contains the HTTP response code and headers from the 465 // server. 466 googleapi.ServerResponse `json:"-"` 467 468 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 469 // unconditionally include in API requests. By default, fields with 470 // empty values are omitted from API requests. However, any non-pointer, 471 // non-interface field appearing in ForceSendFields will be sent to the 472 // server regardless of whether the field is empty or not. This may be 473 // used to include empty fields in Patch requests. 474 ForceSendFields []string `json:"-"` 475 476 // NullFields is a list of field names (e.g. "AlternateLink") to include 477 // in API requests with the JSON null value. By default, fields with 478 // empty values are omitted from API requests. However, any field with 479 // an empty value appearing in NullFields will be sent to the server as 480 // null. It is an error if a field in this list has a non-empty value. 481 // This may be used to include null fields in Patch requests. 482 NullFields []string `json:"-"` 483} 484 485func (s *Announcement) MarshalJSON() ([]byte, error) { 486 type NoMethod Announcement 487 raw := NoMethod(*s) 488 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 489} 490 491// Assignment: Additional details for assignments. 492type Assignment struct { 493 // StudentWorkFolder: Drive folder where attachments from student 494 // submissions are placed. 495 // This is only populated for course teachers and administrators. 496 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 497 498 // ForceSendFields is a list of field names (e.g. "StudentWorkFolder") 499 // to unconditionally include in API requests. By default, fields with 500 // empty values are omitted from API requests. However, any non-pointer, 501 // non-interface field appearing in ForceSendFields will be sent to the 502 // server regardless of whether the field is empty or not. This may be 503 // used to include empty fields in Patch requests. 504 ForceSendFields []string `json:"-"` 505 506 // NullFields is a list of field names (e.g. "StudentWorkFolder") to 507 // include in API requests with the JSON null value. By default, fields 508 // with empty values are omitted from API requests. However, any field 509 // with an empty value appearing in NullFields will be sent to the 510 // server as null. It is an error if a field in this list has a 511 // non-empty value. This may be used to include null fields in Patch 512 // requests. 513 NullFields []string `json:"-"` 514} 515 516func (s *Assignment) MarshalJSON() ([]byte, error) { 517 type NoMethod Assignment 518 raw := NoMethod(*s) 519 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 520} 521 522// AssignmentSubmission: Student work for an assignment. 523type AssignmentSubmission struct { 524 // Attachments: Attachments added by the student. 525 // Drive files that correspond to materials with a share mode 526 // of 527 // STUDENT_COPY may not exist yet if the student has not accessed 528 // the 529 // assignment in Classroom. 530 // 531 // Some attachment metadata is only populated if the requesting user 532 // has 533 // permission to access it. Identifier and alternate_link fields are 534 // always 535 // available, but others (e.g. title) may not be. 536 Attachments []*Attachment `json:"attachments,omitempty"` 537 538 // ForceSendFields is a list of field names (e.g. "Attachments") to 539 // unconditionally include in API requests. By default, fields with 540 // empty values are omitted from API requests. However, any non-pointer, 541 // non-interface field appearing in ForceSendFields will be sent to the 542 // server regardless of whether the field is empty or not. This may be 543 // used to include empty fields in Patch requests. 544 ForceSendFields []string `json:"-"` 545 546 // NullFields is a list of field names (e.g. "Attachments") to include 547 // in API requests with the JSON null value. By default, fields with 548 // empty values are omitted from API requests. However, any field with 549 // an empty value appearing in NullFields will be sent to the server as 550 // null. It is an error if a field in this list has a non-empty value. 551 // This may be used to include null fields in Patch requests. 552 NullFields []string `json:"-"` 553} 554 555func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) { 556 type NoMethod AssignmentSubmission 557 raw := NoMethod(*s) 558 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 559} 560 561// Attachment: Attachment added to student assignment work. 562// 563// When creating attachments, setting the `form` field is not supported. 564type Attachment struct { 565 // DriveFile: Google Drive file attachment. 566 DriveFile *DriveFile `json:"driveFile,omitempty"` 567 568 // Form: Google Forms attachment. 569 Form *Form `json:"form,omitempty"` 570 571 // Link: Link attachment. 572 Link *Link `json:"link,omitempty"` 573 574 // YouTubeVideo: Youtube video attachment. 575 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 576 577 // ForceSendFields is a list of field names (e.g. "DriveFile") to 578 // unconditionally include in API requests. By default, fields with 579 // empty values are omitted from API requests. However, any non-pointer, 580 // non-interface field appearing in ForceSendFields will be sent to the 581 // server regardless of whether the field is empty or not. This may be 582 // used to include empty fields in Patch requests. 583 ForceSendFields []string `json:"-"` 584 585 // NullFields is a list of field names (e.g. "DriveFile") to include in 586 // API requests with the JSON null value. By default, fields with empty 587 // values are omitted from API requests. However, any field with an 588 // empty value appearing in NullFields will be sent to the server as 589 // null. It is an error if a field in this list has a non-empty value. 590 // This may be used to include null fields in Patch requests. 591 NullFields []string `json:"-"` 592} 593 594func (s *Attachment) MarshalJSON() ([]byte, error) { 595 type NoMethod Attachment 596 raw := NoMethod(*s) 597 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 598} 599 600// CloudPubsubTopic: A reference to a Cloud Pub/Sub topic. 601// 602// To register for notifications, the owner of the topic must 603// grant 604// `classroom-notifications@system.gserviceaccount.com` the 605// `projects.topics.publish` permission. 606type CloudPubsubTopic struct { 607 // TopicName: The `name` field of a Cloud 608 // Pub/Sub 609 // [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1 610 // /projects.topics#Topic). 611 TopicName string `json:"topicName,omitempty"` 612 613 // ForceSendFields is a list of field names (e.g. "TopicName") to 614 // unconditionally include in API requests. By default, fields with 615 // empty values are omitted from API requests. However, any non-pointer, 616 // non-interface field appearing in ForceSendFields will be sent to the 617 // server regardless of whether the field is empty or not. This may be 618 // used to include empty fields in Patch requests. 619 ForceSendFields []string `json:"-"` 620 621 // NullFields is a list of field names (e.g. "TopicName") to include in 622 // API requests with the JSON null value. By default, fields with empty 623 // values are omitted from API requests. However, any field with an 624 // empty value appearing in NullFields will be sent to the server as 625 // null. It is an error if a field in this list has a non-empty value. 626 // This may be used to include null fields in Patch requests. 627 NullFields []string `json:"-"` 628} 629 630func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) { 631 type NoMethod CloudPubsubTopic 632 raw := NoMethod(*s) 633 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 634} 635 636// Course: A Course in Classroom. 637type Course struct { 638 // AlternateLink: Absolute link to this course in the Classroom web 639 // UI. 640 // 641 // Read-only. 642 AlternateLink string `json:"alternateLink,omitempty"` 643 644 // CalendarId: The Calendar ID for a calendar that all course members 645 // can see, to which 646 // Classroom adds events for course work and announcements in the 647 // course. 648 // 649 // Read-only. 650 CalendarId string `json:"calendarId,omitempty"` 651 652 // CourseGroupEmail: The email address of a Google group containing all 653 // members of the course. 654 // This group does not accept email and can only be used for 655 // permissions. 656 // 657 // Read-only. 658 CourseGroupEmail string `json:"courseGroupEmail,omitempty"` 659 660 // CourseMaterialSets: Sets of materials that appear on the "about" page 661 // of this course. 662 // 663 // Read-only. 664 CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"` 665 666 // CourseState: State of the course. 667 // If unspecified, the default state is `PROVISIONED`. 668 // 669 // Possible values: 670 // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 671 // message will use this value. 672 // "ACTIVE" - The course is active. 673 // "ARCHIVED" - The course has been archived. You cannot modify it 674 // except to change it 675 // to a different state. 676 // "PROVISIONED" - The course has been created, but not yet activated. 677 // It is accessible by 678 // the primary teacher and domain administrators, who may modify it 679 // or 680 // change it to the `ACTIVE` or `DECLINED` states. 681 // A course may only be changed to `PROVISIONED` if it is in the 682 // `DECLINED` 683 // state. 684 // "DECLINED" - The course has been created, but declined. It is 685 // accessible by the 686 // course owner and domain administrators, though it will not 687 // be 688 // displayed in the web UI. You cannot modify the course except to 689 // change it 690 // to the `PROVISIONED` state. 691 // A course may only be changed to `DECLINED` if it is in the 692 // `PROVISIONED` 693 // state. 694 // "SUSPENDED" - The course has been suspended. You cannot modify the 695 // course, and only the 696 // user identified by the `owner_id` can view the course. 697 // A course may be placed in this state if it potentially violates 698 // the 699 // Terms of Service. 700 CourseState string `json:"courseState,omitempty"` 701 702 // CreationTime: Creation time of the course. 703 // Specifying this field in a course update mask results in an 704 // error. 705 // 706 // Read-only. 707 CreationTime string `json:"creationTime,omitempty"` 708 709 // Description: Optional description. 710 // For example, "We'll be learning about the structure of 711 // living 712 // creatures from a combination of textbooks, guest lectures, and lab 713 // work. 714 // Expect to be excited!" 715 // If set, this field must be a valid UTF-8 string and no longer than 716 // 30,000 717 // characters. 718 Description string `json:"description,omitempty"` 719 720 // DescriptionHeading: Optional heading for the description. 721 // For example, "Welcome to 10th Grade Biology." 722 // If set, this field must be a valid UTF-8 string and no longer than 723 // 3600 724 // characters. 725 DescriptionHeading string `json:"descriptionHeading,omitempty"` 726 727 // EnrollmentCode: Enrollment code to use when joining this 728 // course. 729 // Specifying this field in a course update mask results in an 730 // error. 731 // 732 // Read-only. 733 EnrollmentCode string `json:"enrollmentCode,omitempty"` 734 735 // GuardiansEnabled: Whether or not guardian notifications are enabled 736 // for this course. 737 // 738 // Read-only. 739 GuardiansEnabled bool `json:"guardiansEnabled,omitempty"` 740 741 // Id: Identifier for this course assigned by Classroom. 742 // 743 // When 744 // creating a course, 745 // you may optionally set this identifier to an 746 // alias string in the 747 // request to create a corresponding alias. The `id` is still assigned 748 // by 749 // Classroom and cannot be updated after the course is 750 // created. 751 // 752 // Specifying this field in a course update mask results in an error. 753 Id string `json:"id,omitempty"` 754 755 // Name: Name of the course. 756 // For example, "10th Grade Biology". 757 // The name is required. It must be between 1 and 750 characters and a 758 // valid 759 // UTF-8 string. 760 Name string `json:"name,omitempty"` 761 762 // OwnerId: The identifier of the owner of a course. 763 // 764 // When specified as a parameter of a 765 // create course request, this 766 // field is required. 767 // The identifier can be one of the following: 768 // 769 // * the numeric identifier for the user 770 // * the email address of the user 771 // * the string literal "me", indicating the requesting user 772 // 773 // This must be set in a create request. Admins can also specify this 774 // field 775 // in a patch course request to 776 // transfer ownership. In other contexts, it is read-only. 777 OwnerId string `json:"ownerId,omitempty"` 778 779 // Room: Optional room location. 780 // For example, "301". 781 // If set, this field must be a valid UTF-8 string and no longer than 782 // 650 783 // characters. 784 Room string `json:"room,omitempty"` 785 786 // Section: Section of the course. 787 // For example, "Period 2". 788 // If set, this field must be a valid UTF-8 string and no longer than 789 // 2800 790 // characters. 791 Section string `json:"section,omitempty"` 792 793 // TeacherFolder: Information about a Drive Folder that is shared with 794 // all teachers of the 795 // course. 796 // 797 // This field will only be set for teachers of the course and 798 // domain 799 // administrators. 800 // 801 // Read-only. 802 TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"` 803 804 // TeacherGroupEmail: The email address of a Google group containing all 805 // teachers of the course. 806 // This group does not accept email and can only be used for 807 // permissions. 808 // 809 // Read-only. 810 TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"` 811 812 // UpdateTime: Time of the most recent update to this course. 813 // Specifying this field in a course update mask results in an 814 // error. 815 // 816 // Read-only. 817 UpdateTime string `json:"updateTime,omitempty"` 818 819 // ServerResponse contains the HTTP response code and headers from the 820 // server. 821 googleapi.ServerResponse `json:"-"` 822 823 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 824 // unconditionally include in API requests. By default, fields with 825 // empty values are omitted from API requests. However, any non-pointer, 826 // non-interface field appearing in ForceSendFields will be sent to the 827 // server regardless of whether the field is empty or not. This may be 828 // used to include empty fields in Patch requests. 829 ForceSendFields []string `json:"-"` 830 831 // NullFields is a list of field names (e.g. "AlternateLink") to include 832 // in API requests with the JSON null value. By default, fields with 833 // empty values are omitted from API requests. However, any field with 834 // an empty value appearing in NullFields will be sent to the server as 835 // null. It is an error if a field in this list has a non-empty value. 836 // This may be used to include null fields in Patch requests. 837 NullFields []string `json:"-"` 838} 839 840func (s *Course) MarshalJSON() ([]byte, error) { 841 type NoMethod Course 842 raw := NoMethod(*s) 843 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 844} 845 846// CourseAlias: Alternative identifier for a course. 847// 848// An alias uniquely identifies a course. It must be unique within one 849// of the 850// following scopes: 851// 852// * domain: A domain-scoped alias is visible to all users within the 853// alias 854// creator's domain and can be created only by a domain admin. A 855// domain-scoped 856// alias is often used when a course has an identifier external to 857// Classroom. 858// 859// * project: A project-scoped alias is visible to any request from 860// an 861// application using the Developer Console project ID that created the 862// alias 863// and can be created by any project. A project-scoped alias is often 864// used when 865// an application has alternative identifiers. A random value can also 866// be used 867// to avoid duplicate courses in the event of transmission failures, as 868// retrying 869// a request will return `ALREADY_EXISTS` if a previous one has 870// succeeded. 871type CourseAlias struct { 872 // Alias: Alias string. The format of the string indicates the desired 873 // alias scoping. 874 // 875 // * `d:<name>` indicates a domain-scoped alias. 876 // Example: `d:math_101` 877 // * `p:<name>` indicates a project-scoped alias. 878 // Example: `p:abc123` 879 // 880 // This field has a maximum length of 256 characters. 881 Alias string `json:"alias,omitempty"` 882 883 // ServerResponse contains the HTTP response code and headers from the 884 // server. 885 googleapi.ServerResponse `json:"-"` 886 887 // ForceSendFields is a list of field names (e.g. "Alias") to 888 // unconditionally include in API requests. By default, fields with 889 // empty values are omitted from API requests. However, any non-pointer, 890 // non-interface field appearing in ForceSendFields will be sent to the 891 // server regardless of whether the field is empty or not. This may be 892 // used to include empty fields in Patch requests. 893 ForceSendFields []string `json:"-"` 894 895 // NullFields is a list of field names (e.g. "Alias") to include in API 896 // requests with the JSON null value. By default, fields with empty 897 // values are omitted from API requests. However, any field with an 898 // empty value appearing in NullFields will be sent to the server as 899 // null. It is an error if a field in this list has a non-empty value. 900 // This may be used to include null fields in Patch requests. 901 NullFields []string `json:"-"` 902} 903 904func (s *CourseAlias) MarshalJSON() ([]byte, error) { 905 type NoMethod CourseAlias 906 raw := NoMethod(*s) 907 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 908} 909 910// CourseMaterial: A material attached to a course as part of a material 911// set. 912type CourseMaterial struct { 913 // DriveFile: Google Drive file attachment. 914 DriveFile *DriveFile `json:"driveFile,omitempty"` 915 916 // Form: Google Forms attachment. 917 Form *Form `json:"form,omitempty"` 918 919 // Link: Link atatchment. 920 Link *Link `json:"link,omitempty"` 921 922 // YouTubeVideo: Youtube video attachment. 923 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 924 925 // ForceSendFields is a list of field names (e.g. "DriveFile") to 926 // unconditionally include in API requests. By default, fields with 927 // empty values are omitted from API requests. However, any non-pointer, 928 // non-interface field appearing in ForceSendFields will be sent to the 929 // server regardless of whether the field is empty or not. This may be 930 // used to include empty fields in Patch requests. 931 ForceSendFields []string `json:"-"` 932 933 // NullFields is a list of field names (e.g. "DriveFile") to include in 934 // API requests with the JSON null value. By default, fields with empty 935 // values are omitted from API requests. However, any field with an 936 // empty value appearing in NullFields will be sent to the server as 937 // null. It is an error if a field in this list has a non-empty value. 938 // This may be used to include null fields in Patch requests. 939 NullFields []string `json:"-"` 940} 941 942func (s *CourseMaterial) MarshalJSON() ([]byte, error) { 943 type NoMethod CourseMaterial 944 raw := NoMethod(*s) 945 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 946} 947 948// CourseMaterialSet: A set of materials that appears on the "About" 949// page of the course. 950// These materials might include a syllabus, schedule, or other 951// background 952// information relating to the course as a whole. 953type CourseMaterialSet struct { 954 // Materials: Materials attached to this set. 955 Materials []*CourseMaterial `json:"materials,omitempty"` 956 957 // Title: Title for this set. 958 Title string `json:"title,omitempty"` 959 960 // ForceSendFields is a list of field names (e.g. "Materials") to 961 // unconditionally include in API requests. By default, fields with 962 // empty values are omitted from API requests. However, any non-pointer, 963 // non-interface field appearing in ForceSendFields will be sent to the 964 // server regardless of whether the field is empty or not. This may be 965 // used to include empty fields in Patch requests. 966 ForceSendFields []string `json:"-"` 967 968 // NullFields is a list of field names (e.g. "Materials") to include in 969 // API requests with the JSON null value. By default, fields with empty 970 // values are omitted from API requests. However, any field with an 971 // empty value appearing in NullFields will be sent to the server as 972 // null. It is an error if a field in this list has a non-empty value. 973 // This may be used to include null fields in Patch requests. 974 NullFields []string `json:"-"` 975} 976 977func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) { 978 type NoMethod CourseMaterialSet 979 raw := NoMethod(*s) 980 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 981} 982 983// CourseRosterChangesInfo: Information about a `Feed` with a 984// `feed_type` of `COURSE_ROSTER_CHANGES`. 985type CourseRosterChangesInfo struct { 986 // CourseId: The `course_id` of the course to subscribe to roster 987 // changes for. 988 CourseId string `json:"courseId,omitempty"` 989 990 // ForceSendFields is a list of field names (e.g. "CourseId") to 991 // unconditionally include in API requests. By default, fields with 992 // empty values are omitted from API requests. However, any non-pointer, 993 // non-interface field appearing in ForceSendFields will be sent to the 994 // server regardless of whether the field is empty or not. This may be 995 // used to include empty fields in Patch requests. 996 ForceSendFields []string `json:"-"` 997 998 // NullFields is a list of field names (e.g. "CourseId") to include in 999 // API requests with the JSON null value. By default, fields with empty 1000 // values are omitted from API requests. However, any field with an 1001 // empty value appearing in NullFields will be sent to the server as 1002 // null. It is an error if a field in this list has a non-empty value. 1003 // This may be used to include null fields in Patch requests. 1004 NullFields []string `json:"-"` 1005} 1006 1007func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) { 1008 type NoMethod CourseRosterChangesInfo 1009 raw := NoMethod(*s) 1010 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1011} 1012 1013// CourseWork: Course work created by a teacher for students of the 1014// course. 1015type CourseWork struct { 1016 // AlternateLink: Absolute link to this course work in the Classroom web 1017 // UI. 1018 // This is only populated if `state` is `PUBLISHED`. 1019 // 1020 // Read-only. 1021 AlternateLink string `json:"alternateLink,omitempty"` 1022 1023 // AssigneeMode: Assignee mode of the coursework. 1024 // If unspecified, the default value is `ALL_STUDENTS`. 1025 // 1026 // Possible values: 1027 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 1028 // returned. 1029 // "ALL_STUDENTS" - All students can see the item. 1030 // This is the default state. 1031 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 1032 AssigneeMode string `json:"assigneeMode,omitempty"` 1033 1034 // Assignment: Assignment details. 1035 // This is populated only when `work_type` is `ASSIGNMENT`. 1036 // 1037 // Read-only. 1038 Assignment *Assignment `json:"assignment,omitempty"` 1039 1040 // AssociatedWithDeveloper: Whether this course work item is associated 1041 // with the Developer Console 1042 // project making the request. 1043 // 1044 // See google.classroom.Work.CreateCourseWork for 1045 // more 1046 // details. 1047 // 1048 // Read-only. 1049 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 1050 1051 // CourseId: Identifier of the course. 1052 // 1053 // Read-only. 1054 CourseId string `json:"courseId,omitempty"` 1055 1056 // CreationTime: Timestamp when this course work was 1057 // created. 1058 // 1059 // Read-only. 1060 CreationTime string `json:"creationTime,omitempty"` 1061 1062 // CreatorUserId: Identifier for the user that created the 1063 // coursework. 1064 // 1065 // Read-only. 1066 CreatorUserId string `json:"creatorUserId,omitempty"` 1067 1068 // Description: Optional description of this course work. 1069 // If set, the description must be a valid UTF-8 string containing no 1070 // more 1071 // than 30,000 characters. 1072 Description string `json:"description,omitempty"` 1073 1074 // DueDate: Optional date, in UTC, that submissions for this course work 1075 // are due. 1076 // This must be specified if `due_time` is specified. 1077 DueDate *Date `json:"dueDate,omitempty"` 1078 1079 // DueTime: Optional time of day, in UTC, that submissions for this 1080 // course work 1081 // are due. 1082 // This must be specified if `due_date` is specified. 1083 DueTime *TimeOfDay `json:"dueTime,omitempty"` 1084 1085 // Id: Classroom-assigned identifier of this course work, unique per 1086 // course. 1087 // 1088 // Read-only. 1089 Id string `json:"id,omitempty"` 1090 1091 // IndividualStudentsOptions: Identifiers of students with access to the 1092 // coursework. 1093 // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`. 1094 // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only 1095 // students 1096 // specified in this field will be assigned the coursework. 1097 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 1098 1099 // Materials: Additional materials. 1100 // 1101 // CourseWork must have no more than 20 material items. 1102 Materials []*Material `json:"materials,omitempty"` 1103 1104 // MaxPoints: Maximum grade for this course work. 1105 // If zero or unspecified, this assignment is considered ungraded. 1106 // This must be a non-negative integer value. 1107 MaxPoints float64 `json:"maxPoints,omitempty"` 1108 1109 // MultipleChoiceQuestion: Multiple choice question details. 1110 // For read operations, this field is populated only when `work_type` 1111 // is 1112 // `MULTIPLE_CHOICE_QUESTION`. 1113 // For write operations, this field must be specified when creating 1114 // course 1115 // work with a `work_type` of `MULTIPLE_CHOICE_QUESTION`, and it must 1116 // not be 1117 // set otherwise. 1118 MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"` 1119 1120 // ScheduledTime: Optional timestamp when this course work is scheduled 1121 // to be published. 1122 ScheduledTime string `json:"scheduledTime,omitempty"` 1123 1124 // State: Status of this course work. 1125 // If unspecified, the default state is `DRAFT`. 1126 // 1127 // Possible values: 1128 // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 1129 // returned. 1130 // "PUBLISHED" - Status for work that has been published. 1131 // This is the default state. 1132 // "DRAFT" - Status for work that is not yet published. 1133 // Work in this state is visible only to course teachers and 1134 // domain 1135 // administrators. 1136 // "DELETED" - Status for work that was published but is now 1137 // deleted. 1138 // Work in this state is visible only to course teachers and 1139 // domain 1140 // administrators. 1141 // Work in this state is deleted after some time. 1142 State string `json:"state,omitempty"` 1143 1144 // SubmissionModificationMode: Setting to determine when students are 1145 // allowed to modify submissions. 1146 // If unspecified, the default value is `MODIFIABLE_UNTIL_TURNED_IN`. 1147 // 1148 // Possible values: 1149 // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode 1150 // specified. This is never returned. 1151 // "MODIFIABLE_UNTIL_TURNED_IN" - Submissions can be modified before 1152 // being turned in. 1153 // "MODIFIABLE" - Submissions can be modified at any time. 1154 SubmissionModificationMode string `json:"submissionModificationMode,omitempty"` 1155 1156 // Title: Title of this course work. 1157 // The title must be a valid UTF-8 string containing between 1 and 1158 // 3000 1159 // characters. 1160 Title string `json:"title,omitempty"` 1161 1162 // TopicId: Identifier for the topic that this coursework is associated 1163 // with. 1164 // Must match an existing topic in the course. 1165 TopicId string `json:"topicId,omitempty"` 1166 1167 // UpdateTime: Timestamp of the most recent change to this course 1168 // work. 1169 // 1170 // Read-only. 1171 UpdateTime string `json:"updateTime,omitempty"` 1172 1173 // WorkType: Type of this course work. 1174 // 1175 // The type is set when the course work is created and cannot be 1176 // changed. 1177 // 1178 // Possible values: 1179 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 1180 // never returned. 1181 // "ASSIGNMENT" - An assignment. 1182 // "SHORT_ANSWER_QUESTION" - A short answer question. 1183 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 1184 WorkType string `json:"workType,omitempty"` 1185 1186 // ServerResponse contains the HTTP response code and headers from the 1187 // server. 1188 googleapi.ServerResponse `json:"-"` 1189 1190 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1191 // unconditionally include in API requests. By default, fields with 1192 // empty values are omitted from API requests. However, any non-pointer, 1193 // non-interface field appearing in ForceSendFields will be sent to the 1194 // server regardless of whether the field is empty or not. This may be 1195 // used to include empty fields in Patch requests. 1196 ForceSendFields []string `json:"-"` 1197 1198 // NullFields is a list of field names (e.g. "AlternateLink") to include 1199 // in API requests with the JSON null value. By default, fields with 1200 // empty values are omitted from API requests. However, any field with 1201 // an empty value appearing in NullFields will be sent to the server as 1202 // null. It is an error if a field in this list has a non-empty value. 1203 // This may be used to include null fields in Patch requests. 1204 NullFields []string `json:"-"` 1205} 1206 1207func (s *CourseWork) MarshalJSON() ([]byte, error) { 1208 type NoMethod CourseWork 1209 raw := NoMethod(*s) 1210 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1211} 1212 1213func (s *CourseWork) UnmarshalJSON(data []byte) error { 1214 type NoMethod CourseWork 1215 var s1 struct { 1216 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1217 *NoMethod 1218 } 1219 s1.NoMethod = (*NoMethod)(s) 1220 if err := json.Unmarshal(data, &s1); err != nil { 1221 return err 1222 } 1223 s.MaxPoints = float64(s1.MaxPoints) 1224 return nil 1225} 1226 1227// CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1228// of `COURSE_WORK_CHANGES`. 1229type CourseWorkChangesInfo struct { 1230 // CourseId: The `course_id` of the course to subscribe to work changes 1231 // for. 1232 CourseId string `json:"courseId,omitempty"` 1233 1234 // ForceSendFields is a list of field names (e.g. "CourseId") to 1235 // unconditionally include in API requests. By default, fields with 1236 // empty values are omitted from API requests. However, any non-pointer, 1237 // non-interface field appearing in ForceSendFields will be sent to the 1238 // server regardless of whether the field is empty or not. This may be 1239 // used to include empty fields in Patch requests. 1240 ForceSendFields []string `json:"-"` 1241 1242 // NullFields is a list of field names (e.g. "CourseId") to include in 1243 // API requests with the JSON null value. By default, fields with empty 1244 // values are omitted from API requests. However, any field with an 1245 // empty value appearing in NullFields will be sent to the server as 1246 // null. It is an error if a field in this list has a non-empty value. 1247 // This may be used to include null fields in Patch requests. 1248 NullFields []string `json:"-"` 1249} 1250 1251func (s *CourseWorkChangesInfo) MarshalJSON() ([]byte, error) { 1252 type NoMethod CourseWorkChangesInfo 1253 raw := NoMethod(*s) 1254 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1255} 1256 1257// Date: Represents a whole or partial calendar date, e.g. a birthday. 1258// The time of day 1259// and time zone are either specified elsewhere or are not significant. 1260// The date 1261// is relative to the Proleptic Gregorian Calendar. This can 1262// represent: 1263// 1264// * A full date, with non-zero year, month and day values 1265// * A month and day value, with a zero year, e.g. an anniversary 1266// * A year on its own, with zero month and day values 1267// * A year and month value, with a zero day, e.g. a credit card 1268// expiration date 1269// 1270// Related types are google.type.TimeOfDay and 1271// `google.protobuf.Timestamp`. 1272type Date struct { 1273 // Day: Day of month. Must be from 1 to 31 and valid for the year and 1274 // month, or 0 1275 // if specifying a year by itself or a year and month where the day is 1276 // not 1277 // significant. 1278 Day int64 `json:"day,omitempty"` 1279 1280 // Month: Month of year. Must be from 1 to 12, or 0 if specifying a year 1281 // without a 1282 // month and day. 1283 Month int64 `json:"month,omitempty"` 1284 1285 // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date 1286 // without 1287 // a year. 1288 Year int64 `json:"year,omitempty"` 1289 1290 // ForceSendFields is a list of field names (e.g. "Day") to 1291 // unconditionally include in API requests. By default, fields with 1292 // empty values are omitted from API requests. However, any non-pointer, 1293 // non-interface field appearing in ForceSendFields will be sent to the 1294 // server regardless of whether the field is empty or not. This may be 1295 // used to include empty fields in Patch requests. 1296 ForceSendFields []string `json:"-"` 1297 1298 // NullFields is a list of field names (e.g. "Day") to include in API 1299 // requests with the JSON null value. By default, fields with empty 1300 // values are omitted from API requests. However, any field with an 1301 // empty value appearing in NullFields will be sent to the server as 1302 // null. It is an error if a field in this list has a non-empty value. 1303 // This may be used to include null fields in Patch requests. 1304 NullFields []string `json:"-"` 1305} 1306 1307func (s *Date) MarshalJSON() ([]byte, error) { 1308 type NoMethod Date 1309 raw := NoMethod(*s) 1310 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1311} 1312 1313// DriveFile: Representation of a Google Drive file. 1314type DriveFile struct { 1315 // AlternateLink: URL that can be used to access the Drive 1316 // item. 1317 // 1318 // Read-only. 1319 AlternateLink string `json:"alternateLink,omitempty"` 1320 1321 // Id: Drive API resource ID. 1322 Id string `json:"id,omitempty"` 1323 1324 // ThumbnailUrl: URL of a thumbnail image of the Drive item. 1325 // 1326 // Read-only. 1327 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1328 1329 // Title: Title of the Drive item. 1330 // 1331 // Read-only. 1332 Title string `json:"title,omitempty"` 1333 1334 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1335 // unconditionally include in API requests. By default, fields with 1336 // empty values are omitted from API requests. However, any non-pointer, 1337 // non-interface field appearing in ForceSendFields will be sent to the 1338 // server regardless of whether the field is empty or not. This may be 1339 // used to include empty fields in Patch requests. 1340 ForceSendFields []string `json:"-"` 1341 1342 // NullFields is a list of field names (e.g. "AlternateLink") to include 1343 // in API requests with the JSON null value. By default, fields with 1344 // empty values are omitted from API requests. However, any field with 1345 // an empty value appearing in NullFields will be sent to the server as 1346 // null. It is an error if a field in this list has a non-empty value. 1347 // This may be used to include null fields in Patch requests. 1348 NullFields []string `json:"-"` 1349} 1350 1351func (s *DriveFile) MarshalJSON() ([]byte, error) { 1352 type NoMethod DriveFile 1353 raw := NoMethod(*s) 1354 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1355} 1356 1357// DriveFolder: Representation of a Google Drive folder. 1358type DriveFolder struct { 1359 // AlternateLink: URL that can be used to access the Drive 1360 // folder. 1361 // 1362 // Read-only. 1363 AlternateLink string `json:"alternateLink,omitempty"` 1364 1365 // Id: Drive API resource ID. 1366 Id string `json:"id,omitempty"` 1367 1368 // Title: Title of the Drive folder. 1369 // 1370 // Read-only. 1371 Title string `json:"title,omitempty"` 1372 1373 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1374 // unconditionally include in API requests. By default, fields with 1375 // empty values are omitted from API requests. However, any non-pointer, 1376 // non-interface field appearing in ForceSendFields will be sent to the 1377 // server regardless of whether the field is empty or not. This may be 1378 // used to include empty fields in Patch requests. 1379 ForceSendFields []string `json:"-"` 1380 1381 // NullFields is a list of field names (e.g. "AlternateLink") to include 1382 // in API requests with the JSON null value. By default, fields with 1383 // empty values are omitted from API requests. However, any field with 1384 // an empty value appearing in NullFields will be sent to the server as 1385 // null. It is an error if a field in this list has a non-empty value. 1386 // This may be used to include null fields in Patch requests. 1387 NullFields []string `json:"-"` 1388} 1389 1390func (s *DriveFolder) MarshalJSON() ([]byte, error) { 1391 type NoMethod DriveFolder 1392 raw := NoMethod(*s) 1393 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1394} 1395 1396// Empty: A generic empty message that you can re-use to avoid defining 1397// duplicated 1398// empty messages in your APIs. A typical example is to use it as the 1399// request 1400// or the response type of an API method. For instance: 1401// 1402// service Foo { 1403// rpc Bar(google.protobuf.Empty) returns 1404// (google.protobuf.Empty); 1405// } 1406// 1407// The JSON representation for `Empty` is empty JSON object `{}`. 1408type Empty struct { 1409 // ServerResponse contains the HTTP response code and headers from the 1410 // server. 1411 googleapi.ServerResponse `json:"-"` 1412} 1413 1414// Feed: A class of notifications that an application can register to 1415// receive. 1416// For example: "all roster changes for a domain". 1417type Feed struct { 1418 // CourseRosterChangesInfo: Information about a `Feed` with a 1419 // `feed_type` of `COURSE_ROSTER_CHANGES`. 1420 // This field must be specified if `feed_type` is 1421 // `COURSE_ROSTER_CHANGES`. 1422 CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"` 1423 1424 // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1425 // of `COURSE_WORK_CHANGES`. 1426 // This field must be specified if `feed_type` is `COURSE_WORK_CHANGES`. 1427 CourseWorkChangesInfo *CourseWorkChangesInfo `json:"courseWorkChangesInfo,omitempty"` 1428 1429 // FeedType: The type of feed. 1430 // 1431 // Possible values: 1432 // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided. 1433 // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular 1434 // domain. 1435 // 1436 // Notifications will be generated whenever a user joins or leaves a 1437 // course. 1438 // 1439 // No notifications will be generated when an invitation is created 1440 // or 1441 // deleted, but notifications will be generated when a user joins a 1442 // course 1443 // by accepting an invitation. 1444 // "COURSE_ROSTER_CHANGES" - All roster changes for a particular 1445 // course. 1446 // 1447 // Notifications will be generated whenever a user joins or leaves a 1448 // course. 1449 // 1450 // No notifications will be generated when an invitation is created 1451 // or 1452 // deleted, but notifications will be generated when a user joins a 1453 // course 1454 // by accepting an invitation. 1455 // "COURSE_WORK_CHANGES" - All course work activity for a particular 1456 // course. 1457 // 1458 // Notifications will be generated when a CourseWork 1459 // or 1460 // StudentSubmission object is created or modified. No notification will 1461 // be 1462 // generated when a StudentSubmission object is created in connection 1463 // with 1464 // the creation or modification of its parent CourseWork object (but 1465 // a 1466 // notification will be generated for that CourseWork object's creation 1467 // or 1468 // modification). 1469 FeedType string `json:"feedType,omitempty"` 1470 1471 // ForceSendFields is a list of field names (e.g. 1472 // "CourseRosterChangesInfo") to unconditionally include in API 1473 // requests. By default, fields with empty values are omitted from API 1474 // requests. However, any non-pointer, non-interface field appearing in 1475 // ForceSendFields will be sent to the server regardless of whether the 1476 // field is empty or not. This may be used to include empty fields in 1477 // Patch requests. 1478 ForceSendFields []string `json:"-"` 1479 1480 // NullFields is a list of field names (e.g. "CourseRosterChangesInfo") 1481 // to include in API requests with the JSON null value. By default, 1482 // fields with empty values are omitted from API requests. However, any 1483 // field with an empty value appearing in NullFields will be sent to the 1484 // server as null. It is an error if a field in this list has a 1485 // non-empty value. This may be used to include null fields in Patch 1486 // requests. 1487 NullFields []string `json:"-"` 1488} 1489 1490func (s *Feed) MarshalJSON() ([]byte, error) { 1491 type NoMethod Feed 1492 raw := NoMethod(*s) 1493 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1494} 1495 1496// Form: Google Forms item. 1497type Form struct { 1498 // FormUrl: URL of the form. 1499 FormUrl string `json:"formUrl,omitempty"` 1500 1501 // ResponseUrl: URL of the form responses document. 1502 // Only set if respsonses have been recorded and only when 1503 // the 1504 // requesting user is an editor of the form. 1505 // 1506 // Read-only. 1507 ResponseUrl string `json:"responseUrl,omitempty"` 1508 1509 // ThumbnailUrl: URL of a thumbnail image of the Form. 1510 // 1511 // Read-only. 1512 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1513 1514 // Title: Title of the Form. 1515 // 1516 // Read-only. 1517 Title string `json:"title,omitempty"` 1518 1519 // ForceSendFields is a list of field names (e.g. "FormUrl") to 1520 // unconditionally include in API requests. By default, fields with 1521 // empty values are omitted from API requests. However, any non-pointer, 1522 // non-interface field appearing in ForceSendFields will be sent to the 1523 // server regardless of whether the field is empty or not. This may be 1524 // used to include empty fields in Patch requests. 1525 ForceSendFields []string `json:"-"` 1526 1527 // NullFields is a list of field names (e.g. "FormUrl") to include in 1528 // API requests with the JSON null value. By default, fields with empty 1529 // values are omitted from API requests. However, any field with an 1530 // empty value appearing in NullFields will be sent to the server as 1531 // null. It is an error if a field in this list has a non-empty value. 1532 // This may be used to include null fields in Patch requests. 1533 NullFields []string `json:"-"` 1534} 1535 1536func (s *Form) MarshalJSON() ([]byte, error) { 1537 type NoMethod Form 1538 raw := NoMethod(*s) 1539 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1540} 1541 1542// GlobalPermission: Global user permission description. 1543type GlobalPermission struct { 1544 // Permission: Permission value. 1545 // 1546 // Possible values: 1547 // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not 1548 // returned and is not a 1549 // valid value. 1550 // "CREATE_COURSE" - User is permitted to create a course. 1551 Permission string `json:"permission,omitempty"` 1552 1553 // ForceSendFields is a list of field names (e.g. "Permission") to 1554 // unconditionally include in API requests. By default, fields with 1555 // empty values are omitted from API requests. However, any non-pointer, 1556 // non-interface field appearing in ForceSendFields will be sent to the 1557 // server regardless of whether the field is empty or not. This may be 1558 // used to include empty fields in Patch requests. 1559 ForceSendFields []string `json:"-"` 1560 1561 // NullFields is a list of field names (e.g. "Permission") to include in 1562 // API requests with the JSON null value. By default, fields with empty 1563 // values are omitted from API requests. However, any field with an 1564 // empty value appearing in NullFields will be sent to the server as 1565 // null. It is an error if a field in this list has a non-empty value. 1566 // This may be used to include null fields in Patch requests. 1567 NullFields []string `json:"-"` 1568} 1569 1570func (s *GlobalPermission) MarshalJSON() ([]byte, error) { 1571 type NoMethod GlobalPermission 1572 raw := NoMethod(*s) 1573 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1574} 1575 1576// GradeHistory: The history of each grade on this submission. 1577type GradeHistory struct { 1578 // ActorUserId: The teacher who made the grade change. 1579 ActorUserId string `json:"actorUserId,omitempty"` 1580 1581 // GradeChangeType: The type of grade change at this time in the 1582 // submission grade history. 1583 // 1584 // Possible values: 1585 // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This 1586 // should never be returned. 1587 // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of 1588 // the draft grade. 1589 // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator 1590 // of the assigned grade. 1591 // "MAX_POINTS_CHANGE" - A change in the denominator of the grade. 1592 GradeChangeType string `json:"gradeChangeType,omitempty"` 1593 1594 // GradeTimestamp: When the grade of the submission was changed. 1595 GradeTimestamp string `json:"gradeTimestamp,omitempty"` 1596 1597 // MaxPoints: The denominator of the grade at this time in the 1598 // submission grade 1599 // history. 1600 MaxPoints float64 `json:"maxPoints,omitempty"` 1601 1602 // PointsEarned: The numerator of the grade at this time in the 1603 // submission grade history. 1604 PointsEarned float64 `json:"pointsEarned,omitempty"` 1605 1606 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 1607 // unconditionally include in API requests. By default, fields with 1608 // empty values are omitted from API requests. However, any non-pointer, 1609 // non-interface field appearing in ForceSendFields will be sent to the 1610 // server regardless of whether the field is empty or not. This may be 1611 // used to include empty fields in Patch requests. 1612 ForceSendFields []string `json:"-"` 1613 1614 // NullFields is a list of field names (e.g. "ActorUserId") to include 1615 // in API requests with the JSON null value. By default, fields with 1616 // empty values are omitted from API requests. However, any field with 1617 // an empty value appearing in NullFields will be sent to the server as 1618 // null. It is an error if a field in this list has a non-empty value. 1619 // This may be used to include null fields in Patch requests. 1620 NullFields []string `json:"-"` 1621} 1622 1623func (s *GradeHistory) MarshalJSON() ([]byte, error) { 1624 type NoMethod GradeHistory 1625 raw := NoMethod(*s) 1626 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1627} 1628 1629func (s *GradeHistory) UnmarshalJSON(data []byte) error { 1630 type NoMethod GradeHistory 1631 var s1 struct { 1632 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1633 PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"` 1634 *NoMethod 1635 } 1636 s1.NoMethod = (*NoMethod)(s) 1637 if err := json.Unmarshal(data, &s1); err != nil { 1638 return err 1639 } 1640 s.MaxPoints = float64(s1.MaxPoints) 1641 s.PointsEarned = float64(s1.PointsEarned) 1642 return nil 1643} 1644 1645// Guardian: Association between a student and a guardian of that 1646// student. The guardian 1647// may receive information about the student's course work. 1648type Guardian struct { 1649 // GuardianId: Identifier for the guardian. 1650 GuardianId string `json:"guardianId,omitempty"` 1651 1652 // GuardianProfile: User profile for the guardian. 1653 GuardianProfile *UserProfile `json:"guardianProfile,omitempty"` 1654 1655 // InvitedEmailAddress: The email address to which the initial guardian 1656 // invitation was sent. 1657 // This field is only visible to domain administrators. 1658 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1659 1660 // StudentId: Identifier for the student to whom the guardian 1661 // relationship applies. 1662 StudentId string `json:"studentId,omitempty"` 1663 1664 // ServerResponse contains the HTTP response code and headers from the 1665 // server. 1666 googleapi.ServerResponse `json:"-"` 1667 1668 // ForceSendFields is a list of field names (e.g. "GuardianId") to 1669 // unconditionally include in API requests. By default, fields with 1670 // empty values are omitted from API requests. However, any non-pointer, 1671 // non-interface field appearing in ForceSendFields will be sent to the 1672 // server regardless of whether the field is empty or not. This may be 1673 // used to include empty fields in Patch requests. 1674 ForceSendFields []string `json:"-"` 1675 1676 // NullFields is a list of field names (e.g. "GuardianId") to include in 1677 // API requests with the JSON null value. By default, fields with empty 1678 // values are omitted from API requests. However, any field with an 1679 // empty value appearing in NullFields will be sent to the server as 1680 // null. It is an error if a field in this list has a non-empty value. 1681 // This may be used to include null fields in Patch requests. 1682 NullFields []string `json:"-"` 1683} 1684 1685func (s *Guardian) MarshalJSON() ([]byte, error) { 1686 type NoMethod Guardian 1687 raw := NoMethod(*s) 1688 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1689} 1690 1691// GuardianInvitation: An invitation to become the guardian of a 1692// specified user, sent to a specified 1693// email address. 1694type GuardianInvitation struct { 1695 // CreationTime: The time that this invitation was created. 1696 // 1697 // Read-only. 1698 CreationTime string `json:"creationTime,omitempty"` 1699 1700 // InvitationId: Unique identifier for this invitation. 1701 // 1702 // Read-only. 1703 InvitationId string `json:"invitationId,omitempty"` 1704 1705 // InvitedEmailAddress: Email address that the invitation was sent 1706 // to. 1707 // This field is only visible to domain administrators. 1708 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1709 1710 // State: The state that this invitation is in. 1711 // 1712 // Possible values: 1713 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 1714 // "PENDING" - The invitation is active and awaiting a response. 1715 // "COMPLETE" - The invitation is no longer active. It may have been 1716 // accepted, declined, 1717 // withdrawn or it may have expired. 1718 State string `json:"state,omitempty"` 1719 1720 // StudentId: ID of the student (in standard format) 1721 StudentId string `json:"studentId,omitempty"` 1722 1723 // ServerResponse contains the HTTP response code and headers from the 1724 // server. 1725 googleapi.ServerResponse `json:"-"` 1726 1727 // ForceSendFields is a list of field names (e.g. "CreationTime") to 1728 // unconditionally include in API requests. By default, fields with 1729 // empty values are omitted from API requests. However, any non-pointer, 1730 // non-interface field appearing in ForceSendFields will be sent to the 1731 // server regardless of whether the field is empty or not. This may be 1732 // used to include empty fields in Patch requests. 1733 ForceSendFields []string `json:"-"` 1734 1735 // NullFields is a list of field names (e.g. "CreationTime") to include 1736 // in API requests with the JSON null value. By default, fields with 1737 // empty values are omitted from API requests. However, any field with 1738 // an empty value appearing in NullFields will be sent to the server as 1739 // null. It is an error if a field in this list has a non-empty value. 1740 // This may be used to include null fields in Patch requests. 1741 NullFields []string `json:"-"` 1742} 1743 1744func (s *GuardianInvitation) MarshalJSON() ([]byte, error) { 1745 type NoMethod GuardianInvitation 1746 raw := NoMethod(*s) 1747 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1748} 1749 1750// IndividualStudentsOptions: Assignee details about a 1751// coursework/announcement. 1752// This field is set if and only if `assigneeMode` is 1753// `INDIVIDUAL_STUDENTS`. 1754type IndividualStudentsOptions struct { 1755 // StudentIds: Identifiers for the students that have access to 1756 // the 1757 // coursework/announcement. 1758 StudentIds []string `json:"studentIds,omitempty"` 1759 1760 // ForceSendFields is a list of field names (e.g. "StudentIds") to 1761 // unconditionally include in API requests. By default, fields with 1762 // empty values are omitted from API requests. However, any non-pointer, 1763 // non-interface field appearing in ForceSendFields will be sent to the 1764 // server regardless of whether the field is empty or not. This may be 1765 // used to include empty fields in Patch requests. 1766 ForceSendFields []string `json:"-"` 1767 1768 // NullFields is a list of field names (e.g. "StudentIds") to include in 1769 // API requests with the JSON null value. By default, fields with empty 1770 // values are omitted from API requests. However, any field with an 1771 // empty value appearing in NullFields will be sent to the server as 1772 // null. It is an error if a field in this list has a non-empty value. 1773 // This may be used to include null fields in Patch requests. 1774 NullFields []string `json:"-"` 1775} 1776 1777func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) { 1778 type NoMethod IndividualStudentsOptions 1779 raw := NoMethod(*s) 1780 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1781} 1782 1783// Invitation: An invitation to join a course. 1784type Invitation struct { 1785 // CourseId: Identifier of the course to invite the user to. 1786 CourseId string `json:"courseId,omitempty"` 1787 1788 // Id: Identifier assigned by Classroom. 1789 // 1790 // Read-only. 1791 Id string `json:"id,omitempty"` 1792 1793 // Role: Role to invite the user to have. 1794 // Must not be `COURSE_ROLE_UNSPECIFIED`. 1795 // 1796 // Possible values: 1797 // "COURSE_ROLE_UNSPECIFIED" - No course role. 1798 // "STUDENT" - Student in the course. 1799 // "TEACHER" - Teacher of the course. 1800 // "OWNER" - Owner of the course. 1801 Role string `json:"role,omitempty"` 1802 1803 // UserId: Identifier of the invited user. 1804 // 1805 // When specified as a parameter of a request, this identifier can be 1806 // set to 1807 // one of the following: 1808 // 1809 // * the numeric identifier for the user 1810 // * the email address of the user 1811 // * the string literal "me", indicating the requesting user 1812 UserId string `json:"userId,omitempty"` 1813 1814 // ServerResponse contains the HTTP response code and headers from the 1815 // server. 1816 googleapi.ServerResponse `json:"-"` 1817 1818 // ForceSendFields is a list of field names (e.g. "CourseId") to 1819 // unconditionally include in API requests. By default, fields with 1820 // empty values are omitted from API requests. However, any non-pointer, 1821 // non-interface field appearing in ForceSendFields will be sent to the 1822 // server regardless of whether the field is empty or not. This may be 1823 // used to include empty fields in Patch requests. 1824 ForceSendFields []string `json:"-"` 1825 1826 // NullFields is a list of field names (e.g. "CourseId") to include in 1827 // API requests with the JSON null value. By default, fields with empty 1828 // values are omitted from API requests. However, any field with an 1829 // empty value appearing in NullFields will be sent to the server as 1830 // null. It is an error if a field in this list has a non-empty value. 1831 // This may be used to include null fields in Patch requests. 1832 NullFields []string `json:"-"` 1833} 1834 1835func (s *Invitation) MarshalJSON() ([]byte, error) { 1836 type NoMethod Invitation 1837 raw := NoMethod(*s) 1838 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1839} 1840 1841// Link: URL item. 1842type Link struct { 1843 // ThumbnailUrl: URL of a thumbnail image of the target URL. 1844 // 1845 // Read-only. 1846 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1847 1848 // Title: Title of the target of the URL. 1849 // 1850 // Read-only. 1851 Title string `json:"title,omitempty"` 1852 1853 // Url: URL to link to. 1854 // This must be a valid UTF-8 string containing between 1 and 2024 1855 // characters. 1856 Url string `json:"url,omitempty"` 1857 1858 // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to 1859 // unconditionally include in API requests. By default, fields with 1860 // empty values are omitted from API requests. However, any non-pointer, 1861 // non-interface field appearing in ForceSendFields will be sent to the 1862 // server regardless of whether the field is empty or not. This may be 1863 // used to include empty fields in Patch requests. 1864 ForceSendFields []string `json:"-"` 1865 1866 // NullFields is a list of field names (e.g. "ThumbnailUrl") to include 1867 // in API requests with the JSON null value. By default, fields with 1868 // empty values are omitted from API requests. However, any field with 1869 // an empty value appearing in NullFields will be sent to the server as 1870 // null. It is an error if a field in this list has a non-empty value. 1871 // This may be used to include null fields in Patch requests. 1872 NullFields []string `json:"-"` 1873} 1874 1875func (s *Link) MarshalJSON() ([]byte, error) { 1876 type NoMethod Link 1877 raw := NoMethod(*s) 1878 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1879} 1880 1881// ListAnnouncementsResponse: Response when listing course work. 1882type ListAnnouncementsResponse struct { 1883 // Announcements: Announcement items that match the request. 1884 Announcements []*Announcement `json:"announcements,omitempty"` 1885 1886 // NextPageToken: Token identifying the next page of results to return. 1887 // If empty, no further 1888 // results are available. 1889 NextPageToken string `json:"nextPageToken,omitempty"` 1890 1891 // ServerResponse contains the HTTP response code and headers from the 1892 // server. 1893 googleapi.ServerResponse `json:"-"` 1894 1895 // ForceSendFields is a list of field names (e.g. "Announcements") to 1896 // unconditionally include in API requests. By default, fields with 1897 // empty values are omitted from API requests. However, any non-pointer, 1898 // non-interface field appearing in ForceSendFields will be sent to the 1899 // server regardless of whether the field is empty or not. This may be 1900 // used to include empty fields in Patch requests. 1901 ForceSendFields []string `json:"-"` 1902 1903 // NullFields is a list of field names (e.g. "Announcements") to include 1904 // in API requests with the JSON null value. By default, fields with 1905 // empty values are omitted from API requests. However, any field with 1906 // an empty value appearing in NullFields will be sent to the server as 1907 // null. It is an error if a field in this list has a non-empty value. 1908 // This may be used to include null fields in Patch requests. 1909 NullFields []string `json:"-"` 1910} 1911 1912func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) { 1913 type NoMethod ListAnnouncementsResponse 1914 raw := NoMethod(*s) 1915 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1916} 1917 1918// ListCourseAliasesResponse: Response when listing course aliases. 1919type ListCourseAliasesResponse struct { 1920 // Aliases: The course aliases. 1921 Aliases []*CourseAlias `json:"aliases,omitempty"` 1922 1923 // NextPageToken: Token identifying the next page of results to return. 1924 // If empty, no further 1925 // results are available. 1926 NextPageToken string `json:"nextPageToken,omitempty"` 1927 1928 // ServerResponse contains the HTTP response code and headers from the 1929 // server. 1930 googleapi.ServerResponse `json:"-"` 1931 1932 // ForceSendFields is a list of field names (e.g. "Aliases") to 1933 // unconditionally include in API requests. By default, fields with 1934 // empty values are omitted from API requests. However, any non-pointer, 1935 // non-interface field appearing in ForceSendFields will be sent to the 1936 // server regardless of whether the field is empty or not. This may be 1937 // used to include empty fields in Patch requests. 1938 ForceSendFields []string `json:"-"` 1939 1940 // NullFields is a list of field names (e.g. "Aliases") to include in 1941 // API requests with the JSON null value. By default, fields with empty 1942 // values are omitted from API requests. However, any field with an 1943 // empty value appearing in NullFields will be sent to the server as 1944 // null. It is an error if a field in this list has a non-empty value. 1945 // This may be used to include null fields in Patch requests. 1946 NullFields []string `json:"-"` 1947} 1948 1949func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) { 1950 type NoMethod ListCourseAliasesResponse 1951 raw := NoMethod(*s) 1952 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1953} 1954 1955// ListCourseWorkResponse: Response when listing course work. 1956type ListCourseWorkResponse struct { 1957 // CourseWork: Course work items that match the request. 1958 CourseWork []*CourseWork `json:"courseWork,omitempty"` 1959 1960 // NextPageToken: Token identifying the next page of results to return. 1961 // If empty, no further 1962 // results are available. 1963 NextPageToken string `json:"nextPageToken,omitempty"` 1964 1965 // ServerResponse contains the HTTP response code and headers from the 1966 // server. 1967 googleapi.ServerResponse `json:"-"` 1968 1969 // ForceSendFields is a list of field names (e.g. "CourseWork") to 1970 // unconditionally include in API requests. By default, fields with 1971 // empty values are omitted from API requests. However, any non-pointer, 1972 // non-interface field appearing in ForceSendFields will be sent to the 1973 // server regardless of whether the field is empty or not. This may be 1974 // used to include empty fields in Patch requests. 1975 ForceSendFields []string `json:"-"` 1976 1977 // NullFields is a list of field names (e.g. "CourseWork") to include in 1978 // API requests with the JSON null value. By default, fields with empty 1979 // values are omitted from API requests. However, any field with an 1980 // empty value appearing in NullFields will be sent to the server as 1981 // null. It is an error if a field in this list has a non-empty value. 1982 // This may be used to include null fields in Patch requests. 1983 NullFields []string `json:"-"` 1984} 1985 1986func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) { 1987 type NoMethod ListCourseWorkResponse 1988 raw := NoMethod(*s) 1989 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1990} 1991 1992// ListCoursesResponse: Response when listing courses. 1993type ListCoursesResponse struct { 1994 // Courses: Courses that match the list request. 1995 Courses []*Course `json:"courses,omitempty"` 1996 1997 // NextPageToken: Token identifying the next page of results to return. 1998 // If empty, no further 1999 // results are available. 2000 NextPageToken string `json:"nextPageToken,omitempty"` 2001 2002 // ServerResponse contains the HTTP response code and headers from the 2003 // server. 2004 googleapi.ServerResponse `json:"-"` 2005 2006 // ForceSendFields is a list of field names (e.g. "Courses") to 2007 // unconditionally include in API requests. By default, fields with 2008 // empty values are omitted from API requests. However, any non-pointer, 2009 // non-interface field appearing in ForceSendFields will be sent to the 2010 // server regardless of whether the field is empty or not. This may be 2011 // used to include empty fields in Patch requests. 2012 ForceSendFields []string `json:"-"` 2013 2014 // NullFields is a list of field names (e.g. "Courses") to include in 2015 // API requests with the JSON null value. By default, fields with empty 2016 // values are omitted from API requests. However, any field with an 2017 // empty value appearing in NullFields will be sent to the server as 2018 // null. It is an error if a field in this list has a non-empty value. 2019 // This may be used to include null fields in Patch requests. 2020 NullFields []string `json:"-"` 2021} 2022 2023func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) { 2024 type NoMethod ListCoursesResponse 2025 raw := NoMethod(*s) 2026 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2027} 2028 2029// ListGuardianInvitationsResponse: Response when listing guardian 2030// invitations. 2031type ListGuardianInvitationsResponse struct { 2032 // GuardianInvitations: Guardian invitations that matched the list 2033 // request. 2034 GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"` 2035 2036 // NextPageToken: Token identifying the next page of results to return. 2037 // If empty, no further 2038 // results are available. 2039 NextPageToken string `json:"nextPageToken,omitempty"` 2040 2041 // ServerResponse contains the HTTP response code and headers from the 2042 // server. 2043 googleapi.ServerResponse `json:"-"` 2044 2045 // ForceSendFields is a list of field names (e.g. "GuardianInvitations") 2046 // to unconditionally include in API requests. By default, fields with 2047 // empty values are omitted from API requests. However, any non-pointer, 2048 // non-interface field appearing in ForceSendFields will be sent to the 2049 // server regardless of whether the field is empty or not. This may be 2050 // used to include empty fields in Patch requests. 2051 ForceSendFields []string `json:"-"` 2052 2053 // NullFields is a list of field names (e.g. "GuardianInvitations") to 2054 // include in API requests with the JSON null value. By default, fields 2055 // with empty values are omitted from API requests. However, any field 2056 // with an empty value appearing in NullFields will be sent to the 2057 // server as null. It is an error if a field in this list has a 2058 // non-empty value. This may be used to include null fields in Patch 2059 // requests. 2060 NullFields []string `json:"-"` 2061} 2062 2063func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) { 2064 type NoMethod ListGuardianInvitationsResponse 2065 raw := NoMethod(*s) 2066 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2067} 2068 2069// ListGuardiansResponse: Response when listing guardians. 2070type ListGuardiansResponse struct { 2071 // Guardians: Guardians on this page of results that met the criteria 2072 // specified in 2073 // the request. 2074 Guardians []*Guardian `json:"guardians,omitempty"` 2075 2076 // NextPageToken: Token identifying the next page of results to return. 2077 // If empty, no further 2078 // results are available. 2079 NextPageToken string `json:"nextPageToken,omitempty"` 2080 2081 // ServerResponse contains the HTTP response code and headers from the 2082 // server. 2083 googleapi.ServerResponse `json:"-"` 2084 2085 // ForceSendFields is a list of field names (e.g. "Guardians") to 2086 // unconditionally include in API requests. By default, fields with 2087 // empty values are omitted from API requests. However, any non-pointer, 2088 // non-interface field appearing in ForceSendFields will be sent to the 2089 // server regardless of whether the field is empty or not. This may be 2090 // used to include empty fields in Patch requests. 2091 ForceSendFields []string `json:"-"` 2092 2093 // NullFields is a list of field names (e.g. "Guardians") to include in 2094 // API requests with the JSON null value. By default, fields with empty 2095 // values are omitted from API requests. However, any field with an 2096 // empty value appearing in NullFields will be sent to the server as 2097 // null. It is an error if a field in this list has a non-empty value. 2098 // This may be used to include null fields in Patch requests. 2099 NullFields []string `json:"-"` 2100} 2101 2102func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) { 2103 type NoMethod ListGuardiansResponse 2104 raw := NoMethod(*s) 2105 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2106} 2107 2108// ListInvitationsResponse: Response when listing invitations. 2109type ListInvitationsResponse struct { 2110 // Invitations: Invitations that match the list request. 2111 Invitations []*Invitation `json:"invitations,omitempty"` 2112 2113 // NextPageToken: Token identifying the next page of results to return. 2114 // If empty, no further 2115 // results are available. 2116 NextPageToken string `json:"nextPageToken,omitempty"` 2117 2118 // ServerResponse contains the HTTP response code and headers from the 2119 // server. 2120 googleapi.ServerResponse `json:"-"` 2121 2122 // ForceSendFields is a list of field names (e.g. "Invitations") to 2123 // unconditionally include in API requests. By default, fields with 2124 // empty values are omitted from API requests. However, any non-pointer, 2125 // non-interface field appearing in ForceSendFields will be sent to the 2126 // server regardless of whether the field is empty or not. This may be 2127 // used to include empty fields in Patch requests. 2128 ForceSendFields []string `json:"-"` 2129 2130 // NullFields is a list of field names (e.g. "Invitations") to include 2131 // in API requests with the JSON null value. By default, fields with 2132 // empty values are omitted from API requests. However, any field with 2133 // an empty value appearing in NullFields will be sent to the server as 2134 // null. It is an error if a field in this list has a non-empty value. 2135 // This may be used to include null fields in Patch requests. 2136 NullFields []string `json:"-"` 2137} 2138 2139func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) { 2140 type NoMethod ListInvitationsResponse 2141 raw := NoMethod(*s) 2142 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2143} 2144 2145// ListStudentSubmissionsResponse: Response when listing student 2146// submissions. 2147type ListStudentSubmissionsResponse struct { 2148 // NextPageToken: Token identifying the next page of results to return. 2149 // If empty, no further 2150 // results are available. 2151 NextPageToken string `json:"nextPageToken,omitempty"` 2152 2153 // StudentSubmissions: Student work that matches the request. 2154 StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"` 2155 2156 // ServerResponse contains the HTTP response code and headers from the 2157 // server. 2158 googleapi.ServerResponse `json:"-"` 2159 2160 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2161 // unconditionally include in API requests. By default, fields with 2162 // empty values are omitted from API requests. However, any non-pointer, 2163 // non-interface field appearing in ForceSendFields will be sent to the 2164 // server regardless of whether the field is empty or not. This may be 2165 // used to include empty fields in Patch requests. 2166 ForceSendFields []string `json:"-"` 2167 2168 // NullFields is a list of field names (e.g. "NextPageToken") to include 2169 // in API requests with the JSON null value. By default, fields with 2170 // empty values are omitted from API requests. However, any field with 2171 // an empty value appearing in NullFields will be sent to the server as 2172 // null. It is an error if a field in this list has a non-empty value. 2173 // This may be used to include null fields in Patch requests. 2174 NullFields []string `json:"-"` 2175} 2176 2177func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) { 2178 type NoMethod ListStudentSubmissionsResponse 2179 raw := NoMethod(*s) 2180 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2181} 2182 2183// ListStudentsResponse: Response when listing students. 2184type ListStudentsResponse struct { 2185 // NextPageToken: Token identifying the next page of results to return. 2186 // If empty, no further 2187 // results are available. 2188 NextPageToken string `json:"nextPageToken,omitempty"` 2189 2190 // Students: Students who match the list request. 2191 Students []*Student `json:"students,omitempty"` 2192 2193 // ServerResponse contains the HTTP response code and headers from the 2194 // server. 2195 googleapi.ServerResponse `json:"-"` 2196 2197 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2198 // unconditionally include in API requests. By default, fields with 2199 // empty values are omitted from API requests. However, any non-pointer, 2200 // non-interface field appearing in ForceSendFields will be sent to the 2201 // server regardless of whether the field is empty or not. This may be 2202 // used to include empty fields in Patch requests. 2203 ForceSendFields []string `json:"-"` 2204 2205 // NullFields is a list of field names (e.g. "NextPageToken") to include 2206 // in API requests with the JSON null value. By default, fields with 2207 // empty values are omitted from API requests. However, any field with 2208 // an empty value appearing in NullFields will be sent to the server as 2209 // null. It is an error if a field in this list has a non-empty value. 2210 // This may be used to include null fields in Patch requests. 2211 NullFields []string `json:"-"` 2212} 2213 2214func (s *ListStudentsResponse) MarshalJSON() ([]byte, error) { 2215 type NoMethod ListStudentsResponse 2216 raw := NoMethod(*s) 2217 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2218} 2219 2220// ListTeachersResponse: Response when listing teachers. 2221type ListTeachersResponse struct { 2222 // NextPageToken: Token identifying the next page of results to return. 2223 // If empty, no further 2224 // results are available. 2225 NextPageToken string `json:"nextPageToken,omitempty"` 2226 2227 // Teachers: Teachers who match the list request. 2228 Teachers []*Teacher `json:"teachers,omitempty"` 2229 2230 // ServerResponse contains the HTTP response code and headers from the 2231 // server. 2232 googleapi.ServerResponse `json:"-"` 2233 2234 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2235 // unconditionally include in API requests. By default, fields with 2236 // empty values are omitted from API requests. However, any non-pointer, 2237 // non-interface field appearing in ForceSendFields will be sent to the 2238 // server regardless of whether the field is empty or not. This may be 2239 // used to include empty fields in Patch requests. 2240 ForceSendFields []string `json:"-"` 2241 2242 // NullFields is a list of field names (e.g. "NextPageToken") to include 2243 // in API requests with the JSON null value. By default, fields with 2244 // empty values are omitted from API requests. However, any field with 2245 // an empty value appearing in NullFields will be sent to the server as 2246 // null. It is an error if a field in this list has a non-empty value. 2247 // This may be used to include null fields in Patch requests. 2248 NullFields []string `json:"-"` 2249} 2250 2251func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) { 2252 type NoMethod ListTeachersResponse 2253 raw := NoMethod(*s) 2254 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2255} 2256 2257// ListTopicResponse: Response when listing topics. 2258type ListTopicResponse struct { 2259 // NextPageToken: Token identifying the next page of results to return. 2260 // If empty, no further 2261 // results are available. 2262 NextPageToken string `json:"nextPageToken,omitempty"` 2263 2264 // Topic: Topic items that match the request. 2265 Topic []*Topic `json:"topic,omitempty"` 2266 2267 // ServerResponse contains the HTTP response code and headers from the 2268 // server. 2269 googleapi.ServerResponse `json:"-"` 2270 2271 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2272 // unconditionally include in API requests. By default, fields with 2273 // empty values are omitted from API requests. However, any non-pointer, 2274 // non-interface field appearing in ForceSendFields will be sent to the 2275 // server regardless of whether the field is empty or not. This may be 2276 // used to include empty fields in Patch requests. 2277 ForceSendFields []string `json:"-"` 2278 2279 // NullFields is a list of field names (e.g. "NextPageToken") to include 2280 // in API requests with the JSON null value. By default, fields with 2281 // empty values are omitted from API requests. However, any field with 2282 // an empty value appearing in NullFields will be sent to the server as 2283 // null. It is an error if a field in this list has a non-empty value. 2284 // This may be used to include null fields in Patch requests. 2285 NullFields []string `json:"-"` 2286} 2287 2288func (s *ListTopicResponse) MarshalJSON() ([]byte, error) { 2289 type NoMethod ListTopicResponse 2290 raw := NoMethod(*s) 2291 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2292} 2293 2294// Material: Material attached to course work. 2295// 2296// When creating attachments, setting the `form` field is not supported. 2297type Material struct { 2298 // DriveFile: Google Drive file material. 2299 DriveFile *SharedDriveFile `json:"driveFile,omitempty"` 2300 2301 // Form: Google Forms material. 2302 Form *Form `json:"form,omitempty"` 2303 2304 // Link: Link material. On creation, will be upgraded to a more 2305 // appropriate type 2306 // if possible, and this will be reflected in the response. 2307 Link *Link `json:"link,omitempty"` 2308 2309 // YoutubeVideo: YouTube video material. 2310 YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"` 2311 2312 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2313 // unconditionally include in API requests. By default, fields with 2314 // empty values are omitted from API requests. However, any non-pointer, 2315 // non-interface field appearing in ForceSendFields will be sent to the 2316 // server regardless of whether the field is empty or not. This may be 2317 // used to include empty fields in Patch requests. 2318 ForceSendFields []string `json:"-"` 2319 2320 // NullFields is a list of field names (e.g. "DriveFile") to include in 2321 // API requests with the JSON null value. By default, fields with empty 2322 // values are omitted from API requests. However, any field with an 2323 // empty value appearing in NullFields will be sent to the server as 2324 // null. It is an error if a field in this list has a non-empty value. 2325 // This may be used to include null fields in Patch requests. 2326 NullFields []string `json:"-"` 2327} 2328 2329func (s *Material) MarshalJSON() ([]byte, error) { 2330 type NoMethod Material 2331 raw := NoMethod(*s) 2332 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2333} 2334 2335// ModifyAnnouncementAssigneesRequest: Request to modify assignee mode 2336// and options of an announcement. 2337type ModifyAnnouncementAssigneesRequest struct { 2338 // AssigneeMode: Mode of the announcement describing whether it will be 2339 // accessible by all 2340 // students or specified individual students. 2341 // 2342 // Possible values: 2343 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2344 // returned. 2345 // "ALL_STUDENTS" - All students can see the item. 2346 // This is the default state. 2347 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2348 AssigneeMode string `json:"assigneeMode,omitempty"` 2349 2350 // ModifyIndividualStudentsOptions: Set which students can view or 2351 // cannot view the announcement. 2352 // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2353 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2354 2355 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2356 // unconditionally include in API requests. By default, fields with 2357 // empty values are omitted from API requests. However, any non-pointer, 2358 // non-interface field appearing in ForceSendFields will be sent to the 2359 // server regardless of whether the field is empty or not. This may be 2360 // used to include empty fields in Patch requests. 2361 ForceSendFields []string `json:"-"` 2362 2363 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2364 // in API requests with the JSON null value. By default, fields with 2365 // empty values are omitted from API requests. However, any field with 2366 // an empty value appearing in NullFields will be sent to the server as 2367 // null. It is an error if a field in this list has a non-empty value. 2368 // This may be used to include null fields in Patch requests. 2369 NullFields []string `json:"-"` 2370} 2371 2372func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) { 2373 type NoMethod ModifyAnnouncementAssigneesRequest 2374 raw := NoMethod(*s) 2375 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2376} 2377 2378// ModifyAttachmentsRequest: Request to modify the attachments of a 2379// student submission. 2380type ModifyAttachmentsRequest struct { 2381 // AddAttachments: Attachments to add. 2382 // A student submission may not have more than 20 attachments. 2383 // 2384 // Form attachments are not supported. 2385 AddAttachments []*Attachment `json:"addAttachments,omitempty"` 2386 2387 // ForceSendFields is a list of field names (e.g. "AddAttachments") to 2388 // unconditionally include in API requests. By default, fields with 2389 // empty values are omitted from API requests. However, any non-pointer, 2390 // non-interface field appearing in ForceSendFields will be sent to the 2391 // server regardless of whether the field is empty or not. This may be 2392 // used to include empty fields in Patch requests. 2393 ForceSendFields []string `json:"-"` 2394 2395 // NullFields is a list of field names (e.g. "AddAttachments") to 2396 // include in API requests with the JSON null value. By default, fields 2397 // with empty values are omitted from API requests. However, any field 2398 // with an empty value appearing in NullFields will be sent to the 2399 // server as null. It is an error if a field in this list has a 2400 // non-empty value. This may be used to include null fields in Patch 2401 // requests. 2402 NullFields []string `json:"-"` 2403} 2404 2405func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) { 2406 type NoMethod ModifyAttachmentsRequest 2407 raw := NoMethod(*s) 2408 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2409} 2410 2411// ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and 2412// options of a coursework. 2413type ModifyCourseWorkAssigneesRequest struct { 2414 // AssigneeMode: Mode of the coursework describing whether it will be 2415 // assigned to all 2416 // students or specified individual students. 2417 // 2418 // Possible values: 2419 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2420 // returned. 2421 // "ALL_STUDENTS" - All students can see the item. 2422 // This is the default state. 2423 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2424 AssigneeMode string `json:"assigneeMode,omitempty"` 2425 2426 // ModifyIndividualStudentsOptions: Set which students are assigned or 2427 // not assigned to the coursework. 2428 // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2429 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2430 2431 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2432 // unconditionally include in API requests. By default, fields with 2433 // empty values are omitted from API requests. However, any non-pointer, 2434 // non-interface field appearing in ForceSendFields will be sent to the 2435 // server regardless of whether the field is empty or not. This may be 2436 // used to include empty fields in Patch requests. 2437 ForceSendFields []string `json:"-"` 2438 2439 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2440 // in API requests with the JSON null value. By default, fields with 2441 // empty values are omitted from API requests. However, any field with 2442 // an empty value appearing in NullFields will be sent to the server as 2443 // null. It is an error if a field in this list has a non-empty value. 2444 // This may be used to include null fields in Patch requests. 2445 NullFields []string `json:"-"` 2446} 2447 2448func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) { 2449 type NoMethod ModifyCourseWorkAssigneesRequest 2450 raw := NoMethod(*s) 2451 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2452} 2453 2454// ModifyIndividualStudentsOptions: Contains fields to add or remove 2455// students from a course work or announcement 2456// where the `assigneeMode` is set to `INDIVIDUAL_STUDENTS`. 2457type ModifyIndividualStudentsOptions struct { 2458 // AddStudentIds: Ids of students to be added as having access to 2459 // this 2460 // coursework/announcement. 2461 AddStudentIds []string `json:"addStudentIds,omitempty"` 2462 2463 // RemoveStudentIds: Ids of students to be removed from having access to 2464 // this 2465 // coursework/announcement. 2466 RemoveStudentIds []string `json:"removeStudentIds,omitempty"` 2467 2468 // ForceSendFields is a list of field names (e.g. "AddStudentIds") to 2469 // unconditionally include in API requests. By default, fields with 2470 // empty values are omitted from API requests. However, any non-pointer, 2471 // non-interface field appearing in ForceSendFields will be sent to the 2472 // server regardless of whether the field is empty or not. This may be 2473 // used to include empty fields in Patch requests. 2474 ForceSendFields []string `json:"-"` 2475 2476 // NullFields is a list of field names (e.g. "AddStudentIds") to include 2477 // in API requests with the JSON null value. By default, fields with 2478 // empty values are omitted from API requests. However, any field with 2479 // an empty value appearing in NullFields will be sent to the server as 2480 // null. It is an error if a field in this list has a non-empty value. 2481 // This may be used to include null fields in Patch requests. 2482 NullFields []string `json:"-"` 2483} 2484 2485func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) { 2486 type NoMethod ModifyIndividualStudentsOptions 2487 raw := NoMethod(*s) 2488 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2489} 2490 2491// MultipleChoiceQuestion: Additional details for multiple-choice 2492// questions. 2493type MultipleChoiceQuestion struct { 2494 // Choices: Possible choices. 2495 Choices []string `json:"choices,omitempty"` 2496 2497 // ForceSendFields is a list of field names (e.g. "Choices") to 2498 // unconditionally include in API requests. By default, fields with 2499 // empty values are omitted from API requests. However, any non-pointer, 2500 // non-interface field appearing in ForceSendFields will be sent to the 2501 // server regardless of whether the field is empty or not. This may be 2502 // used to include empty fields in Patch requests. 2503 ForceSendFields []string `json:"-"` 2504 2505 // NullFields is a list of field names (e.g. "Choices") to include in 2506 // API requests with the JSON null value. By default, fields with empty 2507 // values are omitted from API requests. However, any field with an 2508 // empty value appearing in NullFields will be sent to the server as 2509 // null. It is an error if a field in this list has a non-empty value. 2510 // This may be used to include null fields in Patch requests. 2511 NullFields []string `json:"-"` 2512} 2513 2514func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) { 2515 type NoMethod MultipleChoiceQuestion 2516 raw := NoMethod(*s) 2517 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2518} 2519 2520// MultipleChoiceSubmission: Student work for a multiple-choice 2521// question. 2522type MultipleChoiceSubmission struct { 2523 // Answer: Student's select choice. 2524 Answer string `json:"answer,omitempty"` 2525 2526 // ForceSendFields is a list of field names (e.g. "Answer") to 2527 // unconditionally include in API requests. By default, fields with 2528 // empty values are omitted from API requests. However, any non-pointer, 2529 // non-interface field appearing in ForceSendFields will be sent to the 2530 // server regardless of whether the field is empty or not. This may be 2531 // used to include empty fields in Patch requests. 2532 ForceSendFields []string `json:"-"` 2533 2534 // NullFields is a list of field names (e.g. "Answer") to include in API 2535 // requests with the JSON null value. By default, fields with empty 2536 // values are omitted from API requests. However, any field with an 2537 // empty value appearing in NullFields will be sent to the server as 2538 // null. It is an error if a field in this list has a non-empty value. 2539 // This may be used to include null fields in Patch requests. 2540 NullFields []string `json:"-"` 2541} 2542 2543func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) { 2544 type NoMethod MultipleChoiceSubmission 2545 raw := NoMethod(*s) 2546 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2547} 2548 2549// Name: Details of the user's name. 2550type Name struct { 2551 // FamilyName: The user's last name. 2552 // 2553 // Read-only. 2554 FamilyName string `json:"familyName,omitempty"` 2555 2556 // FullName: The user's full name formed by concatenating the first and 2557 // last name 2558 // values. 2559 // 2560 // Read-only. 2561 FullName string `json:"fullName,omitempty"` 2562 2563 // GivenName: The user's first name. 2564 // 2565 // Read-only. 2566 GivenName string `json:"givenName,omitempty"` 2567 2568 // ForceSendFields is a list of field names (e.g. "FamilyName") to 2569 // unconditionally include in API requests. By default, fields with 2570 // empty values are omitted from API requests. However, any non-pointer, 2571 // non-interface field appearing in ForceSendFields will be sent to the 2572 // server regardless of whether the field is empty or not. This may be 2573 // used to include empty fields in Patch requests. 2574 ForceSendFields []string `json:"-"` 2575 2576 // NullFields is a list of field names (e.g. "FamilyName") to include in 2577 // API requests with the JSON null value. By default, fields with empty 2578 // values are omitted from API requests. However, any field with an 2579 // empty value appearing in NullFields will be sent to the server as 2580 // null. It is an error if a field in this list has a non-empty value. 2581 // This may be used to include null fields in Patch requests. 2582 NullFields []string `json:"-"` 2583} 2584 2585func (s *Name) MarshalJSON() ([]byte, error) { 2586 type NoMethod Name 2587 raw := NoMethod(*s) 2588 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2589} 2590 2591// ReclaimStudentSubmissionRequest: Request to reclaim a student 2592// submission. 2593type ReclaimStudentSubmissionRequest struct { 2594} 2595 2596// Registration: An instruction to Classroom to send notifications from 2597// the `feed` to the 2598// provided destination. 2599type Registration struct { 2600 // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to 2601 // be sent to. 2602 CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"` 2603 2604 // ExpiryTime: The time until which the `Registration` is 2605 // effective. 2606 // 2607 // This is a read-only field assigned by the server. 2608 ExpiryTime string `json:"expiryTime,omitempty"` 2609 2610 // Feed: Specification for the class of notifications that Classroom 2611 // should deliver 2612 // to the destination. 2613 Feed *Feed `json:"feed,omitempty"` 2614 2615 // RegistrationId: A server-generated unique identifier for this 2616 // `Registration`. 2617 // 2618 // Read-only. 2619 RegistrationId string `json:"registrationId,omitempty"` 2620 2621 // ServerResponse contains the HTTP response code and headers from the 2622 // server. 2623 googleapi.ServerResponse `json:"-"` 2624 2625 // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to 2626 // unconditionally include in API requests. By default, fields with 2627 // empty values are omitted from API requests. However, any non-pointer, 2628 // non-interface field appearing in ForceSendFields will be sent to the 2629 // server regardless of whether the field is empty or not. This may be 2630 // used to include empty fields in Patch requests. 2631 ForceSendFields []string `json:"-"` 2632 2633 // NullFields is a list of field names (e.g. "CloudPubsubTopic") to 2634 // include in API requests with the JSON null value. By default, fields 2635 // with empty values are omitted from API requests. However, any field 2636 // with an empty value appearing in NullFields will be sent to the 2637 // server as null. It is an error if a field in this list has a 2638 // non-empty value. This may be used to include null fields in Patch 2639 // requests. 2640 NullFields []string `json:"-"` 2641} 2642 2643func (s *Registration) MarshalJSON() ([]byte, error) { 2644 type NoMethod Registration 2645 raw := NoMethod(*s) 2646 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2647} 2648 2649// ReturnStudentSubmissionRequest: Request to return a student 2650// submission. 2651type ReturnStudentSubmissionRequest struct { 2652} 2653 2654// SharedDriveFile: Drive file that is used as material for course work. 2655type SharedDriveFile struct { 2656 // DriveFile: Drive file details. 2657 DriveFile *DriveFile `json:"driveFile,omitempty"` 2658 2659 // ShareMode: Mechanism by which students access the Drive item. 2660 // 2661 // Possible values: 2662 // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never 2663 // be returned. 2664 // "VIEW" - Students can view the shared file. 2665 // "EDIT" - Students can edit the shared file. 2666 // "STUDENT_COPY" - Students have a personal copy of the shared file. 2667 ShareMode string `json:"shareMode,omitempty"` 2668 2669 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2670 // unconditionally include in API requests. By default, fields with 2671 // empty values are omitted from API requests. However, any non-pointer, 2672 // non-interface field appearing in ForceSendFields will be sent to the 2673 // server regardless of whether the field is empty or not. This may be 2674 // used to include empty fields in Patch requests. 2675 ForceSendFields []string `json:"-"` 2676 2677 // NullFields is a list of field names (e.g. "DriveFile") to include in 2678 // API requests with the JSON null value. By default, fields with empty 2679 // values are omitted from API requests. However, any field with an 2680 // empty value appearing in NullFields will be sent to the server as 2681 // null. It is an error if a field in this list has a non-empty value. 2682 // This may be used to include null fields in Patch requests. 2683 NullFields []string `json:"-"` 2684} 2685 2686func (s *SharedDriveFile) MarshalJSON() ([]byte, error) { 2687 type NoMethod SharedDriveFile 2688 raw := NoMethod(*s) 2689 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2690} 2691 2692// ShortAnswerSubmission: Student work for a short answer question. 2693type ShortAnswerSubmission struct { 2694 // Answer: Student response to a short-answer question. 2695 Answer string `json:"answer,omitempty"` 2696 2697 // ForceSendFields is a list of field names (e.g. "Answer") to 2698 // unconditionally include in API requests. By default, fields with 2699 // empty values are omitted from API requests. However, any non-pointer, 2700 // non-interface field appearing in ForceSendFields will be sent to the 2701 // server regardless of whether the field is empty or not. This may be 2702 // used to include empty fields in Patch requests. 2703 ForceSendFields []string `json:"-"` 2704 2705 // NullFields is a list of field names (e.g. "Answer") to include in API 2706 // requests with the JSON null value. By default, fields with empty 2707 // values are omitted from API requests. However, any field with an 2708 // empty value appearing in NullFields will be sent to the server as 2709 // null. It is an error if a field in this list has a non-empty value. 2710 // This may be used to include null fields in Patch requests. 2711 NullFields []string `json:"-"` 2712} 2713 2714func (s *ShortAnswerSubmission) MarshalJSON() ([]byte, error) { 2715 type NoMethod ShortAnswerSubmission 2716 raw := NoMethod(*s) 2717 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2718} 2719 2720// StateHistory: The history of each state this submission has been in. 2721type StateHistory struct { 2722 // ActorUserId: The teacher or student who made the change 2723 ActorUserId string `json:"actorUserId,omitempty"` 2724 2725 // State: The workflow pipeline stage. 2726 // 2727 // Possible values: 2728 // "STATE_UNSPECIFIED" - No state specified. This should never be 2729 // returned. 2730 // "CREATED" - The Submission has been created. 2731 // "TURNED_IN" - The student has turned in an assigned document, which 2732 // may or may not be 2733 // a template. 2734 // "RETURNED" - The teacher has returned the assigned document to the 2735 // student. 2736 // "RECLAIMED_BY_STUDENT" - The student turned in the assigned 2737 // document, and then chose to 2738 // "unsubmit" the assignment, giving the student control again as 2739 // the 2740 // owner. 2741 // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their 2742 // submission after turning it in. Currently, 2743 // only used by Questions, when the student edits their answer. 2744 State string `json:"state,omitempty"` 2745 2746 // StateTimestamp: When the submission entered this state. 2747 StateTimestamp string `json:"stateTimestamp,omitempty"` 2748 2749 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 2750 // unconditionally include in API requests. By default, fields with 2751 // empty values are omitted from API requests. However, any non-pointer, 2752 // non-interface field appearing in ForceSendFields will be sent to the 2753 // server regardless of whether the field is empty or not. This may be 2754 // used to include empty fields in Patch requests. 2755 ForceSendFields []string `json:"-"` 2756 2757 // NullFields is a list of field names (e.g. "ActorUserId") to include 2758 // in API requests with the JSON null value. By default, fields with 2759 // empty values are omitted from API requests. However, any field with 2760 // an empty value appearing in NullFields will be sent to the server as 2761 // null. It is an error if a field in this list has a non-empty value. 2762 // This may be used to include null fields in Patch requests. 2763 NullFields []string `json:"-"` 2764} 2765 2766func (s *StateHistory) MarshalJSON() ([]byte, error) { 2767 type NoMethod StateHistory 2768 raw := NoMethod(*s) 2769 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2770} 2771 2772// Student: Student in a course. 2773type Student struct { 2774 // CourseId: Identifier of the course. 2775 // 2776 // Read-only. 2777 CourseId string `json:"courseId,omitempty"` 2778 2779 // Profile: Global user information for the student. 2780 // 2781 // Read-only. 2782 Profile *UserProfile `json:"profile,omitempty"` 2783 2784 // StudentWorkFolder: Information about a Drive Folder for this 2785 // student's work in this course. 2786 // Only visible to the student and domain administrators. 2787 // 2788 // Read-only. 2789 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 2790 2791 // UserId: Identifier of the user. 2792 // 2793 // When specified as a parameter of a request, this identifier can be 2794 // one of 2795 // the following: 2796 // 2797 // * the numeric identifier for the user 2798 // * the email address of the user 2799 // * the string literal "me", indicating the requesting user 2800 UserId string `json:"userId,omitempty"` 2801 2802 // ServerResponse contains the HTTP response code and headers from the 2803 // server. 2804 googleapi.ServerResponse `json:"-"` 2805 2806 // ForceSendFields is a list of field names (e.g. "CourseId") to 2807 // unconditionally include in API requests. By default, fields with 2808 // empty values are omitted from API requests. However, any non-pointer, 2809 // non-interface field appearing in ForceSendFields will be sent to the 2810 // server regardless of whether the field is empty or not. This may be 2811 // used to include empty fields in Patch requests. 2812 ForceSendFields []string `json:"-"` 2813 2814 // NullFields is a list of field names (e.g. "CourseId") to include in 2815 // API requests with the JSON null value. By default, fields with empty 2816 // values are omitted from API requests. However, any field with an 2817 // empty value appearing in NullFields will be sent to the server as 2818 // null. It is an error if a field in this list has a non-empty value. 2819 // This may be used to include null fields in Patch requests. 2820 NullFields []string `json:"-"` 2821} 2822 2823func (s *Student) MarshalJSON() ([]byte, error) { 2824 type NoMethod Student 2825 raw := NoMethod(*s) 2826 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2827} 2828 2829// StudentSubmission: Student submission for course 2830// work. 2831// 2832// StudentSubmission items are generated when a CourseWork item is 2833// created. 2834// 2835// StudentSubmissions that have never been accessed (i.e. with `state` = 2836// NEW) 2837// may not have a creation time or update time. 2838type StudentSubmission struct { 2839 // AlternateLink: Absolute link to the submission in the Classroom web 2840 // UI. 2841 // 2842 // Read-only. 2843 AlternateLink string `json:"alternateLink,omitempty"` 2844 2845 // AssignedGrade: Optional grade. If unset, no grade was set. 2846 // This value must be non-negative. Decimal (i.e. non-integer) values 2847 // are 2848 // allowed, but will be rounded to two decimal places. 2849 // 2850 // This may be modified only by course teachers. 2851 AssignedGrade float64 `json:"assignedGrade,omitempty"` 2852 2853 // AssignmentSubmission: Submission content when course_work_type is 2854 // ASSIGNMENT. 2855 // 2856 // Students can modify this content 2857 // using 2858 // google.classroom.Work.ModifyAttachments. 2859 AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"` 2860 2861 // AssociatedWithDeveloper: Whether this student submission is 2862 // associated with the Developer Console 2863 // project making the request. 2864 // 2865 // See google.classroom.Work.CreateCourseWork for 2866 // more 2867 // details. 2868 // 2869 // Read-only. 2870 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 2871 2872 // CourseId: Identifier of the course. 2873 // 2874 // Read-only. 2875 CourseId string `json:"courseId,omitempty"` 2876 2877 // CourseWorkId: Identifier for the course work this corresponds 2878 // to. 2879 // 2880 // Read-only. 2881 CourseWorkId string `json:"courseWorkId,omitempty"` 2882 2883 // CourseWorkType: Type of course work this submission is 2884 // for. 2885 // 2886 // Read-only. 2887 // 2888 // Possible values: 2889 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 2890 // never returned. 2891 // "ASSIGNMENT" - An assignment. 2892 // "SHORT_ANSWER_QUESTION" - A short answer question. 2893 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 2894 CourseWorkType string `json:"courseWorkType,omitempty"` 2895 2896 // CreationTime: Creation time of this submission. 2897 // This may be unset if the student has not accessed this 2898 // item. 2899 // 2900 // Read-only. 2901 CreationTime string `json:"creationTime,omitempty"` 2902 2903 // DraftGrade: Optional pending grade. If unset, no grade was set. 2904 // This value must be non-negative. Decimal (i.e. non-integer) values 2905 // are 2906 // allowed, but will be rounded to two decimal places. 2907 // 2908 // This is only visible to and modifiable by course teachers. 2909 DraftGrade float64 `json:"draftGrade,omitempty"` 2910 2911 // Id: Classroom-assigned Identifier for the student submission. 2912 // This is unique among submissions for the relevant course 2913 // work. 2914 // 2915 // Read-only. 2916 Id string `json:"id,omitempty"` 2917 2918 // Late: Whether this submission is late. 2919 // 2920 // Read-only. 2921 Late bool `json:"late,omitempty"` 2922 2923 // MultipleChoiceSubmission: Submission content when course_work_type is 2924 // MULTIPLE_CHOICE_QUESTION. 2925 MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"` 2926 2927 // ShortAnswerSubmission: Submission content when course_work_type is 2928 // SHORT_ANSWER_QUESTION. 2929 ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"` 2930 2931 // State: State of this submission. 2932 // 2933 // Read-only. 2934 // 2935 // Possible values: 2936 // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 2937 // never be returned. 2938 // "NEW" - The student has never accessed this submission. Attachments 2939 // are not 2940 // returned and timestamps is not set. 2941 // "CREATED" - Has been created. 2942 // "TURNED_IN" - Has been turned in to the teacher. 2943 // "RETURNED" - Has been returned to the student. 2944 // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 2945 // assignment. 2946 State string `json:"state,omitempty"` 2947 2948 // SubmissionHistory: The history of the submission (includes state and 2949 // grade histories). 2950 // 2951 // Read-only. 2952 SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"` 2953 2954 // UpdateTime: Last update time of this submission. 2955 // This may be unset if the student has not accessed this 2956 // item. 2957 // 2958 // Read-only. 2959 UpdateTime string `json:"updateTime,omitempty"` 2960 2961 // UserId: Identifier for the student that owns this 2962 // submission. 2963 // 2964 // Read-only. 2965 UserId string `json:"userId,omitempty"` 2966 2967 // ServerResponse contains the HTTP response code and headers from the 2968 // server. 2969 googleapi.ServerResponse `json:"-"` 2970 2971 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 2972 // unconditionally include in API requests. By default, fields with 2973 // empty values are omitted from API requests. However, any non-pointer, 2974 // non-interface field appearing in ForceSendFields will be sent to the 2975 // server regardless of whether the field is empty or not. This may be 2976 // used to include empty fields in Patch requests. 2977 ForceSendFields []string `json:"-"` 2978 2979 // NullFields is a list of field names (e.g. "AlternateLink") to include 2980 // in API requests with the JSON null value. By default, fields with 2981 // empty values are omitted from API requests. However, any field with 2982 // an empty value appearing in NullFields will be sent to the server as 2983 // null. It is an error if a field in this list has a non-empty value. 2984 // This may be used to include null fields in Patch requests. 2985 NullFields []string `json:"-"` 2986} 2987 2988func (s *StudentSubmission) MarshalJSON() ([]byte, error) { 2989 type NoMethod StudentSubmission 2990 raw := NoMethod(*s) 2991 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2992} 2993 2994func (s *StudentSubmission) UnmarshalJSON(data []byte) error { 2995 type NoMethod StudentSubmission 2996 var s1 struct { 2997 AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"` 2998 DraftGrade gensupport.JSONFloat64 `json:"draftGrade"` 2999 *NoMethod 3000 } 3001 s1.NoMethod = (*NoMethod)(s) 3002 if err := json.Unmarshal(data, &s1); err != nil { 3003 return err 3004 } 3005 s.AssignedGrade = float64(s1.AssignedGrade) 3006 s.DraftGrade = float64(s1.DraftGrade) 3007 return nil 3008} 3009 3010// SubmissionHistory: The history of the submission. This currently 3011// includes state and grade 3012// histories. 3013type SubmissionHistory struct { 3014 // GradeHistory: The grade history information of the submission, if 3015 // present. 3016 GradeHistory *GradeHistory `json:"gradeHistory,omitempty"` 3017 3018 // StateHistory: The state history information of the submission, if 3019 // present. 3020 StateHistory *StateHistory `json:"stateHistory,omitempty"` 3021 3022 // ForceSendFields is a list of field names (e.g. "GradeHistory") to 3023 // unconditionally include in API requests. By default, fields with 3024 // empty values are omitted from API requests. However, any non-pointer, 3025 // non-interface field appearing in ForceSendFields will be sent to the 3026 // server regardless of whether the field is empty or not. This may be 3027 // used to include empty fields in Patch requests. 3028 ForceSendFields []string `json:"-"` 3029 3030 // NullFields is a list of field names (e.g. "GradeHistory") to include 3031 // in API requests with the JSON null value. By default, fields with 3032 // empty values are omitted from API requests. However, any field with 3033 // an empty value appearing in NullFields will be sent to the server as 3034 // null. It is an error if a field in this list has a non-empty value. 3035 // This may be used to include null fields in Patch requests. 3036 NullFields []string `json:"-"` 3037} 3038 3039func (s *SubmissionHistory) MarshalJSON() ([]byte, error) { 3040 type NoMethod SubmissionHistory 3041 raw := NoMethod(*s) 3042 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3043} 3044 3045// Teacher: Teacher of a course. 3046type Teacher struct { 3047 // CourseId: Identifier of the course. 3048 // 3049 // Read-only. 3050 CourseId string `json:"courseId,omitempty"` 3051 3052 // Profile: Global user information for the teacher. 3053 // 3054 // Read-only. 3055 Profile *UserProfile `json:"profile,omitempty"` 3056 3057 // UserId: Identifier of the user. 3058 // 3059 // When specified as a parameter of a request, this identifier can be 3060 // one of 3061 // the following: 3062 // 3063 // * the numeric identifier for the user 3064 // * the email address of the user 3065 // * the string literal "me", indicating the requesting user 3066 UserId string `json:"userId,omitempty"` 3067 3068 // ServerResponse contains the HTTP response code and headers from the 3069 // server. 3070 googleapi.ServerResponse `json:"-"` 3071 3072 // ForceSendFields is a list of field names (e.g. "CourseId") to 3073 // unconditionally include in API requests. By default, fields with 3074 // empty values are omitted from API requests. However, any non-pointer, 3075 // non-interface field appearing in ForceSendFields will be sent to the 3076 // server regardless of whether the field is empty or not. This may be 3077 // used to include empty fields in Patch requests. 3078 ForceSendFields []string `json:"-"` 3079 3080 // NullFields is a list of field names (e.g. "CourseId") to include in 3081 // API requests with the JSON null value. By default, fields with empty 3082 // values are omitted from API requests. However, any field with an 3083 // empty value appearing in NullFields will be sent to the server as 3084 // null. It is an error if a field in this list has a non-empty value. 3085 // This may be used to include null fields in Patch requests. 3086 NullFields []string `json:"-"` 3087} 3088 3089func (s *Teacher) MarshalJSON() ([]byte, error) { 3090 type NoMethod Teacher 3091 raw := NoMethod(*s) 3092 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3093} 3094 3095// TimeOfDay: Represents a time of day. The date and time zone are 3096// either not significant 3097// or are specified elsewhere. An API may choose to allow leap seconds. 3098// Related 3099// types are google.type.Date and `google.protobuf.Timestamp`. 3100type TimeOfDay struct { 3101 // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API 3102 // may choose 3103 // to allow the value "24:00:00" for scenarios like business closing 3104 // time. 3105 Hours int64 `json:"hours,omitempty"` 3106 3107 // Minutes: Minutes of hour of day. Must be from 0 to 59. 3108 Minutes int64 `json:"minutes,omitempty"` 3109 3110 // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to 3111 // 999,999,999. 3112 Nanos int64 `json:"nanos,omitempty"` 3113 3114 // Seconds: Seconds of minutes of the time. Must normally be from 0 to 3115 // 59. An API may 3116 // allow the value 60 if it allows leap-seconds. 3117 Seconds int64 `json:"seconds,omitempty"` 3118 3119 // ForceSendFields is a list of field names (e.g. "Hours") to 3120 // unconditionally include in API requests. By default, fields with 3121 // empty values are omitted from API requests. However, any non-pointer, 3122 // non-interface field appearing in ForceSendFields will be sent to the 3123 // server regardless of whether the field is empty or not. This may be 3124 // used to include empty fields in Patch requests. 3125 ForceSendFields []string `json:"-"` 3126 3127 // NullFields is a list of field names (e.g. "Hours") to include in API 3128 // requests with the JSON null value. By default, fields with empty 3129 // values are omitted from API requests. However, any field with an 3130 // empty value appearing in NullFields will be sent to the server as 3131 // null. It is an error if a field in this list has a non-empty value. 3132 // This may be used to include null fields in Patch requests. 3133 NullFields []string `json:"-"` 3134} 3135 3136func (s *TimeOfDay) MarshalJSON() ([]byte, error) { 3137 type NoMethod TimeOfDay 3138 raw := NoMethod(*s) 3139 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3140} 3141 3142// Topic: Topic created by a teacher for the course 3143type Topic struct { 3144 // CourseId: Identifier of the course. 3145 // 3146 // Read-only. 3147 CourseId string `json:"courseId,omitempty"` 3148 3149 // Name: The name of the topic, generated by the user. 3150 // Leading and trailing whitespaces, if any, will be trimmed. Also, 3151 // multiple 3152 // consecutive whitespaces will be collapsed into one inside the name. 3153 // The 3154 // result must be a non-empty string. Topic names are case sensitive, 3155 // and must 3156 // be no longer than 100 characters. 3157 Name string `json:"name,omitempty"` 3158 3159 // TopicId: Unique identifier for the topic. 3160 // 3161 // Read-only. 3162 TopicId string `json:"topicId,omitempty"` 3163 3164 // UpdateTime: The time the topic was last updated by the 3165 // system. 3166 // 3167 // Read-only. 3168 UpdateTime string `json:"updateTime,omitempty"` 3169 3170 // ServerResponse contains the HTTP response code and headers from the 3171 // server. 3172 googleapi.ServerResponse `json:"-"` 3173 3174 // ForceSendFields is a list of field names (e.g. "CourseId") to 3175 // unconditionally include in API requests. By default, fields with 3176 // empty values are omitted from API requests. However, any non-pointer, 3177 // non-interface field appearing in ForceSendFields will be sent to the 3178 // server regardless of whether the field is empty or not. This may be 3179 // used to include empty fields in Patch requests. 3180 ForceSendFields []string `json:"-"` 3181 3182 // NullFields is a list of field names (e.g. "CourseId") to include in 3183 // API requests with the JSON null value. By default, fields with empty 3184 // values are omitted from API requests. However, any field with an 3185 // empty value appearing in NullFields will be sent to the server as 3186 // null. It is an error if a field in this list has a non-empty value. 3187 // This may be used to include null fields in Patch requests. 3188 NullFields []string `json:"-"` 3189} 3190 3191func (s *Topic) MarshalJSON() ([]byte, error) { 3192 type NoMethod Topic 3193 raw := NoMethod(*s) 3194 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3195} 3196 3197// TurnInStudentSubmissionRequest: Request to turn in a student 3198// submission. 3199type TurnInStudentSubmissionRequest struct { 3200} 3201 3202// UserProfile: Global information for a user. 3203type UserProfile struct { 3204 // EmailAddress: Email address of the user. 3205 // 3206 // Read-only. 3207 EmailAddress string `json:"emailAddress,omitempty"` 3208 3209 // Id: Identifier of the user. 3210 // 3211 // Read-only. 3212 Id string `json:"id,omitempty"` 3213 3214 // Name: Name of the user. 3215 // 3216 // Read-only. 3217 Name *Name `json:"name,omitempty"` 3218 3219 // Permissions: Global permissions of the user. 3220 // 3221 // Read-only. 3222 Permissions []*GlobalPermission `json:"permissions,omitempty"` 3223 3224 // PhotoUrl: URL of user's profile photo. 3225 // 3226 // Read-only. 3227 PhotoUrl string `json:"photoUrl,omitempty"` 3228 3229 // VerifiedTeacher: Represents whether a G Suite for Education user's 3230 // domain administrator has 3231 // explicitly verified them as being a teacher. If the user is not a 3232 // member of 3233 // a G Suite for Education domain, than this field will always be 3234 // false. 3235 // 3236 // Read-only 3237 VerifiedTeacher bool `json:"verifiedTeacher,omitempty"` 3238 3239 // ServerResponse contains the HTTP response code and headers from the 3240 // server. 3241 googleapi.ServerResponse `json:"-"` 3242 3243 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 3244 // unconditionally include in API requests. By default, fields with 3245 // empty values are omitted from API requests. However, any non-pointer, 3246 // non-interface field appearing in ForceSendFields will be sent to the 3247 // server regardless of whether the field is empty or not. This may be 3248 // used to include empty fields in Patch requests. 3249 ForceSendFields []string `json:"-"` 3250 3251 // NullFields is a list of field names (e.g. "EmailAddress") to include 3252 // in API requests with the JSON null value. By default, fields with 3253 // empty values are omitted from API requests. However, any field with 3254 // an empty value appearing in NullFields will be sent to the server as 3255 // null. It is an error if a field in this list has a non-empty value. 3256 // This may be used to include null fields in Patch requests. 3257 NullFields []string `json:"-"` 3258} 3259 3260func (s *UserProfile) MarshalJSON() ([]byte, error) { 3261 type NoMethod UserProfile 3262 raw := NoMethod(*s) 3263 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3264} 3265 3266// YouTubeVideo: YouTube video item. 3267type YouTubeVideo struct { 3268 // AlternateLink: URL that can be used to view the YouTube 3269 // video. 3270 // 3271 // Read-only. 3272 AlternateLink string `json:"alternateLink,omitempty"` 3273 3274 // Id: YouTube API resource ID. 3275 Id string `json:"id,omitempty"` 3276 3277 // ThumbnailUrl: URL of a thumbnail image of the YouTube 3278 // video. 3279 // 3280 // Read-only. 3281 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 3282 3283 // Title: Title of the YouTube video. 3284 // 3285 // Read-only. 3286 Title string `json:"title,omitempty"` 3287 3288 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 3289 // unconditionally include in API requests. By default, fields with 3290 // empty values are omitted from API requests. However, any non-pointer, 3291 // non-interface field appearing in ForceSendFields will be sent to the 3292 // server regardless of whether the field is empty or not. This may be 3293 // used to include empty fields in Patch requests. 3294 ForceSendFields []string `json:"-"` 3295 3296 // NullFields is a list of field names (e.g. "AlternateLink") to include 3297 // in API requests with the JSON null value. By default, fields with 3298 // empty values are omitted from API requests. However, any field with 3299 // an empty value appearing in NullFields will be sent to the server as 3300 // null. It is an error if a field in this list has a non-empty value. 3301 // This may be used to include null fields in Patch requests. 3302 NullFields []string `json:"-"` 3303} 3304 3305func (s *YouTubeVideo) MarshalJSON() ([]byte, error) { 3306 type NoMethod YouTubeVideo 3307 raw := NoMethod(*s) 3308 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3309} 3310 3311// method id "classroom.courses.create": 3312 3313type CoursesCreateCall struct { 3314 s *Service 3315 course *Course 3316 urlParams_ gensupport.URLParams 3317 ctx_ context.Context 3318 header_ http.Header 3319} 3320 3321// Create: Creates a course. 3322// 3323// The user specified in `ownerId` is the owner of the created 3324// course 3325// and added as a teacher. 3326// 3327// This method returns the following error codes: 3328// 3329// * `PERMISSION_DENIED` if the requesting user is not permitted to 3330// create 3331// courses or for access errors. 3332// * `NOT_FOUND` if the primary teacher is not a valid user. 3333// * `FAILED_PRECONDITION` if the course owner's account is disabled or 3334// for 3335// the following request errors: 3336// * UserGroupsMembershipLimitReached 3337// * `ALREADY_EXISTS` if an alias was specified in the `id` and 3338// already exists. 3339func (r *CoursesService) Create(course *Course) *CoursesCreateCall { 3340 c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3341 c.course = course 3342 return c 3343} 3344 3345// Fields allows partial responses to be retrieved. See 3346// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3347// for more information. 3348func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall { 3349 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3350 return c 3351} 3352 3353// Context sets the context to be used in this call's Do method. Any 3354// pending HTTP request will be aborted if the provided context is 3355// canceled. 3356func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall { 3357 c.ctx_ = ctx 3358 return c 3359} 3360 3361// Header returns an http.Header that can be modified by the caller to 3362// add HTTP headers to the request. 3363func (c *CoursesCreateCall) Header() http.Header { 3364 if c.header_ == nil { 3365 c.header_ = make(http.Header) 3366 } 3367 return c.header_ 3368} 3369 3370func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) { 3371 reqHeaders := make(http.Header) 3372 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3373 for k, v := range c.header_ { 3374 reqHeaders[k] = v 3375 } 3376 reqHeaders.Set("User-Agent", c.s.userAgent()) 3377 var body io.Reader = nil 3378 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3379 if err != nil { 3380 return nil, err 3381 } 3382 reqHeaders.Set("Content-Type", "application/json") 3383 c.urlParams_.Set("alt", alt) 3384 c.urlParams_.Set("prettyPrint", "false") 3385 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3386 urls += "?" + c.urlParams_.Encode() 3387 req, err := http.NewRequest("POST", urls, body) 3388 if err != nil { 3389 return nil, err 3390 } 3391 req.Header = reqHeaders 3392 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3393} 3394 3395// Do executes the "classroom.courses.create" call. 3396// Exactly one of *Course or error will be non-nil. Any non-2xx status 3397// code is an error. Response headers are in either 3398// *Course.ServerResponse.Header or (if a response was returned at all) 3399// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3400// check whether the returned error was because http.StatusNotModified 3401// was returned. 3402func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3403 gensupport.SetOptions(c.urlParams_, opts...) 3404 res, err := c.doRequest("json") 3405 if res != nil && res.StatusCode == http.StatusNotModified { 3406 if res.Body != nil { 3407 res.Body.Close() 3408 } 3409 return nil, &googleapi.Error{ 3410 Code: res.StatusCode, 3411 Header: res.Header, 3412 } 3413 } 3414 if err != nil { 3415 return nil, err 3416 } 3417 defer googleapi.CloseBody(res) 3418 if err := googleapi.CheckResponse(res); err != nil { 3419 return nil, err 3420 } 3421 ret := &Course{ 3422 ServerResponse: googleapi.ServerResponse{ 3423 Header: res.Header, 3424 HTTPStatusCode: res.StatusCode, 3425 }, 3426 } 3427 target := &ret 3428 if err := gensupport.DecodeResponse(target, res); err != nil { 3429 return nil, err 3430 } 3431 return ret, nil 3432 // { 3433 // "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.", 3434 // "flatPath": "v1/courses", 3435 // "httpMethod": "POST", 3436 // "id": "classroom.courses.create", 3437 // "parameterOrder": [], 3438 // "parameters": {}, 3439 // "path": "v1/courses", 3440 // "request": { 3441 // "$ref": "Course" 3442 // }, 3443 // "response": { 3444 // "$ref": "Course" 3445 // }, 3446 // "scopes": [ 3447 // "https://www.googleapis.com/auth/classroom.courses" 3448 // ] 3449 // } 3450 3451} 3452 3453// method id "classroom.courses.delete": 3454 3455type CoursesDeleteCall struct { 3456 s *Service 3457 id string 3458 urlParams_ gensupport.URLParams 3459 ctx_ context.Context 3460 header_ http.Header 3461} 3462 3463// Delete: Deletes a course. 3464// 3465// This method returns the following error codes: 3466// 3467// * `PERMISSION_DENIED` if the requesting user is not permitted to 3468// delete the 3469// requested course or for access errors. 3470// * `NOT_FOUND` if no course exists with the requested ID. 3471func (r *CoursesService) Delete(id string) *CoursesDeleteCall { 3472 c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3473 c.id = id 3474 return c 3475} 3476 3477// Fields allows partial responses to be retrieved. See 3478// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3479// for more information. 3480func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall { 3481 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3482 return c 3483} 3484 3485// Context sets the context to be used in this call's Do method. Any 3486// pending HTTP request will be aborted if the provided context is 3487// canceled. 3488func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall { 3489 c.ctx_ = ctx 3490 return c 3491} 3492 3493// Header returns an http.Header that can be modified by the caller to 3494// add HTTP headers to the request. 3495func (c *CoursesDeleteCall) Header() http.Header { 3496 if c.header_ == nil { 3497 c.header_ = make(http.Header) 3498 } 3499 return c.header_ 3500} 3501 3502func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) { 3503 reqHeaders := make(http.Header) 3504 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3505 for k, v := range c.header_ { 3506 reqHeaders[k] = v 3507 } 3508 reqHeaders.Set("User-Agent", c.s.userAgent()) 3509 var body io.Reader = nil 3510 c.urlParams_.Set("alt", alt) 3511 c.urlParams_.Set("prettyPrint", "false") 3512 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3513 urls += "?" + c.urlParams_.Encode() 3514 req, err := http.NewRequest("DELETE", urls, body) 3515 if err != nil { 3516 return nil, err 3517 } 3518 req.Header = reqHeaders 3519 googleapi.Expand(req.URL, map[string]string{ 3520 "id": c.id, 3521 }) 3522 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3523} 3524 3525// Do executes the "classroom.courses.delete" call. 3526// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3527// code is an error. Response headers are in either 3528// *Empty.ServerResponse.Header or (if a response was returned at all) 3529// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3530// check whether the returned error was because http.StatusNotModified 3531// was returned. 3532func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3533 gensupport.SetOptions(c.urlParams_, opts...) 3534 res, err := c.doRequest("json") 3535 if res != nil && res.StatusCode == http.StatusNotModified { 3536 if res.Body != nil { 3537 res.Body.Close() 3538 } 3539 return nil, &googleapi.Error{ 3540 Code: res.StatusCode, 3541 Header: res.Header, 3542 } 3543 } 3544 if err != nil { 3545 return nil, err 3546 } 3547 defer googleapi.CloseBody(res) 3548 if err := googleapi.CheckResponse(res); err != nil { 3549 return nil, err 3550 } 3551 ret := &Empty{ 3552 ServerResponse: googleapi.ServerResponse{ 3553 Header: res.Header, 3554 HTTPStatusCode: res.StatusCode, 3555 }, 3556 } 3557 target := &ret 3558 if err := gensupport.DecodeResponse(target, res); err != nil { 3559 return nil, err 3560 } 3561 return ret, nil 3562 // { 3563 // "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.", 3564 // "flatPath": "v1/courses/{id}", 3565 // "httpMethod": "DELETE", 3566 // "id": "classroom.courses.delete", 3567 // "parameterOrder": [ 3568 // "id" 3569 // ], 3570 // "parameters": { 3571 // "id": { 3572 // "description": "Identifier of the course to delete.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3573 // "location": "path", 3574 // "required": true, 3575 // "type": "string" 3576 // } 3577 // }, 3578 // "path": "v1/courses/{id}", 3579 // "response": { 3580 // "$ref": "Empty" 3581 // }, 3582 // "scopes": [ 3583 // "https://www.googleapis.com/auth/classroom.courses" 3584 // ] 3585 // } 3586 3587} 3588 3589// method id "classroom.courses.get": 3590 3591type CoursesGetCall struct { 3592 s *Service 3593 id string 3594 urlParams_ gensupport.URLParams 3595 ifNoneMatch_ string 3596 ctx_ context.Context 3597 header_ http.Header 3598} 3599 3600// Get: Returns a course. 3601// 3602// This method returns the following error codes: 3603// 3604// * `PERMISSION_DENIED` if the requesting user is not permitted to 3605// access the 3606// requested course or for access errors. 3607// * `NOT_FOUND` if no course exists with the requested ID. 3608func (r *CoursesService) Get(id string) *CoursesGetCall { 3609 c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3610 c.id = id 3611 return c 3612} 3613 3614// Fields allows partial responses to be retrieved. See 3615// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3616// for more information. 3617func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall { 3618 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3619 return c 3620} 3621 3622// IfNoneMatch sets the optional parameter which makes the operation 3623// fail if the object's ETag matches the given value. This is useful for 3624// getting updates only after the object has changed since the last 3625// request. Use googleapi.IsNotModified to check whether the response 3626// error from Do is the result of In-None-Match. 3627func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall { 3628 c.ifNoneMatch_ = entityTag 3629 return c 3630} 3631 3632// Context sets the context to be used in this call's Do method. Any 3633// pending HTTP request will be aborted if the provided context is 3634// canceled. 3635func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall { 3636 c.ctx_ = ctx 3637 return c 3638} 3639 3640// Header returns an http.Header that can be modified by the caller to 3641// add HTTP headers to the request. 3642func (c *CoursesGetCall) Header() http.Header { 3643 if c.header_ == nil { 3644 c.header_ = make(http.Header) 3645 } 3646 return c.header_ 3647} 3648 3649func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) { 3650 reqHeaders := make(http.Header) 3651 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3652 for k, v := range c.header_ { 3653 reqHeaders[k] = v 3654 } 3655 reqHeaders.Set("User-Agent", c.s.userAgent()) 3656 if c.ifNoneMatch_ != "" { 3657 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3658 } 3659 var body io.Reader = nil 3660 c.urlParams_.Set("alt", alt) 3661 c.urlParams_.Set("prettyPrint", "false") 3662 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3663 urls += "?" + c.urlParams_.Encode() 3664 req, err := http.NewRequest("GET", urls, body) 3665 if err != nil { 3666 return nil, err 3667 } 3668 req.Header = reqHeaders 3669 googleapi.Expand(req.URL, map[string]string{ 3670 "id": c.id, 3671 }) 3672 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3673} 3674 3675// Do executes the "classroom.courses.get" call. 3676// Exactly one of *Course or error will be non-nil. Any non-2xx status 3677// code is an error. Response headers are in either 3678// *Course.ServerResponse.Header or (if a response was returned at all) 3679// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3680// check whether the returned error was because http.StatusNotModified 3681// was returned. 3682func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3683 gensupport.SetOptions(c.urlParams_, opts...) 3684 res, err := c.doRequest("json") 3685 if res != nil && res.StatusCode == http.StatusNotModified { 3686 if res.Body != nil { 3687 res.Body.Close() 3688 } 3689 return nil, &googleapi.Error{ 3690 Code: res.StatusCode, 3691 Header: res.Header, 3692 } 3693 } 3694 if err != nil { 3695 return nil, err 3696 } 3697 defer googleapi.CloseBody(res) 3698 if err := googleapi.CheckResponse(res); err != nil { 3699 return nil, err 3700 } 3701 ret := &Course{ 3702 ServerResponse: googleapi.ServerResponse{ 3703 Header: res.Header, 3704 HTTPStatusCode: res.StatusCode, 3705 }, 3706 } 3707 target := &ret 3708 if err := gensupport.DecodeResponse(target, res); err != nil { 3709 return nil, err 3710 } 3711 return ret, nil 3712 // { 3713 // "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.", 3714 // "flatPath": "v1/courses/{id}", 3715 // "httpMethod": "GET", 3716 // "id": "classroom.courses.get", 3717 // "parameterOrder": [ 3718 // "id" 3719 // ], 3720 // "parameters": { 3721 // "id": { 3722 // "description": "Identifier of the course to return.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3723 // "location": "path", 3724 // "required": true, 3725 // "type": "string" 3726 // } 3727 // }, 3728 // "path": "v1/courses/{id}", 3729 // "response": { 3730 // "$ref": "Course" 3731 // }, 3732 // "scopes": [ 3733 // "https://www.googleapis.com/auth/classroom.courses", 3734 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3735 // ] 3736 // } 3737 3738} 3739 3740// method id "classroom.courses.list": 3741 3742type CoursesListCall struct { 3743 s *Service 3744 urlParams_ gensupport.URLParams 3745 ifNoneMatch_ string 3746 ctx_ context.Context 3747 header_ http.Header 3748} 3749 3750// List: Returns a list of courses that the requesting user is permitted 3751// to view, 3752// restricted to those that match the request. Returned courses are 3753// ordered by 3754// creation time, with the most recently created coming first. 3755// 3756// This method returns the following error codes: 3757// 3758// * `PERMISSION_DENIED` for access errors. 3759// * `INVALID_ARGUMENT` if the query argument is malformed. 3760// * `NOT_FOUND` if any users specified in the query arguments do not 3761// exist. 3762func (r *CoursesService) List() *CoursesListCall { 3763 c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3764 return c 3765} 3766 3767// CourseStates sets the optional parameter "courseStates": Restricts 3768// returned courses to those in one of the specified states 3769// The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED. 3770// 3771// Possible values: 3772// "COURSE_STATE_UNSPECIFIED" 3773// "ACTIVE" 3774// "ARCHIVED" 3775// "PROVISIONED" 3776// "DECLINED" 3777// "SUSPENDED" 3778func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall { 3779 c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...)) 3780 return c 3781} 3782 3783// PageSize sets the optional parameter "pageSize": Maximum number of 3784// items to return. Zero or unspecified indicates that the 3785// server may assign a maximum. 3786// 3787// The server may return fewer than the specified number of results. 3788func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall { 3789 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3790 return c 3791} 3792 3793// PageToken sets the optional parameter "pageToken": 3794// nextPageToken 3795// value returned from a previous 3796// list call, 3797// indicating that the subsequent page of results should be 3798// returned. 3799// 3800// The list request must be 3801// otherwise identical to the one that resulted in this token. 3802func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall { 3803 c.urlParams_.Set("pageToken", pageToken) 3804 return c 3805} 3806 3807// StudentId sets the optional parameter "studentId": Restricts returned 3808// courses to those having a student with the specified 3809// identifier. The identifier can be one of the following: 3810// 3811// * the numeric identifier for the user 3812// * the email address of the user 3813// * the string literal "me", indicating the requesting user 3814func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall { 3815 c.urlParams_.Set("studentId", studentId) 3816 return c 3817} 3818 3819// TeacherId sets the optional parameter "teacherId": Restricts returned 3820// courses to those having a teacher with the specified 3821// identifier. The identifier can be one of the following: 3822// 3823// * the numeric identifier for the user 3824// * the email address of the user 3825// * the string literal "me", indicating the requesting user 3826func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall { 3827 c.urlParams_.Set("teacherId", teacherId) 3828 return c 3829} 3830 3831// Fields allows partial responses to be retrieved. See 3832// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3833// for more information. 3834func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall { 3835 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3836 return c 3837} 3838 3839// IfNoneMatch sets the optional parameter which makes the operation 3840// fail if the object's ETag matches the given value. This is useful for 3841// getting updates only after the object has changed since the last 3842// request. Use googleapi.IsNotModified to check whether the response 3843// error from Do is the result of In-None-Match. 3844func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall { 3845 c.ifNoneMatch_ = entityTag 3846 return c 3847} 3848 3849// Context sets the context to be used in this call's Do method. Any 3850// pending HTTP request will be aborted if the provided context is 3851// canceled. 3852func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall { 3853 c.ctx_ = ctx 3854 return c 3855} 3856 3857// Header returns an http.Header that can be modified by the caller to 3858// add HTTP headers to the request. 3859func (c *CoursesListCall) Header() http.Header { 3860 if c.header_ == nil { 3861 c.header_ = make(http.Header) 3862 } 3863 return c.header_ 3864} 3865 3866func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) { 3867 reqHeaders := make(http.Header) 3868 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3869 for k, v := range c.header_ { 3870 reqHeaders[k] = v 3871 } 3872 reqHeaders.Set("User-Agent", c.s.userAgent()) 3873 if c.ifNoneMatch_ != "" { 3874 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3875 } 3876 var body io.Reader = nil 3877 c.urlParams_.Set("alt", alt) 3878 c.urlParams_.Set("prettyPrint", "false") 3879 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3880 urls += "?" + c.urlParams_.Encode() 3881 req, err := http.NewRequest("GET", urls, body) 3882 if err != nil { 3883 return nil, err 3884 } 3885 req.Header = reqHeaders 3886 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3887} 3888 3889// Do executes the "classroom.courses.list" call. 3890// Exactly one of *ListCoursesResponse or error will be non-nil. Any 3891// non-2xx status code is an error. Response headers are in either 3892// *ListCoursesResponse.ServerResponse.Header or (if a response was 3893// returned at all) in error.(*googleapi.Error).Header. Use 3894// googleapi.IsNotModified to check whether the returned error was 3895// because http.StatusNotModified was returned. 3896func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) { 3897 gensupport.SetOptions(c.urlParams_, opts...) 3898 res, err := c.doRequest("json") 3899 if res != nil && res.StatusCode == http.StatusNotModified { 3900 if res.Body != nil { 3901 res.Body.Close() 3902 } 3903 return nil, &googleapi.Error{ 3904 Code: res.StatusCode, 3905 Header: res.Header, 3906 } 3907 } 3908 if err != nil { 3909 return nil, err 3910 } 3911 defer googleapi.CloseBody(res) 3912 if err := googleapi.CheckResponse(res); err != nil { 3913 return nil, err 3914 } 3915 ret := &ListCoursesResponse{ 3916 ServerResponse: googleapi.ServerResponse{ 3917 Header: res.Header, 3918 HTTPStatusCode: res.StatusCode, 3919 }, 3920 } 3921 target := &ret 3922 if err := gensupport.DecodeResponse(target, res); err != nil { 3923 return nil, err 3924 } 3925 return ret, nil 3926 // { 3927 // "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.", 3928 // "flatPath": "v1/courses", 3929 // "httpMethod": "GET", 3930 // "id": "classroom.courses.list", 3931 // "parameterOrder": [], 3932 // "parameters": { 3933 // "courseStates": { 3934 // "description": "Restricts returned courses to those in one of the specified states\nThe default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.", 3935 // "enum": [ 3936 // "COURSE_STATE_UNSPECIFIED", 3937 // "ACTIVE", 3938 // "ARCHIVED", 3939 // "PROVISIONED", 3940 // "DECLINED", 3941 // "SUSPENDED" 3942 // ], 3943 // "location": "query", 3944 // "repeated": true, 3945 // "type": "string" 3946 // }, 3947 // "pageSize": { 3948 // "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.", 3949 // "format": "int32", 3950 // "location": "query", 3951 // "type": "integer" 3952 // }, 3953 // "pageToken": { 3954 // "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.", 3955 // "location": "query", 3956 // "type": "string" 3957 // }, 3958 // "studentId": { 3959 // "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", 3960 // "location": "query", 3961 // "type": "string" 3962 // }, 3963 // "teacherId": { 3964 // "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", 3965 // "location": "query", 3966 // "type": "string" 3967 // } 3968 // }, 3969 // "path": "v1/courses", 3970 // "response": { 3971 // "$ref": "ListCoursesResponse" 3972 // }, 3973 // "scopes": [ 3974 // "https://www.googleapis.com/auth/classroom.courses", 3975 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3976 // ] 3977 // } 3978 3979} 3980 3981// Pages invokes f for each page of results. 3982// A non-nil error returned from f will halt the iteration. 3983// The provided context supersedes any context provided to the Context method. 3984func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error { 3985 c.ctx_ = ctx 3986 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3987 for { 3988 x, err := c.Do() 3989 if err != nil { 3990 return err 3991 } 3992 if err := f(x); err != nil { 3993 return err 3994 } 3995 if x.NextPageToken == "" { 3996 return nil 3997 } 3998 c.PageToken(x.NextPageToken) 3999 } 4000} 4001 4002// method id "classroom.courses.patch": 4003 4004type CoursesPatchCall struct { 4005 s *Service 4006 id string 4007 course *Course 4008 urlParams_ gensupport.URLParams 4009 ctx_ context.Context 4010 header_ http.Header 4011} 4012 4013// Patch: Updates one or more fields in a course. 4014// 4015// This method returns the following error codes: 4016// 4017// * `PERMISSION_DENIED` if the requesting user is not permitted to 4018// modify the 4019// requested course or for access errors. 4020// * `NOT_FOUND` if no course exists with the requested ID. 4021// * `INVALID_ARGUMENT` if invalid fields are specified in the update 4022// mask or 4023// if no update mask is supplied. 4024// * `FAILED_PRECONDITION` for the following request errors: 4025// * CourseNotModifiable 4026func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall { 4027 c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4028 c.id = id 4029 c.course = course 4030 return c 4031} 4032 4033// UpdateMask sets the optional parameter "updateMask": Mask that 4034// identifies which fields on the course to update. 4035// This field is required to do an update. The update will fail if 4036// invalid 4037// fields are specified. The following fields are valid: 4038// 4039// * `name` 4040// * `section` 4041// * `descriptionHeading` 4042// * `description` 4043// * `room` 4044// * `courseState` 4045// * `ownerId` 4046// 4047// Note: patches to ownerId are treated as being effective immediately, 4048// but in 4049// practice it may take some time for the ownership transfer of all 4050// affected 4051// resources to complete. 4052// 4053// When set in a query parameter, this field should be specified 4054// as 4055// 4056// `updateMask=<field1>,<field2>,...` 4057func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall { 4058 c.urlParams_.Set("updateMask", updateMask) 4059 return c 4060} 4061 4062// Fields allows partial responses to be retrieved. See 4063// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4064// for more information. 4065func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall { 4066 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4067 return c 4068} 4069 4070// Context sets the context to be used in this call's Do method. Any 4071// pending HTTP request will be aborted if the provided context is 4072// canceled. 4073func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall { 4074 c.ctx_ = ctx 4075 return c 4076} 4077 4078// Header returns an http.Header that can be modified by the caller to 4079// add HTTP headers to the request. 4080func (c *CoursesPatchCall) Header() http.Header { 4081 if c.header_ == nil { 4082 c.header_ = make(http.Header) 4083 } 4084 return c.header_ 4085} 4086 4087func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) { 4088 reqHeaders := make(http.Header) 4089 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4090 for k, v := range c.header_ { 4091 reqHeaders[k] = v 4092 } 4093 reqHeaders.Set("User-Agent", c.s.userAgent()) 4094 var body io.Reader = nil 4095 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4096 if err != nil { 4097 return nil, err 4098 } 4099 reqHeaders.Set("Content-Type", "application/json") 4100 c.urlParams_.Set("alt", alt) 4101 c.urlParams_.Set("prettyPrint", "false") 4102 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4103 urls += "?" + c.urlParams_.Encode() 4104 req, err := http.NewRequest("PATCH", urls, body) 4105 if err != nil { 4106 return nil, err 4107 } 4108 req.Header = reqHeaders 4109 googleapi.Expand(req.URL, map[string]string{ 4110 "id": c.id, 4111 }) 4112 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4113} 4114 4115// Do executes the "classroom.courses.patch" call. 4116// Exactly one of *Course or error will be non-nil. Any non-2xx status 4117// code is an error. Response headers are in either 4118// *Course.ServerResponse.Header or (if a response was returned at all) 4119// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4120// check whether the returned error was because http.StatusNotModified 4121// was returned. 4122func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4123 gensupport.SetOptions(c.urlParams_, opts...) 4124 res, err := c.doRequest("json") 4125 if res != nil && res.StatusCode == http.StatusNotModified { 4126 if res.Body != nil { 4127 res.Body.Close() 4128 } 4129 return nil, &googleapi.Error{ 4130 Code: res.StatusCode, 4131 Header: res.Header, 4132 } 4133 } 4134 if err != nil { 4135 return nil, err 4136 } 4137 defer googleapi.CloseBody(res) 4138 if err := googleapi.CheckResponse(res); err != nil { 4139 return nil, err 4140 } 4141 ret := &Course{ 4142 ServerResponse: googleapi.ServerResponse{ 4143 Header: res.Header, 4144 HTTPStatusCode: res.StatusCode, 4145 }, 4146 } 4147 target := &ret 4148 if err := gensupport.DecodeResponse(target, res); err != nil { 4149 return nil, err 4150 } 4151 return ret, nil 4152 // { 4153 // "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", 4154 // "flatPath": "v1/courses/{id}", 4155 // "httpMethod": "PATCH", 4156 // "id": "classroom.courses.patch", 4157 // "parameterOrder": [ 4158 // "id" 4159 // ], 4160 // "parameters": { 4161 // "id": { 4162 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4163 // "location": "path", 4164 // "required": true, 4165 // "type": "string" 4166 // }, 4167 // "updateMask": { 4168 // "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,...`", 4169 // "format": "google-fieldmask", 4170 // "location": "query", 4171 // "type": "string" 4172 // } 4173 // }, 4174 // "path": "v1/courses/{id}", 4175 // "request": { 4176 // "$ref": "Course" 4177 // }, 4178 // "response": { 4179 // "$ref": "Course" 4180 // }, 4181 // "scopes": [ 4182 // "https://www.googleapis.com/auth/classroom.courses" 4183 // ] 4184 // } 4185 4186} 4187 4188// method id "classroom.courses.update": 4189 4190type CoursesUpdateCall struct { 4191 s *Service 4192 id string 4193 course *Course 4194 urlParams_ gensupport.URLParams 4195 ctx_ context.Context 4196 header_ http.Header 4197} 4198 4199// Update: Updates a course. 4200// 4201// This method returns the following error codes: 4202// 4203// * `PERMISSION_DENIED` if the requesting user is not permitted to 4204// modify the 4205// requested course or for access errors. 4206// * `NOT_FOUND` if no course exists with the requested ID. 4207// * `FAILED_PRECONDITION` for the following request errors: 4208// * CourseNotModifiable 4209func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall { 4210 c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4211 c.id = id 4212 c.course = course 4213 return c 4214} 4215 4216// Fields allows partial responses to be retrieved. See 4217// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4218// for more information. 4219func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall { 4220 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4221 return c 4222} 4223 4224// Context sets the context to be used in this call's Do method. Any 4225// pending HTTP request will be aborted if the provided context is 4226// canceled. 4227func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall { 4228 c.ctx_ = ctx 4229 return c 4230} 4231 4232// Header returns an http.Header that can be modified by the caller to 4233// add HTTP headers to the request. 4234func (c *CoursesUpdateCall) Header() http.Header { 4235 if c.header_ == nil { 4236 c.header_ = make(http.Header) 4237 } 4238 return c.header_ 4239} 4240 4241func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) { 4242 reqHeaders := make(http.Header) 4243 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4244 for k, v := range c.header_ { 4245 reqHeaders[k] = v 4246 } 4247 reqHeaders.Set("User-Agent", c.s.userAgent()) 4248 var body io.Reader = nil 4249 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4250 if err != nil { 4251 return nil, err 4252 } 4253 reqHeaders.Set("Content-Type", "application/json") 4254 c.urlParams_.Set("alt", alt) 4255 c.urlParams_.Set("prettyPrint", "false") 4256 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4257 urls += "?" + c.urlParams_.Encode() 4258 req, err := http.NewRequest("PUT", urls, body) 4259 if err != nil { 4260 return nil, err 4261 } 4262 req.Header = reqHeaders 4263 googleapi.Expand(req.URL, map[string]string{ 4264 "id": c.id, 4265 }) 4266 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4267} 4268 4269// Do executes the "classroom.courses.update" call. 4270// Exactly one of *Course or error will be non-nil. Any non-2xx status 4271// code is an error. Response headers are in either 4272// *Course.ServerResponse.Header or (if a response was returned at all) 4273// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4274// check whether the returned error was because http.StatusNotModified 4275// was returned. 4276func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4277 gensupport.SetOptions(c.urlParams_, opts...) 4278 res, err := c.doRequest("json") 4279 if res != nil && res.StatusCode == http.StatusNotModified { 4280 if res.Body != nil { 4281 res.Body.Close() 4282 } 4283 return nil, &googleapi.Error{ 4284 Code: res.StatusCode, 4285 Header: res.Header, 4286 } 4287 } 4288 if err != nil { 4289 return nil, err 4290 } 4291 defer googleapi.CloseBody(res) 4292 if err := googleapi.CheckResponse(res); err != nil { 4293 return nil, err 4294 } 4295 ret := &Course{ 4296 ServerResponse: googleapi.ServerResponse{ 4297 Header: res.Header, 4298 HTTPStatusCode: res.StatusCode, 4299 }, 4300 } 4301 target := &ret 4302 if err := gensupport.DecodeResponse(target, res); err != nil { 4303 return nil, err 4304 } 4305 return ret, nil 4306 // { 4307 // "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", 4308 // "flatPath": "v1/courses/{id}", 4309 // "httpMethod": "PUT", 4310 // "id": "classroom.courses.update", 4311 // "parameterOrder": [ 4312 // "id" 4313 // ], 4314 // "parameters": { 4315 // "id": { 4316 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4317 // "location": "path", 4318 // "required": true, 4319 // "type": "string" 4320 // } 4321 // }, 4322 // "path": "v1/courses/{id}", 4323 // "request": { 4324 // "$ref": "Course" 4325 // }, 4326 // "response": { 4327 // "$ref": "Course" 4328 // }, 4329 // "scopes": [ 4330 // "https://www.googleapis.com/auth/classroom.courses" 4331 // ] 4332 // } 4333 4334} 4335 4336// method id "classroom.courses.aliases.create": 4337 4338type CoursesAliasesCreateCall struct { 4339 s *Service 4340 courseId string 4341 coursealias *CourseAlias 4342 urlParams_ gensupport.URLParams 4343 ctx_ context.Context 4344 header_ http.Header 4345} 4346 4347// Create: Creates an alias for a course. 4348// 4349// This method returns the following error codes: 4350// 4351// * `PERMISSION_DENIED` if the requesting user is not permitted to 4352// create the 4353// alias or for access errors. 4354// * `NOT_FOUND` if the course does not exist. 4355// * `ALREADY_EXISTS` if the alias already exists. 4356// * `FAILED_PRECONDITION` if the alias requested does not make sense 4357// for the 4358// requesting user or course (for example, if a user not in a domain 4359// attempts to access a domain-scoped alias). 4360func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall { 4361 c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4362 c.courseId = courseId 4363 c.coursealias = coursealias 4364 return c 4365} 4366 4367// Fields allows partial responses to be retrieved. See 4368// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4369// for more information. 4370func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall { 4371 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4372 return c 4373} 4374 4375// Context sets the context to be used in this call's Do method. Any 4376// pending HTTP request will be aborted if the provided context is 4377// canceled. 4378func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall { 4379 c.ctx_ = ctx 4380 return c 4381} 4382 4383// Header returns an http.Header that can be modified by the caller to 4384// add HTTP headers to the request. 4385func (c *CoursesAliasesCreateCall) Header() http.Header { 4386 if c.header_ == nil { 4387 c.header_ = make(http.Header) 4388 } 4389 return c.header_ 4390} 4391 4392func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) { 4393 reqHeaders := make(http.Header) 4394 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4395 for k, v := range c.header_ { 4396 reqHeaders[k] = v 4397 } 4398 reqHeaders.Set("User-Agent", c.s.userAgent()) 4399 var body io.Reader = nil 4400 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias) 4401 if err != nil { 4402 return nil, err 4403 } 4404 reqHeaders.Set("Content-Type", "application/json") 4405 c.urlParams_.Set("alt", alt) 4406 c.urlParams_.Set("prettyPrint", "false") 4407 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4408 urls += "?" + c.urlParams_.Encode() 4409 req, err := http.NewRequest("POST", urls, body) 4410 if err != nil { 4411 return nil, err 4412 } 4413 req.Header = reqHeaders 4414 googleapi.Expand(req.URL, map[string]string{ 4415 "courseId": c.courseId, 4416 }) 4417 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4418} 4419 4420// Do executes the "classroom.courses.aliases.create" call. 4421// Exactly one of *CourseAlias or error will be non-nil. Any non-2xx 4422// status code is an error. Response headers are in either 4423// *CourseAlias.ServerResponse.Header or (if a response was returned at 4424// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4425// to check whether the returned error was because 4426// http.StatusNotModified was returned. 4427func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) { 4428 gensupport.SetOptions(c.urlParams_, opts...) 4429 res, err := c.doRequest("json") 4430 if res != nil && res.StatusCode == http.StatusNotModified { 4431 if res.Body != nil { 4432 res.Body.Close() 4433 } 4434 return nil, &googleapi.Error{ 4435 Code: res.StatusCode, 4436 Header: res.Header, 4437 } 4438 } 4439 if err != nil { 4440 return nil, err 4441 } 4442 defer googleapi.CloseBody(res) 4443 if err := googleapi.CheckResponse(res); err != nil { 4444 return nil, err 4445 } 4446 ret := &CourseAlias{ 4447 ServerResponse: googleapi.ServerResponse{ 4448 Header: res.Header, 4449 HTTPStatusCode: res.StatusCode, 4450 }, 4451 } 4452 target := &ret 4453 if err := gensupport.DecodeResponse(target, res); err != nil { 4454 return nil, err 4455 } 4456 return ret, nil 4457 // { 4458 // "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).", 4459 // "flatPath": "v1/courses/{courseId}/aliases", 4460 // "httpMethod": "POST", 4461 // "id": "classroom.courses.aliases.create", 4462 // "parameterOrder": [ 4463 // "courseId" 4464 // ], 4465 // "parameters": { 4466 // "courseId": { 4467 // "description": "Identifier of the course to alias.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4468 // "location": "path", 4469 // "required": true, 4470 // "type": "string" 4471 // } 4472 // }, 4473 // "path": "v1/courses/{courseId}/aliases", 4474 // "request": { 4475 // "$ref": "CourseAlias" 4476 // }, 4477 // "response": { 4478 // "$ref": "CourseAlias" 4479 // }, 4480 // "scopes": [ 4481 // "https://www.googleapis.com/auth/classroom.courses" 4482 // ] 4483 // } 4484 4485} 4486 4487// method id "classroom.courses.aliases.delete": 4488 4489type CoursesAliasesDeleteCall struct { 4490 s *Service 4491 courseId string 4492 aliasid string 4493 urlParams_ gensupport.URLParams 4494 ctx_ context.Context 4495 header_ http.Header 4496} 4497 4498// Delete: Deletes an alias of a course. 4499// 4500// This method returns the following error codes: 4501// 4502// * `PERMISSION_DENIED` if the requesting user is not permitted to 4503// remove the 4504// alias or for access errors. 4505// * `NOT_FOUND` if the alias does not exist. 4506// * `FAILED_PRECONDITION` if the alias requested does not make sense 4507// for the 4508// requesting user or course (for example, if a user not in a domain 4509// attempts to delete a domain-scoped alias). 4510func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall { 4511 c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4512 c.courseId = courseId 4513 c.aliasid = aliasid 4514 return c 4515} 4516 4517// Fields allows partial responses to be retrieved. See 4518// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4519// for more information. 4520func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall { 4521 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4522 return c 4523} 4524 4525// Context sets the context to be used in this call's Do method. Any 4526// pending HTTP request will be aborted if the provided context is 4527// canceled. 4528func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall { 4529 c.ctx_ = ctx 4530 return c 4531} 4532 4533// Header returns an http.Header that can be modified by the caller to 4534// add HTTP headers to the request. 4535func (c *CoursesAliasesDeleteCall) Header() http.Header { 4536 if c.header_ == nil { 4537 c.header_ = make(http.Header) 4538 } 4539 return c.header_ 4540} 4541 4542func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) { 4543 reqHeaders := make(http.Header) 4544 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4545 for k, v := range c.header_ { 4546 reqHeaders[k] = v 4547 } 4548 reqHeaders.Set("User-Agent", c.s.userAgent()) 4549 var body io.Reader = nil 4550 c.urlParams_.Set("alt", alt) 4551 c.urlParams_.Set("prettyPrint", "false") 4552 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}") 4553 urls += "?" + c.urlParams_.Encode() 4554 req, err := http.NewRequest("DELETE", urls, body) 4555 if err != nil { 4556 return nil, err 4557 } 4558 req.Header = reqHeaders 4559 googleapi.Expand(req.URL, map[string]string{ 4560 "courseId": c.courseId, 4561 "alias": c.aliasid, 4562 }) 4563 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4564} 4565 4566// Do executes the "classroom.courses.aliases.delete" call. 4567// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4568// code is an error. Response headers are in either 4569// *Empty.ServerResponse.Header or (if a response was returned at all) 4570// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4571// check whether the returned error was because http.StatusNotModified 4572// was returned. 4573func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4574 gensupport.SetOptions(c.urlParams_, opts...) 4575 res, err := c.doRequest("json") 4576 if res != nil && res.StatusCode == http.StatusNotModified { 4577 if res.Body != nil { 4578 res.Body.Close() 4579 } 4580 return nil, &googleapi.Error{ 4581 Code: res.StatusCode, 4582 Header: res.Header, 4583 } 4584 } 4585 if err != nil { 4586 return nil, err 4587 } 4588 defer googleapi.CloseBody(res) 4589 if err := googleapi.CheckResponse(res); err != nil { 4590 return nil, err 4591 } 4592 ret := &Empty{ 4593 ServerResponse: googleapi.ServerResponse{ 4594 Header: res.Header, 4595 HTTPStatusCode: res.StatusCode, 4596 }, 4597 } 4598 target := &ret 4599 if err := gensupport.DecodeResponse(target, res); err != nil { 4600 return nil, err 4601 } 4602 return ret, nil 4603 // { 4604 // "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).", 4605 // "flatPath": "v1/courses/{courseId}/aliases/{alias}", 4606 // "httpMethod": "DELETE", 4607 // "id": "classroom.courses.aliases.delete", 4608 // "parameterOrder": [ 4609 // "courseId", 4610 // "alias" 4611 // ], 4612 // "parameters": { 4613 // "alias": { 4614 // "description": "Alias to delete.\nThis may not be the Classroom-assigned identifier.", 4615 // "location": "path", 4616 // "required": true, 4617 // "type": "string" 4618 // }, 4619 // "courseId": { 4620 // "description": "Identifier of the course whose alias should be deleted.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4621 // "location": "path", 4622 // "required": true, 4623 // "type": "string" 4624 // } 4625 // }, 4626 // "path": "v1/courses/{courseId}/aliases/{alias}", 4627 // "response": { 4628 // "$ref": "Empty" 4629 // }, 4630 // "scopes": [ 4631 // "https://www.googleapis.com/auth/classroom.courses" 4632 // ] 4633 // } 4634 4635} 4636 4637// method id "classroom.courses.aliases.list": 4638 4639type CoursesAliasesListCall struct { 4640 s *Service 4641 courseId string 4642 urlParams_ gensupport.URLParams 4643 ifNoneMatch_ string 4644 ctx_ context.Context 4645 header_ http.Header 4646} 4647 4648// List: Returns a list of aliases for a course. 4649// 4650// This method returns the following error codes: 4651// 4652// * `PERMISSION_DENIED` if the requesting user is not permitted to 4653// access the 4654// course or for access errors. 4655// * `NOT_FOUND` if the course does not exist. 4656func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall { 4657 c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4658 c.courseId = courseId 4659 return c 4660} 4661 4662// PageSize sets the optional parameter "pageSize": Maximum number of 4663// items to return. Zero or unspecified indicates that the 4664// server may assign a maximum. 4665// 4666// The server may return fewer than the specified number of results. 4667func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall { 4668 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4669 return c 4670} 4671 4672// PageToken sets the optional parameter "pageToken": 4673// nextPageToken 4674// value returned from a previous 4675// list call, 4676// indicating that the subsequent page of results should be 4677// returned. 4678// 4679// The list request 4680// must be otherwise identical to the one that resulted in this token. 4681func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall { 4682 c.urlParams_.Set("pageToken", pageToken) 4683 return c 4684} 4685 4686// Fields allows partial responses to be retrieved. See 4687// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4688// for more information. 4689func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall { 4690 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4691 return c 4692} 4693 4694// IfNoneMatch sets the optional parameter which makes the operation 4695// fail if the object's ETag matches the given value. This is useful for 4696// getting updates only after the object has changed since the last 4697// request. Use googleapi.IsNotModified to check whether the response 4698// error from Do is the result of In-None-Match. 4699func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall { 4700 c.ifNoneMatch_ = entityTag 4701 return c 4702} 4703 4704// Context sets the context to be used in this call's Do method. Any 4705// pending HTTP request will be aborted if the provided context is 4706// canceled. 4707func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall { 4708 c.ctx_ = ctx 4709 return c 4710} 4711 4712// Header returns an http.Header that can be modified by the caller to 4713// add HTTP headers to the request. 4714func (c *CoursesAliasesListCall) Header() http.Header { 4715 if c.header_ == nil { 4716 c.header_ = make(http.Header) 4717 } 4718 return c.header_ 4719} 4720 4721func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) { 4722 reqHeaders := make(http.Header) 4723 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4724 for k, v := range c.header_ { 4725 reqHeaders[k] = v 4726 } 4727 reqHeaders.Set("User-Agent", c.s.userAgent()) 4728 if c.ifNoneMatch_ != "" { 4729 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4730 } 4731 var body io.Reader = nil 4732 c.urlParams_.Set("alt", alt) 4733 c.urlParams_.Set("prettyPrint", "false") 4734 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4735 urls += "?" + c.urlParams_.Encode() 4736 req, err := http.NewRequest("GET", urls, body) 4737 if err != nil { 4738 return nil, err 4739 } 4740 req.Header = reqHeaders 4741 googleapi.Expand(req.URL, map[string]string{ 4742 "courseId": c.courseId, 4743 }) 4744 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4745} 4746 4747// Do executes the "classroom.courses.aliases.list" call. 4748// Exactly one of *ListCourseAliasesResponse or error will be non-nil. 4749// Any non-2xx status code is an error. Response headers are in either 4750// *ListCourseAliasesResponse.ServerResponse.Header or (if a response 4751// was returned at all) in error.(*googleapi.Error).Header. Use 4752// googleapi.IsNotModified to check whether the returned error was 4753// because http.StatusNotModified was returned. 4754func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) { 4755 gensupport.SetOptions(c.urlParams_, opts...) 4756 res, err := c.doRequest("json") 4757 if res != nil && res.StatusCode == http.StatusNotModified { 4758 if res.Body != nil { 4759 res.Body.Close() 4760 } 4761 return nil, &googleapi.Error{ 4762 Code: res.StatusCode, 4763 Header: res.Header, 4764 } 4765 } 4766 if err != nil { 4767 return nil, err 4768 } 4769 defer googleapi.CloseBody(res) 4770 if err := googleapi.CheckResponse(res); err != nil { 4771 return nil, err 4772 } 4773 ret := &ListCourseAliasesResponse{ 4774 ServerResponse: googleapi.ServerResponse{ 4775 Header: res.Header, 4776 HTTPStatusCode: res.StatusCode, 4777 }, 4778 } 4779 target := &ret 4780 if err := gensupport.DecodeResponse(target, res); err != nil { 4781 return nil, err 4782 } 4783 return ret, nil 4784 // { 4785 // "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.", 4786 // "flatPath": "v1/courses/{courseId}/aliases", 4787 // "httpMethod": "GET", 4788 // "id": "classroom.courses.aliases.list", 4789 // "parameterOrder": [ 4790 // "courseId" 4791 // ], 4792 // "parameters": { 4793 // "courseId": { 4794 // "description": "The identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4795 // "location": "path", 4796 // "required": true, 4797 // "type": "string" 4798 // }, 4799 // "pageSize": { 4800 // "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.", 4801 // "format": "int32", 4802 // "location": "query", 4803 // "type": "integer" 4804 // }, 4805 // "pageToken": { 4806 // "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.", 4807 // "location": "query", 4808 // "type": "string" 4809 // } 4810 // }, 4811 // "path": "v1/courses/{courseId}/aliases", 4812 // "response": { 4813 // "$ref": "ListCourseAliasesResponse" 4814 // }, 4815 // "scopes": [ 4816 // "https://www.googleapis.com/auth/classroom.courses", 4817 // "https://www.googleapis.com/auth/classroom.courses.readonly" 4818 // ] 4819 // } 4820 4821} 4822 4823// Pages invokes f for each page of results. 4824// A non-nil error returned from f will halt the iteration. 4825// The provided context supersedes any context provided to the Context method. 4826func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error { 4827 c.ctx_ = ctx 4828 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4829 for { 4830 x, err := c.Do() 4831 if err != nil { 4832 return err 4833 } 4834 if err := f(x); err != nil { 4835 return err 4836 } 4837 if x.NextPageToken == "" { 4838 return nil 4839 } 4840 c.PageToken(x.NextPageToken) 4841 } 4842} 4843 4844// method id "classroom.courses.announcements.create": 4845 4846type CoursesAnnouncementsCreateCall struct { 4847 s *Service 4848 courseId string 4849 announcement *Announcement 4850 urlParams_ gensupport.URLParams 4851 ctx_ context.Context 4852 header_ http.Header 4853} 4854 4855// Create: Creates an announcement. 4856// 4857// This method returns the following error codes: 4858// 4859// * `PERMISSION_DENIED` if the requesting user is not permitted to 4860// access the 4861// requested course, create announcements in the requested course, share 4862// a 4863// Drive attachment, or for access errors. 4864// * `INVALID_ARGUMENT` if the request is malformed. 4865// * `NOT_FOUND` if the requested course does not exist. 4866// * `FAILED_PRECONDITION` for the following request error: 4867// * AttachmentNotVisible 4868func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall { 4869 c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4870 c.courseId = courseId 4871 c.announcement = announcement 4872 return c 4873} 4874 4875// Fields allows partial responses to be retrieved. See 4876// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4877// for more information. 4878func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall { 4879 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4880 return c 4881} 4882 4883// Context sets the context to be used in this call's Do method. Any 4884// pending HTTP request will be aborted if the provided context is 4885// canceled. 4886func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall { 4887 c.ctx_ = ctx 4888 return c 4889} 4890 4891// Header returns an http.Header that can be modified by the caller to 4892// add HTTP headers to the request. 4893func (c *CoursesAnnouncementsCreateCall) Header() http.Header { 4894 if c.header_ == nil { 4895 c.header_ = make(http.Header) 4896 } 4897 return c.header_ 4898} 4899 4900func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) { 4901 reqHeaders := make(http.Header) 4902 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4903 for k, v := range c.header_ { 4904 reqHeaders[k] = v 4905 } 4906 reqHeaders.Set("User-Agent", c.s.userAgent()) 4907 var body io.Reader = nil 4908 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 4909 if err != nil { 4910 return nil, err 4911 } 4912 reqHeaders.Set("Content-Type", "application/json") 4913 c.urlParams_.Set("alt", alt) 4914 c.urlParams_.Set("prettyPrint", "false") 4915 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 4916 urls += "?" + c.urlParams_.Encode() 4917 req, err := http.NewRequest("POST", urls, body) 4918 if err != nil { 4919 return nil, err 4920 } 4921 req.Header = reqHeaders 4922 googleapi.Expand(req.URL, map[string]string{ 4923 "courseId": c.courseId, 4924 }) 4925 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4926} 4927 4928// Do executes the "classroom.courses.announcements.create" call. 4929// Exactly one of *Announcement or error will be non-nil. Any non-2xx 4930// status code is an error. Response headers are in either 4931// *Announcement.ServerResponse.Header or (if a response was returned at 4932// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4933// to check whether the returned error was because 4934// http.StatusNotModified was returned. 4935func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 4936 gensupport.SetOptions(c.urlParams_, opts...) 4937 res, err := c.doRequest("json") 4938 if res != nil && res.StatusCode == http.StatusNotModified { 4939 if res.Body != nil { 4940 res.Body.Close() 4941 } 4942 return nil, &googleapi.Error{ 4943 Code: res.StatusCode, 4944 Header: res.Header, 4945 } 4946 } 4947 if err != nil { 4948 return nil, err 4949 } 4950 defer googleapi.CloseBody(res) 4951 if err := googleapi.CheckResponse(res); err != nil { 4952 return nil, err 4953 } 4954 ret := &Announcement{ 4955 ServerResponse: googleapi.ServerResponse{ 4956 Header: res.Header, 4957 HTTPStatusCode: res.StatusCode, 4958 }, 4959 } 4960 target := &ret 4961 if err := gensupport.DecodeResponse(target, res); err != nil { 4962 return nil, err 4963 } 4964 return ret, nil 4965 // { 4966 // "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", 4967 // "flatPath": "v1/courses/{courseId}/announcements", 4968 // "httpMethod": "POST", 4969 // "id": "classroom.courses.announcements.create", 4970 // "parameterOrder": [ 4971 // "courseId" 4972 // ], 4973 // "parameters": { 4974 // "courseId": { 4975 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4976 // "location": "path", 4977 // "required": true, 4978 // "type": "string" 4979 // } 4980 // }, 4981 // "path": "v1/courses/{courseId}/announcements", 4982 // "request": { 4983 // "$ref": "Announcement" 4984 // }, 4985 // "response": { 4986 // "$ref": "Announcement" 4987 // }, 4988 // "scopes": [ 4989 // "https://www.googleapis.com/auth/classroom.announcements" 4990 // ] 4991 // } 4992 4993} 4994 4995// method id "classroom.courses.announcements.delete": 4996 4997type CoursesAnnouncementsDeleteCall struct { 4998 s *Service 4999 courseId string 5000 id string 5001 urlParams_ gensupport.URLParams 5002 ctx_ context.Context 5003 header_ http.Header 5004} 5005 5006// Delete: Deletes an announcement. 5007// 5008// This request must be made by the Developer Console project of 5009// the 5010// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5011// used to 5012// create the corresponding announcement item. 5013// 5014// This method returns the following error codes: 5015// 5016// * `PERMISSION_DENIED` if the requesting developer project did not 5017// create 5018// the corresponding announcement, if the requesting user is not 5019// permitted 5020// to delete the requested course or for access errors. 5021// * `FAILED_PRECONDITION` if the requested announcement has already 5022// been 5023// deleted. 5024// * `NOT_FOUND` if no course exists with the requested ID. 5025func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall { 5026 c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5027 c.courseId = courseId 5028 c.id = id 5029 return c 5030} 5031 5032// Fields allows partial responses to be retrieved. See 5033// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5034// for more information. 5035func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall { 5036 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5037 return c 5038} 5039 5040// Context sets the context to be used in this call's Do method. Any 5041// pending HTTP request will be aborted if the provided context is 5042// canceled. 5043func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall { 5044 c.ctx_ = ctx 5045 return c 5046} 5047 5048// Header returns an http.Header that can be modified by the caller to 5049// add HTTP headers to the request. 5050func (c *CoursesAnnouncementsDeleteCall) Header() http.Header { 5051 if c.header_ == nil { 5052 c.header_ = make(http.Header) 5053 } 5054 return c.header_ 5055} 5056 5057func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) { 5058 reqHeaders := make(http.Header) 5059 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5060 for k, v := range c.header_ { 5061 reqHeaders[k] = v 5062 } 5063 reqHeaders.Set("User-Agent", c.s.userAgent()) 5064 var body io.Reader = nil 5065 c.urlParams_.Set("alt", alt) 5066 c.urlParams_.Set("prettyPrint", "false") 5067 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5068 urls += "?" + c.urlParams_.Encode() 5069 req, err := http.NewRequest("DELETE", urls, body) 5070 if err != nil { 5071 return nil, err 5072 } 5073 req.Header = reqHeaders 5074 googleapi.Expand(req.URL, map[string]string{ 5075 "courseId": c.courseId, 5076 "id": c.id, 5077 }) 5078 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5079} 5080 5081// Do executes the "classroom.courses.announcements.delete" call. 5082// Exactly one of *Empty or error will be non-nil. Any non-2xx status 5083// code is an error. Response headers are in either 5084// *Empty.ServerResponse.Header or (if a response was returned at all) 5085// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5086// check whether the returned error was because http.StatusNotModified 5087// was returned. 5088func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 5089 gensupport.SetOptions(c.urlParams_, opts...) 5090 res, err := c.doRequest("json") 5091 if res != nil && res.StatusCode == http.StatusNotModified { 5092 if res.Body != nil { 5093 res.Body.Close() 5094 } 5095 return nil, &googleapi.Error{ 5096 Code: res.StatusCode, 5097 Header: res.Header, 5098 } 5099 } 5100 if err != nil { 5101 return nil, err 5102 } 5103 defer googleapi.CloseBody(res) 5104 if err := googleapi.CheckResponse(res); err != nil { 5105 return nil, err 5106 } 5107 ret := &Empty{ 5108 ServerResponse: googleapi.ServerResponse{ 5109 Header: res.Header, 5110 HTTPStatusCode: res.StatusCode, 5111 }, 5112 } 5113 target := &ret 5114 if err := gensupport.DecodeResponse(target, res); err != nil { 5115 return nil, err 5116 } 5117 return ret, nil 5118 // { 5119 // "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.", 5120 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5121 // "httpMethod": "DELETE", 5122 // "id": "classroom.courses.announcements.delete", 5123 // "parameterOrder": [ 5124 // "courseId", 5125 // "id" 5126 // ], 5127 // "parameters": { 5128 // "courseId": { 5129 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5130 // "location": "path", 5131 // "required": true, 5132 // "type": "string" 5133 // }, 5134 // "id": { 5135 // "description": "Identifier of the announcement to delete.\nThis identifier is a Classroom-assigned identifier.", 5136 // "location": "path", 5137 // "required": true, 5138 // "type": "string" 5139 // } 5140 // }, 5141 // "path": "v1/courses/{courseId}/announcements/{id}", 5142 // "response": { 5143 // "$ref": "Empty" 5144 // }, 5145 // "scopes": [ 5146 // "https://www.googleapis.com/auth/classroom.announcements" 5147 // ] 5148 // } 5149 5150} 5151 5152// method id "classroom.courses.announcements.get": 5153 5154type CoursesAnnouncementsGetCall struct { 5155 s *Service 5156 courseId string 5157 id string 5158 urlParams_ gensupport.URLParams 5159 ifNoneMatch_ string 5160 ctx_ context.Context 5161 header_ http.Header 5162} 5163 5164// Get: Returns an announcement. 5165// 5166// This method returns the following error codes: 5167// 5168// * `PERMISSION_DENIED` if the requesting user is not permitted to 5169// access the 5170// requested course or announcement, or for access errors. 5171// * `INVALID_ARGUMENT` if the request is malformed. 5172// * `NOT_FOUND` if the requested course or announcement does not exist. 5173func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall { 5174 c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5175 c.courseId = courseId 5176 c.id = id 5177 return c 5178} 5179 5180// Fields allows partial responses to be retrieved. See 5181// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5182// for more information. 5183func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall { 5184 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5185 return c 5186} 5187 5188// IfNoneMatch sets the optional parameter which makes the operation 5189// fail if the object's ETag matches the given value. This is useful for 5190// getting updates only after the object has changed since the last 5191// request. Use googleapi.IsNotModified to check whether the response 5192// error from Do is the result of In-None-Match. 5193func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall { 5194 c.ifNoneMatch_ = entityTag 5195 return c 5196} 5197 5198// Context sets the context to be used in this call's Do method. Any 5199// pending HTTP request will be aborted if the provided context is 5200// canceled. 5201func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall { 5202 c.ctx_ = ctx 5203 return c 5204} 5205 5206// Header returns an http.Header that can be modified by the caller to 5207// add HTTP headers to the request. 5208func (c *CoursesAnnouncementsGetCall) Header() http.Header { 5209 if c.header_ == nil { 5210 c.header_ = make(http.Header) 5211 } 5212 return c.header_ 5213} 5214 5215func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) { 5216 reqHeaders := make(http.Header) 5217 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5218 for k, v := range c.header_ { 5219 reqHeaders[k] = v 5220 } 5221 reqHeaders.Set("User-Agent", c.s.userAgent()) 5222 if c.ifNoneMatch_ != "" { 5223 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5224 } 5225 var body io.Reader = nil 5226 c.urlParams_.Set("alt", alt) 5227 c.urlParams_.Set("prettyPrint", "false") 5228 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5229 urls += "?" + c.urlParams_.Encode() 5230 req, err := http.NewRequest("GET", urls, body) 5231 if err != nil { 5232 return nil, err 5233 } 5234 req.Header = reqHeaders 5235 googleapi.Expand(req.URL, map[string]string{ 5236 "courseId": c.courseId, 5237 "id": c.id, 5238 }) 5239 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5240} 5241 5242// Do executes the "classroom.courses.announcements.get" call. 5243// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5244// status code is an error. Response headers are in either 5245// *Announcement.ServerResponse.Header or (if a response was returned at 5246// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5247// to check whether the returned error was because 5248// http.StatusNotModified was returned. 5249func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5250 gensupport.SetOptions(c.urlParams_, opts...) 5251 res, err := c.doRequest("json") 5252 if res != nil && res.StatusCode == http.StatusNotModified { 5253 if res.Body != nil { 5254 res.Body.Close() 5255 } 5256 return nil, &googleapi.Error{ 5257 Code: res.StatusCode, 5258 Header: res.Header, 5259 } 5260 } 5261 if err != nil { 5262 return nil, err 5263 } 5264 defer googleapi.CloseBody(res) 5265 if err := googleapi.CheckResponse(res); err != nil { 5266 return nil, err 5267 } 5268 ret := &Announcement{ 5269 ServerResponse: googleapi.ServerResponse{ 5270 Header: res.Header, 5271 HTTPStatusCode: res.StatusCode, 5272 }, 5273 } 5274 target := &ret 5275 if err := gensupport.DecodeResponse(target, res); err != nil { 5276 return nil, err 5277 } 5278 return ret, nil 5279 // { 5280 // "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.", 5281 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5282 // "httpMethod": "GET", 5283 // "id": "classroom.courses.announcements.get", 5284 // "parameterOrder": [ 5285 // "courseId", 5286 // "id" 5287 // ], 5288 // "parameters": { 5289 // "courseId": { 5290 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5291 // "location": "path", 5292 // "required": true, 5293 // "type": "string" 5294 // }, 5295 // "id": { 5296 // "description": "Identifier of the announcement.", 5297 // "location": "path", 5298 // "required": true, 5299 // "type": "string" 5300 // } 5301 // }, 5302 // "path": "v1/courses/{courseId}/announcements/{id}", 5303 // "response": { 5304 // "$ref": "Announcement" 5305 // }, 5306 // "scopes": [ 5307 // "https://www.googleapis.com/auth/classroom.announcements", 5308 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5309 // ] 5310 // } 5311 5312} 5313 5314// method id "classroom.courses.announcements.list": 5315 5316type CoursesAnnouncementsListCall struct { 5317 s *Service 5318 courseId string 5319 urlParams_ gensupport.URLParams 5320 ifNoneMatch_ string 5321 ctx_ context.Context 5322 header_ http.Header 5323} 5324 5325// List: Returns a list of announcements that the requester is permitted 5326// to view. 5327// 5328// Course students may only view `PUBLISHED` announcements. Course 5329// teachers 5330// and domain administrators may view all announcements. 5331// 5332// This method returns the following error codes: 5333// 5334// * `PERMISSION_DENIED` if the requesting user is not permitted to 5335// access 5336// the requested course or for access errors. 5337// * `INVALID_ARGUMENT` if the request is malformed. 5338// * `NOT_FOUND` if the requested course does not exist. 5339func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall { 5340 c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5341 c.courseId = courseId 5342 return c 5343} 5344 5345// AnnouncementStates sets the optional parameter "announcementStates": 5346// Restriction on the `state` of announcements returned. 5347// If this argument is left unspecified, the default value is 5348// `PUBLISHED`. 5349// 5350// Possible values: 5351// "ANNOUNCEMENT_STATE_UNSPECIFIED" 5352// "PUBLISHED" 5353// "DRAFT" 5354// "DELETED" 5355func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall { 5356 c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...)) 5357 return c 5358} 5359 5360// OrderBy sets the optional parameter "orderBy": Optional sort ordering 5361// for results. A comma-separated list of fields with 5362// an optional sort direction keyword. Supported field is 5363// `updateTime`. 5364// Supported direction keywords are `asc` and `desc`. 5365// If not specified, `updateTime desc` is the default 5366// behavior. 5367// Examples: `updateTime asc`, `updateTime` 5368func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall { 5369 c.urlParams_.Set("orderBy", orderBy) 5370 return c 5371} 5372 5373// PageSize sets the optional parameter "pageSize": Maximum number of 5374// items to return. Zero or unspecified indicates that the 5375// server may assign a maximum. 5376// 5377// The server may return fewer than the specified number of results. 5378func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall { 5379 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5380 return c 5381} 5382 5383// PageToken sets the optional parameter "pageToken": 5384// nextPageToken 5385// value returned from a previous 5386// list call, 5387// indicating that the subsequent page of results should be 5388// returned. 5389// 5390// The list request 5391// must be otherwise identical to the one that resulted in this token. 5392func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall { 5393 c.urlParams_.Set("pageToken", pageToken) 5394 return c 5395} 5396 5397// Fields allows partial responses to be retrieved. See 5398// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5399// for more information. 5400func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall { 5401 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5402 return c 5403} 5404 5405// IfNoneMatch sets the optional parameter which makes the operation 5406// fail if the object's ETag matches the given value. This is useful for 5407// getting updates only after the object has changed since the last 5408// request. Use googleapi.IsNotModified to check whether the response 5409// error from Do is the result of In-None-Match. 5410func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall { 5411 c.ifNoneMatch_ = entityTag 5412 return c 5413} 5414 5415// Context sets the context to be used in this call's Do method. Any 5416// pending HTTP request will be aborted if the provided context is 5417// canceled. 5418func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall { 5419 c.ctx_ = ctx 5420 return c 5421} 5422 5423// Header returns an http.Header that can be modified by the caller to 5424// add HTTP headers to the request. 5425func (c *CoursesAnnouncementsListCall) Header() http.Header { 5426 if c.header_ == nil { 5427 c.header_ = make(http.Header) 5428 } 5429 return c.header_ 5430} 5431 5432func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) { 5433 reqHeaders := make(http.Header) 5434 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5435 for k, v := range c.header_ { 5436 reqHeaders[k] = v 5437 } 5438 reqHeaders.Set("User-Agent", c.s.userAgent()) 5439 if c.ifNoneMatch_ != "" { 5440 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5441 } 5442 var body io.Reader = nil 5443 c.urlParams_.Set("alt", alt) 5444 c.urlParams_.Set("prettyPrint", "false") 5445 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 5446 urls += "?" + c.urlParams_.Encode() 5447 req, err := http.NewRequest("GET", urls, body) 5448 if err != nil { 5449 return nil, err 5450 } 5451 req.Header = reqHeaders 5452 googleapi.Expand(req.URL, map[string]string{ 5453 "courseId": c.courseId, 5454 }) 5455 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5456} 5457 5458// Do executes the "classroom.courses.announcements.list" call. 5459// Exactly one of *ListAnnouncementsResponse or error will be non-nil. 5460// Any non-2xx status code is an error. Response headers are in either 5461// *ListAnnouncementsResponse.ServerResponse.Header or (if a response 5462// was returned at all) in error.(*googleapi.Error).Header. Use 5463// googleapi.IsNotModified to check whether the returned error was 5464// because http.StatusNotModified was returned. 5465func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) { 5466 gensupport.SetOptions(c.urlParams_, opts...) 5467 res, err := c.doRequest("json") 5468 if res != nil && res.StatusCode == http.StatusNotModified { 5469 if res.Body != nil { 5470 res.Body.Close() 5471 } 5472 return nil, &googleapi.Error{ 5473 Code: res.StatusCode, 5474 Header: res.Header, 5475 } 5476 } 5477 if err != nil { 5478 return nil, err 5479 } 5480 defer googleapi.CloseBody(res) 5481 if err := googleapi.CheckResponse(res); err != nil { 5482 return nil, err 5483 } 5484 ret := &ListAnnouncementsResponse{ 5485 ServerResponse: googleapi.ServerResponse{ 5486 Header: res.Header, 5487 HTTPStatusCode: res.StatusCode, 5488 }, 5489 } 5490 target := &ret 5491 if err := gensupport.DecodeResponse(target, res); err != nil { 5492 return nil, err 5493 } 5494 return ret, nil 5495 // { 5496 // "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.", 5497 // "flatPath": "v1/courses/{courseId}/announcements", 5498 // "httpMethod": "GET", 5499 // "id": "classroom.courses.announcements.list", 5500 // "parameterOrder": [ 5501 // "courseId" 5502 // ], 5503 // "parameters": { 5504 // "announcementStates": { 5505 // "description": "Restriction on the `state` of announcements returned.\nIf this argument is left unspecified, the default value is `PUBLISHED`.", 5506 // "enum": [ 5507 // "ANNOUNCEMENT_STATE_UNSPECIFIED", 5508 // "PUBLISHED", 5509 // "DRAFT", 5510 // "DELETED" 5511 // ], 5512 // "location": "query", 5513 // "repeated": true, 5514 // "type": "string" 5515 // }, 5516 // "courseId": { 5517 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5518 // "location": "path", 5519 // "required": true, 5520 // "type": "string" 5521 // }, 5522 // "orderBy": { 5523 // "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`", 5524 // "location": "query", 5525 // "type": "string" 5526 // }, 5527 // "pageSize": { 5528 // "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.", 5529 // "format": "int32", 5530 // "location": "query", 5531 // "type": "integer" 5532 // }, 5533 // "pageToken": { 5534 // "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.", 5535 // "location": "query", 5536 // "type": "string" 5537 // } 5538 // }, 5539 // "path": "v1/courses/{courseId}/announcements", 5540 // "response": { 5541 // "$ref": "ListAnnouncementsResponse" 5542 // }, 5543 // "scopes": [ 5544 // "https://www.googleapis.com/auth/classroom.announcements", 5545 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5546 // ] 5547 // } 5548 5549} 5550 5551// Pages invokes f for each page of results. 5552// A non-nil error returned from f will halt the iteration. 5553// The provided context supersedes any context provided to the Context method. 5554func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error { 5555 c.ctx_ = ctx 5556 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5557 for { 5558 x, err := c.Do() 5559 if err != nil { 5560 return err 5561 } 5562 if err := f(x); err != nil { 5563 return err 5564 } 5565 if x.NextPageToken == "" { 5566 return nil 5567 } 5568 c.PageToken(x.NextPageToken) 5569 } 5570} 5571 5572// method id "classroom.courses.announcements.modifyAssignees": 5573 5574type CoursesAnnouncementsModifyAssigneesCall struct { 5575 s *Service 5576 courseId string 5577 id string 5578 modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest 5579 urlParams_ gensupport.URLParams 5580 ctx_ context.Context 5581 header_ http.Header 5582} 5583 5584// ModifyAssignees: Modifies assignee mode and options of an 5585// announcement. 5586// 5587// Only a teacher of the course that contains the announcement may 5588// call this method. 5589// 5590// This method returns the following error codes: 5591// 5592// * `PERMISSION_DENIED` if the requesting user is not permitted to 5593// access the 5594// requested course or course work or for access errors. 5595// * `INVALID_ARGUMENT` if the request is malformed. 5596// * `NOT_FOUND` if the requested course or course work does not exist. 5597func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall { 5598 c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5599 c.courseId = courseId 5600 c.id = id 5601 c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest 5602 return c 5603} 5604 5605// Fields allows partial responses to be retrieved. See 5606// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5607// for more information. 5608func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall { 5609 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5610 return c 5611} 5612 5613// Context sets the context to be used in this call's Do method. Any 5614// pending HTTP request will be aborted if the provided context is 5615// canceled. 5616func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall { 5617 c.ctx_ = ctx 5618 return c 5619} 5620 5621// Header returns an http.Header that can be modified by the caller to 5622// add HTTP headers to the request. 5623func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header { 5624 if c.header_ == nil { 5625 c.header_ = make(http.Header) 5626 } 5627 return c.header_ 5628} 5629 5630func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 5631 reqHeaders := make(http.Header) 5632 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5633 for k, v := range c.header_ { 5634 reqHeaders[k] = v 5635 } 5636 reqHeaders.Set("User-Agent", c.s.userAgent()) 5637 var body io.Reader = nil 5638 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest) 5639 if err != nil { 5640 return nil, err 5641 } 5642 reqHeaders.Set("Content-Type", "application/json") 5643 c.urlParams_.Set("alt", alt) 5644 c.urlParams_.Set("prettyPrint", "false") 5645 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees") 5646 urls += "?" + c.urlParams_.Encode() 5647 req, err := http.NewRequest("POST", urls, body) 5648 if err != nil { 5649 return nil, err 5650 } 5651 req.Header = reqHeaders 5652 googleapi.Expand(req.URL, map[string]string{ 5653 "courseId": c.courseId, 5654 "id": c.id, 5655 }) 5656 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5657} 5658 5659// Do executes the "classroom.courses.announcements.modifyAssignees" call. 5660// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5661// status code is an error. Response headers are in either 5662// *Announcement.ServerResponse.Header or (if a response was returned at 5663// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5664// to check whether the returned error was because 5665// http.StatusNotModified was returned. 5666func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5667 gensupport.SetOptions(c.urlParams_, opts...) 5668 res, err := c.doRequest("json") 5669 if res != nil && res.StatusCode == http.StatusNotModified { 5670 if res.Body != nil { 5671 res.Body.Close() 5672 } 5673 return nil, &googleapi.Error{ 5674 Code: res.StatusCode, 5675 Header: res.Header, 5676 } 5677 } 5678 if err != nil { 5679 return nil, err 5680 } 5681 defer googleapi.CloseBody(res) 5682 if err := googleapi.CheckResponse(res); err != nil { 5683 return nil, err 5684 } 5685 ret := &Announcement{ 5686 ServerResponse: googleapi.ServerResponse{ 5687 Header: res.Header, 5688 HTTPStatusCode: res.StatusCode, 5689 }, 5690 } 5691 target := &ret 5692 if err := gensupport.DecodeResponse(target, res); err != nil { 5693 return nil, err 5694 } 5695 return ret, nil 5696 // { 5697 // "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.", 5698 // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5699 // "httpMethod": "POST", 5700 // "id": "classroom.courses.announcements.modifyAssignees", 5701 // "parameterOrder": [ 5702 // "courseId", 5703 // "id" 5704 // ], 5705 // "parameters": { 5706 // "courseId": { 5707 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5708 // "location": "path", 5709 // "required": true, 5710 // "type": "string" 5711 // }, 5712 // "id": { 5713 // "description": "Identifier of the announcement.", 5714 // "location": "path", 5715 // "required": true, 5716 // "type": "string" 5717 // } 5718 // }, 5719 // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5720 // "request": { 5721 // "$ref": "ModifyAnnouncementAssigneesRequest" 5722 // }, 5723 // "response": { 5724 // "$ref": "Announcement" 5725 // }, 5726 // "scopes": [ 5727 // "https://www.googleapis.com/auth/classroom.announcements" 5728 // ] 5729 // } 5730 5731} 5732 5733// method id "classroom.courses.announcements.patch": 5734 5735type CoursesAnnouncementsPatchCall struct { 5736 s *Service 5737 courseId string 5738 id string 5739 announcement *Announcement 5740 urlParams_ gensupport.URLParams 5741 ctx_ context.Context 5742 header_ http.Header 5743} 5744 5745// Patch: Updates one or more fields of an announcement. 5746// 5747// This method returns the following error codes: 5748// 5749// * `PERMISSION_DENIED` if the requesting developer project did not 5750// create 5751// the corresponding announcement or for access errors. 5752// * `INVALID_ARGUMENT` if the request is malformed. 5753// * `FAILED_PRECONDITION` if the requested announcement has already 5754// been 5755// deleted. 5756// * `NOT_FOUND` if the requested course or announcement does not exist 5757func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall { 5758 c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5759 c.courseId = courseId 5760 c.id = id 5761 c.announcement = announcement 5762 return c 5763} 5764 5765// UpdateMask sets the optional parameter "updateMask": Mask that 5766// identifies which fields on the announcement to update. 5767// This field is required to do an update. The update fails if 5768// invalid 5769// fields are specified. If a field supports empty values, it can be 5770// cleared 5771// by specifying it in the update mask and not in the Announcement 5772// object. If 5773// a field that does not support empty values is included in the update 5774// mask 5775// and not set in the Announcement object, an `INVALID_ARGUMENT` error 5776// will be 5777// returned. 5778// 5779// The following fields may be specified by teachers: 5780// 5781// * `text` 5782// * `state` 5783// * `scheduled_time` 5784func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall { 5785 c.urlParams_.Set("updateMask", updateMask) 5786 return c 5787} 5788 5789// Fields allows partial responses to be retrieved. See 5790// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5791// for more information. 5792func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall { 5793 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5794 return c 5795} 5796 5797// Context sets the context to be used in this call's Do method. Any 5798// pending HTTP request will be aborted if the provided context is 5799// canceled. 5800func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall { 5801 c.ctx_ = ctx 5802 return c 5803} 5804 5805// Header returns an http.Header that can be modified by the caller to 5806// add HTTP headers to the request. 5807func (c *CoursesAnnouncementsPatchCall) Header() http.Header { 5808 if c.header_ == nil { 5809 c.header_ = make(http.Header) 5810 } 5811 return c.header_ 5812} 5813 5814func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) { 5815 reqHeaders := make(http.Header) 5816 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5817 for k, v := range c.header_ { 5818 reqHeaders[k] = v 5819 } 5820 reqHeaders.Set("User-Agent", c.s.userAgent()) 5821 var body io.Reader = nil 5822 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 5823 if err != nil { 5824 return nil, err 5825 } 5826 reqHeaders.Set("Content-Type", "application/json") 5827 c.urlParams_.Set("alt", alt) 5828 c.urlParams_.Set("prettyPrint", "false") 5829 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5830 urls += "?" + c.urlParams_.Encode() 5831 req, err := http.NewRequest("PATCH", urls, body) 5832 if err != nil { 5833 return nil, err 5834 } 5835 req.Header = reqHeaders 5836 googleapi.Expand(req.URL, map[string]string{ 5837 "courseId": c.courseId, 5838 "id": c.id, 5839 }) 5840 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5841} 5842 5843// Do executes the "classroom.courses.announcements.patch" call. 5844// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5845// status code is an error. Response headers are in either 5846// *Announcement.ServerResponse.Header or (if a response was returned at 5847// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5848// to check whether the returned error was because 5849// http.StatusNotModified was returned. 5850func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5851 gensupport.SetOptions(c.urlParams_, opts...) 5852 res, err := c.doRequest("json") 5853 if res != nil && res.StatusCode == http.StatusNotModified { 5854 if res.Body != nil { 5855 res.Body.Close() 5856 } 5857 return nil, &googleapi.Error{ 5858 Code: res.StatusCode, 5859 Header: res.Header, 5860 } 5861 } 5862 if err != nil { 5863 return nil, err 5864 } 5865 defer googleapi.CloseBody(res) 5866 if err := googleapi.CheckResponse(res); err != nil { 5867 return nil, err 5868 } 5869 ret := &Announcement{ 5870 ServerResponse: googleapi.ServerResponse{ 5871 Header: res.Header, 5872 HTTPStatusCode: res.StatusCode, 5873 }, 5874 } 5875 target := &ret 5876 if err := gensupport.DecodeResponse(target, res); err != nil { 5877 return nil, err 5878 } 5879 return ret, nil 5880 // { 5881 // "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", 5882 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5883 // "httpMethod": "PATCH", 5884 // "id": "classroom.courses.announcements.patch", 5885 // "parameterOrder": [ 5886 // "courseId", 5887 // "id" 5888 // ], 5889 // "parameters": { 5890 // "courseId": { 5891 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5892 // "location": "path", 5893 // "required": true, 5894 // "type": "string" 5895 // }, 5896 // "id": { 5897 // "description": "Identifier of the announcement.", 5898 // "location": "path", 5899 // "required": true, 5900 // "type": "string" 5901 // }, 5902 // "updateMask": { 5903 // "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 will be\nreturned.\n\nThe following fields may be specified by teachers:\n\n* `text`\n* `state`\n* `scheduled_time`", 5904 // "format": "google-fieldmask", 5905 // "location": "query", 5906 // "type": "string" 5907 // } 5908 // }, 5909 // "path": "v1/courses/{courseId}/announcements/{id}", 5910 // "request": { 5911 // "$ref": "Announcement" 5912 // }, 5913 // "response": { 5914 // "$ref": "Announcement" 5915 // }, 5916 // "scopes": [ 5917 // "https://www.googleapis.com/auth/classroom.announcements" 5918 // ] 5919 // } 5920 5921} 5922 5923// method id "classroom.courses.courseWork.create": 5924 5925type CoursesCourseWorkCreateCall struct { 5926 s *Service 5927 courseId string 5928 coursework *CourseWork 5929 urlParams_ gensupport.URLParams 5930 ctx_ context.Context 5931 header_ http.Header 5932} 5933 5934// Create: Creates course work. 5935// 5936// The resulting course work (and corresponding student submissions) 5937// are 5938// associated with the Developer Console project of the 5939// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5940// used to 5941// make the request. Classroom API requests to modify course work and 5942// student 5943// submissions must be made with an OAuth client ID from the 5944// associated 5945// Developer Console project. 5946// 5947// This method returns the following error codes: 5948// 5949// * `PERMISSION_DENIED` if the requesting user is not permitted to 5950// access the 5951// requested course, create course work in the requested course, share 5952// a 5953// Drive attachment, or for access errors. 5954// * `INVALID_ARGUMENT` if the request is malformed. 5955// * `NOT_FOUND` if the requested course does not exist. 5956// * `FAILED_PRECONDITION` for the following request error: 5957// * AttachmentNotVisible 5958func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall { 5959 c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5960 c.courseId = courseId 5961 c.coursework = coursework 5962 return c 5963} 5964 5965// Fields allows partial responses to be retrieved. See 5966// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5967// for more information. 5968func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall { 5969 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5970 return c 5971} 5972 5973// Context sets the context to be used in this call's Do method. Any 5974// pending HTTP request will be aborted if the provided context is 5975// canceled. 5976func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall { 5977 c.ctx_ = ctx 5978 return c 5979} 5980 5981// Header returns an http.Header that can be modified by the caller to 5982// add HTTP headers to the request. 5983func (c *CoursesCourseWorkCreateCall) Header() http.Header { 5984 if c.header_ == nil { 5985 c.header_ = make(http.Header) 5986 } 5987 return c.header_ 5988} 5989 5990func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) { 5991 reqHeaders := make(http.Header) 5992 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5993 for k, v := range c.header_ { 5994 reqHeaders[k] = v 5995 } 5996 reqHeaders.Set("User-Agent", c.s.userAgent()) 5997 var body io.Reader = nil 5998 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 5999 if err != nil { 6000 return nil, err 6001 } 6002 reqHeaders.Set("Content-Type", "application/json") 6003 c.urlParams_.Set("alt", alt) 6004 c.urlParams_.Set("prettyPrint", "false") 6005 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6006 urls += "?" + c.urlParams_.Encode() 6007 req, err := http.NewRequest("POST", urls, body) 6008 if err != nil { 6009 return nil, err 6010 } 6011 req.Header = reqHeaders 6012 googleapi.Expand(req.URL, map[string]string{ 6013 "courseId": c.courseId, 6014 }) 6015 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6016} 6017 6018// Do executes the "classroom.courses.courseWork.create" call. 6019// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6020// status code is an error. Response headers are in either 6021// *CourseWork.ServerResponse.Header or (if a response was returned at 6022// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6023// to check whether the returned error was because 6024// http.StatusNotModified was returned. 6025func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6026 gensupport.SetOptions(c.urlParams_, opts...) 6027 res, err := c.doRequest("json") 6028 if res != nil && res.StatusCode == http.StatusNotModified { 6029 if res.Body != nil { 6030 res.Body.Close() 6031 } 6032 return nil, &googleapi.Error{ 6033 Code: res.StatusCode, 6034 Header: res.Header, 6035 } 6036 } 6037 if err != nil { 6038 return nil, err 6039 } 6040 defer googleapi.CloseBody(res) 6041 if err := googleapi.CheckResponse(res); err != nil { 6042 return nil, err 6043 } 6044 ret := &CourseWork{ 6045 ServerResponse: googleapi.ServerResponse{ 6046 Header: res.Header, 6047 HTTPStatusCode: res.StatusCode, 6048 }, 6049 } 6050 target := &ret 6051 if err := gensupport.DecodeResponse(target, res); err != nil { 6052 return nil, err 6053 } 6054 return ret, nil 6055 // { 6056 // "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", 6057 // "flatPath": "v1/courses/{courseId}/courseWork", 6058 // "httpMethod": "POST", 6059 // "id": "classroom.courses.courseWork.create", 6060 // "parameterOrder": [ 6061 // "courseId" 6062 // ], 6063 // "parameters": { 6064 // "courseId": { 6065 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6066 // "location": "path", 6067 // "required": true, 6068 // "type": "string" 6069 // } 6070 // }, 6071 // "path": "v1/courses/{courseId}/courseWork", 6072 // "request": { 6073 // "$ref": "CourseWork" 6074 // }, 6075 // "response": { 6076 // "$ref": "CourseWork" 6077 // }, 6078 // "scopes": [ 6079 // "https://www.googleapis.com/auth/classroom.coursework.students" 6080 // ] 6081 // } 6082 6083} 6084 6085// method id "classroom.courses.courseWork.delete": 6086 6087type CoursesCourseWorkDeleteCall struct { 6088 s *Service 6089 courseId string 6090 id string 6091 urlParams_ gensupport.URLParams 6092 ctx_ context.Context 6093 header_ http.Header 6094} 6095 6096// Delete: Deletes a course work. 6097// 6098// This request must be made by the Developer Console project of 6099// the 6100// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6101// used to 6102// create the corresponding course work item. 6103// 6104// This method returns the following error codes: 6105// 6106// * `PERMISSION_DENIED` if the requesting developer project did not 6107// create 6108// the corresponding course work, if the requesting user is not 6109// permitted 6110// to delete the requested course or for access errors. 6111// * `FAILED_PRECONDITION` if the requested course work has already 6112// been 6113// deleted. 6114// * `NOT_FOUND` if no course exists with the requested ID. 6115func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall { 6116 c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6117 c.courseId = courseId 6118 c.id = id 6119 return c 6120} 6121 6122// Fields allows partial responses to be retrieved. See 6123// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6124// for more information. 6125func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall { 6126 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6127 return c 6128} 6129 6130// Context sets the context to be used in this call's Do method. Any 6131// pending HTTP request will be aborted if the provided context is 6132// canceled. 6133func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall { 6134 c.ctx_ = ctx 6135 return c 6136} 6137 6138// Header returns an http.Header that can be modified by the caller to 6139// add HTTP headers to the request. 6140func (c *CoursesCourseWorkDeleteCall) Header() http.Header { 6141 if c.header_ == nil { 6142 c.header_ = make(http.Header) 6143 } 6144 return c.header_ 6145} 6146 6147func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) { 6148 reqHeaders := make(http.Header) 6149 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6150 for k, v := range c.header_ { 6151 reqHeaders[k] = v 6152 } 6153 reqHeaders.Set("User-Agent", c.s.userAgent()) 6154 var body io.Reader = nil 6155 c.urlParams_.Set("alt", alt) 6156 c.urlParams_.Set("prettyPrint", "false") 6157 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6158 urls += "?" + c.urlParams_.Encode() 6159 req, err := http.NewRequest("DELETE", urls, body) 6160 if err != nil { 6161 return nil, err 6162 } 6163 req.Header = reqHeaders 6164 googleapi.Expand(req.URL, map[string]string{ 6165 "courseId": c.courseId, 6166 "id": c.id, 6167 }) 6168 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6169} 6170 6171// Do executes the "classroom.courses.courseWork.delete" call. 6172// Exactly one of *Empty or error will be non-nil. Any non-2xx status 6173// code is an error. Response headers are in either 6174// *Empty.ServerResponse.Header or (if a response was returned at all) 6175// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6176// check whether the returned error was because http.StatusNotModified 6177// was returned. 6178func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 6179 gensupport.SetOptions(c.urlParams_, opts...) 6180 res, err := c.doRequest("json") 6181 if res != nil && res.StatusCode == http.StatusNotModified { 6182 if res.Body != nil { 6183 res.Body.Close() 6184 } 6185 return nil, &googleapi.Error{ 6186 Code: res.StatusCode, 6187 Header: res.Header, 6188 } 6189 } 6190 if err != nil { 6191 return nil, err 6192 } 6193 defer googleapi.CloseBody(res) 6194 if err := googleapi.CheckResponse(res); err != nil { 6195 return nil, err 6196 } 6197 ret := &Empty{ 6198 ServerResponse: googleapi.ServerResponse{ 6199 Header: res.Header, 6200 HTTPStatusCode: res.StatusCode, 6201 }, 6202 } 6203 target := &ret 6204 if err := gensupport.DecodeResponse(target, res); err != nil { 6205 return nil, err 6206 } 6207 return ret, nil 6208 // { 6209 // "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.", 6210 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6211 // "httpMethod": "DELETE", 6212 // "id": "classroom.courses.courseWork.delete", 6213 // "parameterOrder": [ 6214 // "courseId", 6215 // "id" 6216 // ], 6217 // "parameters": { 6218 // "courseId": { 6219 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6220 // "location": "path", 6221 // "required": true, 6222 // "type": "string" 6223 // }, 6224 // "id": { 6225 // "description": "Identifier of the course work to delete.\nThis identifier is a Classroom-assigned identifier.", 6226 // "location": "path", 6227 // "required": true, 6228 // "type": "string" 6229 // } 6230 // }, 6231 // "path": "v1/courses/{courseId}/courseWork/{id}", 6232 // "response": { 6233 // "$ref": "Empty" 6234 // }, 6235 // "scopes": [ 6236 // "https://www.googleapis.com/auth/classroom.coursework.students" 6237 // ] 6238 // } 6239 6240} 6241 6242// method id "classroom.courses.courseWork.get": 6243 6244type CoursesCourseWorkGetCall struct { 6245 s *Service 6246 courseId string 6247 id string 6248 urlParams_ gensupport.URLParams 6249 ifNoneMatch_ string 6250 ctx_ context.Context 6251 header_ http.Header 6252} 6253 6254// Get: Returns course work. 6255// 6256// This method returns the following error codes: 6257// 6258// * `PERMISSION_DENIED` if the requesting user is not permitted to 6259// access the 6260// requested course or course work, or for access errors. 6261// * `INVALID_ARGUMENT` if the request is malformed. 6262// * `NOT_FOUND` if the requested course or course work does not exist. 6263func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall { 6264 c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6265 c.courseId = courseId 6266 c.id = id 6267 return c 6268} 6269 6270// Fields allows partial responses to be retrieved. See 6271// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6272// for more information. 6273func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall { 6274 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6275 return c 6276} 6277 6278// IfNoneMatch sets the optional parameter which makes the operation 6279// fail if the object's ETag matches the given value. This is useful for 6280// getting updates only after the object has changed since the last 6281// request. Use googleapi.IsNotModified to check whether the response 6282// error from Do is the result of In-None-Match. 6283func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall { 6284 c.ifNoneMatch_ = entityTag 6285 return c 6286} 6287 6288// Context sets the context to be used in this call's Do method. Any 6289// pending HTTP request will be aborted if the provided context is 6290// canceled. 6291func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall { 6292 c.ctx_ = ctx 6293 return c 6294} 6295 6296// Header returns an http.Header that can be modified by the caller to 6297// add HTTP headers to the request. 6298func (c *CoursesCourseWorkGetCall) Header() http.Header { 6299 if c.header_ == nil { 6300 c.header_ = make(http.Header) 6301 } 6302 return c.header_ 6303} 6304 6305func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) { 6306 reqHeaders := make(http.Header) 6307 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6308 for k, v := range c.header_ { 6309 reqHeaders[k] = v 6310 } 6311 reqHeaders.Set("User-Agent", c.s.userAgent()) 6312 if c.ifNoneMatch_ != "" { 6313 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6314 } 6315 var body io.Reader = nil 6316 c.urlParams_.Set("alt", alt) 6317 c.urlParams_.Set("prettyPrint", "false") 6318 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6319 urls += "?" + c.urlParams_.Encode() 6320 req, err := http.NewRequest("GET", urls, body) 6321 if err != nil { 6322 return nil, err 6323 } 6324 req.Header = reqHeaders 6325 googleapi.Expand(req.URL, map[string]string{ 6326 "courseId": c.courseId, 6327 "id": c.id, 6328 }) 6329 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6330} 6331 6332// Do executes the "classroom.courses.courseWork.get" call. 6333// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6334// status code is an error. Response headers are in either 6335// *CourseWork.ServerResponse.Header or (if a response was returned at 6336// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6337// to check whether the returned error was because 6338// http.StatusNotModified was returned. 6339func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6340 gensupport.SetOptions(c.urlParams_, opts...) 6341 res, err := c.doRequest("json") 6342 if res != nil && res.StatusCode == http.StatusNotModified { 6343 if res.Body != nil { 6344 res.Body.Close() 6345 } 6346 return nil, &googleapi.Error{ 6347 Code: res.StatusCode, 6348 Header: res.Header, 6349 } 6350 } 6351 if err != nil { 6352 return nil, err 6353 } 6354 defer googleapi.CloseBody(res) 6355 if err := googleapi.CheckResponse(res); err != nil { 6356 return nil, err 6357 } 6358 ret := &CourseWork{ 6359 ServerResponse: googleapi.ServerResponse{ 6360 Header: res.Header, 6361 HTTPStatusCode: res.StatusCode, 6362 }, 6363 } 6364 target := &ret 6365 if err := gensupport.DecodeResponse(target, res); err != nil { 6366 return nil, err 6367 } 6368 return ret, nil 6369 // { 6370 // "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.", 6371 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6372 // "httpMethod": "GET", 6373 // "id": "classroom.courses.courseWork.get", 6374 // "parameterOrder": [ 6375 // "courseId", 6376 // "id" 6377 // ], 6378 // "parameters": { 6379 // "courseId": { 6380 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6381 // "location": "path", 6382 // "required": true, 6383 // "type": "string" 6384 // }, 6385 // "id": { 6386 // "description": "Identifier of the course work.", 6387 // "location": "path", 6388 // "required": true, 6389 // "type": "string" 6390 // } 6391 // }, 6392 // "path": "v1/courses/{courseId}/courseWork/{id}", 6393 // "response": { 6394 // "$ref": "CourseWork" 6395 // }, 6396 // "scopes": [ 6397 // "https://www.googleapis.com/auth/classroom.coursework.me", 6398 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6399 // "https://www.googleapis.com/auth/classroom.coursework.students", 6400 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6401 // ] 6402 // } 6403 6404} 6405 6406// method id "classroom.courses.courseWork.list": 6407 6408type CoursesCourseWorkListCall struct { 6409 s *Service 6410 courseId string 6411 urlParams_ gensupport.URLParams 6412 ifNoneMatch_ string 6413 ctx_ context.Context 6414 header_ http.Header 6415} 6416 6417// List: Returns a list of course work that the requester is permitted 6418// to view. 6419// 6420// Course students may only view `PUBLISHED` course work. Course 6421// teachers 6422// and domain administrators may view all course work. 6423// 6424// This method returns the following error codes: 6425// 6426// * `PERMISSION_DENIED` if the requesting user is not permitted to 6427// access 6428// the requested course or for access errors. 6429// * `INVALID_ARGUMENT` if the request is malformed. 6430// * `NOT_FOUND` if the requested course does not exist. 6431func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall { 6432 c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6433 c.courseId = courseId 6434 return c 6435} 6436 6437// CourseWorkStates sets the optional parameter "courseWorkStates": 6438// Restriction on the work status to return. Only courseWork that 6439// matches 6440// is returned. If unspecified, items with a work status of 6441// `PUBLISHED` 6442// is returned. 6443// 6444// Possible values: 6445// "COURSE_WORK_STATE_UNSPECIFIED" 6446// "PUBLISHED" 6447// "DRAFT" 6448// "DELETED" 6449func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall { 6450 c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...)) 6451 return c 6452} 6453 6454// OrderBy sets the optional parameter "orderBy": Optional sort ordering 6455// for results. A comma-separated list of fields with 6456// an optional sort direction keyword. Supported fields are 6457// `updateTime` 6458// and `dueDate`. Supported direction keywords are `asc` and `desc`. 6459// If not specified, `updateTime desc` is the default 6460// behavior. 6461// Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc` 6462func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall { 6463 c.urlParams_.Set("orderBy", orderBy) 6464 return c 6465} 6466 6467// PageSize sets the optional parameter "pageSize": Maximum number of 6468// items to return. Zero or unspecified indicates that the 6469// server may assign a maximum. 6470// 6471// The server may return fewer than the specified number of results. 6472func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall { 6473 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6474 return c 6475} 6476 6477// PageToken sets the optional parameter "pageToken": 6478// nextPageToken 6479// value returned from a previous 6480// list call, 6481// indicating that the subsequent page of results should be 6482// returned. 6483// 6484// The list request 6485// must be otherwise identical to the one that resulted in this token. 6486func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall { 6487 c.urlParams_.Set("pageToken", pageToken) 6488 return c 6489} 6490 6491// Fields allows partial responses to be retrieved. See 6492// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6493// for more information. 6494func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall { 6495 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6496 return c 6497} 6498 6499// IfNoneMatch sets the optional parameter which makes the operation 6500// fail if the object's ETag matches the given value. This is useful for 6501// getting updates only after the object has changed since the last 6502// request. Use googleapi.IsNotModified to check whether the response 6503// error from Do is the result of In-None-Match. 6504func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall { 6505 c.ifNoneMatch_ = entityTag 6506 return c 6507} 6508 6509// Context sets the context to be used in this call's Do method. Any 6510// pending HTTP request will be aborted if the provided context is 6511// canceled. 6512func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall { 6513 c.ctx_ = ctx 6514 return c 6515} 6516 6517// Header returns an http.Header that can be modified by the caller to 6518// add HTTP headers to the request. 6519func (c *CoursesCourseWorkListCall) Header() http.Header { 6520 if c.header_ == nil { 6521 c.header_ = make(http.Header) 6522 } 6523 return c.header_ 6524} 6525 6526func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) { 6527 reqHeaders := make(http.Header) 6528 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6529 for k, v := range c.header_ { 6530 reqHeaders[k] = v 6531 } 6532 reqHeaders.Set("User-Agent", c.s.userAgent()) 6533 if c.ifNoneMatch_ != "" { 6534 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6535 } 6536 var body io.Reader = nil 6537 c.urlParams_.Set("alt", alt) 6538 c.urlParams_.Set("prettyPrint", "false") 6539 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6540 urls += "?" + c.urlParams_.Encode() 6541 req, err := http.NewRequest("GET", urls, body) 6542 if err != nil { 6543 return nil, err 6544 } 6545 req.Header = reqHeaders 6546 googleapi.Expand(req.URL, map[string]string{ 6547 "courseId": c.courseId, 6548 }) 6549 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6550} 6551 6552// Do executes the "classroom.courses.courseWork.list" call. 6553// Exactly one of *ListCourseWorkResponse or error will be non-nil. Any 6554// non-2xx status code is an error. Response headers are in either 6555// *ListCourseWorkResponse.ServerResponse.Header or (if a response was 6556// returned at all) in error.(*googleapi.Error).Header. Use 6557// googleapi.IsNotModified to check whether the returned error was 6558// because http.StatusNotModified was returned. 6559func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) { 6560 gensupport.SetOptions(c.urlParams_, opts...) 6561 res, err := c.doRequest("json") 6562 if res != nil && res.StatusCode == http.StatusNotModified { 6563 if res.Body != nil { 6564 res.Body.Close() 6565 } 6566 return nil, &googleapi.Error{ 6567 Code: res.StatusCode, 6568 Header: res.Header, 6569 } 6570 } 6571 if err != nil { 6572 return nil, err 6573 } 6574 defer googleapi.CloseBody(res) 6575 if err := googleapi.CheckResponse(res); err != nil { 6576 return nil, err 6577 } 6578 ret := &ListCourseWorkResponse{ 6579 ServerResponse: googleapi.ServerResponse{ 6580 Header: res.Header, 6581 HTTPStatusCode: res.StatusCode, 6582 }, 6583 } 6584 target := &ret 6585 if err := gensupport.DecodeResponse(target, res); err != nil { 6586 return nil, err 6587 } 6588 return ret, nil 6589 // { 6590 // "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.", 6591 // "flatPath": "v1/courses/{courseId}/courseWork", 6592 // "httpMethod": "GET", 6593 // "id": "classroom.courses.courseWork.list", 6594 // "parameterOrder": [ 6595 // "courseId" 6596 // ], 6597 // "parameters": { 6598 // "courseId": { 6599 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6600 // "location": "path", 6601 // "required": true, 6602 // "type": "string" 6603 // }, 6604 // "courseWorkStates": { 6605 // "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.", 6606 // "enum": [ 6607 // "COURSE_WORK_STATE_UNSPECIFIED", 6608 // "PUBLISHED", 6609 // "DRAFT", 6610 // "DELETED" 6611 // ], 6612 // "location": "query", 6613 // "repeated": true, 6614 // "type": "string" 6615 // }, 6616 // "orderBy": { 6617 // "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`", 6618 // "location": "query", 6619 // "type": "string" 6620 // }, 6621 // "pageSize": { 6622 // "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.", 6623 // "format": "int32", 6624 // "location": "query", 6625 // "type": "integer" 6626 // }, 6627 // "pageToken": { 6628 // "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.", 6629 // "location": "query", 6630 // "type": "string" 6631 // } 6632 // }, 6633 // "path": "v1/courses/{courseId}/courseWork", 6634 // "response": { 6635 // "$ref": "ListCourseWorkResponse" 6636 // }, 6637 // "scopes": [ 6638 // "https://www.googleapis.com/auth/classroom.coursework.me", 6639 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6640 // "https://www.googleapis.com/auth/classroom.coursework.students", 6641 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6642 // ] 6643 // } 6644 6645} 6646 6647// Pages invokes f for each page of results. 6648// A non-nil error returned from f will halt the iteration. 6649// The provided context supersedes any context provided to the Context method. 6650func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error { 6651 c.ctx_ = ctx 6652 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6653 for { 6654 x, err := c.Do() 6655 if err != nil { 6656 return err 6657 } 6658 if err := f(x); err != nil { 6659 return err 6660 } 6661 if x.NextPageToken == "" { 6662 return nil 6663 } 6664 c.PageToken(x.NextPageToken) 6665 } 6666} 6667 6668// method id "classroom.courses.courseWork.modifyAssignees": 6669 6670type CoursesCourseWorkModifyAssigneesCall struct { 6671 s *Service 6672 courseId string 6673 id string 6674 modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest 6675 urlParams_ gensupport.URLParams 6676 ctx_ context.Context 6677 header_ http.Header 6678} 6679 6680// ModifyAssignees: Modifies assignee mode and options of a 6681// coursework. 6682// 6683// Only a teacher of the course that contains the coursework may 6684// call this method. 6685// 6686// This method returns the following error codes: 6687// 6688// * `PERMISSION_DENIED` if the requesting user is not permitted to 6689// access the 6690// requested course or course work or for access errors. 6691// * `INVALID_ARGUMENT` if the request is malformed. 6692// * `NOT_FOUND` if the requested course or course work does not exist. 6693func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall { 6694 c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6695 c.courseId = courseId 6696 c.id = id 6697 c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest 6698 return c 6699} 6700 6701// Fields allows partial responses to be retrieved. See 6702// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6703// for more information. 6704func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall { 6705 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6706 return c 6707} 6708 6709// Context sets the context to be used in this call's Do method. Any 6710// pending HTTP request will be aborted if the provided context is 6711// canceled. 6712func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall { 6713 c.ctx_ = ctx 6714 return c 6715} 6716 6717// Header returns an http.Header that can be modified by the caller to 6718// add HTTP headers to the request. 6719func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header { 6720 if c.header_ == nil { 6721 c.header_ = make(http.Header) 6722 } 6723 return c.header_ 6724} 6725 6726func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 6727 reqHeaders := make(http.Header) 6728 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6729 for k, v := range c.header_ { 6730 reqHeaders[k] = v 6731 } 6732 reqHeaders.Set("User-Agent", c.s.userAgent()) 6733 var body io.Reader = nil 6734 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest) 6735 if err != nil { 6736 return nil, err 6737 } 6738 reqHeaders.Set("Content-Type", "application/json") 6739 c.urlParams_.Set("alt", alt) 6740 c.urlParams_.Set("prettyPrint", "false") 6741 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees") 6742 urls += "?" + c.urlParams_.Encode() 6743 req, err := http.NewRequest("POST", urls, body) 6744 if err != nil { 6745 return nil, err 6746 } 6747 req.Header = reqHeaders 6748 googleapi.Expand(req.URL, map[string]string{ 6749 "courseId": c.courseId, 6750 "id": c.id, 6751 }) 6752 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6753} 6754 6755// Do executes the "classroom.courses.courseWork.modifyAssignees" call. 6756// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6757// status code is an error. Response headers are in either 6758// *CourseWork.ServerResponse.Header or (if a response was returned at 6759// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6760// to check whether the returned error was because 6761// http.StatusNotModified was returned. 6762func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6763 gensupport.SetOptions(c.urlParams_, opts...) 6764 res, err := c.doRequest("json") 6765 if res != nil && res.StatusCode == http.StatusNotModified { 6766 if res.Body != nil { 6767 res.Body.Close() 6768 } 6769 return nil, &googleapi.Error{ 6770 Code: res.StatusCode, 6771 Header: res.Header, 6772 } 6773 } 6774 if err != nil { 6775 return nil, err 6776 } 6777 defer googleapi.CloseBody(res) 6778 if err := googleapi.CheckResponse(res); err != nil { 6779 return nil, err 6780 } 6781 ret := &CourseWork{ 6782 ServerResponse: googleapi.ServerResponse{ 6783 Header: res.Header, 6784 HTTPStatusCode: res.StatusCode, 6785 }, 6786 } 6787 target := &ret 6788 if err := gensupport.DecodeResponse(target, res); err != nil { 6789 return nil, err 6790 } 6791 return ret, nil 6792 // { 6793 // "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.", 6794 // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6795 // "httpMethod": "POST", 6796 // "id": "classroom.courses.courseWork.modifyAssignees", 6797 // "parameterOrder": [ 6798 // "courseId", 6799 // "id" 6800 // ], 6801 // "parameters": { 6802 // "courseId": { 6803 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6804 // "location": "path", 6805 // "required": true, 6806 // "type": "string" 6807 // }, 6808 // "id": { 6809 // "description": "Identifier of the coursework.", 6810 // "location": "path", 6811 // "required": true, 6812 // "type": "string" 6813 // } 6814 // }, 6815 // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6816 // "request": { 6817 // "$ref": "ModifyCourseWorkAssigneesRequest" 6818 // }, 6819 // "response": { 6820 // "$ref": "CourseWork" 6821 // }, 6822 // "scopes": [ 6823 // "https://www.googleapis.com/auth/classroom.coursework.students" 6824 // ] 6825 // } 6826 6827} 6828 6829// method id "classroom.courses.courseWork.patch": 6830 6831type CoursesCourseWorkPatchCall struct { 6832 s *Service 6833 courseId string 6834 id string 6835 coursework *CourseWork 6836 urlParams_ gensupport.URLParams 6837 ctx_ context.Context 6838 header_ http.Header 6839} 6840 6841// Patch: Updates one or more fields of a course work. 6842// 6843// See google.classroom.v1.CourseWork for details 6844// of which fields may be updated and who may change them. 6845// 6846// This request must be made by the Developer Console project of 6847// the 6848// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6849// used to 6850// create the corresponding course work item. 6851// 6852// This method returns the following error codes: 6853// 6854// * `PERMISSION_DENIED` if the requesting developer project did not 6855// create 6856// the corresponding course work, if the user is not permitted to make 6857// the 6858// requested modification to the student submission, or for 6859// access errors. 6860// * `INVALID_ARGUMENT` if the request is malformed. 6861// * `FAILED_PRECONDITION` if the requested course work has already 6862// been 6863// deleted. 6864// * `NOT_FOUND` if the requested course, course work, or student 6865// submission 6866// does not exist. 6867func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall { 6868 c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6869 c.courseId = courseId 6870 c.id = id 6871 c.coursework = coursework 6872 return c 6873} 6874 6875// UpdateMask sets the optional parameter "updateMask": Mask that 6876// identifies which fields on the course work to update. 6877// This field is required to do an update. The update fails if 6878// invalid 6879// fields are specified. If a field supports empty values, it can be 6880// cleared 6881// by specifying it in the update mask and not in the CourseWork object. 6882// If a 6883// field that does not support empty values is included in the update 6884// mask and 6885// not set in the CourseWork object, an `INVALID_ARGUMENT` error will 6886// be 6887// returned. 6888// 6889// The following fields may be specified by teachers: 6890// 6891// * `title` 6892// * `description` 6893// * `state` 6894// * `due_date` 6895// * `due_time` 6896// * `max_points` 6897// * `scheduled_time` 6898// * `submission_modification_mode` 6899// * `topic_id` 6900func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall { 6901 c.urlParams_.Set("updateMask", updateMask) 6902 return c 6903} 6904 6905// Fields allows partial responses to be retrieved. See 6906// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6907// for more information. 6908func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall { 6909 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6910 return c 6911} 6912 6913// Context sets the context to be used in this call's Do method. Any 6914// pending HTTP request will be aborted if the provided context is 6915// canceled. 6916func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall { 6917 c.ctx_ = ctx 6918 return c 6919} 6920 6921// Header returns an http.Header that can be modified by the caller to 6922// add HTTP headers to the request. 6923func (c *CoursesCourseWorkPatchCall) Header() http.Header { 6924 if c.header_ == nil { 6925 c.header_ = make(http.Header) 6926 } 6927 return c.header_ 6928} 6929 6930func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) { 6931 reqHeaders := make(http.Header) 6932 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6933 for k, v := range c.header_ { 6934 reqHeaders[k] = v 6935 } 6936 reqHeaders.Set("User-Agent", c.s.userAgent()) 6937 var body io.Reader = nil 6938 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6939 if err != nil { 6940 return nil, err 6941 } 6942 reqHeaders.Set("Content-Type", "application/json") 6943 c.urlParams_.Set("alt", alt) 6944 c.urlParams_.Set("prettyPrint", "false") 6945 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6946 urls += "?" + c.urlParams_.Encode() 6947 req, err := http.NewRequest("PATCH", urls, body) 6948 if err != nil { 6949 return nil, err 6950 } 6951 req.Header = reqHeaders 6952 googleapi.Expand(req.URL, map[string]string{ 6953 "courseId": c.courseId, 6954 "id": c.id, 6955 }) 6956 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6957} 6958 6959// Do executes the "classroom.courses.courseWork.patch" call. 6960// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6961// status code is an error. Response headers are in either 6962// *CourseWork.ServerResponse.Header or (if a response was returned at 6963// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6964// to check whether the returned error was because 6965// http.StatusNotModified was returned. 6966func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6967 gensupport.SetOptions(c.urlParams_, opts...) 6968 res, err := c.doRequest("json") 6969 if res != nil && res.StatusCode == http.StatusNotModified { 6970 if res.Body != nil { 6971 res.Body.Close() 6972 } 6973 return nil, &googleapi.Error{ 6974 Code: res.StatusCode, 6975 Header: res.Header, 6976 } 6977 } 6978 if err != nil { 6979 return nil, err 6980 } 6981 defer googleapi.CloseBody(res) 6982 if err := googleapi.CheckResponse(res); err != nil { 6983 return nil, err 6984 } 6985 ret := &CourseWork{ 6986 ServerResponse: googleapi.ServerResponse{ 6987 Header: res.Header, 6988 HTTPStatusCode: res.StatusCode, 6989 }, 6990 } 6991 target := &ret 6992 if err := gensupport.DecodeResponse(target, res); err != nil { 6993 return nil, err 6994 } 6995 return ret, nil 6996 // { 6997 // "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.", 6998 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6999 // "httpMethod": "PATCH", 7000 // "id": "classroom.courses.courseWork.patch", 7001 // "parameterOrder": [ 7002 // "courseId", 7003 // "id" 7004 // ], 7005 // "parameters": { 7006 // "courseId": { 7007 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7008 // "location": "path", 7009 // "required": true, 7010 // "type": "string" 7011 // }, 7012 // "id": { 7013 // "description": "Identifier of the course work.", 7014 // "location": "path", 7015 // "required": true, 7016 // "type": "string" 7017 // }, 7018 // "updateMask": { 7019 // "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 will be\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`", 7020 // "format": "google-fieldmask", 7021 // "location": "query", 7022 // "type": "string" 7023 // } 7024 // }, 7025 // "path": "v1/courses/{courseId}/courseWork/{id}", 7026 // "request": { 7027 // "$ref": "CourseWork" 7028 // }, 7029 // "response": { 7030 // "$ref": "CourseWork" 7031 // }, 7032 // "scopes": [ 7033 // "https://www.googleapis.com/auth/classroom.coursework.students" 7034 // ] 7035 // } 7036 7037} 7038 7039// method id "classroom.courses.courseWork.studentSubmissions.get": 7040 7041type CoursesCourseWorkStudentSubmissionsGetCall struct { 7042 s *Service 7043 courseId string 7044 courseWorkId string 7045 id string 7046 urlParams_ gensupport.URLParams 7047 ifNoneMatch_ string 7048 ctx_ context.Context 7049 header_ http.Header 7050} 7051 7052// Get: Returns a student submission. 7053// 7054// * `PERMISSION_DENIED` if the requesting user is not permitted to 7055// access the 7056// requested course, course work, or student submission or for 7057// access errors. 7058// * `INVALID_ARGUMENT` if the request is malformed. 7059// * `NOT_FOUND` if the requested course, course work, or student 7060// submission 7061// does not exist. 7062func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall { 7063 c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7064 c.courseId = courseId 7065 c.courseWorkId = courseWorkId 7066 c.id = id 7067 return c 7068} 7069 7070// Fields allows partial responses to be retrieved. See 7071// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7072// for more information. 7073func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall { 7074 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7075 return c 7076} 7077 7078// IfNoneMatch sets the optional parameter which makes the operation 7079// fail if the object's ETag matches the given value. This is useful for 7080// getting updates only after the object has changed since the last 7081// request. Use googleapi.IsNotModified to check whether the response 7082// error from Do is the result of In-None-Match. 7083func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall { 7084 c.ifNoneMatch_ = entityTag 7085 return c 7086} 7087 7088// Context sets the context to be used in this call's Do method. Any 7089// pending HTTP request will be aborted if the provided context is 7090// canceled. 7091func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall { 7092 c.ctx_ = ctx 7093 return c 7094} 7095 7096// Header returns an http.Header that can be modified by the caller to 7097// add HTTP headers to the request. 7098func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header { 7099 if c.header_ == nil { 7100 c.header_ = make(http.Header) 7101 } 7102 return c.header_ 7103} 7104 7105func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) { 7106 reqHeaders := make(http.Header) 7107 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7108 for k, v := range c.header_ { 7109 reqHeaders[k] = v 7110 } 7111 reqHeaders.Set("User-Agent", c.s.userAgent()) 7112 if c.ifNoneMatch_ != "" { 7113 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7114 } 7115 var body io.Reader = nil 7116 c.urlParams_.Set("alt", alt) 7117 c.urlParams_.Set("prettyPrint", "false") 7118 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7119 urls += "?" + c.urlParams_.Encode() 7120 req, err := http.NewRequest("GET", urls, body) 7121 if err != nil { 7122 return nil, err 7123 } 7124 req.Header = reqHeaders 7125 googleapi.Expand(req.URL, map[string]string{ 7126 "courseId": c.courseId, 7127 "courseWorkId": c.courseWorkId, 7128 "id": c.id, 7129 }) 7130 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7131} 7132 7133// Do executes the "classroom.courses.courseWork.studentSubmissions.get" call. 7134// Exactly one of *StudentSubmission or error will be non-nil. Any 7135// non-2xx status code is an error. Response headers are in either 7136// *StudentSubmission.ServerResponse.Header or (if a response was 7137// returned at all) in error.(*googleapi.Error).Header. Use 7138// googleapi.IsNotModified to check whether the returned error was 7139// because http.StatusNotModified was returned. 7140func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7141 gensupport.SetOptions(c.urlParams_, opts...) 7142 res, err := c.doRequest("json") 7143 if res != nil && res.StatusCode == http.StatusNotModified { 7144 if res.Body != nil { 7145 res.Body.Close() 7146 } 7147 return nil, &googleapi.Error{ 7148 Code: res.StatusCode, 7149 Header: res.Header, 7150 } 7151 } 7152 if err != nil { 7153 return nil, err 7154 } 7155 defer googleapi.CloseBody(res) 7156 if err := googleapi.CheckResponse(res); err != nil { 7157 return nil, err 7158 } 7159 ret := &StudentSubmission{ 7160 ServerResponse: googleapi.ServerResponse{ 7161 Header: res.Header, 7162 HTTPStatusCode: res.StatusCode, 7163 }, 7164 } 7165 target := &ret 7166 if err := gensupport.DecodeResponse(target, res); err != nil { 7167 return nil, err 7168 } 7169 return ret, nil 7170 // { 7171 // "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.", 7172 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7173 // "httpMethod": "GET", 7174 // "id": "classroom.courses.courseWork.studentSubmissions.get", 7175 // "parameterOrder": [ 7176 // "courseId", 7177 // "courseWorkId", 7178 // "id" 7179 // ], 7180 // "parameters": { 7181 // "courseId": { 7182 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7183 // "location": "path", 7184 // "required": true, 7185 // "type": "string" 7186 // }, 7187 // "courseWorkId": { 7188 // "description": "Identifier of the course work.", 7189 // "location": "path", 7190 // "required": true, 7191 // "type": "string" 7192 // }, 7193 // "id": { 7194 // "description": "Identifier of the student submission.", 7195 // "location": "path", 7196 // "required": true, 7197 // "type": "string" 7198 // } 7199 // }, 7200 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7201 // "response": { 7202 // "$ref": "StudentSubmission" 7203 // }, 7204 // "scopes": [ 7205 // "https://www.googleapis.com/auth/classroom.coursework.me", 7206 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7207 // "https://www.googleapis.com/auth/classroom.coursework.students", 7208 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7209 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7210 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7211 // ] 7212 // } 7213 7214} 7215 7216// method id "classroom.courses.courseWork.studentSubmissions.list": 7217 7218type CoursesCourseWorkStudentSubmissionsListCall struct { 7219 s *Service 7220 courseId string 7221 courseWorkId string 7222 urlParams_ gensupport.URLParams 7223 ifNoneMatch_ string 7224 ctx_ context.Context 7225 header_ http.Header 7226} 7227 7228// List: Returns a list of student submissions that the requester is 7229// permitted to 7230// view, factoring in the OAuth scopes of the request. 7231// `-` may be specified as the `course_work_id` to include 7232// student 7233// submissions for multiple course work items. 7234// 7235// Course students may only view their own work. Course teachers 7236// and domain administrators may view all student submissions. 7237// 7238// This method returns the following error codes: 7239// 7240// * `PERMISSION_DENIED` if the requesting user is not permitted to 7241// access the 7242// requested course or course work, or for access errors. 7243// * `INVALID_ARGUMENT` if the request is malformed. 7244// * `NOT_FOUND` if the requested course does not exist. 7245func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall { 7246 c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7247 c.courseId = courseId 7248 c.courseWorkId = courseWorkId 7249 return c 7250} 7251 7252// Late sets the optional parameter "late": Requested lateness value. If 7253// specified, returned student submissions are 7254// restricted by the requested value. 7255// If unspecified, submissions are returned regardless of `late` value. 7256// 7257// Possible values: 7258// "LATE_VALUES_UNSPECIFIED" 7259// "LATE_ONLY" 7260// "NOT_LATE_ONLY" 7261func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall { 7262 c.urlParams_.Set("late", late) 7263 return c 7264} 7265 7266// PageSize sets the optional parameter "pageSize": Maximum number of 7267// items to return. Zero or unspecified indicates that the 7268// server may assign a maximum. 7269// 7270// The server may return fewer than the specified number of results. 7271func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall { 7272 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 7273 return c 7274} 7275 7276// PageToken sets the optional parameter "pageToken": 7277// nextPageToken 7278// value returned from a previous 7279// list call, 7280// indicating that the subsequent page of results should be 7281// returned. 7282// 7283// The list request 7284// must be otherwise identical to the one that resulted in this token. 7285func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall { 7286 c.urlParams_.Set("pageToken", pageToken) 7287 return c 7288} 7289 7290// States sets the optional parameter "states": Requested submission 7291// states. If specified, returned student submissions 7292// match one of the specified submission states. 7293// 7294// Possible values: 7295// "SUBMISSION_STATE_UNSPECIFIED" 7296// "NEW" 7297// "CREATED" 7298// "TURNED_IN" 7299// "RETURNED" 7300// "RECLAIMED_BY_STUDENT" 7301func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall { 7302 c.urlParams_.SetMulti("states", append([]string{}, states...)) 7303 return c 7304} 7305 7306// UserId sets the optional parameter "userId": Optional argument to 7307// restrict returned student work to those owned by the 7308// student with the specified identifier. The identifier can be one of 7309// the 7310// following: 7311// 7312// * the numeric identifier for the user 7313// * the email address of the user 7314// * the string literal "me", indicating the requesting user 7315func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall { 7316 c.urlParams_.Set("userId", userId) 7317 return c 7318} 7319 7320// Fields allows partial responses to be retrieved. See 7321// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7322// for more information. 7323func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall { 7324 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7325 return c 7326} 7327 7328// IfNoneMatch sets the optional parameter which makes the operation 7329// fail if the object's ETag matches the given value. This is useful for 7330// getting updates only after the object has changed since the last 7331// request. Use googleapi.IsNotModified to check whether the response 7332// error from Do is the result of In-None-Match. 7333func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall { 7334 c.ifNoneMatch_ = entityTag 7335 return c 7336} 7337 7338// Context sets the context to be used in this call's Do method. Any 7339// pending HTTP request will be aborted if the provided context is 7340// canceled. 7341func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall { 7342 c.ctx_ = ctx 7343 return c 7344} 7345 7346// Header returns an http.Header that can be modified by the caller to 7347// add HTTP headers to the request. 7348func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header { 7349 if c.header_ == nil { 7350 c.header_ = make(http.Header) 7351 } 7352 return c.header_ 7353} 7354 7355func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) { 7356 reqHeaders := make(http.Header) 7357 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7358 for k, v := range c.header_ { 7359 reqHeaders[k] = v 7360 } 7361 reqHeaders.Set("User-Agent", c.s.userAgent()) 7362 if c.ifNoneMatch_ != "" { 7363 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7364 } 7365 var body io.Reader = nil 7366 c.urlParams_.Set("alt", alt) 7367 c.urlParams_.Set("prettyPrint", "false") 7368 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions") 7369 urls += "?" + c.urlParams_.Encode() 7370 req, err := http.NewRequest("GET", urls, body) 7371 if err != nil { 7372 return nil, err 7373 } 7374 req.Header = reqHeaders 7375 googleapi.Expand(req.URL, map[string]string{ 7376 "courseId": c.courseId, 7377 "courseWorkId": c.courseWorkId, 7378 }) 7379 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7380} 7381 7382// Do executes the "classroom.courses.courseWork.studentSubmissions.list" call. 7383// Exactly one of *ListStudentSubmissionsResponse or error will be 7384// non-nil. Any non-2xx status code is an error. Response headers are in 7385// either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a 7386// response was returned at all) in error.(*googleapi.Error).Header. Use 7387// googleapi.IsNotModified to check whether the returned error was 7388// because http.StatusNotModified was returned. 7389func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) { 7390 gensupport.SetOptions(c.urlParams_, opts...) 7391 res, err := c.doRequest("json") 7392 if res != nil && res.StatusCode == http.StatusNotModified { 7393 if res.Body != nil { 7394 res.Body.Close() 7395 } 7396 return nil, &googleapi.Error{ 7397 Code: res.StatusCode, 7398 Header: res.Header, 7399 } 7400 } 7401 if err != nil { 7402 return nil, err 7403 } 7404 defer googleapi.CloseBody(res) 7405 if err := googleapi.CheckResponse(res); err != nil { 7406 return nil, err 7407 } 7408 ret := &ListStudentSubmissionsResponse{ 7409 ServerResponse: googleapi.ServerResponse{ 7410 Header: res.Header, 7411 HTTPStatusCode: res.StatusCode, 7412 }, 7413 } 7414 target := &ret 7415 if err := gensupport.DecodeResponse(target, res); err != nil { 7416 return nil, err 7417 } 7418 return ret, nil 7419 // { 7420 // "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.", 7421 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7422 // "httpMethod": "GET", 7423 // "id": "classroom.courses.courseWork.studentSubmissions.list", 7424 // "parameterOrder": [ 7425 // "courseId", 7426 // "courseWorkId" 7427 // ], 7428 // "parameters": { 7429 // "courseId": { 7430 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7431 // "location": "path", 7432 // "required": true, 7433 // "type": "string" 7434 // }, 7435 // "courseWorkId": { 7436 // "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.", 7437 // "location": "path", 7438 // "required": true, 7439 // "type": "string" 7440 // }, 7441 // "late": { 7442 // "description": "Requested lateness value. If specified, returned student submissions are\nrestricted by the requested value.\nIf unspecified, submissions are returned regardless of `late` value.", 7443 // "enum": [ 7444 // "LATE_VALUES_UNSPECIFIED", 7445 // "LATE_ONLY", 7446 // "NOT_LATE_ONLY" 7447 // ], 7448 // "location": "query", 7449 // "type": "string" 7450 // }, 7451 // "pageSize": { 7452 // "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.", 7453 // "format": "int32", 7454 // "location": "query", 7455 // "type": "integer" 7456 // }, 7457 // "pageToken": { 7458 // "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.", 7459 // "location": "query", 7460 // "type": "string" 7461 // }, 7462 // "states": { 7463 // "description": "Requested submission states. If specified, returned student submissions\nmatch one of the specified submission states.", 7464 // "enum": [ 7465 // "SUBMISSION_STATE_UNSPECIFIED", 7466 // "NEW", 7467 // "CREATED", 7468 // "TURNED_IN", 7469 // "RETURNED", 7470 // "RECLAIMED_BY_STUDENT" 7471 // ], 7472 // "location": "query", 7473 // "repeated": true, 7474 // "type": "string" 7475 // }, 7476 // "userId": { 7477 // "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", 7478 // "location": "query", 7479 // "type": "string" 7480 // } 7481 // }, 7482 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7483 // "response": { 7484 // "$ref": "ListStudentSubmissionsResponse" 7485 // }, 7486 // "scopes": [ 7487 // "https://www.googleapis.com/auth/classroom.coursework.me", 7488 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7489 // "https://www.googleapis.com/auth/classroom.coursework.students", 7490 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7491 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7492 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7493 // ] 7494 // } 7495 7496} 7497 7498// Pages invokes f for each page of results. 7499// A non-nil error returned from f will halt the iteration. 7500// The provided context supersedes any context provided to the Context method. 7501func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error { 7502 c.ctx_ = ctx 7503 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7504 for { 7505 x, err := c.Do() 7506 if err != nil { 7507 return err 7508 } 7509 if err := f(x); err != nil { 7510 return err 7511 } 7512 if x.NextPageToken == "" { 7513 return nil 7514 } 7515 c.PageToken(x.NextPageToken) 7516 } 7517} 7518 7519// method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments": 7520 7521type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct { 7522 s *Service 7523 courseId string 7524 courseWorkId string 7525 id string 7526 modifyattachmentsrequest *ModifyAttachmentsRequest 7527 urlParams_ gensupport.URLParams 7528 ctx_ context.Context 7529 header_ http.Header 7530} 7531 7532// ModifyAttachments: Modifies attachments of student 7533// submission. 7534// 7535// Attachments may only be added to student submissions belonging to 7536// course 7537// work objects with a `workType` of `ASSIGNMENT`. 7538// 7539// This request must be made by the Developer Console project of 7540// the 7541// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7542// used to 7543// create the corresponding course work item. 7544// 7545// This method returns the following error codes: 7546// 7547// * `PERMISSION_DENIED` if the requesting user is not permitted to 7548// access the 7549// requested course or course work, if the user is not permitted to 7550// modify 7551// attachments on the requested student submission, or for 7552// access errors. 7553// * `INVALID_ARGUMENT` if the request is malformed. 7554// * `NOT_FOUND` if the requested course, course work, or student 7555// submission 7556// does not exist. 7557func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7558 c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7559 c.courseId = courseId 7560 c.courseWorkId = courseWorkId 7561 c.id = id 7562 c.modifyattachmentsrequest = modifyattachmentsrequest 7563 return c 7564} 7565 7566// Fields allows partial responses to be retrieved. See 7567// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7568// for more information. 7569func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7570 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7571 return c 7572} 7573 7574// Context sets the context to be used in this call's Do method. Any 7575// pending HTTP request will be aborted if the provided context is 7576// canceled. 7577func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7578 c.ctx_ = ctx 7579 return c 7580} 7581 7582// Header returns an http.Header that can be modified by the caller to 7583// add HTTP headers to the request. 7584func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header { 7585 if c.header_ == nil { 7586 c.header_ = make(http.Header) 7587 } 7588 return c.header_ 7589} 7590 7591func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) { 7592 reqHeaders := make(http.Header) 7593 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7594 for k, v := range c.header_ { 7595 reqHeaders[k] = v 7596 } 7597 reqHeaders.Set("User-Agent", c.s.userAgent()) 7598 var body io.Reader = nil 7599 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest) 7600 if err != nil { 7601 return nil, err 7602 } 7603 reqHeaders.Set("Content-Type", "application/json") 7604 c.urlParams_.Set("alt", alt) 7605 c.urlParams_.Set("prettyPrint", "false") 7606 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments") 7607 urls += "?" + c.urlParams_.Encode() 7608 req, err := http.NewRequest("POST", urls, body) 7609 if err != nil { 7610 return nil, err 7611 } 7612 req.Header = reqHeaders 7613 googleapi.Expand(req.URL, map[string]string{ 7614 "courseId": c.courseId, 7615 "courseWorkId": c.courseWorkId, 7616 "id": c.id, 7617 }) 7618 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7619} 7620 7621// Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call. 7622// Exactly one of *StudentSubmission or error will be non-nil. Any 7623// non-2xx status code is an error. Response headers are in either 7624// *StudentSubmission.ServerResponse.Header or (if a response was 7625// returned at all) in error.(*googleapi.Error).Header. Use 7626// googleapi.IsNotModified to check whether the returned error was 7627// because http.StatusNotModified was returned. 7628func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7629 gensupport.SetOptions(c.urlParams_, opts...) 7630 res, err := c.doRequest("json") 7631 if res != nil && res.StatusCode == http.StatusNotModified { 7632 if res.Body != nil { 7633 res.Body.Close() 7634 } 7635 return nil, &googleapi.Error{ 7636 Code: res.StatusCode, 7637 Header: res.Header, 7638 } 7639 } 7640 if err != nil { 7641 return nil, err 7642 } 7643 defer googleapi.CloseBody(res) 7644 if err := googleapi.CheckResponse(res); err != nil { 7645 return nil, err 7646 } 7647 ret := &StudentSubmission{ 7648 ServerResponse: googleapi.ServerResponse{ 7649 Header: res.Header, 7650 HTTPStatusCode: res.StatusCode, 7651 }, 7652 } 7653 target := &ret 7654 if err := gensupport.DecodeResponse(target, res); err != nil { 7655 return nil, err 7656 } 7657 return ret, nil 7658 // { 7659 // "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.", 7660 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7661 // "httpMethod": "POST", 7662 // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments", 7663 // "parameterOrder": [ 7664 // "courseId", 7665 // "courseWorkId", 7666 // "id" 7667 // ], 7668 // "parameters": { 7669 // "courseId": { 7670 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7671 // "location": "path", 7672 // "required": true, 7673 // "type": "string" 7674 // }, 7675 // "courseWorkId": { 7676 // "description": "Identifier of the course work.", 7677 // "location": "path", 7678 // "required": true, 7679 // "type": "string" 7680 // }, 7681 // "id": { 7682 // "description": "Identifier of the student submission.", 7683 // "location": "path", 7684 // "required": true, 7685 // "type": "string" 7686 // } 7687 // }, 7688 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7689 // "request": { 7690 // "$ref": "ModifyAttachmentsRequest" 7691 // }, 7692 // "response": { 7693 // "$ref": "StudentSubmission" 7694 // }, 7695 // "scopes": [ 7696 // "https://www.googleapis.com/auth/classroom.coursework.me", 7697 // "https://www.googleapis.com/auth/classroom.coursework.students" 7698 // ] 7699 // } 7700 7701} 7702 7703// method id "classroom.courses.courseWork.studentSubmissions.patch": 7704 7705type CoursesCourseWorkStudentSubmissionsPatchCall struct { 7706 s *Service 7707 courseId string 7708 courseWorkId string 7709 id string 7710 studentsubmission *StudentSubmission 7711 urlParams_ gensupport.URLParams 7712 ctx_ context.Context 7713 header_ http.Header 7714} 7715 7716// Patch: Updates one or more fields of a student submission. 7717// 7718// See google.classroom.v1.StudentSubmission for details 7719// of which fields may be updated and who may change them. 7720// 7721// This request must be made by the Developer Console project of 7722// the 7723// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7724// used to 7725// create the corresponding course work item. 7726// 7727// This method returns the following error codes: 7728// 7729// * `PERMISSION_DENIED` if the requesting developer project did not 7730// create 7731// the corresponding course work, if the user is not permitted to make 7732// the 7733// requested modification to the student submission, or for 7734// access errors. 7735// * `INVALID_ARGUMENT` if the request is malformed. 7736// * `NOT_FOUND` if the requested course, course work, or student 7737// submission 7738// does not exist. 7739func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall { 7740 c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7741 c.courseId = courseId 7742 c.courseWorkId = courseWorkId 7743 c.id = id 7744 c.studentsubmission = studentsubmission 7745 return c 7746} 7747 7748// UpdateMask sets the optional parameter "updateMask": Mask that 7749// identifies which fields on the student submission to update. 7750// This field is required to do an update. The update fails if 7751// invalid 7752// fields are specified. 7753// 7754// The following fields may be specified by teachers: 7755// 7756// * `draft_grade` 7757// * `assigned_grade` 7758func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall { 7759 c.urlParams_.Set("updateMask", updateMask) 7760 return c 7761} 7762 7763// Fields allows partial responses to be retrieved. See 7764// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7765// for more information. 7766func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall { 7767 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7768 return c 7769} 7770 7771// Context sets the context to be used in this call's Do method. Any 7772// pending HTTP request will be aborted if the provided context is 7773// canceled. 7774func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall { 7775 c.ctx_ = ctx 7776 return c 7777} 7778 7779// Header returns an http.Header that can be modified by the caller to 7780// add HTTP headers to the request. 7781func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header { 7782 if c.header_ == nil { 7783 c.header_ = make(http.Header) 7784 } 7785 return c.header_ 7786} 7787 7788func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) { 7789 reqHeaders := make(http.Header) 7790 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7791 for k, v := range c.header_ { 7792 reqHeaders[k] = v 7793 } 7794 reqHeaders.Set("User-Agent", c.s.userAgent()) 7795 var body io.Reader = nil 7796 body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission) 7797 if err != nil { 7798 return nil, err 7799 } 7800 reqHeaders.Set("Content-Type", "application/json") 7801 c.urlParams_.Set("alt", alt) 7802 c.urlParams_.Set("prettyPrint", "false") 7803 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7804 urls += "?" + c.urlParams_.Encode() 7805 req, err := http.NewRequest("PATCH", urls, body) 7806 if err != nil { 7807 return nil, err 7808 } 7809 req.Header = reqHeaders 7810 googleapi.Expand(req.URL, map[string]string{ 7811 "courseId": c.courseId, 7812 "courseWorkId": c.courseWorkId, 7813 "id": c.id, 7814 }) 7815 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7816} 7817 7818// Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call. 7819// Exactly one of *StudentSubmission or error will be non-nil. Any 7820// non-2xx status code is an error. Response headers are in either 7821// *StudentSubmission.ServerResponse.Header or (if a response was 7822// returned at all) in error.(*googleapi.Error).Header. Use 7823// googleapi.IsNotModified to check whether the returned error was 7824// because http.StatusNotModified was returned. 7825func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7826 gensupport.SetOptions(c.urlParams_, opts...) 7827 res, err := c.doRequest("json") 7828 if res != nil && res.StatusCode == http.StatusNotModified { 7829 if res.Body != nil { 7830 res.Body.Close() 7831 } 7832 return nil, &googleapi.Error{ 7833 Code: res.StatusCode, 7834 Header: res.Header, 7835 } 7836 } 7837 if err != nil { 7838 return nil, err 7839 } 7840 defer googleapi.CloseBody(res) 7841 if err := googleapi.CheckResponse(res); err != nil { 7842 return nil, err 7843 } 7844 ret := &StudentSubmission{ 7845 ServerResponse: googleapi.ServerResponse{ 7846 Header: res.Header, 7847 HTTPStatusCode: res.StatusCode, 7848 }, 7849 } 7850 target := &ret 7851 if err := gensupport.DecodeResponse(target, res); err != nil { 7852 return nil, err 7853 } 7854 return ret, nil 7855 // { 7856 // "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.", 7857 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7858 // "httpMethod": "PATCH", 7859 // "id": "classroom.courses.courseWork.studentSubmissions.patch", 7860 // "parameterOrder": [ 7861 // "courseId", 7862 // "courseWorkId", 7863 // "id" 7864 // ], 7865 // "parameters": { 7866 // "courseId": { 7867 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7868 // "location": "path", 7869 // "required": true, 7870 // "type": "string" 7871 // }, 7872 // "courseWorkId": { 7873 // "description": "Identifier of the course work.", 7874 // "location": "path", 7875 // "required": true, 7876 // "type": "string" 7877 // }, 7878 // "id": { 7879 // "description": "Identifier of the student submission.", 7880 // "location": "path", 7881 // "required": true, 7882 // "type": "string" 7883 // }, 7884 // "updateMask": { 7885 // "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`", 7886 // "format": "google-fieldmask", 7887 // "location": "query", 7888 // "type": "string" 7889 // } 7890 // }, 7891 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7892 // "request": { 7893 // "$ref": "StudentSubmission" 7894 // }, 7895 // "response": { 7896 // "$ref": "StudentSubmission" 7897 // }, 7898 // "scopes": [ 7899 // "https://www.googleapis.com/auth/classroom.coursework.me", 7900 // "https://www.googleapis.com/auth/classroom.coursework.students" 7901 // ] 7902 // } 7903 7904} 7905 7906// method id "classroom.courses.courseWork.studentSubmissions.reclaim": 7907 7908type CoursesCourseWorkStudentSubmissionsReclaimCall struct { 7909 s *Service 7910 courseId string 7911 courseWorkId string 7912 id string 7913 reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest 7914 urlParams_ gensupport.URLParams 7915 ctx_ context.Context 7916 header_ http.Header 7917} 7918 7919// Reclaim: Reclaims a student submission on behalf of the student that 7920// owns it. 7921// 7922// Reclaiming a student submission transfers ownership of attached 7923// Drive 7924// files to the student and updates the submission state. 7925// 7926// Only the student that owns the requested student submission may call 7927// this 7928// method, and only for a student submission that has been turned 7929// in. 7930// 7931// This request must be made by the Developer Console project of 7932// the 7933// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7934// used to 7935// create the corresponding course work item. 7936// 7937// This method returns the following error codes: 7938// 7939// * `PERMISSION_DENIED` if the requesting user is not permitted to 7940// access the 7941// requested course or course work, unsubmit the requested student 7942// submission, 7943// or for access errors. 7944// * `FAILED_PRECONDITION` if the student submission has not been turned 7945// in. 7946// * `INVALID_ARGUMENT` if the request is malformed. 7947// * `NOT_FOUND` if the requested course, course work, or student 7948// submission 7949// does not exist. 7950func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7951 c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7952 c.courseId = courseId 7953 c.courseWorkId = courseWorkId 7954 c.id = id 7955 c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest 7956 return c 7957} 7958 7959// Fields allows partial responses to be retrieved. See 7960// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7961// for more information. 7962func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7963 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7964 return c 7965} 7966 7967// Context sets the context to be used in this call's Do method. Any 7968// pending HTTP request will be aborted if the provided context is 7969// canceled. 7970func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7971 c.ctx_ = ctx 7972 return c 7973} 7974 7975// Header returns an http.Header that can be modified by the caller to 7976// add HTTP headers to the request. 7977func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header { 7978 if c.header_ == nil { 7979 c.header_ = make(http.Header) 7980 } 7981 return c.header_ 7982} 7983 7984func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) { 7985 reqHeaders := make(http.Header) 7986 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7987 for k, v := range c.header_ { 7988 reqHeaders[k] = v 7989 } 7990 reqHeaders.Set("User-Agent", c.s.userAgent()) 7991 var body io.Reader = nil 7992 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest) 7993 if err != nil { 7994 return nil, err 7995 } 7996 reqHeaders.Set("Content-Type", "application/json") 7997 c.urlParams_.Set("alt", alt) 7998 c.urlParams_.Set("prettyPrint", "false") 7999 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim") 8000 urls += "?" + c.urlParams_.Encode() 8001 req, err := http.NewRequest("POST", urls, body) 8002 if err != nil { 8003 return nil, err 8004 } 8005 req.Header = reqHeaders 8006 googleapi.Expand(req.URL, map[string]string{ 8007 "courseId": c.courseId, 8008 "courseWorkId": c.courseWorkId, 8009 "id": c.id, 8010 }) 8011 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8012} 8013 8014// Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call. 8015// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8016// code is an error. Response headers are in either 8017// *Empty.ServerResponse.Header or (if a response was returned at all) 8018// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8019// check whether the returned error was because http.StatusNotModified 8020// was returned. 8021func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8022 gensupport.SetOptions(c.urlParams_, opts...) 8023 res, err := c.doRequest("json") 8024 if res != nil && res.StatusCode == http.StatusNotModified { 8025 if res.Body != nil { 8026 res.Body.Close() 8027 } 8028 return nil, &googleapi.Error{ 8029 Code: res.StatusCode, 8030 Header: res.Header, 8031 } 8032 } 8033 if err != nil { 8034 return nil, err 8035 } 8036 defer googleapi.CloseBody(res) 8037 if err := googleapi.CheckResponse(res); err != nil { 8038 return nil, err 8039 } 8040 ret := &Empty{ 8041 ServerResponse: googleapi.ServerResponse{ 8042 Header: res.Header, 8043 HTTPStatusCode: res.StatusCode, 8044 }, 8045 } 8046 target := &ret 8047 if err := gensupport.DecodeResponse(target, res); err != nil { 8048 return nil, err 8049 } 8050 return ret, nil 8051 // { 8052 // "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.", 8053 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8054 // "httpMethod": "POST", 8055 // "id": "classroom.courses.courseWork.studentSubmissions.reclaim", 8056 // "parameterOrder": [ 8057 // "courseId", 8058 // "courseWorkId", 8059 // "id" 8060 // ], 8061 // "parameters": { 8062 // "courseId": { 8063 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8064 // "location": "path", 8065 // "required": true, 8066 // "type": "string" 8067 // }, 8068 // "courseWorkId": { 8069 // "description": "Identifier of the course work.", 8070 // "location": "path", 8071 // "required": true, 8072 // "type": "string" 8073 // }, 8074 // "id": { 8075 // "description": "Identifier of the student submission.", 8076 // "location": "path", 8077 // "required": true, 8078 // "type": "string" 8079 // } 8080 // }, 8081 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8082 // "request": { 8083 // "$ref": "ReclaimStudentSubmissionRequest" 8084 // }, 8085 // "response": { 8086 // "$ref": "Empty" 8087 // }, 8088 // "scopes": [ 8089 // "https://www.googleapis.com/auth/classroom.coursework.me" 8090 // ] 8091 // } 8092 8093} 8094 8095// method id "classroom.courses.courseWork.studentSubmissions.return": 8096 8097type CoursesCourseWorkStudentSubmissionsReturnCall struct { 8098 s *Service 8099 courseId string 8100 courseWorkId string 8101 id string 8102 returnstudentsubmissionrequest *ReturnStudentSubmissionRequest 8103 urlParams_ gensupport.URLParams 8104 ctx_ context.Context 8105 header_ http.Header 8106} 8107 8108// Return: Returns a student submission. 8109// 8110// Returning a student submission transfers ownership of attached 8111// Drive 8112// files to the student and may also update the submission state. 8113// Unlike the Classroom application, returning a student submission does 8114// not 8115// set assignedGrade to the draftGrade value. 8116// 8117// Only a teacher of the course that contains the requested student 8118// submission 8119// may call this method. 8120// 8121// This request must be made by the Developer Console project of 8122// the 8123// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8124// used to 8125// create the corresponding course work item. 8126// 8127// This method returns the following error codes: 8128// 8129// * `PERMISSION_DENIED` if the requesting user is not permitted to 8130// access the 8131// requested course or course work, return the requested student 8132// submission, 8133// or for access errors. 8134// * `INVALID_ARGUMENT` if the request is malformed. 8135// * `NOT_FOUND` if the requested course, course work, or student 8136// submission 8137// does not exist. 8138func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall { 8139 c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8140 c.courseId = courseId 8141 c.courseWorkId = courseWorkId 8142 c.id = id 8143 c.returnstudentsubmissionrequest = returnstudentsubmissionrequest 8144 return c 8145} 8146 8147// Fields allows partial responses to be retrieved. See 8148// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8149// for more information. 8150func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall { 8151 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8152 return c 8153} 8154 8155// Context sets the context to be used in this call's Do method. Any 8156// pending HTTP request will be aborted if the provided context is 8157// canceled. 8158func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall { 8159 c.ctx_ = ctx 8160 return c 8161} 8162 8163// Header returns an http.Header that can be modified by the caller to 8164// add HTTP headers to the request. 8165func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header { 8166 if c.header_ == nil { 8167 c.header_ = make(http.Header) 8168 } 8169 return c.header_ 8170} 8171 8172func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) { 8173 reqHeaders := make(http.Header) 8174 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 8175 for k, v := range c.header_ { 8176 reqHeaders[k] = v 8177 } 8178 reqHeaders.Set("User-Agent", c.s.userAgent()) 8179 var body io.Reader = nil 8180 body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest) 8181 if err != nil { 8182 return nil, err 8183 } 8184 reqHeaders.Set("Content-Type", "application/json") 8185 c.urlParams_.Set("alt", alt) 8186 c.urlParams_.Set("prettyPrint", "false") 8187 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return") 8188 urls += "?" + c.urlParams_.Encode() 8189 req, err := http.NewRequest("POST", urls, body) 8190 if err != nil { 8191 return nil, err 8192 } 8193 req.Header = reqHeaders 8194 googleapi.Expand(req.URL, map[string]string{ 8195 "courseId": c.courseId, 8196 "courseWorkId": c.courseWorkId, 8197 "id": c.id, 8198 }) 8199 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8200} 8201 8202// Do executes the "classroom.courses.courseWork.studentSubmissions.return" call. 8203// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8204// code is an error. Response headers are in either 8205// *Empty.ServerResponse.Header or (if a response was returned at all) 8206// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8207// check whether the returned error was because http.StatusNotModified 8208// was returned. 8209func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8210 gensupport.SetOptions(c.urlParams_, opts...) 8211 res, err := c.doRequest("json") 8212 if res != nil && res.StatusCode == http.StatusNotModified { 8213 if res.Body != nil { 8214 res.Body.Close() 8215 } 8216 return nil, &googleapi.Error{ 8217 Code: res.StatusCode, 8218 Header: res.Header, 8219 } 8220 } 8221 if err != nil { 8222 return nil, err 8223 } 8224 defer googleapi.CloseBody(res) 8225 if err := googleapi.CheckResponse(res); err != nil { 8226 return nil, err 8227 } 8228 ret := &Empty{ 8229 ServerResponse: googleapi.ServerResponse{ 8230 Header: res.Header, 8231 HTTPStatusCode: res.StatusCode, 8232 }, 8233 } 8234 target := &ret 8235 if err := gensupport.DecodeResponse(target, res); err != nil { 8236 return nil, err 8237 } 8238 return ret, nil 8239 // { 8240 // "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.", 8241 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8242 // "httpMethod": "POST", 8243 // "id": "classroom.courses.courseWork.studentSubmissions.return", 8244 // "parameterOrder": [ 8245 // "courseId", 8246 // "courseWorkId", 8247 // "id" 8248 // ], 8249 // "parameters": { 8250 // "courseId": { 8251 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8252 // "location": "path", 8253 // "required": true, 8254 // "type": "string" 8255 // }, 8256 // "courseWorkId": { 8257 // "description": "Identifier of the course work.", 8258 // "location": "path", 8259 // "required": true, 8260 // "type": "string" 8261 // }, 8262 // "id": { 8263 // "description": "Identifier of the student submission.", 8264 // "location": "path", 8265 // "required": true, 8266 // "type": "string" 8267 // } 8268 // }, 8269 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8270 // "request": { 8271 // "$ref": "ReturnStudentSubmissionRequest" 8272 // }, 8273 // "response": { 8274 // "$ref": "Empty" 8275 // }, 8276 // "scopes": [ 8277 // "https://www.googleapis.com/auth/classroom.coursework.students" 8278 // ] 8279 // } 8280 8281} 8282 8283// method id "classroom.courses.courseWork.studentSubmissions.turnIn": 8284 8285type CoursesCourseWorkStudentSubmissionsTurnInCall struct { 8286 s *Service 8287 courseId string 8288 courseWorkId string 8289 id string 8290 turninstudentsubmissionrequest *TurnInStudentSubmissionRequest 8291 urlParams_ gensupport.URLParams 8292 ctx_ context.Context 8293 header_ http.Header 8294} 8295 8296// TurnIn: Turns in a student submission. 8297// 8298// Turning in a student submission transfers ownership of attached 8299// Drive 8300// files to the teacher and may also update the submission state. 8301// 8302// This may only be called by the student that owns the specified 8303// student 8304// submission. 8305// 8306// This request must be made by the Developer Console project of 8307// the 8308// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8309// used to 8310// create the corresponding course work item. 8311// 8312// This method returns the following error codes: 8313// 8314// * `PERMISSION_DENIED` if the requesting user is not permitted to 8315// access the 8316// requested course or course work, turn in the requested student 8317// submission, 8318// or for access errors. 8319// * `INVALID_ARGUMENT` if the request is malformed. 8320// * `NOT_FOUND` if the requested course, course work, or student 8321// submission 8322// does not exist. 8323func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8324 c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8325 c.courseId = courseId 8326 c.courseWorkId = courseWorkId 8327 c.id = id 8328 c.turninstudentsubmissionrequest = turninstudentsubmissionrequest 8329 return c 8330} 8331 8332// Fields allows partial responses to be retrieved. See 8333// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8334// for more information. 8335func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8336 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8337 return c 8338} 8339 8340// Context sets the context to be used in this call's Do method. Any 8341// pending HTTP request will be aborted if the provided context is 8342// canceled. 8343func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8344 c.ctx_ = ctx 8345 return c 8346} 8347 8348// Header returns an http.Header that can be modified by the caller to 8349// add HTTP headers to the request. 8350func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header { 8351 if c.header_ == nil { 8352 c.header_ = make(http.Header) 8353 } 8354 return c.header_ 8355} 8356 8357func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) { 8358 reqHeaders := make(http.Header) 8359 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 8360 for k, v := range c.header_ { 8361 reqHeaders[k] = v 8362 } 8363 reqHeaders.Set("User-Agent", c.s.userAgent()) 8364 var body io.Reader = nil 8365 body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest) 8366 if err != nil { 8367 return nil, err 8368 } 8369 reqHeaders.Set("Content-Type", "application/json") 8370 c.urlParams_.Set("alt", alt) 8371 c.urlParams_.Set("prettyPrint", "false") 8372 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn") 8373 urls += "?" + c.urlParams_.Encode() 8374 req, err := http.NewRequest("POST", urls, body) 8375 if err != nil { 8376 return nil, err 8377 } 8378 req.Header = reqHeaders 8379 googleapi.Expand(req.URL, map[string]string{ 8380 "courseId": c.courseId, 8381 "courseWorkId": c.courseWorkId, 8382 "id": c.id, 8383 }) 8384 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8385} 8386 8387// Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call. 8388// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8389// code is an error. Response headers are in either 8390// *Empty.ServerResponse.Header or (if a response was returned at all) 8391// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8392// check whether the returned error was because http.StatusNotModified 8393// was returned. 8394func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8395 gensupport.SetOptions(c.urlParams_, opts...) 8396 res, err := c.doRequest("json") 8397 if res != nil && res.StatusCode == http.StatusNotModified { 8398 if res.Body != nil { 8399 res.Body.Close() 8400 } 8401 return nil, &googleapi.Error{ 8402 Code: res.StatusCode, 8403 Header: res.Header, 8404 } 8405 } 8406 if err != nil { 8407 return nil, err 8408 } 8409 defer googleapi.CloseBody(res) 8410 if err := googleapi.CheckResponse(res); err != nil { 8411 return nil, err 8412 } 8413 ret := &Empty{ 8414 ServerResponse: googleapi.ServerResponse{ 8415 Header: res.Header, 8416 HTTPStatusCode: res.StatusCode, 8417 }, 8418 } 8419 target := &ret 8420 if err := gensupport.DecodeResponse(target, res); err != nil { 8421 return nil, err 8422 } 8423 return ret, nil 8424 // { 8425 // "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.", 8426 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8427 // "httpMethod": "POST", 8428 // "id": "classroom.courses.courseWork.studentSubmissions.turnIn", 8429 // "parameterOrder": [ 8430 // "courseId", 8431 // "courseWorkId", 8432 // "id" 8433 // ], 8434 // "parameters": { 8435 // "courseId": { 8436 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8437 // "location": "path", 8438 // "required": true, 8439 // "type": "string" 8440 // }, 8441 // "courseWorkId": { 8442 // "description": "Identifier of the course work.", 8443 // "location": "path", 8444 // "required": true, 8445 // "type": "string" 8446 // }, 8447 // "id": { 8448 // "description": "Identifier of the student submission.", 8449 // "location": "path", 8450 // "required": true, 8451 // "type": "string" 8452 // } 8453 // }, 8454 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8455 // "request": { 8456 // "$ref": "TurnInStudentSubmissionRequest" 8457 // }, 8458 // "response": { 8459 // "$ref": "Empty" 8460 // }, 8461 // "scopes": [ 8462 // "https://www.googleapis.com/auth/classroom.coursework.me" 8463 // ] 8464 // } 8465 8466} 8467 8468// method id "classroom.courses.students.create": 8469 8470type CoursesStudentsCreateCall struct { 8471 s *Service 8472 courseId string 8473 student *Student 8474 urlParams_ gensupport.URLParams 8475 ctx_ context.Context 8476 header_ http.Header 8477} 8478 8479// Create: Adds a user as a student of a course. 8480// 8481// This method returns the following error codes: 8482// 8483// * `PERMISSION_DENIED` if the requesting user is not permitted to 8484// create 8485// students in this course or for access errors. 8486// * `NOT_FOUND` if the requested course ID does not exist. 8487// * `FAILED_PRECONDITION` if the requested user's account is 8488// disabled, 8489// for the following request errors: 8490// * CourseMemberLimitReached 8491// * CourseNotModifiable 8492// * UserGroupsMembershipLimitReached 8493// * `ALREADY_EXISTS` if the user is already a student or teacher in 8494// the 8495// course. 8496func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall { 8497 c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8498 c.courseId = courseId 8499 c.student = student 8500 return c 8501} 8502 8503// EnrollmentCode sets the optional parameter "enrollmentCode": 8504// Enrollment code of the course to create the student in. 8505// This code is required if userId 8506// corresponds to the requesting user; it may be omitted if the 8507// requesting 8508// user has administrative permissions to create students for any user. 8509func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall { 8510 c.urlParams_.Set("enrollmentCode", enrollmentCode) 8511 return c 8512} 8513 8514// Fields allows partial responses to be retrieved. See 8515// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8516// for more information. 8517func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall { 8518 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8519 return c 8520} 8521 8522// Context sets the context to be used in this call's Do method. Any 8523// pending HTTP request will be aborted if the provided context is 8524// canceled. 8525func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall { 8526 c.ctx_ = ctx 8527 return c 8528} 8529 8530// Header returns an http.Header that can be modified by the caller to 8531// add HTTP headers to the request. 8532func (c *CoursesStudentsCreateCall) Header() http.Header { 8533 if c.header_ == nil { 8534 c.header_ = make(http.Header) 8535 } 8536 return c.header_ 8537} 8538 8539func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) { 8540 reqHeaders := make(http.Header) 8541 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 8542 for k, v := range c.header_ { 8543 reqHeaders[k] = v 8544 } 8545 reqHeaders.Set("User-Agent", c.s.userAgent()) 8546 var body io.Reader = nil 8547 body, err := googleapi.WithoutDataWrapper.JSONReader(c.student) 8548 if err != nil { 8549 return nil, err 8550 } 8551 reqHeaders.Set("Content-Type", "application/json") 8552 c.urlParams_.Set("alt", alt) 8553 c.urlParams_.Set("prettyPrint", "false") 8554 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 8555 urls += "?" + c.urlParams_.Encode() 8556 req, err := http.NewRequest("POST", urls, body) 8557 if err != nil { 8558 return nil, err 8559 } 8560 req.Header = reqHeaders 8561 googleapi.Expand(req.URL, map[string]string{ 8562 "courseId": c.courseId, 8563 }) 8564 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8565} 8566 8567// Do executes the "classroom.courses.students.create" call. 8568// Exactly one of *Student or error will be non-nil. Any non-2xx status 8569// code is an error. Response headers are in either 8570// *Student.ServerResponse.Header or (if a response was returned at all) 8571// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8572// check whether the returned error was because http.StatusNotModified 8573// was returned. 8574func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8575 gensupport.SetOptions(c.urlParams_, opts...) 8576 res, err := c.doRequest("json") 8577 if res != nil && res.StatusCode == http.StatusNotModified { 8578 if res.Body != nil { 8579 res.Body.Close() 8580 } 8581 return nil, &googleapi.Error{ 8582 Code: res.StatusCode, 8583 Header: res.Header, 8584 } 8585 } 8586 if err != nil { 8587 return nil, err 8588 } 8589 defer googleapi.CloseBody(res) 8590 if err := googleapi.CheckResponse(res); err != nil { 8591 return nil, err 8592 } 8593 ret := &Student{ 8594 ServerResponse: googleapi.ServerResponse{ 8595 Header: res.Header, 8596 HTTPStatusCode: res.StatusCode, 8597 }, 8598 } 8599 target := &ret 8600 if err := gensupport.DecodeResponse(target, res); err != nil { 8601 return nil, err 8602 } 8603 return ret, nil 8604 // { 8605 // "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.", 8606 // "flatPath": "v1/courses/{courseId}/students", 8607 // "httpMethod": "POST", 8608 // "id": "classroom.courses.students.create", 8609 // "parameterOrder": [ 8610 // "courseId" 8611 // ], 8612 // "parameters": { 8613 // "courseId": { 8614 // "description": "Identifier of the course to create the student in.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8615 // "location": "path", 8616 // "required": true, 8617 // "type": "string" 8618 // }, 8619 // "enrollmentCode": { 8620 // "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.", 8621 // "location": "query", 8622 // "type": "string" 8623 // } 8624 // }, 8625 // "path": "v1/courses/{courseId}/students", 8626 // "request": { 8627 // "$ref": "Student" 8628 // }, 8629 // "response": { 8630 // "$ref": "Student" 8631 // }, 8632 // "scopes": [ 8633 // "https://www.googleapis.com/auth/classroom.profile.emails", 8634 // "https://www.googleapis.com/auth/classroom.profile.photos", 8635 // "https://www.googleapis.com/auth/classroom.rosters" 8636 // ] 8637 // } 8638 8639} 8640 8641// method id "classroom.courses.students.delete": 8642 8643type CoursesStudentsDeleteCall struct { 8644 s *Service 8645 courseId string 8646 userId string 8647 urlParams_ gensupport.URLParams 8648 ctx_ context.Context 8649 header_ http.Header 8650} 8651 8652// Delete: Deletes a student of a course. 8653// 8654// This method returns the following error codes: 8655// 8656// * `PERMISSION_DENIED` if the requesting user is not permitted to 8657// delete 8658// students of this course or for access errors. 8659// * `NOT_FOUND` if no student of this course has the requested ID or if 8660// the 8661// course does not exist. 8662func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall { 8663 c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8664 c.courseId = courseId 8665 c.userId = userId 8666 return c 8667} 8668 8669// Fields allows partial responses to be retrieved. See 8670// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8671// for more information. 8672func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall { 8673 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8674 return c 8675} 8676 8677// Context sets the context to be used in this call's Do method. Any 8678// pending HTTP request will be aborted if the provided context is 8679// canceled. 8680func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall { 8681 c.ctx_ = ctx 8682 return c 8683} 8684 8685// Header returns an http.Header that can be modified by the caller to 8686// add HTTP headers to the request. 8687func (c *CoursesStudentsDeleteCall) Header() http.Header { 8688 if c.header_ == nil { 8689 c.header_ = make(http.Header) 8690 } 8691 return c.header_ 8692} 8693 8694func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) { 8695 reqHeaders := make(http.Header) 8696 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 8697 for k, v := range c.header_ { 8698 reqHeaders[k] = v 8699 } 8700 reqHeaders.Set("User-Agent", c.s.userAgent()) 8701 var body io.Reader = nil 8702 c.urlParams_.Set("alt", alt) 8703 c.urlParams_.Set("prettyPrint", "false") 8704 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8705 urls += "?" + c.urlParams_.Encode() 8706 req, err := http.NewRequest("DELETE", urls, body) 8707 if err != nil { 8708 return nil, err 8709 } 8710 req.Header = reqHeaders 8711 googleapi.Expand(req.URL, map[string]string{ 8712 "courseId": c.courseId, 8713 "userId": c.userId, 8714 }) 8715 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8716} 8717 8718// Do executes the "classroom.courses.students.delete" call. 8719// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8720// code is an error. Response headers are in either 8721// *Empty.ServerResponse.Header or (if a response was returned at all) 8722// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8723// check whether the returned error was because http.StatusNotModified 8724// was returned. 8725func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8726 gensupport.SetOptions(c.urlParams_, opts...) 8727 res, err := c.doRequest("json") 8728 if res != nil && res.StatusCode == http.StatusNotModified { 8729 if res.Body != nil { 8730 res.Body.Close() 8731 } 8732 return nil, &googleapi.Error{ 8733 Code: res.StatusCode, 8734 Header: res.Header, 8735 } 8736 } 8737 if err != nil { 8738 return nil, err 8739 } 8740 defer googleapi.CloseBody(res) 8741 if err := googleapi.CheckResponse(res); err != nil { 8742 return nil, err 8743 } 8744 ret := &Empty{ 8745 ServerResponse: googleapi.ServerResponse{ 8746 Header: res.Header, 8747 HTTPStatusCode: res.StatusCode, 8748 }, 8749 } 8750 target := &ret 8751 if err := gensupport.DecodeResponse(target, res); err != nil { 8752 return nil, err 8753 } 8754 return ret, nil 8755 // { 8756 // "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.", 8757 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8758 // "httpMethod": "DELETE", 8759 // "id": "classroom.courses.students.delete", 8760 // "parameterOrder": [ 8761 // "courseId", 8762 // "userId" 8763 // ], 8764 // "parameters": { 8765 // "courseId": { 8766 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8767 // "location": "path", 8768 // "required": true, 8769 // "type": "string" 8770 // }, 8771 // "userId": { 8772 // "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", 8773 // "location": "path", 8774 // "required": true, 8775 // "type": "string" 8776 // } 8777 // }, 8778 // "path": "v1/courses/{courseId}/students/{userId}", 8779 // "response": { 8780 // "$ref": "Empty" 8781 // }, 8782 // "scopes": [ 8783 // "https://www.googleapis.com/auth/classroom.rosters" 8784 // ] 8785 // } 8786 8787} 8788 8789// method id "classroom.courses.students.get": 8790 8791type CoursesStudentsGetCall struct { 8792 s *Service 8793 courseId string 8794 userId string 8795 urlParams_ gensupport.URLParams 8796 ifNoneMatch_ string 8797 ctx_ context.Context 8798 header_ http.Header 8799} 8800 8801// Get: Returns a student of a course. 8802// 8803// This method returns the following error codes: 8804// 8805// * `PERMISSION_DENIED` if the requesting user is not permitted to 8806// view 8807// students of this course or for access errors. 8808// * `NOT_FOUND` if no student of this course has the requested ID or if 8809// the 8810// course does not exist. 8811func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall { 8812 c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8813 c.courseId = courseId 8814 c.userId = userId 8815 return c 8816} 8817 8818// Fields allows partial responses to be retrieved. See 8819// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8820// for more information. 8821func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall { 8822 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8823 return c 8824} 8825 8826// IfNoneMatch sets the optional parameter which makes the operation 8827// fail if the object's ETag matches the given value. This is useful for 8828// getting updates only after the object has changed since the last 8829// request. Use googleapi.IsNotModified to check whether the response 8830// error from Do is the result of In-None-Match. 8831func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall { 8832 c.ifNoneMatch_ = entityTag 8833 return c 8834} 8835 8836// Context sets the context to be used in this call's Do method. Any 8837// pending HTTP request will be aborted if the provided context is 8838// canceled. 8839func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall { 8840 c.ctx_ = ctx 8841 return c 8842} 8843 8844// Header returns an http.Header that can be modified by the caller to 8845// add HTTP headers to the request. 8846func (c *CoursesStudentsGetCall) Header() http.Header { 8847 if c.header_ == nil { 8848 c.header_ = make(http.Header) 8849 } 8850 return c.header_ 8851} 8852 8853func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) { 8854 reqHeaders := make(http.Header) 8855 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 8856 for k, v := range c.header_ { 8857 reqHeaders[k] = v 8858 } 8859 reqHeaders.Set("User-Agent", c.s.userAgent()) 8860 if c.ifNoneMatch_ != "" { 8861 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8862 } 8863 var body io.Reader = nil 8864 c.urlParams_.Set("alt", alt) 8865 c.urlParams_.Set("prettyPrint", "false") 8866 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8867 urls += "?" + c.urlParams_.Encode() 8868 req, err := http.NewRequest("GET", urls, body) 8869 if err != nil { 8870 return nil, err 8871 } 8872 req.Header = reqHeaders 8873 googleapi.Expand(req.URL, map[string]string{ 8874 "courseId": c.courseId, 8875 "userId": c.userId, 8876 }) 8877 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8878} 8879 8880// Do executes the "classroom.courses.students.get" call. 8881// Exactly one of *Student or error will be non-nil. Any non-2xx status 8882// code is an error. Response headers are in either 8883// *Student.ServerResponse.Header or (if a response was returned at all) 8884// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8885// check whether the returned error was because http.StatusNotModified 8886// was returned. 8887func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8888 gensupport.SetOptions(c.urlParams_, opts...) 8889 res, err := c.doRequest("json") 8890 if res != nil && res.StatusCode == http.StatusNotModified { 8891 if res.Body != nil { 8892 res.Body.Close() 8893 } 8894 return nil, &googleapi.Error{ 8895 Code: res.StatusCode, 8896 Header: res.Header, 8897 } 8898 } 8899 if err != nil { 8900 return nil, err 8901 } 8902 defer googleapi.CloseBody(res) 8903 if err := googleapi.CheckResponse(res); err != nil { 8904 return nil, err 8905 } 8906 ret := &Student{ 8907 ServerResponse: googleapi.ServerResponse{ 8908 Header: res.Header, 8909 HTTPStatusCode: res.StatusCode, 8910 }, 8911 } 8912 target := &ret 8913 if err := gensupport.DecodeResponse(target, res); err != nil { 8914 return nil, err 8915 } 8916 return ret, nil 8917 // { 8918 // "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.", 8919 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8920 // "httpMethod": "GET", 8921 // "id": "classroom.courses.students.get", 8922 // "parameterOrder": [ 8923 // "courseId", 8924 // "userId" 8925 // ], 8926 // "parameters": { 8927 // "courseId": { 8928 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8929 // "location": "path", 8930 // "required": true, 8931 // "type": "string" 8932 // }, 8933 // "userId": { 8934 // "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", 8935 // "location": "path", 8936 // "required": true, 8937 // "type": "string" 8938 // } 8939 // }, 8940 // "path": "v1/courses/{courseId}/students/{userId}", 8941 // "response": { 8942 // "$ref": "Student" 8943 // }, 8944 // "scopes": [ 8945 // "https://www.googleapis.com/auth/classroom.profile.emails", 8946 // "https://www.googleapis.com/auth/classroom.profile.photos", 8947 // "https://www.googleapis.com/auth/classroom.rosters", 8948 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 8949 // ] 8950 // } 8951 8952} 8953 8954// method id "classroom.courses.students.list": 8955 8956type CoursesStudentsListCall struct { 8957 s *Service 8958 courseId string 8959 urlParams_ gensupport.URLParams 8960 ifNoneMatch_ string 8961 ctx_ context.Context 8962 header_ http.Header 8963} 8964 8965// List: Returns a list of students of this course that the requester 8966// is permitted to view. 8967// 8968// This method returns the following error codes: 8969// 8970// * `NOT_FOUND` if the course does not exist. 8971// * `PERMISSION_DENIED` for access errors. 8972func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall { 8973 c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8974 c.courseId = courseId 8975 return c 8976} 8977 8978// PageSize sets the optional parameter "pageSize": Maximum number of 8979// items to return. Zero means no maximum. 8980// 8981// The server may return fewer than the specified number of results. 8982func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall { 8983 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8984 return c 8985} 8986 8987// PageToken sets the optional parameter "pageToken": 8988// nextPageToken 8989// value returned from a previous 8990// list call, indicating that 8991// the subsequent page of results should be returned. 8992// 8993// The list request must be 8994// otherwise identical to the one that resulted in this token. 8995func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall { 8996 c.urlParams_.Set("pageToken", pageToken) 8997 return c 8998} 8999 9000// Fields allows partial responses to be retrieved. See 9001// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9002// for more information. 9003func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall { 9004 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9005 return c 9006} 9007 9008// IfNoneMatch sets the optional parameter which makes the operation 9009// fail if the object's ETag matches the given value. This is useful for 9010// getting updates only after the object has changed since the last 9011// request. Use googleapi.IsNotModified to check whether the response 9012// error from Do is the result of In-None-Match. 9013func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall { 9014 c.ifNoneMatch_ = entityTag 9015 return c 9016} 9017 9018// Context sets the context to be used in this call's Do method. Any 9019// pending HTTP request will be aborted if the provided context is 9020// canceled. 9021func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall { 9022 c.ctx_ = ctx 9023 return c 9024} 9025 9026// Header returns an http.Header that can be modified by the caller to 9027// add HTTP headers to the request. 9028func (c *CoursesStudentsListCall) Header() http.Header { 9029 if c.header_ == nil { 9030 c.header_ = make(http.Header) 9031 } 9032 return c.header_ 9033} 9034 9035func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) { 9036 reqHeaders := make(http.Header) 9037 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 9038 for k, v := range c.header_ { 9039 reqHeaders[k] = v 9040 } 9041 reqHeaders.Set("User-Agent", c.s.userAgent()) 9042 if c.ifNoneMatch_ != "" { 9043 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9044 } 9045 var body io.Reader = nil 9046 c.urlParams_.Set("alt", alt) 9047 c.urlParams_.Set("prettyPrint", "false") 9048 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9049 urls += "?" + c.urlParams_.Encode() 9050 req, err := http.NewRequest("GET", urls, body) 9051 if err != nil { 9052 return nil, err 9053 } 9054 req.Header = reqHeaders 9055 googleapi.Expand(req.URL, map[string]string{ 9056 "courseId": c.courseId, 9057 }) 9058 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9059} 9060 9061// Do executes the "classroom.courses.students.list" call. 9062// Exactly one of *ListStudentsResponse or error will be non-nil. Any 9063// non-2xx status code is an error. Response headers are in either 9064// *ListStudentsResponse.ServerResponse.Header or (if a response was 9065// returned at all) in error.(*googleapi.Error).Header. Use 9066// googleapi.IsNotModified to check whether the returned error was 9067// because http.StatusNotModified was returned. 9068func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) { 9069 gensupport.SetOptions(c.urlParams_, opts...) 9070 res, err := c.doRequest("json") 9071 if res != nil && res.StatusCode == http.StatusNotModified { 9072 if res.Body != nil { 9073 res.Body.Close() 9074 } 9075 return nil, &googleapi.Error{ 9076 Code: res.StatusCode, 9077 Header: res.Header, 9078 } 9079 } 9080 if err != nil { 9081 return nil, err 9082 } 9083 defer googleapi.CloseBody(res) 9084 if err := googleapi.CheckResponse(res); err != nil { 9085 return nil, err 9086 } 9087 ret := &ListStudentsResponse{ 9088 ServerResponse: googleapi.ServerResponse{ 9089 Header: res.Header, 9090 HTTPStatusCode: res.StatusCode, 9091 }, 9092 } 9093 target := &ret 9094 if err := gensupport.DecodeResponse(target, res); err != nil { 9095 return nil, err 9096 } 9097 return ret, nil 9098 // { 9099 // "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.", 9100 // "flatPath": "v1/courses/{courseId}/students", 9101 // "httpMethod": "GET", 9102 // "id": "classroom.courses.students.list", 9103 // "parameterOrder": [ 9104 // "courseId" 9105 // ], 9106 // "parameters": { 9107 // "courseId": { 9108 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9109 // "location": "path", 9110 // "required": true, 9111 // "type": "string" 9112 // }, 9113 // "pageSize": { 9114 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9115 // "format": "int32", 9116 // "location": "query", 9117 // "type": "integer" 9118 // }, 9119 // "pageToken": { 9120 // "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.", 9121 // "location": "query", 9122 // "type": "string" 9123 // } 9124 // }, 9125 // "path": "v1/courses/{courseId}/students", 9126 // "response": { 9127 // "$ref": "ListStudentsResponse" 9128 // }, 9129 // "scopes": [ 9130 // "https://www.googleapis.com/auth/classroom.profile.emails", 9131 // "https://www.googleapis.com/auth/classroom.profile.photos", 9132 // "https://www.googleapis.com/auth/classroom.rosters", 9133 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9134 // ] 9135 // } 9136 9137} 9138 9139// Pages invokes f for each page of results. 9140// A non-nil error returned from f will halt the iteration. 9141// The provided context supersedes any context provided to the Context method. 9142func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error { 9143 c.ctx_ = ctx 9144 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9145 for { 9146 x, err := c.Do() 9147 if err != nil { 9148 return err 9149 } 9150 if err := f(x); err != nil { 9151 return err 9152 } 9153 if x.NextPageToken == "" { 9154 return nil 9155 } 9156 c.PageToken(x.NextPageToken) 9157 } 9158} 9159 9160// method id "classroom.courses.teachers.create": 9161 9162type CoursesTeachersCreateCall struct { 9163 s *Service 9164 courseId string 9165 teacher *Teacher 9166 urlParams_ gensupport.URLParams 9167 ctx_ context.Context 9168 header_ http.Header 9169} 9170 9171// Create: Creates a teacher of a course. 9172// 9173// This method returns the following error codes: 9174// 9175// * `PERMISSION_DENIED` if the requesting user is not permitted to 9176// create 9177// teachers in this course or for access errors. 9178// * `NOT_FOUND` if the requested course ID does not exist. 9179// * `FAILED_PRECONDITION` if the requested user's account is 9180// disabled, 9181// for the following request errors: 9182// * CourseMemberLimitReached 9183// * CourseNotModifiable 9184// * CourseTeacherLimitReached 9185// * UserGroupsMembershipLimitReached 9186// * `ALREADY_EXISTS` if the user is already a teacher or student in 9187// the 9188// course. 9189func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall { 9190 c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9191 c.courseId = courseId 9192 c.teacher = teacher 9193 return c 9194} 9195 9196// Fields allows partial responses to be retrieved. See 9197// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9198// for more information. 9199func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall { 9200 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9201 return c 9202} 9203 9204// Context sets the context to be used in this call's Do method. Any 9205// pending HTTP request will be aborted if the provided context is 9206// canceled. 9207func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall { 9208 c.ctx_ = ctx 9209 return c 9210} 9211 9212// Header returns an http.Header that can be modified by the caller to 9213// add HTTP headers to the request. 9214func (c *CoursesTeachersCreateCall) Header() http.Header { 9215 if c.header_ == nil { 9216 c.header_ = make(http.Header) 9217 } 9218 return c.header_ 9219} 9220 9221func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) { 9222 reqHeaders := make(http.Header) 9223 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 9224 for k, v := range c.header_ { 9225 reqHeaders[k] = v 9226 } 9227 reqHeaders.Set("User-Agent", c.s.userAgent()) 9228 var body io.Reader = nil 9229 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher) 9230 if err != nil { 9231 return nil, err 9232 } 9233 reqHeaders.Set("Content-Type", "application/json") 9234 c.urlParams_.Set("alt", alt) 9235 c.urlParams_.Set("prettyPrint", "false") 9236 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9237 urls += "?" + c.urlParams_.Encode() 9238 req, err := http.NewRequest("POST", urls, body) 9239 if err != nil { 9240 return nil, err 9241 } 9242 req.Header = reqHeaders 9243 googleapi.Expand(req.URL, map[string]string{ 9244 "courseId": c.courseId, 9245 }) 9246 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9247} 9248 9249// Do executes the "classroom.courses.teachers.create" call. 9250// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9251// code is an error. Response headers are in either 9252// *Teacher.ServerResponse.Header or (if a response was returned at all) 9253// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9254// check whether the returned error was because http.StatusNotModified 9255// was returned. 9256func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9257 gensupport.SetOptions(c.urlParams_, opts...) 9258 res, err := c.doRequest("json") 9259 if res != nil && res.StatusCode == http.StatusNotModified { 9260 if res.Body != nil { 9261 res.Body.Close() 9262 } 9263 return nil, &googleapi.Error{ 9264 Code: res.StatusCode, 9265 Header: res.Header, 9266 } 9267 } 9268 if err != nil { 9269 return nil, err 9270 } 9271 defer googleapi.CloseBody(res) 9272 if err := googleapi.CheckResponse(res); err != nil { 9273 return nil, err 9274 } 9275 ret := &Teacher{ 9276 ServerResponse: googleapi.ServerResponse{ 9277 Header: res.Header, 9278 HTTPStatusCode: res.StatusCode, 9279 }, 9280 } 9281 target := &ret 9282 if err := gensupport.DecodeResponse(target, res); err != nil { 9283 return nil, err 9284 } 9285 return ret, nil 9286 // { 9287 // "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.", 9288 // "flatPath": "v1/courses/{courseId}/teachers", 9289 // "httpMethod": "POST", 9290 // "id": "classroom.courses.teachers.create", 9291 // "parameterOrder": [ 9292 // "courseId" 9293 // ], 9294 // "parameters": { 9295 // "courseId": { 9296 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9297 // "location": "path", 9298 // "required": true, 9299 // "type": "string" 9300 // } 9301 // }, 9302 // "path": "v1/courses/{courseId}/teachers", 9303 // "request": { 9304 // "$ref": "Teacher" 9305 // }, 9306 // "response": { 9307 // "$ref": "Teacher" 9308 // }, 9309 // "scopes": [ 9310 // "https://www.googleapis.com/auth/classroom.profile.emails", 9311 // "https://www.googleapis.com/auth/classroom.profile.photos", 9312 // "https://www.googleapis.com/auth/classroom.rosters" 9313 // ] 9314 // } 9315 9316} 9317 9318// method id "classroom.courses.teachers.delete": 9319 9320type CoursesTeachersDeleteCall struct { 9321 s *Service 9322 courseId string 9323 userId string 9324 urlParams_ gensupport.URLParams 9325 ctx_ context.Context 9326 header_ http.Header 9327} 9328 9329// Delete: Deletes a teacher of a course. 9330// 9331// This method returns the following error codes: 9332// 9333// * `PERMISSION_DENIED` if the requesting user is not permitted to 9334// delete 9335// teachers of this course or for access errors. 9336// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9337// the 9338// course does not exist. 9339// * `FAILED_PRECONDITION` if the requested ID belongs to the primary 9340// teacher 9341// of this course. 9342func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall { 9343 c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9344 c.courseId = courseId 9345 c.userId = userId 9346 return c 9347} 9348 9349// Fields allows partial responses to be retrieved. See 9350// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9351// for more information. 9352func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall { 9353 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9354 return c 9355} 9356 9357// Context sets the context to be used in this call's Do method. Any 9358// pending HTTP request will be aborted if the provided context is 9359// canceled. 9360func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall { 9361 c.ctx_ = ctx 9362 return c 9363} 9364 9365// Header returns an http.Header that can be modified by the caller to 9366// add HTTP headers to the request. 9367func (c *CoursesTeachersDeleteCall) Header() http.Header { 9368 if c.header_ == nil { 9369 c.header_ = make(http.Header) 9370 } 9371 return c.header_ 9372} 9373 9374func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) { 9375 reqHeaders := make(http.Header) 9376 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 9377 for k, v := range c.header_ { 9378 reqHeaders[k] = v 9379 } 9380 reqHeaders.Set("User-Agent", c.s.userAgent()) 9381 var body io.Reader = nil 9382 c.urlParams_.Set("alt", alt) 9383 c.urlParams_.Set("prettyPrint", "false") 9384 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9385 urls += "?" + c.urlParams_.Encode() 9386 req, err := http.NewRequest("DELETE", urls, body) 9387 if err != nil { 9388 return nil, err 9389 } 9390 req.Header = reqHeaders 9391 googleapi.Expand(req.URL, map[string]string{ 9392 "courseId": c.courseId, 9393 "userId": c.userId, 9394 }) 9395 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9396} 9397 9398// Do executes the "classroom.courses.teachers.delete" call. 9399// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9400// code is an error. Response headers are in either 9401// *Empty.ServerResponse.Header or (if a response was returned at all) 9402// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9403// check whether the returned error was because http.StatusNotModified 9404// was returned. 9405func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9406 gensupport.SetOptions(c.urlParams_, opts...) 9407 res, err := c.doRequest("json") 9408 if res != nil && res.StatusCode == http.StatusNotModified { 9409 if res.Body != nil { 9410 res.Body.Close() 9411 } 9412 return nil, &googleapi.Error{ 9413 Code: res.StatusCode, 9414 Header: res.Header, 9415 } 9416 } 9417 if err != nil { 9418 return nil, err 9419 } 9420 defer googleapi.CloseBody(res) 9421 if err := googleapi.CheckResponse(res); err != nil { 9422 return nil, err 9423 } 9424 ret := &Empty{ 9425 ServerResponse: googleapi.ServerResponse{ 9426 Header: res.Header, 9427 HTTPStatusCode: res.StatusCode, 9428 }, 9429 } 9430 target := &ret 9431 if err := gensupport.DecodeResponse(target, res); err != nil { 9432 return nil, err 9433 } 9434 return ret, nil 9435 // { 9436 // "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.", 9437 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9438 // "httpMethod": "DELETE", 9439 // "id": "classroom.courses.teachers.delete", 9440 // "parameterOrder": [ 9441 // "courseId", 9442 // "userId" 9443 // ], 9444 // "parameters": { 9445 // "courseId": { 9446 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9447 // "location": "path", 9448 // "required": true, 9449 // "type": "string" 9450 // }, 9451 // "userId": { 9452 // "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", 9453 // "location": "path", 9454 // "required": true, 9455 // "type": "string" 9456 // } 9457 // }, 9458 // "path": "v1/courses/{courseId}/teachers/{userId}", 9459 // "response": { 9460 // "$ref": "Empty" 9461 // }, 9462 // "scopes": [ 9463 // "https://www.googleapis.com/auth/classroom.rosters" 9464 // ] 9465 // } 9466 9467} 9468 9469// method id "classroom.courses.teachers.get": 9470 9471type CoursesTeachersGetCall struct { 9472 s *Service 9473 courseId string 9474 userId string 9475 urlParams_ gensupport.URLParams 9476 ifNoneMatch_ string 9477 ctx_ context.Context 9478 header_ http.Header 9479} 9480 9481// Get: Returns a teacher of a course. 9482// 9483// This method returns the following error codes: 9484// 9485// * `PERMISSION_DENIED` if the requesting user is not permitted to 9486// view 9487// teachers of this course or for access errors. 9488// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9489// the 9490// course does not exist. 9491func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall { 9492 c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9493 c.courseId = courseId 9494 c.userId = userId 9495 return c 9496} 9497 9498// Fields allows partial responses to be retrieved. See 9499// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9500// for more information. 9501func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall { 9502 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9503 return c 9504} 9505 9506// IfNoneMatch sets the optional parameter which makes the operation 9507// fail if the object's ETag matches the given value. This is useful for 9508// getting updates only after the object has changed since the last 9509// request. Use googleapi.IsNotModified to check whether the response 9510// error from Do is the result of In-None-Match. 9511func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall { 9512 c.ifNoneMatch_ = entityTag 9513 return c 9514} 9515 9516// Context sets the context to be used in this call's Do method. Any 9517// pending HTTP request will be aborted if the provided context is 9518// canceled. 9519func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall { 9520 c.ctx_ = ctx 9521 return c 9522} 9523 9524// Header returns an http.Header that can be modified by the caller to 9525// add HTTP headers to the request. 9526func (c *CoursesTeachersGetCall) Header() http.Header { 9527 if c.header_ == nil { 9528 c.header_ = make(http.Header) 9529 } 9530 return c.header_ 9531} 9532 9533func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) { 9534 reqHeaders := make(http.Header) 9535 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 9536 for k, v := range c.header_ { 9537 reqHeaders[k] = v 9538 } 9539 reqHeaders.Set("User-Agent", c.s.userAgent()) 9540 if c.ifNoneMatch_ != "" { 9541 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9542 } 9543 var body io.Reader = nil 9544 c.urlParams_.Set("alt", alt) 9545 c.urlParams_.Set("prettyPrint", "false") 9546 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9547 urls += "?" + c.urlParams_.Encode() 9548 req, err := http.NewRequest("GET", urls, body) 9549 if err != nil { 9550 return nil, err 9551 } 9552 req.Header = reqHeaders 9553 googleapi.Expand(req.URL, map[string]string{ 9554 "courseId": c.courseId, 9555 "userId": c.userId, 9556 }) 9557 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9558} 9559 9560// Do executes the "classroom.courses.teachers.get" call. 9561// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9562// code is an error. Response headers are in either 9563// *Teacher.ServerResponse.Header or (if a response was returned at all) 9564// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9565// check whether the returned error was because http.StatusNotModified 9566// was returned. 9567func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9568 gensupport.SetOptions(c.urlParams_, opts...) 9569 res, err := c.doRequest("json") 9570 if res != nil && res.StatusCode == http.StatusNotModified { 9571 if res.Body != nil { 9572 res.Body.Close() 9573 } 9574 return nil, &googleapi.Error{ 9575 Code: res.StatusCode, 9576 Header: res.Header, 9577 } 9578 } 9579 if err != nil { 9580 return nil, err 9581 } 9582 defer googleapi.CloseBody(res) 9583 if err := googleapi.CheckResponse(res); err != nil { 9584 return nil, err 9585 } 9586 ret := &Teacher{ 9587 ServerResponse: googleapi.ServerResponse{ 9588 Header: res.Header, 9589 HTTPStatusCode: res.StatusCode, 9590 }, 9591 } 9592 target := &ret 9593 if err := gensupport.DecodeResponse(target, res); err != nil { 9594 return nil, err 9595 } 9596 return ret, nil 9597 // { 9598 // "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.", 9599 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9600 // "httpMethod": "GET", 9601 // "id": "classroom.courses.teachers.get", 9602 // "parameterOrder": [ 9603 // "courseId", 9604 // "userId" 9605 // ], 9606 // "parameters": { 9607 // "courseId": { 9608 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9609 // "location": "path", 9610 // "required": true, 9611 // "type": "string" 9612 // }, 9613 // "userId": { 9614 // "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", 9615 // "location": "path", 9616 // "required": true, 9617 // "type": "string" 9618 // } 9619 // }, 9620 // "path": "v1/courses/{courseId}/teachers/{userId}", 9621 // "response": { 9622 // "$ref": "Teacher" 9623 // }, 9624 // "scopes": [ 9625 // "https://www.googleapis.com/auth/classroom.profile.emails", 9626 // "https://www.googleapis.com/auth/classroom.profile.photos", 9627 // "https://www.googleapis.com/auth/classroom.rosters", 9628 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9629 // ] 9630 // } 9631 9632} 9633 9634// method id "classroom.courses.teachers.list": 9635 9636type CoursesTeachersListCall struct { 9637 s *Service 9638 courseId string 9639 urlParams_ gensupport.URLParams 9640 ifNoneMatch_ string 9641 ctx_ context.Context 9642 header_ http.Header 9643} 9644 9645// List: Returns a list of teachers of this course that the requester 9646// is permitted to view. 9647// 9648// This method returns the following error codes: 9649// 9650// * `NOT_FOUND` if the course does not exist. 9651// * `PERMISSION_DENIED` for access errors. 9652func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall { 9653 c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9654 c.courseId = courseId 9655 return c 9656} 9657 9658// PageSize sets the optional parameter "pageSize": Maximum number of 9659// items to return. Zero means no maximum. 9660// 9661// The server may return fewer than the specified number of results. 9662func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall { 9663 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9664 return c 9665} 9666 9667// PageToken sets the optional parameter "pageToken": 9668// nextPageToken 9669// value returned from a previous 9670// list call, indicating that 9671// the subsequent page of results should be returned. 9672// 9673// The list request must be 9674// otherwise identical to the one that resulted in this token. 9675func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall { 9676 c.urlParams_.Set("pageToken", pageToken) 9677 return c 9678} 9679 9680// Fields allows partial responses to be retrieved. See 9681// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9682// for more information. 9683func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall { 9684 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9685 return c 9686} 9687 9688// IfNoneMatch sets the optional parameter which makes the operation 9689// fail if the object's ETag matches the given value. This is useful for 9690// getting updates only after the object has changed since the last 9691// request. Use googleapi.IsNotModified to check whether the response 9692// error from Do is the result of In-None-Match. 9693func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall { 9694 c.ifNoneMatch_ = entityTag 9695 return c 9696} 9697 9698// Context sets the context to be used in this call's Do method. Any 9699// pending HTTP request will be aborted if the provided context is 9700// canceled. 9701func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall { 9702 c.ctx_ = ctx 9703 return c 9704} 9705 9706// Header returns an http.Header that can be modified by the caller to 9707// add HTTP headers to the request. 9708func (c *CoursesTeachersListCall) Header() http.Header { 9709 if c.header_ == nil { 9710 c.header_ = make(http.Header) 9711 } 9712 return c.header_ 9713} 9714 9715func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) { 9716 reqHeaders := make(http.Header) 9717 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 9718 for k, v := range c.header_ { 9719 reqHeaders[k] = v 9720 } 9721 reqHeaders.Set("User-Agent", c.s.userAgent()) 9722 if c.ifNoneMatch_ != "" { 9723 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9724 } 9725 var body io.Reader = nil 9726 c.urlParams_.Set("alt", alt) 9727 c.urlParams_.Set("prettyPrint", "false") 9728 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9729 urls += "?" + c.urlParams_.Encode() 9730 req, err := http.NewRequest("GET", urls, body) 9731 if err != nil { 9732 return nil, err 9733 } 9734 req.Header = reqHeaders 9735 googleapi.Expand(req.URL, map[string]string{ 9736 "courseId": c.courseId, 9737 }) 9738 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9739} 9740 9741// Do executes the "classroom.courses.teachers.list" call. 9742// Exactly one of *ListTeachersResponse or error will be non-nil. Any 9743// non-2xx status code is an error. Response headers are in either 9744// *ListTeachersResponse.ServerResponse.Header or (if a response was 9745// returned at all) in error.(*googleapi.Error).Header. Use 9746// googleapi.IsNotModified to check whether the returned error was 9747// because http.StatusNotModified was returned. 9748func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) { 9749 gensupport.SetOptions(c.urlParams_, opts...) 9750 res, err := c.doRequest("json") 9751 if res != nil && res.StatusCode == http.StatusNotModified { 9752 if res.Body != nil { 9753 res.Body.Close() 9754 } 9755 return nil, &googleapi.Error{ 9756 Code: res.StatusCode, 9757 Header: res.Header, 9758 } 9759 } 9760 if err != nil { 9761 return nil, err 9762 } 9763 defer googleapi.CloseBody(res) 9764 if err := googleapi.CheckResponse(res); err != nil { 9765 return nil, err 9766 } 9767 ret := &ListTeachersResponse{ 9768 ServerResponse: googleapi.ServerResponse{ 9769 Header: res.Header, 9770 HTTPStatusCode: res.StatusCode, 9771 }, 9772 } 9773 target := &ret 9774 if err := gensupport.DecodeResponse(target, res); err != nil { 9775 return nil, err 9776 } 9777 return ret, nil 9778 // { 9779 // "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.", 9780 // "flatPath": "v1/courses/{courseId}/teachers", 9781 // "httpMethod": "GET", 9782 // "id": "classroom.courses.teachers.list", 9783 // "parameterOrder": [ 9784 // "courseId" 9785 // ], 9786 // "parameters": { 9787 // "courseId": { 9788 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9789 // "location": "path", 9790 // "required": true, 9791 // "type": "string" 9792 // }, 9793 // "pageSize": { 9794 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9795 // "format": "int32", 9796 // "location": "query", 9797 // "type": "integer" 9798 // }, 9799 // "pageToken": { 9800 // "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.", 9801 // "location": "query", 9802 // "type": "string" 9803 // } 9804 // }, 9805 // "path": "v1/courses/{courseId}/teachers", 9806 // "response": { 9807 // "$ref": "ListTeachersResponse" 9808 // }, 9809 // "scopes": [ 9810 // "https://www.googleapis.com/auth/classroom.profile.emails", 9811 // "https://www.googleapis.com/auth/classroom.profile.photos", 9812 // "https://www.googleapis.com/auth/classroom.rosters", 9813 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9814 // ] 9815 // } 9816 9817} 9818 9819// Pages invokes f for each page of results. 9820// A non-nil error returned from f will halt the iteration. 9821// The provided context supersedes any context provided to the Context method. 9822func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error { 9823 c.ctx_ = ctx 9824 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9825 for { 9826 x, err := c.Do() 9827 if err != nil { 9828 return err 9829 } 9830 if err := f(x); err != nil { 9831 return err 9832 } 9833 if x.NextPageToken == "" { 9834 return nil 9835 } 9836 c.PageToken(x.NextPageToken) 9837 } 9838} 9839 9840// method id "classroom.courses.topics.create": 9841 9842type CoursesTopicsCreateCall struct { 9843 s *Service 9844 courseId string 9845 topic *Topic 9846 urlParams_ gensupport.URLParams 9847 ctx_ context.Context 9848 header_ http.Header 9849} 9850 9851// Create: Creates a topic. 9852// 9853// This method returns the following error codes: 9854// 9855// * `PERMISSION_DENIED` if the requesting user is not permitted to 9856// access the 9857// requested course, create a topic in the requested course, 9858// or for access errors. 9859// * `INVALID_ARGUMENT` if the request is malformed. 9860// * `NOT_FOUND` if the requested course does not exist. 9861func (r *CoursesTopicsService) Create(courseId string, topic *Topic) *CoursesTopicsCreateCall { 9862 c := &CoursesTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9863 c.courseId = courseId 9864 c.topic = topic 9865 return c 9866} 9867 9868// Fields allows partial responses to be retrieved. See 9869// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9870// for more information. 9871func (c *CoursesTopicsCreateCall) Fields(s ...googleapi.Field) *CoursesTopicsCreateCall { 9872 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9873 return c 9874} 9875 9876// Context sets the context to be used in this call's Do method. Any 9877// pending HTTP request will be aborted if the provided context is 9878// canceled. 9879func (c *CoursesTopicsCreateCall) Context(ctx context.Context) *CoursesTopicsCreateCall { 9880 c.ctx_ = ctx 9881 return c 9882} 9883 9884// Header returns an http.Header that can be modified by the caller to 9885// add HTTP headers to the request. 9886func (c *CoursesTopicsCreateCall) Header() http.Header { 9887 if c.header_ == nil { 9888 c.header_ = make(http.Header) 9889 } 9890 return c.header_ 9891} 9892 9893func (c *CoursesTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 9894 reqHeaders := make(http.Header) 9895 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 9896 for k, v := range c.header_ { 9897 reqHeaders[k] = v 9898 } 9899 reqHeaders.Set("User-Agent", c.s.userAgent()) 9900 var body io.Reader = nil 9901 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 9902 if err != nil { 9903 return nil, err 9904 } 9905 reqHeaders.Set("Content-Type", "application/json") 9906 c.urlParams_.Set("alt", alt) 9907 c.urlParams_.Set("prettyPrint", "false") 9908 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 9909 urls += "?" + c.urlParams_.Encode() 9910 req, err := http.NewRequest("POST", urls, body) 9911 if err != nil { 9912 return nil, err 9913 } 9914 req.Header = reqHeaders 9915 googleapi.Expand(req.URL, map[string]string{ 9916 "courseId": c.courseId, 9917 }) 9918 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9919} 9920 9921// Do executes the "classroom.courses.topics.create" call. 9922// Exactly one of *Topic or error will be non-nil. Any non-2xx status 9923// code is an error. Response headers are in either 9924// *Topic.ServerResponse.Header or (if a response was returned at all) 9925// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9926// check whether the returned error was because http.StatusNotModified 9927// was returned. 9928func (c *CoursesTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 9929 gensupport.SetOptions(c.urlParams_, opts...) 9930 res, err := c.doRequest("json") 9931 if res != nil && res.StatusCode == http.StatusNotModified { 9932 if res.Body != nil { 9933 res.Body.Close() 9934 } 9935 return nil, &googleapi.Error{ 9936 Code: res.StatusCode, 9937 Header: res.Header, 9938 } 9939 } 9940 if err != nil { 9941 return nil, err 9942 } 9943 defer googleapi.CloseBody(res) 9944 if err := googleapi.CheckResponse(res); err != nil { 9945 return nil, err 9946 } 9947 ret := &Topic{ 9948 ServerResponse: googleapi.ServerResponse{ 9949 Header: res.Header, 9950 HTTPStatusCode: res.StatusCode, 9951 }, 9952 } 9953 target := &ret 9954 if err := gensupport.DecodeResponse(target, res); err != nil { 9955 return nil, err 9956 } 9957 return ret, nil 9958 // { 9959 // "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.", 9960 // "flatPath": "v1/courses/{courseId}/topics", 9961 // "httpMethod": "POST", 9962 // "id": "classroom.courses.topics.create", 9963 // "parameterOrder": [ 9964 // "courseId" 9965 // ], 9966 // "parameters": { 9967 // "courseId": { 9968 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9969 // "location": "path", 9970 // "required": true, 9971 // "type": "string" 9972 // } 9973 // }, 9974 // "path": "v1/courses/{courseId}/topics", 9975 // "request": { 9976 // "$ref": "Topic" 9977 // }, 9978 // "response": { 9979 // "$ref": "Topic" 9980 // }, 9981 // "scopes": [ 9982 // "https://www.googleapis.com/auth/classroom.topics" 9983 // ] 9984 // } 9985 9986} 9987 9988// method id "classroom.courses.topics.delete": 9989 9990type CoursesTopicsDeleteCall struct { 9991 s *Service 9992 courseId string 9993 id string 9994 urlParams_ gensupport.URLParams 9995 ctx_ context.Context 9996 header_ http.Header 9997} 9998 9999// Delete: Deletes a topic. 10000// 10001// This method returns the following error codes: 10002// 10003// * `PERMISSION_DENIED` if the requesting user is not allowed to delete 10004// the 10005// requested topic or for access errors. 10006// * `FAILED_PRECONDITION` if the requested topic has already 10007// been 10008// deleted. 10009// * `NOT_FOUND` if no course or topic exists with the requested ID. 10010func (r *CoursesTopicsService) Delete(courseId string, id string) *CoursesTopicsDeleteCall { 10011 c := &CoursesTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10012 c.courseId = courseId 10013 c.id = id 10014 return c 10015} 10016 10017// Fields allows partial responses to be retrieved. See 10018// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10019// for more information. 10020func (c *CoursesTopicsDeleteCall) Fields(s ...googleapi.Field) *CoursesTopicsDeleteCall { 10021 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10022 return c 10023} 10024 10025// Context sets the context to be used in this call's Do method. Any 10026// pending HTTP request will be aborted if the provided context is 10027// canceled. 10028func (c *CoursesTopicsDeleteCall) Context(ctx context.Context) *CoursesTopicsDeleteCall { 10029 c.ctx_ = ctx 10030 return c 10031} 10032 10033// Header returns an http.Header that can be modified by the caller to 10034// add HTTP headers to the request. 10035func (c *CoursesTopicsDeleteCall) Header() http.Header { 10036 if c.header_ == nil { 10037 c.header_ = make(http.Header) 10038 } 10039 return c.header_ 10040} 10041 10042func (c *CoursesTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 10043 reqHeaders := make(http.Header) 10044 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 10045 for k, v := range c.header_ { 10046 reqHeaders[k] = v 10047 } 10048 reqHeaders.Set("User-Agent", c.s.userAgent()) 10049 var body io.Reader = nil 10050 c.urlParams_.Set("alt", alt) 10051 c.urlParams_.Set("prettyPrint", "false") 10052 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10053 urls += "?" + c.urlParams_.Encode() 10054 req, err := http.NewRequest("DELETE", urls, body) 10055 if err != nil { 10056 return nil, err 10057 } 10058 req.Header = reqHeaders 10059 googleapi.Expand(req.URL, map[string]string{ 10060 "courseId": c.courseId, 10061 "id": c.id, 10062 }) 10063 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10064} 10065 10066// Do executes the "classroom.courses.topics.delete" call. 10067// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10068// code is an error. Response headers are in either 10069// *Empty.ServerResponse.Header or (if a response was returned at all) 10070// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10071// check whether the returned error was because http.StatusNotModified 10072// was returned. 10073func (c *CoursesTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10074 gensupport.SetOptions(c.urlParams_, opts...) 10075 res, err := c.doRequest("json") 10076 if res != nil && res.StatusCode == http.StatusNotModified { 10077 if res.Body != nil { 10078 res.Body.Close() 10079 } 10080 return nil, &googleapi.Error{ 10081 Code: res.StatusCode, 10082 Header: res.Header, 10083 } 10084 } 10085 if err != nil { 10086 return nil, err 10087 } 10088 defer googleapi.CloseBody(res) 10089 if err := googleapi.CheckResponse(res); err != nil { 10090 return nil, err 10091 } 10092 ret := &Empty{ 10093 ServerResponse: googleapi.ServerResponse{ 10094 Header: res.Header, 10095 HTTPStatusCode: res.StatusCode, 10096 }, 10097 } 10098 target := &ret 10099 if err := gensupport.DecodeResponse(target, res); err != nil { 10100 return nil, err 10101 } 10102 return ret, nil 10103 // { 10104 // "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.", 10105 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10106 // "httpMethod": "DELETE", 10107 // "id": "classroom.courses.topics.delete", 10108 // "parameterOrder": [ 10109 // "courseId", 10110 // "id" 10111 // ], 10112 // "parameters": { 10113 // "courseId": { 10114 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10115 // "location": "path", 10116 // "required": true, 10117 // "type": "string" 10118 // }, 10119 // "id": { 10120 // "description": "Identifier of the topic to delete.", 10121 // "location": "path", 10122 // "required": true, 10123 // "type": "string" 10124 // } 10125 // }, 10126 // "path": "v1/courses/{courseId}/topics/{id}", 10127 // "response": { 10128 // "$ref": "Empty" 10129 // }, 10130 // "scopes": [ 10131 // "https://www.googleapis.com/auth/classroom.topics" 10132 // ] 10133 // } 10134 10135} 10136 10137// method id "classroom.courses.topics.get": 10138 10139type CoursesTopicsGetCall struct { 10140 s *Service 10141 courseId string 10142 id string 10143 urlParams_ gensupport.URLParams 10144 ifNoneMatch_ string 10145 ctx_ context.Context 10146 header_ http.Header 10147} 10148 10149// Get: Returns a topic. 10150// 10151// This method returns the following error codes: 10152// 10153// * `PERMISSION_DENIED` if the requesting user is not permitted to 10154// access the 10155// requested course or topic, or for access errors. 10156// * `INVALID_ARGUMENT` if the request is malformed. 10157// * `NOT_FOUND` if the requested course or topic does not exist. 10158func (r *CoursesTopicsService) Get(courseId string, id string) *CoursesTopicsGetCall { 10159 c := &CoursesTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10160 c.courseId = courseId 10161 c.id = id 10162 return c 10163} 10164 10165// Fields allows partial responses to be retrieved. See 10166// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10167// for more information. 10168func (c *CoursesTopicsGetCall) Fields(s ...googleapi.Field) *CoursesTopicsGetCall { 10169 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10170 return c 10171} 10172 10173// IfNoneMatch sets the optional parameter which makes the operation 10174// fail if the object's ETag matches the given value. This is useful for 10175// getting updates only after the object has changed since the last 10176// request. Use googleapi.IsNotModified to check whether the response 10177// error from Do is the result of In-None-Match. 10178func (c *CoursesTopicsGetCall) IfNoneMatch(entityTag string) *CoursesTopicsGetCall { 10179 c.ifNoneMatch_ = entityTag 10180 return c 10181} 10182 10183// Context sets the context to be used in this call's Do method. Any 10184// pending HTTP request will be aborted if the provided context is 10185// canceled. 10186func (c *CoursesTopicsGetCall) Context(ctx context.Context) *CoursesTopicsGetCall { 10187 c.ctx_ = ctx 10188 return c 10189} 10190 10191// Header returns an http.Header that can be modified by the caller to 10192// add HTTP headers to the request. 10193func (c *CoursesTopicsGetCall) Header() http.Header { 10194 if c.header_ == nil { 10195 c.header_ = make(http.Header) 10196 } 10197 return c.header_ 10198} 10199 10200func (c *CoursesTopicsGetCall) doRequest(alt string) (*http.Response, error) { 10201 reqHeaders := make(http.Header) 10202 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 10203 for k, v := range c.header_ { 10204 reqHeaders[k] = v 10205 } 10206 reqHeaders.Set("User-Agent", c.s.userAgent()) 10207 if c.ifNoneMatch_ != "" { 10208 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10209 } 10210 var body io.Reader = nil 10211 c.urlParams_.Set("alt", alt) 10212 c.urlParams_.Set("prettyPrint", "false") 10213 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10214 urls += "?" + c.urlParams_.Encode() 10215 req, err := http.NewRequest("GET", urls, body) 10216 if err != nil { 10217 return nil, err 10218 } 10219 req.Header = reqHeaders 10220 googleapi.Expand(req.URL, map[string]string{ 10221 "courseId": c.courseId, 10222 "id": c.id, 10223 }) 10224 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10225} 10226 10227// Do executes the "classroom.courses.topics.get" call. 10228// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10229// code is an error. Response headers are in either 10230// *Topic.ServerResponse.Header or (if a response was returned at all) 10231// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10232// check whether the returned error was because http.StatusNotModified 10233// was returned. 10234func (c *CoursesTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10235 gensupport.SetOptions(c.urlParams_, opts...) 10236 res, err := c.doRequest("json") 10237 if res != nil && res.StatusCode == http.StatusNotModified { 10238 if res.Body != nil { 10239 res.Body.Close() 10240 } 10241 return nil, &googleapi.Error{ 10242 Code: res.StatusCode, 10243 Header: res.Header, 10244 } 10245 } 10246 if err != nil { 10247 return nil, err 10248 } 10249 defer googleapi.CloseBody(res) 10250 if err := googleapi.CheckResponse(res); err != nil { 10251 return nil, err 10252 } 10253 ret := &Topic{ 10254 ServerResponse: googleapi.ServerResponse{ 10255 Header: res.Header, 10256 HTTPStatusCode: res.StatusCode, 10257 }, 10258 } 10259 target := &ret 10260 if err := gensupport.DecodeResponse(target, res); err != nil { 10261 return nil, err 10262 } 10263 return ret, nil 10264 // { 10265 // "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.", 10266 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10267 // "httpMethod": "GET", 10268 // "id": "classroom.courses.topics.get", 10269 // "parameterOrder": [ 10270 // "courseId", 10271 // "id" 10272 // ], 10273 // "parameters": { 10274 // "courseId": { 10275 // "description": "Identifier of the course.", 10276 // "location": "path", 10277 // "required": true, 10278 // "type": "string" 10279 // }, 10280 // "id": { 10281 // "description": "Identifier of the topic.", 10282 // "location": "path", 10283 // "required": true, 10284 // "type": "string" 10285 // } 10286 // }, 10287 // "path": "v1/courses/{courseId}/topics/{id}", 10288 // "response": { 10289 // "$ref": "Topic" 10290 // }, 10291 // "scopes": [ 10292 // "https://www.googleapis.com/auth/classroom.topics", 10293 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10294 // ] 10295 // } 10296 10297} 10298 10299// method id "classroom.courses.topics.list": 10300 10301type CoursesTopicsListCall struct { 10302 s *Service 10303 courseId string 10304 urlParams_ gensupport.URLParams 10305 ifNoneMatch_ string 10306 ctx_ context.Context 10307 header_ http.Header 10308} 10309 10310// List: Returns the list of topics that the requester is permitted to 10311// view. 10312// 10313// This method returns the following error codes: 10314// 10315// * `PERMISSION_DENIED` if the requesting user is not permitted to 10316// access 10317// the requested course or for access errors. 10318// * `INVALID_ARGUMENT` if the request is malformed. 10319// * `NOT_FOUND` if the requested course does not exist. 10320func (r *CoursesTopicsService) List(courseId string) *CoursesTopicsListCall { 10321 c := &CoursesTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10322 c.courseId = courseId 10323 return c 10324} 10325 10326// PageSize sets the optional parameter "pageSize": Maximum number of 10327// items to return. Zero or unspecified indicates that the 10328// server may assign a maximum. 10329// 10330// The server may return fewer than the specified number of results. 10331func (c *CoursesTopicsListCall) PageSize(pageSize int64) *CoursesTopicsListCall { 10332 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10333 return c 10334} 10335 10336// PageToken sets the optional parameter "pageToken": 10337// nextPageToken 10338// value returned from a previous 10339// list call, 10340// indicating that the subsequent page of results should be 10341// returned. 10342// 10343// The list request 10344// must be otherwise identical to the one that resulted in this token. 10345func (c *CoursesTopicsListCall) PageToken(pageToken string) *CoursesTopicsListCall { 10346 c.urlParams_.Set("pageToken", pageToken) 10347 return c 10348} 10349 10350// Fields allows partial responses to be retrieved. See 10351// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10352// for more information. 10353func (c *CoursesTopicsListCall) Fields(s ...googleapi.Field) *CoursesTopicsListCall { 10354 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10355 return c 10356} 10357 10358// IfNoneMatch sets the optional parameter which makes the operation 10359// fail if the object's ETag matches the given value. This is useful for 10360// getting updates only after the object has changed since the last 10361// request. Use googleapi.IsNotModified to check whether the response 10362// error from Do is the result of In-None-Match. 10363func (c *CoursesTopicsListCall) IfNoneMatch(entityTag string) *CoursesTopicsListCall { 10364 c.ifNoneMatch_ = entityTag 10365 return c 10366} 10367 10368// Context sets the context to be used in this call's Do method. Any 10369// pending HTTP request will be aborted if the provided context is 10370// canceled. 10371func (c *CoursesTopicsListCall) Context(ctx context.Context) *CoursesTopicsListCall { 10372 c.ctx_ = ctx 10373 return c 10374} 10375 10376// Header returns an http.Header that can be modified by the caller to 10377// add HTTP headers to the request. 10378func (c *CoursesTopicsListCall) Header() http.Header { 10379 if c.header_ == nil { 10380 c.header_ = make(http.Header) 10381 } 10382 return c.header_ 10383} 10384 10385func (c *CoursesTopicsListCall) doRequest(alt string) (*http.Response, error) { 10386 reqHeaders := make(http.Header) 10387 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 10388 for k, v := range c.header_ { 10389 reqHeaders[k] = v 10390 } 10391 reqHeaders.Set("User-Agent", c.s.userAgent()) 10392 if c.ifNoneMatch_ != "" { 10393 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10394 } 10395 var body io.Reader = nil 10396 c.urlParams_.Set("alt", alt) 10397 c.urlParams_.Set("prettyPrint", "false") 10398 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10399 urls += "?" + c.urlParams_.Encode() 10400 req, err := http.NewRequest("GET", urls, body) 10401 if err != nil { 10402 return nil, err 10403 } 10404 req.Header = reqHeaders 10405 googleapi.Expand(req.URL, map[string]string{ 10406 "courseId": c.courseId, 10407 }) 10408 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10409} 10410 10411// Do executes the "classroom.courses.topics.list" call. 10412// Exactly one of *ListTopicResponse or error will be non-nil. Any 10413// non-2xx status code is an error. Response headers are in either 10414// *ListTopicResponse.ServerResponse.Header or (if a response was 10415// returned at all) in error.(*googleapi.Error).Header. Use 10416// googleapi.IsNotModified to check whether the returned error was 10417// because http.StatusNotModified was returned. 10418func (c *CoursesTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicResponse, error) { 10419 gensupport.SetOptions(c.urlParams_, opts...) 10420 res, err := c.doRequest("json") 10421 if res != nil && res.StatusCode == http.StatusNotModified { 10422 if res.Body != nil { 10423 res.Body.Close() 10424 } 10425 return nil, &googleapi.Error{ 10426 Code: res.StatusCode, 10427 Header: res.Header, 10428 } 10429 } 10430 if err != nil { 10431 return nil, err 10432 } 10433 defer googleapi.CloseBody(res) 10434 if err := googleapi.CheckResponse(res); err != nil { 10435 return nil, err 10436 } 10437 ret := &ListTopicResponse{ 10438 ServerResponse: googleapi.ServerResponse{ 10439 Header: res.Header, 10440 HTTPStatusCode: res.StatusCode, 10441 }, 10442 } 10443 target := &ret 10444 if err := gensupport.DecodeResponse(target, res); err != nil { 10445 return nil, err 10446 } 10447 return ret, nil 10448 // { 10449 // "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.", 10450 // "flatPath": "v1/courses/{courseId}/topics", 10451 // "httpMethod": "GET", 10452 // "id": "classroom.courses.topics.list", 10453 // "parameterOrder": [ 10454 // "courseId" 10455 // ], 10456 // "parameters": { 10457 // "courseId": { 10458 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10459 // "location": "path", 10460 // "required": true, 10461 // "type": "string" 10462 // }, 10463 // "pageSize": { 10464 // "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.", 10465 // "format": "int32", 10466 // "location": "query", 10467 // "type": "integer" 10468 // }, 10469 // "pageToken": { 10470 // "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.", 10471 // "location": "query", 10472 // "type": "string" 10473 // } 10474 // }, 10475 // "path": "v1/courses/{courseId}/topics", 10476 // "response": { 10477 // "$ref": "ListTopicResponse" 10478 // }, 10479 // "scopes": [ 10480 // "https://www.googleapis.com/auth/classroom.topics", 10481 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10482 // ] 10483 // } 10484 10485} 10486 10487// Pages invokes f for each page of results. 10488// A non-nil error returned from f will halt the iteration. 10489// The provided context supersedes any context provided to the Context method. 10490func (c *CoursesTopicsListCall) Pages(ctx context.Context, f func(*ListTopicResponse) error) error { 10491 c.ctx_ = ctx 10492 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10493 for { 10494 x, err := c.Do() 10495 if err != nil { 10496 return err 10497 } 10498 if err := f(x); err != nil { 10499 return err 10500 } 10501 if x.NextPageToken == "" { 10502 return nil 10503 } 10504 c.PageToken(x.NextPageToken) 10505 } 10506} 10507 10508// method id "classroom.courses.topics.patch": 10509 10510type CoursesTopicsPatchCall struct { 10511 s *Service 10512 courseId string 10513 id string 10514 topic *Topic 10515 urlParams_ gensupport.URLParams 10516 ctx_ context.Context 10517 header_ http.Header 10518} 10519 10520// Patch: Updates one or more fields of a topic. 10521// 10522// This method returns the following error codes: 10523// 10524// * `PERMISSION_DENIED` if the requesting developer project did not 10525// create 10526// the corresponding topic or for access errors. 10527// * `INVALID_ARGUMENT` if the request is malformed. 10528// * `NOT_FOUND` if the requested course or topic does not exist 10529func (r *CoursesTopicsService) Patch(courseId string, id string, topic *Topic) *CoursesTopicsPatchCall { 10530 c := &CoursesTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10531 c.courseId = courseId 10532 c.id = id 10533 c.topic = topic 10534 return c 10535} 10536 10537// UpdateMask sets the optional parameter "updateMask": Mask that 10538// identifies which fields on the topic to update. 10539// This field is required to do an update. The update fails if 10540// invalid 10541// fields are specified. If a field supports empty values, it can be 10542// cleared 10543// by specifying it in the update mask and not in the Topic object. If 10544// a 10545// field that does not support empty values is included in the update 10546// mask and 10547// not set in the Topic object, an `INVALID_ARGUMENT` error will 10548// be 10549// returned. 10550// 10551// The following fields may be specified: 10552// 10553// * `name` 10554func (c *CoursesTopicsPatchCall) UpdateMask(updateMask string) *CoursesTopicsPatchCall { 10555 c.urlParams_.Set("updateMask", updateMask) 10556 return c 10557} 10558 10559// Fields allows partial responses to be retrieved. See 10560// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10561// for more information. 10562func (c *CoursesTopicsPatchCall) Fields(s ...googleapi.Field) *CoursesTopicsPatchCall { 10563 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10564 return c 10565} 10566 10567// Context sets the context to be used in this call's Do method. Any 10568// pending HTTP request will be aborted if the provided context is 10569// canceled. 10570func (c *CoursesTopicsPatchCall) Context(ctx context.Context) *CoursesTopicsPatchCall { 10571 c.ctx_ = ctx 10572 return c 10573} 10574 10575// Header returns an http.Header that can be modified by the caller to 10576// add HTTP headers to the request. 10577func (c *CoursesTopicsPatchCall) Header() http.Header { 10578 if c.header_ == nil { 10579 c.header_ = make(http.Header) 10580 } 10581 return c.header_ 10582} 10583 10584func (c *CoursesTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 10585 reqHeaders := make(http.Header) 10586 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 10587 for k, v := range c.header_ { 10588 reqHeaders[k] = v 10589 } 10590 reqHeaders.Set("User-Agent", c.s.userAgent()) 10591 var body io.Reader = nil 10592 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 10593 if err != nil { 10594 return nil, err 10595 } 10596 reqHeaders.Set("Content-Type", "application/json") 10597 c.urlParams_.Set("alt", alt) 10598 c.urlParams_.Set("prettyPrint", "false") 10599 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10600 urls += "?" + c.urlParams_.Encode() 10601 req, err := http.NewRequest("PATCH", urls, body) 10602 if err != nil { 10603 return nil, err 10604 } 10605 req.Header = reqHeaders 10606 googleapi.Expand(req.URL, map[string]string{ 10607 "courseId": c.courseId, 10608 "id": c.id, 10609 }) 10610 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10611} 10612 10613// Do executes the "classroom.courses.topics.patch" call. 10614// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10615// code is an error. Response headers are in either 10616// *Topic.ServerResponse.Header or (if a response was returned at all) 10617// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10618// check whether the returned error was because http.StatusNotModified 10619// was returned. 10620func (c *CoursesTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10621 gensupport.SetOptions(c.urlParams_, opts...) 10622 res, err := c.doRequest("json") 10623 if res != nil && res.StatusCode == http.StatusNotModified { 10624 if res.Body != nil { 10625 res.Body.Close() 10626 } 10627 return nil, &googleapi.Error{ 10628 Code: res.StatusCode, 10629 Header: res.Header, 10630 } 10631 } 10632 if err != nil { 10633 return nil, err 10634 } 10635 defer googleapi.CloseBody(res) 10636 if err := googleapi.CheckResponse(res); err != nil { 10637 return nil, err 10638 } 10639 ret := &Topic{ 10640 ServerResponse: googleapi.ServerResponse{ 10641 Header: res.Header, 10642 HTTPStatusCode: res.StatusCode, 10643 }, 10644 } 10645 target := &ret 10646 if err := gensupport.DecodeResponse(target, res); err != nil { 10647 return nil, err 10648 } 10649 return ret, nil 10650 // { 10651 // "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", 10652 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10653 // "httpMethod": "PATCH", 10654 // "id": "classroom.courses.topics.patch", 10655 // "parameterOrder": [ 10656 // "courseId", 10657 // "id" 10658 // ], 10659 // "parameters": { 10660 // "courseId": { 10661 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10662 // "location": "path", 10663 // "required": true, 10664 // "type": "string" 10665 // }, 10666 // "id": { 10667 // "description": "Identifier of the topic.", 10668 // "location": "path", 10669 // "required": true, 10670 // "type": "string" 10671 // }, 10672 // "updateMask": { 10673 // "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 will be\nreturned.\n\nThe following fields may be specified:\n\n* `name`", 10674 // "format": "google-fieldmask", 10675 // "location": "query", 10676 // "type": "string" 10677 // } 10678 // }, 10679 // "path": "v1/courses/{courseId}/topics/{id}", 10680 // "request": { 10681 // "$ref": "Topic" 10682 // }, 10683 // "response": { 10684 // "$ref": "Topic" 10685 // }, 10686 // "scopes": [ 10687 // "https://www.googleapis.com/auth/classroom.topics" 10688 // ] 10689 // } 10690 10691} 10692 10693// method id "classroom.invitations.accept": 10694 10695type InvitationsAcceptCall struct { 10696 s *Service 10697 id string 10698 urlParams_ gensupport.URLParams 10699 ctx_ context.Context 10700 header_ http.Header 10701} 10702 10703// Accept: Accepts an invitation, removing it and adding the invited 10704// user to the 10705// teachers or students (as appropriate) of the specified course. Only 10706// the 10707// invited user may accept an invitation. 10708// 10709// This method returns the following error codes: 10710// 10711// * `PERMISSION_DENIED` if the requesting user is not permitted to 10712// accept the 10713// requested invitation or for access errors. 10714// * `FAILED_PRECONDITION` for the following request errors: 10715// * CourseMemberLimitReached 10716// * CourseNotModifiable 10717// * CourseTeacherLimitReached 10718// * UserGroupsMembershipLimitReached 10719// * `NOT_FOUND` if no invitation exists with the requested ID. 10720func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall { 10721 c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10722 c.id = id 10723 return c 10724} 10725 10726// Fields allows partial responses to be retrieved. See 10727// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10728// for more information. 10729func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall { 10730 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10731 return c 10732} 10733 10734// Context sets the context to be used in this call's Do method. Any 10735// pending HTTP request will be aborted if the provided context is 10736// canceled. 10737func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall { 10738 c.ctx_ = ctx 10739 return c 10740} 10741 10742// Header returns an http.Header that can be modified by the caller to 10743// add HTTP headers to the request. 10744func (c *InvitationsAcceptCall) Header() http.Header { 10745 if c.header_ == nil { 10746 c.header_ = make(http.Header) 10747 } 10748 return c.header_ 10749} 10750 10751func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) { 10752 reqHeaders := make(http.Header) 10753 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 10754 for k, v := range c.header_ { 10755 reqHeaders[k] = v 10756 } 10757 reqHeaders.Set("User-Agent", c.s.userAgent()) 10758 var body io.Reader = nil 10759 c.urlParams_.Set("alt", alt) 10760 c.urlParams_.Set("prettyPrint", "false") 10761 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept") 10762 urls += "?" + c.urlParams_.Encode() 10763 req, err := http.NewRequest("POST", urls, body) 10764 if err != nil { 10765 return nil, err 10766 } 10767 req.Header = reqHeaders 10768 googleapi.Expand(req.URL, map[string]string{ 10769 "id": c.id, 10770 }) 10771 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10772} 10773 10774// Do executes the "classroom.invitations.accept" call. 10775// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10776// code is an error. Response headers are in either 10777// *Empty.ServerResponse.Header or (if a response was returned at all) 10778// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10779// check whether the returned error was because http.StatusNotModified 10780// was returned. 10781func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10782 gensupport.SetOptions(c.urlParams_, opts...) 10783 res, err := c.doRequest("json") 10784 if res != nil && res.StatusCode == http.StatusNotModified { 10785 if res.Body != nil { 10786 res.Body.Close() 10787 } 10788 return nil, &googleapi.Error{ 10789 Code: res.StatusCode, 10790 Header: res.Header, 10791 } 10792 } 10793 if err != nil { 10794 return nil, err 10795 } 10796 defer googleapi.CloseBody(res) 10797 if err := googleapi.CheckResponse(res); err != nil { 10798 return nil, err 10799 } 10800 ret := &Empty{ 10801 ServerResponse: googleapi.ServerResponse{ 10802 Header: res.Header, 10803 HTTPStatusCode: res.StatusCode, 10804 }, 10805 } 10806 target := &ret 10807 if err := gensupport.DecodeResponse(target, res); err != nil { 10808 return nil, err 10809 } 10810 return ret, nil 10811 // { 10812 // "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.", 10813 // "flatPath": "v1/invitations/{id}:accept", 10814 // "httpMethod": "POST", 10815 // "id": "classroom.invitations.accept", 10816 // "parameterOrder": [ 10817 // "id" 10818 // ], 10819 // "parameters": { 10820 // "id": { 10821 // "description": "Identifier of the invitation to accept.", 10822 // "location": "path", 10823 // "required": true, 10824 // "type": "string" 10825 // } 10826 // }, 10827 // "path": "v1/invitations/{id}:accept", 10828 // "response": { 10829 // "$ref": "Empty" 10830 // }, 10831 // "scopes": [ 10832 // "https://www.googleapis.com/auth/classroom.rosters" 10833 // ] 10834 // } 10835 10836} 10837 10838// method id "classroom.invitations.create": 10839 10840type InvitationsCreateCall struct { 10841 s *Service 10842 invitation *Invitation 10843 urlParams_ gensupport.URLParams 10844 ctx_ context.Context 10845 header_ http.Header 10846} 10847 10848// Create: Creates an invitation. Only one invitation for a user and 10849// course may exist 10850// at a time. Delete and re-create an invitation to make changes. 10851// 10852// This method returns the following error codes: 10853// 10854// * `PERMISSION_DENIED` if the requesting user is not permitted to 10855// create 10856// invitations for this course or for access errors. 10857// * `NOT_FOUND` if the course or the user does not exist. 10858// * `FAILED_PRECONDITION` if the requested user's account is disabled 10859// or if 10860// the user already has this role or a role with greater permissions. 10861// * `ALREADY_EXISTS` if an invitation for the specified user and 10862// course 10863// already exists. 10864func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall { 10865 c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10866 c.invitation = invitation 10867 return c 10868} 10869 10870// Fields allows partial responses to be retrieved. See 10871// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10872// for more information. 10873func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall { 10874 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10875 return c 10876} 10877 10878// Context sets the context to be used in this call's Do method. Any 10879// pending HTTP request will be aborted if the provided context is 10880// canceled. 10881func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall { 10882 c.ctx_ = ctx 10883 return c 10884} 10885 10886// Header returns an http.Header that can be modified by the caller to 10887// add HTTP headers to the request. 10888func (c *InvitationsCreateCall) Header() http.Header { 10889 if c.header_ == nil { 10890 c.header_ = make(http.Header) 10891 } 10892 return c.header_ 10893} 10894 10895func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 10896 reqHeaders := make(http.Header) 10897 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 10898 for k, v := range c.header_ { 10899 reqHeaders[k] = v 10900 } 10901 reqHeaders.Set("User-Agent", c.s.userAgent()) 10902 var body io.Reader = nil 10903 body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation) 10904 if err != nil { 10905 return nil, err 10906 } 10907 reqHeaders.Set("Content-Type", "application/json") 10908 c.urlParams_.Set("alt", alt) 10909 c.urlParams_.Set("prettyPrint", "false") 10910 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 10911 urls += "?" + c.urlParams_.Encode() 10912 req, err := http.NewRequest("POST", urls, body) 10913 if err != nil { 10914 return nil, err 10915 } 10916 req.Header = reqHeaders 10917 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10918} 10919 10920// Do executes the "classroom.invitations.create" call. 10921// Exactly one of *Invitation or error will be non-nil. Any non-2xx 10922// status code is an error. Response headers are in either 10923// *Invitation.ServerResponse.Header or (if a response was returned at 10924// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10925// to check whether the returned error was because 10926// http.StatusNotModified was returned. 10927func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 10928 gensupport.SetOptions(c.urlParams_, opts...) 10929 res, err := c.doRequest("json") 10930 if res != nil && res.StatusCode == http.StatusNotModified { 10931 if res.Body != nil { 10932 res.Body.Close() 10933 } 10934 return nil, &googleapi.Error{ 10935 Code: res.StatusCode, 10936 Header: res.Header, 10937 } 10938 } 10939 if err != nil { 10940 return nil, err 10941 } 10942 defer googleapi.CloseBody(res) 10943 if err := googleapi.CheckResponse(res); err != nil { 10944 return nil, err 10945 } 10946 ret := &Invitation{ 10947 ServerResponse: googleapi.ServerResponse{ 10948 Header: res.Header, 10949 HTTPStatusCode: res.StatusCode, 10950 }, 10951 } 10952 target := &ret 10953 if err := gensupport.DecodeResponse(target, res); err != nil { 10954 return nil, err 10955 } 10956 return ret, nil 10957 // { 10958 // "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.", 10959 // "flatPath": "v1/invitations", 10960 // "httpMethod": "POST", 10961 // "id": "classroom.invitations.create", 10962 // "parameterOrder": [], 10963 // "parameters": {}, 10964 // "path": "v1/invitations", 10965 // "request": { 10966 // "$ref": "Invitation" 10967 // }, 10968 // "response": { 10969 // "$ref": "Invitation" 10970 // }, 10971 // "scopes": [ 10972 // "https://www.googleapis.com/auth/classroom.rosters" 10973 // ] 10974 // } 10975 10976} 10977 10978// method id "classroom.invitations.delete": 10979 10980type InvitationsDeleteCall struct { 10981 s *Service 10982 id string 10983 urlParams_ gensupport.URLParams 10984 ctx_ context.Context 10985 header_ http.Header 10986} 10987 10988// Delete: Deletes an invitation. 10989// 10990// This method returns the following error codes: 10991// 10992// * `PERMISSION_DENIED` if the requesting user is not permitted to 10993// delete the 10994// requested invitation or for access errors. 10995// * `NOT_FOUND` if no invitation exists with the requested ID. 10996func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall { 10997 c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10998 c.id = id 10999 return c 11000} 11001 11002// Fields allows partial responses to be retrieved. See 11003// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11004// for more information. 11005func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall { 11006 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11007 return c 11008} 11009 11010// Context sets the context to be used in this call's Do method. Any 11011// pending HTTP request will be aborted if the provided context is 11012// canceled. 11013func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall { 11014 c.ctx_ = ctx 11015 return c 11016} 11017 11018// Header returns an http.Header that can be modified by the caller to 11019// add HTTP headers to the request. 11020func (c *InvitationsDeleteCall) Header() http.Header { 11021 if c.header_ == nil { 11022 c.header_ = make(http.Header) 11023 } 11024 return c.header_ 11025} 11026 11027func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11028 reqHeaders := make(http.Header) 11029 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 11030 for k, v := range c.header_ { 11031 reqHeaders[k] = v 11032 } 11033 reqHeaders.Set("User-Agent", c.s.userAgent()) 11034 var body io.Reader = nil 11035 c.urlParams_.Set("alt", alt) 11036 c.urlParams_.Set("prettyPrint", "false") 11037 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11038 urls += "?" + c.urlParams_.Encode() 11039 req, err := http.NewRequest("DELETE", urls, body) 11040 if err != nil { 11041 return nil, err 11042 } 11043 req.Header = reqHeaders 11044 googleapi.Expand(req.URL, map[string]string{ 11045 "id": c.id, 11046 }) 11047 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11048} 11049 11050// Do executes the "classroom.invitations.delete" call. 11051// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11052// code is an error. Response headers are in either 11053// *Empty.ServerResponse.Header or (if a response was returned at all) 11054// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11055// check whether the returned error was because http.StatusNotModified 11056// was returned. 11057func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11058 gensupport.SetOptions(c.urlParams_, opts...) 11059 res, err := c.doRequest("json") 11060 if res != nil && res.StatusCode == http.StatusNotModified { 11061 if res.Body != nil { 11062 res.Body.Close() 11063 } 11064 return nil, &googleapi.Error{ 11065 Code: res.StatusCode, 11066 Header: res.Header, 11067 } 11068 } 11069 if err != nil { 11070 return nil, err 11071 } 11072 defer googleapi.CloseBody(res) 11073 if err := googleapi.CheckResponse(res); err != nil { 11074 return nil, err 11075 } 11076 ret := &Empty{ 11077 ServerResponse: googleapi.ServerResponse{ 11078 Header: res.Header, 11079 HTTPStatusCode: res.StatusCode, 11080 }, 11081 } 11082 target := &ret 11083 if err := gensupport.DecodeResponse(target, res); err != nil { 11084 return nil, err 11085 } 11086 return ret, nil 11087 // { 11088 // "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.", 11089 // "flatPath": "v1/invitations/{id}", 11090 // "httpMethod": "DELETE", 11091 // "id": "classroom.invitations.delete", 11092 // "parameterOrder": [ 11093 // "id" 11094 // ], 11095 // "parameters": { 11096 // "id": { 11097 // "description": "Identifier of the invitation to delete.", 11098 // "location": "path", 11099 // "required": true, 11100 // "type": "string" 11101 // } 11102 // }, 11103 // "path": "v1/invitations/{id}", 11104 // "response": { 11105 // "$ref": "Empty" 11106 // }, 11107 // "scopes": [ 11108 // "https://www.googleapis.com/auth/classroom.rosters" 11109 // ] 11110 // } 11111 11112} 11113 11114// method id "classroom.invitations.get": 11115 11116type InvitationsGetCall struct { 11117 s *Service 11118 id string 11119 urlParams_ gensupport.URLParams 11120 ifNoneMatch_ string 11121 ctx_ context.Context 11122 header_ http.Header 11123} 11124 11125// Get: Returns an invitation. 11126// 11127// This method returns the following error codes: 11128// 11129// * `PERMISSION_DENIED` if the requesting user is not permitted to view 11130// the 11131// requested invitation or for access errors. 11132// * `NOT_FOUND` if no invitation exists with the requested ID. 11133func (r *InvitationsService) Get(id string) *InvitationsGetCall { 11134 c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11135 c.id = id 11136 return c 11137} 11138 11139// Fields allows partial responses to be retrieved. See 11140// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11141// for more information. 11142func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall { 11143 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11144 return c 11145} 11146 11147// IfNoneMatch sets the optional parameter which makes the operation 11148// fail if the object's ETag matches the given value. This is useful for 11149// getting updates only after the object has changed since the last 11150// request. Use googleapi.IsNotModified to check whether the response 11151// error from Do is the result of In-None-Match. 11152func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall { 11153 c.ifNoneMatch_ = entityTag 11154 return c 11155} 11156 11157// Context sets the context to be used in this call's Do method. Any 11158// pending HTTP request will be aborted if the provided context is 11159// canceled. 11160func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall { 11161 c.ctx_ = ctx 11162 return c 11163} 11164 11165// Header returns an http.Header that can be modified by the caller to 11166// add HTTP headers to the request. 11167func (c *InvitationsGetCall) Header() http.Header { 11168 if c.header_ == nil { 11169 c.header_ = make(http.Header) 11170 } 11171 return c.header_ 11172} 11173 11174func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) { 11175 reqHeaders := make(http.Header) 11176 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 11177 for k, v := range c.header_ { 11178 reqHeaders[k] = v 11179 } 11180 reqHeaders.Set("User-Agent", c.s.userAgent()) 11181 if c.ifNoneMatch_ != "" { 11182 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11183 } 11184 var body io.Reader = nil 11185 c.urlParams_.Set("alt", alt) 11186 c.urlParams_.Set("prettyPrint", "false") 11187 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11188 urls += "?" + c.urlParams_.Encode() 11189 req, err := http.NewRequest("GET", urls, body) 11190 if err != nil { 11191 return nil, err 11192 } 11193 req.Header = reqHeaders 11194 googleapi.Expand(req.URL, map[string]string{ 11195 "id": c.id, 11196 }) 11197 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11198} 11199 11200// Do executes the "classroom.invitations.get" call. 11201// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11202// status code is an error. Response headers are in either 11203// *Invitation.ServerResponse.Header or (if a response was returned at 11204// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11205// to check whether the returned error was because 11206// http.StatusNotModified was returned. 11207func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11208 gensupport.SetOptions(c.urlParams_, opts...) 11209 res, err := c.doRequest("json") 11210 if res != nil && res.StatusCode == http.StatusNotModified { 11211 if res.Body != nil { 11212 res.Body.Close() 11213 } 11214 return nil, &googleapi.Error{ 11215 Code: res.StatusCode, 11216 Header: res.Header, 11217 } 11218 } 11219 if err != nil { 11220 return nil, err 11221 } 11222 defer googleapi.CloseBody(res) 11223 if err := googleapi.CheckResponse(res); err != nil { 11224 return nil, err 11225 } 11226 ret := &Invitation{ 11227 ServerResponse: googleapi.ServerResponse{ 11228 Header: res.Header, 11229 HTTPStatusCode: res.StatusCode, 11230 }, 11231 } 11232 target := &ret 11233 if err := gensupport.DecodeResponse(target, res); err != nil { 11234 return nil, err 11235 } 11236 return ret, nil 11237 // { 11238 // "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.", 11239 // "flatPath": "v1/invitations/{id}", 11240 // "httpMethod": "GET", 11241 // "id": "classroom.invitations.get", 11242 // "parameterOrder": [ 11243 // "id" 11244 // ], 11245 // "parameters": { 11246 // "id": { 11247 // "description": "Identifier of the invitation to return.", 11248 // "location": "path", 11249 // "required": true, 11250 // "type": "string" 11251 // } 11252 // }, 11253 // "path": "v1/invitations/{id}", 11254 // "response": { 11255 // "$ref": "Invitation" 11256 // }, 11257 // "scopes": [ 11258 // "https://www.googleapis.com/auth/classroom.rosters", 11259 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11260 // ] 11261 // } 11262 11263} 11264 11265// method id "classroom.invitations.list": 11266 11267type InvitationsListCall struct { 11268 s *Service 11269 urlParams_ gensupport.URLParams 11270 ifNoneMatch_ string 11271 ctx_ context.Context 11272 header_ http.Header 11273} 11274 11275// List: Returns a list of invitations that the requesting user is 11276// permitted to 11277// view, restricted to those that match the list request. 11278// 11279// *Note:* At least one of `user_id` or `course_id` must be supplied. 11280// Both 11281// fields can be supplied. 11282// 11283// This method returns the following error codes: 11284// 11285// * `PERMISSION_DENIED` for access errors. 11286func (r *InvitationsService) List() *InvitationsListCall { 11287 c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11288 return c 11289} 11290 11291// CourseId sets the optional parameter "courseId": Restricts returned 11292// invitations to those for a course with the specified 11293// identifier. 11294func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall { 11295 c.urlParams_.Set("courseId", courseId) 11296 return c 11297} 11298 11299// PageSize sets the optional parameter "pageSize": Maximum number of 11300// items to return. Zero means no maximum. 11301// 11302// The server may return fewer than the specified number of results. 11303func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall { 11304 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 11305 return c 11306} 11307 11308// PageToken sets the optional parameter "pageToken": 11309// nextPageToken 11310// value returned from a previous 11311// list call, indicating 11312// that the subsequent page of results should be returned. 11313// 11314// The list request must be 11315// otherwise identical to the one that resulted in this token. 11316func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall { 11317 c.urlParams_.Set("pageToken", pageToken) 11318 return c 11319} 11320 11321// UserId sets the optional parameter "userId": Restricts returned 11322// invitations to those for a specific user. The identifier 11323// can be one of the following: 11324// 11325// * the numeric identifier for the user 11326// * the email address of the user 11327// * the string literal "me", indicating the requesting user 11328func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall { 11329 c.urlParams_.Set("userId", userId) 11330 return c 11331} 11332 11333// Fields allows partial responses to be retrieved. See 11334// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11335// for more information. 11336func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall { 11337 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11338 return c 11339} 11340 11341// IfNoneMatch sets the optional parameter which makes the operation 11342// fail if the object's ETag matches the given value. This is useful for 11343// getting updates only after the object has changed since the last 11344// request. Use googleapi.IsNotModified to check whether the response 11345// error from Do is the result of In-None-Match. 11346func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall { 11347 c.ifNoneMatch_ = entityTag 11348 return c 11349} 11350 11351// Context sets the context to be used in this call's Do method. Any 11352// pending HTTP request will be aborted if the provided context is 11353// canceled. 11354func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall { 11355 c.ctx_ = ctx 11356 return c 11357} 11358 11359// Header returns an http.Header that can be modified by the caller to 11360// add HTTP headers to the request. 11361func (c *InvitationsListCall) Header() http.Header { 11362 if c.header_ == nil { 11363 c.header_ = make(http.Header) 11364 } 11365 return c.header_ 11366} 11367 11368func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) { 11369 reqHeaders := make(http.Header) 11370 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 11371 for k, v := range c.header_ { 11372 reqHeaders[k] = v 11373 } 11374 reqHeaders.Set("User-Agent", c.s.userAgent()) 11375 if c.ifNoneMatch_ != "" { 11376 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11377 } 11378 var body io.Reader = nil 11379 c.urlParams_.Set("alt", alt) 11380 c.urlParams_.Set("prettyPrint", "false") 11381 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11382 urls += "?" + c.urlParams_.Encode() 11383 req, err := http.NewRequest("GET", urls, body) 11384 if err != nil { 11385 return nil, err 11386 } 11387 req.Header = reqHeaders 11388 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11389} 11390 11391// Do executes the "classroom.invitations.list" call. 11392// Exactly one of *ListInvitationsResponse or error will be non-nil. Any 11393// non-2xx status code is an error. Response headers are in either 11394// *ListInvitationsResponse.ServerResponse.Header or (if a response was 11395// returned at all) in error.(*googleapi.Error).Header. Use 11396// googleapi.IsNotModified to check whether the returned error was 11397// because http.StatusNotModified was returned. 11398func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) { 11399 gensupport.SetOptions(c.urlParams_, opts...) 11400 res, err := c.doRequest("json") 11401 if res != nil && res.StatusCode == http.StatusNotModified { 11402 if res.Body != nil { 11403 res.Body.Close() 11404 } 11405 return nil, &googleapi.Error{ 11406 Code: res.StatusCode, 11407 Header: res.Header, 11408 } 11409 } 11410 if err != nil { 11411 return nil, err 11412 } 11413 defer googleapi.CloseBody(res) 11414 if err := googleapi.CheckResponse(res); err != nil { 11415 return nil, err 11416 } 11417 ret := &ListInvitationsResponse{ 11418 ServerResponse: googleapi.ServerResponse{ 11419 Header: res.Header, 11420 HTTPStatusCode: res.StatusCode, 11421 }, 11422 } 11423 target := &ret 11424 if err := gensupport.DecodeResponse(target, res); err != nil { 11425 return nil, err 11426 } 11427 return ret, nil 11428 // { 11429 // "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.", 11430 // "flatPath": "v1/invitations", 11431 // "httpMethod": "GET", 11432 // "id": "classroom.invitations.list", 11433 // "parameterOrder": [], 11434 // "parameters": { 11435 // "courseId": { 11436 // "description": "Restricts returned invitations to those for a course with the specified\nidentifier.", 11437 // "location": "query", 11438 // "type": "string" 11439 // }, 11440 // "pageSize": { 11441 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 11442 // "format": "int32", 11443 // "location": "query", 11444 // "type": "integer" 11445 // }, 11446 // "pageToken": { 11447 // "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.", 11448 // "location": "query", 11449 // "type": "string" 11450 // }, 11451 // "userId": { 11452 // "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", 11453 // "location": "query", 11454 // "type": "string" 11455 // } 11456 // }, 11457 // "path": "v1/invitations", 11458 // "response": { 11459 // "$ref": "ListInvitationsResponse" 11460 // }, 11461 // "scopes": [ 11462 // "https://www.googleapis.com/auth/classroom.rosters", 11463 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11464 // ] 11465 // } 11466 11467} 11468 11469// Pages invokes f for each page of results. 11470// A non-nil error returned from f will halt the iteration. 11471// The provided context supersedes any context provided to the Context method. 11472func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error { 11473 c.ctx_ = ctx 11474 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 11475 for { 11476 x, err := c.Do() 11477 if err != nil { 11478 return err 11479 } 11480 if err := f(x); err != nil { 11481 return err 11482 } 11483 if x.NextPageToken == "" { 11484 return nil 11485 } 11486 c.PageToken(x.NextPageToken) 11487 } 11488} 11489 11490// method id "classroom.registrations.create": 11491 11492type RegistrationsCreateCall struct { 11493 s *Service 11494 registration *Registration 11495 urlParams_ gensupport.URLParams 11496 ctx_ context.Context 11497 header_ http.Header 11498} 11499 11500// Create: Creates a `Registration`, causing Classroom to start sending 11501// notifications 11502// from the provided `feed` to the destination provided in 11503// `cloudPubSubTopic`. 11504// 11505// Returns the created `Registration`. Currently, this will be the same 11506// as 11507// the argument, but with server-assigned fields such as `expiry_time` 11508// and 11509// `id` filled in. 11510// 11511// Note that any value specified for the `expiry_time` or `id` fields 11512// will be 11513// ignored. 11514// 11515// While Classroom may validate the `cloudPubSubTopic` and return errors 11516// on a 11517// best effort basis, it is the caller's responsibility to ensure that 11518// it 11519// exists and that Classroom has permission to publish to it. 11520// 11521// This method may return the following error codes: 11522// 11523// * `PERMISSION_DENIED` if: 11524// * the authenticated user does not have permission to receive 11525// notifications from the requested field; or 11526// * the credential provided does not include the appropriate scope 11527// for 11528// the requested feed. 11529// * another access error is encountered. 11530// * `INVALID_ARGUMENT` if: 11531// * no `cloudPubsubTopic` is specified, or the specified 11532// `cloudPubsubTopic` is not valid; or 11533// * no `feed` is specified, or the specified `feed` is not valid. 11534// * `NOT_FOUND` if: 11535// * the specified `feed` cannot be located, or the requesting user 11536// does 11537// not have permission to determine whether or not it exists; or 11538// * the specified `cloudPubsubTopic` cannot be located, or 11539// Classroom has 11540// not been granted permission to publish to it. 11541func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall { 11542 c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11543 c.registration = registration 11544 return c 11545} 11546 11547// Fields allows partial responses to be retrieved. See 11548// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11549// for more information. 11550func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall { 11551 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11552 return c 11553} 11554 11555// Context sets the context to be used in this call's Do method. Any 11556// pending HTTP request will be aborted if the provided context is 11557// canceled. 11558func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall { 11559 c.ctx_ = ctx 11560 return c 11561} 11562 11563// Header returns an http.Header that can be modified by the caller to 11564// add HTTP headers to the request. 11565func (c *RegistrationsCreateCall) Header() http.Header { 11566 if c.header_ == nil { 11567 c.header_ = make(http.Header) 11568 } 11569 return c.header_ 11570} 11571 11572func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) { 11573 reqHeaders := make(http.Header) 11574 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 11575 for k, v := range c.header_ { 11576 reqHeaders[k] = v 11577 } 11578 reqHeaders.Set("User-Agent", c.s.userAgent()) 11579 var body io.Reader = nil 11580 body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration) 11581 if err != nil { 11582 return nil, err 11583 } 11584 reqHeaders.Set("Content-Type", "application/json") 11585 c.urlParams_.Set("alt", alt) 11586 c.urlParams_.Set("prettyPrint", "false") 11587 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations") 11588 urls += "?" + c.urlParams_.Encode() 11589 req, err := http.NewRequest("POST", urls, body) 11590 if err != nil { 11591 return nil, err 11592 } 11593 req.Header = reqHeaders 11594 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11595} 11596 11597// Do executes the "classroom.registrations.create" call. 11598// Exactly one of *Registration or error will be non-nil. Any non-2xx 11599// status code is an error. Response headers are in either 11600// *Registration.ServerResponse.Header or (if a response was returned at 11601// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11602// to check whether the returned error was because 11603// http.StatusNotModified was returned. 11604func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) { 11605 gensupport.SetOptions(c.urlParams_, opts...) 11606 res, err := c.doRequest("json") 11607 if res != nil && res.StatusCode == http.StatusNotModified { 11608 if res.Body != nil { 11609 res.Body.Close() 11610 } 11611 return nil, &googleapi.Error{ 11612 Code: res.StatusCode, 11613 Header: res.Header, 11614 } 11615 } 11616 if err != nil { 11617 return nil, err 11618 } 11619 defer googleapi.CloseBody(res) 11620 if err := googleapi.CheckResponse(res); err != nil { 11621 return nil, err 11622 } 11623 ret := &Registration{ 11624 ServerResponse: googleapi.ServerResponse{ 11625 Header: res.Header, 11626 HTTPStatusCode: res.StatusCode, 11627 }, 11628 } 11629 target := &ret 11630 if err := gensupport.DecodeResponse(target, res); err != nil { 11631 return nil, err 11632 } 11633 return ret, nil 11634 // { 11635 // "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.", 11636 // "flatPath": "v1/registrations", 11637 // "httpMethod": "POST", 11638 // "id": "classroom.registrations.create", 11639 // "parameterOrder": [], 11640 // "parameters": {}, 11641 // "path": "v1/registrations", 11642 // "request": { 11643 // "$ref": "Registration" 11644 // }, 11645 // "response": { 11646 // "$ref": "Registration" 11647 // }, 11648 // "scopes": [ 11649 // "https://www.googleapis.com/auth/classroom.push-notifications" 11650 // ] 11651 // } 11652 11653} 11654 11655// method id "classroom.registrations.delete": 11656 11657type RegistrationsDeleteCall struct { 11658 s *Service 11659 registrationId string 11660 urlParams_ gensupport.URLParams 11661 ctx_ context.Context 11662 header_ http.Header 11663} 11664 11665// Delete: Deletes a `Registration`, causing Classroom to stop sending 11666// notifications 11667// for that `Registration`. 11668func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall { 11669 c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11670 c.registrationId = registrationId 11671 return c 11672} 11673 11674// Fields allows partial responses to be retrieved. See 11675// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11676// for more information. 11677func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall { 11678 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11679 return c 11680} 11681 11682// Context sets the context to be used in this call's Do method. Any 11683// pending HTTP request will be aborted if the provided context is 11684// canceled. 11685func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall { 11686 c.ctx_ = ctx 11687 return c 11688} 11689 11690// Header returns an http.Header that can be modified by the caller to 11691// add HTTP headers to the request. 11692func (c *RegistrationsDeleteCall) Header() http.Header { 11693 if c.header_ == nil { 11694 c.header_ = make(http.Header) 11695 } 11696 return c.header_ 11697} 11698 11699func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11700 reqHeaders := make(http.Header) 11701 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 11702 for k, v := range c.header_ { 11703 reqHeaders[k] = v 11704 } 11705 reqHeaders.Set("User-Agent", c.s.userAgent()) 11706 var body io.Reader = nil 11707 c.urlParams_.Set("alt", alt) 11708 c.urlParams_.Set("prettyPrint", "false") 11709 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}") 11710 urls += "?" + c.urlParams_.Encode() 11711 req, err := http.NewRequest("DELETE", urls, body) 11712 if err != nil { 11713 return nil, err 11714 } 11715 req.Header = reqHeaders 11716 googleapi.Expand(req.URL, map[string]string{ 11717 "registrationId": c.registrationId, 11718 }) 11719 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11720} 11721 11722// Do executes the "classroom.registrations.delete" call. 11723// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11724// code is an error. Response headers are in either 11725// *Empty.ServerResponse.Header or (if a response was returned at all) 11726// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11727// check whether the returned error was because http.StatusNotModified 11728// was returned. 11729func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11730 gensupport.SetOptions(c.urlParams_, opts...) 11731 res, err := c.doRequest("json") 11732 if res != nil && res.StatusCode == http.StatusNotModified { 11733 if res.Body != nil { 11734 res.Body.Close() 11735 } 11736 return nil, &googleapi.Error{ 11737 Code: res.StatusCode, 11738 Header: res.Header, 11739 } 11740 } 11741 if err != nil { 11742 return nil, err 11743 } 11744 defer googleapi.CloseBody(res) 11745 if err := googleapi.CheckResponse(res); err != nil { 11746 return nil, err 11747 } 11748 ret := &Empty{ 11749 ServerResponse: googleapi.ServerResponse{ 11750 Header: res.Header, 11751 HTTPStatusCode: res.StatusCode, 11752 }, 11753 } 11754 target := &ret 11755 if err := gensupport.DecodeResponse(target, res); err != nil { 11756 return nil, err 11757 } 11758 return ret, nil 11759 // { 11760 // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications\nfor that `Registration`.", 11761 // "flatPath": "v1/registrations/{registrationId}", 11762 // "httpMethod": "DELETE", 11763 // "id": "classroom.registrations.delete", 11764 // "parameterOrder": [ 11765 // "registrationId" 11766 // ], 11767 // "parameters": { 11768 // "registrationId": { 11769 // "description": "The `registration_id` of the `Registration` to be deleted.", 11770 // "location": "path", 11771 // "required": true, 11772 // "type": "string" 11773 // } 11774 // }, 11775 // "path": "v1/registrations/{registrationId}", 11776 // "response": { 11777 // "$ref": "Empty" 11778 // }, 11779 // "scopes": [ 11780 // "https://www.googleapis.com/auth/classroom.push-notifications" 11781 // ] 11782 // } 11783 11784} 11785 11786// method id "classroom.userProfiles.get": 11787 11788type UserProfilesGetCall struct { 11789 s *Service 11790 userId string 11791 urlParams_ gensupport.URLParams 11792 ifNoneMatch_ string 11793 ctx_ context.Context 11794 header_ http.Header 11795} 11796 11797// Get: Returns a user profile. 11798// 11799// This method returns the following error codes: 11800// 11801// * `PERMISSION_DENIED` if the requesting user is not permitted to 11802// access 11803// this user profile, if no profile exists with the requested ID, or 11804// for 11805// access errors. 11806func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall { 11807 c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11808 c.userId = userId 11809 return c 11810} 11811 11812// Fields allows partial responses to be retrieved. See 11813// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11814// for more information. 11815func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall { 11816 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11817 return c 11818} 11819 11820// IfNoneMatch sets the optional parameter which makes the operation 11821// fail if the object's ETag matches the given value. This is useful for 11822// getting updates only after the object has changed since the last 11823// request. Use googleapi.IsNotModified to check whether the response 11824// error from Do is the result of In-None-Match. 11825func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall { 11826 c.ifNoneMatch_ = entityTag 11827 return c 11828} 11829 11830// Context sets the context to be used in this call's Do method. Any 11831// pending HTTP request will be aborted if the provided context is 11832// canceled. 11833func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall { 11834 c.ctx_ = ctx 11835 return c 11836} 11837 11838// Header returns an http.Header that can be modified by the caller to 11839// add HTTP headers to the request. 11840func (c *UserProfilesGetCall) Header() http.Header { 11841 if c.header_ == nil { 11842 c.header_ = make(http.Header) 11843 } 11844 return c.header_ 11845} 11846 11847func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) { 11848 reqHeaders := make(http.Header) 11849 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 11850 for k, v := range c.header_ { 11851 reqHeaders[k] = v 11852 } 11853 reqHeaders.Set("User-Agent", c.s.userAgent()) 11854 if c.ifNoneMatch_ != "" { 11855 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11856 } 11857 var body io.Reader = nil 11858 c.urlParams_.Set("alt", alt) 11859 c.urlParams_.Set("prettyPrint", "false") 11860 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}") 11861 urls += "?" + c.urlParams_.Encode() 11862 req, err := http.NewRequest("GET", urls, body) 11863 if err != nil { 11864 return nil, err 11865 } 11866 req.Header = reqHeaders 11867 googleapi.Expand(req.URL, map[string]string{ 11868 "userId": c.userId, 11869 }) 11870 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11871} 11872 11873// Do executes the "classroom.userProfiles.get" call. 11874// Exactly one of *UserProfile or error will be non-nil. Any non-2xx 11875// status code is an error. Response headers are in either 11876// *UserProfile.ServerResponse.Header or (if a response was returned at 11877// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11878// to check whether the returned error was because 11879// http.StatusNotModified was returned. 11880func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) { 11881 gensupport.SetOptions(c.urlParams_, opts...) 11882 res, err := c.doRequest("json") 11883 if res != nil && res.StatusCode == http.StatusNotModified { 11884 if res.Body != nil { 11885 res.Body.Close() 11886 } 11887 return nil, &googleapi.Error{ 11888 Code: res.StatusCode, 11889 Header: res.Header, 11890 } 11891 } 11892 if err != nil { 11893 return nil, err 11894 } 11895 defer googleapi.CloseBody(res) 11896 if err := googleapi.CheckResponse(res); err != nil { 11897 return nil, err 11898 } 11899 ret := &UserProfile{ 11900 ServerResponse: googleapi.ServerResponse{ 11901 Header: res.Header, 11902 HTTPStatusCode: res.StatusCode, 11903 }, 11904 } 11905 target := &ret 11906 if err := gensupport.DecodeResponse(target, res); err != nil { 11907 return nil, err 11908 } 11909 return ret, nil 11910 // { 11911 // "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.", 11912 // "flatPath": "v1/userProfiles/{userId}", 11913 // "httpMethod": "GET", 11914 // "id": "classroom.userProfiles.get", 11915 // "parameterOrder": [ 11916 // "userId" 11917 // ], 11918 // "parameters": { 11919 // "userId": { 11920 // "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", 11921 // "location": "path", 11922 // "required": true, 11923 // "type": "string" 11924 // } 11925 // }, 11926 // "path": "v1/userProfiles/{userId}", 11927 // "response": { 11928 // "$ref": "UserProfile" 11929 // }, 11930 // "scopes": [ 11931 // "https://www.googleapis.com/auth/classroom.profile.emails", 11932 // "https://www.googleapis.com/auth/classroom.profile.photos", 11933 // "https://www.googleapis.com/auth/classroom.rosters", 11934 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11935 // ] 11936 // } 11937 11938} 11939 11940// method id "classroom.userProfiles.guardianInvitations.create": 11941 11942type UserProfilesGuardianInvitationsCreateCall struct { 11943 s *Service 11944 studentId string 11945 guardianinvitation *GuardianInvitation 11946 urlParams_ gensupport.URLParams 11947 ctx_ context.Context 11948 header_ http.Header 11949} 11950 11951// Create: Creates a guardian invitation, and sends an email to the 11952// guardian asking 11953// them to confirm that they are the student's guardian. 11954// 11955// Once the guardian accepts the invitation, their `state` will change 11956// to 11957// `COMPLETED` and they will start receiving guardian notifications. 11958// A 11959// `Guardian` resource will also be created to represent the active 11960// guardian. 11961// 11962// The request object must have the `student_id` 11963// and 11964// `invited_email_address` fields set. Failing to set these fields, 11965// or 11966// setting any other fields in the request, will result in an 11967// error. 11968// 11969// This method returns the following error codes: 11970// 11971// * `PERMISSION_DENIED` if the current user does not have permission 11972// to 11973// manage guardians, if the guardian in question has already rejected 11974// too many requests for that student, if guardians are not enabled 11975// for the 11976// domain in question, or for other access errors. 11977// * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the 11978// guardian 11979// link limit. 11980// * `INVALID_ARGUMENT` if the guardian email address is not valid (for 11981// example, if it is too long), or if the format of the student ID 11982// provided 11983// cannot be recognized (it is not an email address, nor a `user_id` 11984// from 11985// this API). This error will also be returned if read-only fields are 11986// set, 11987// or if the `state` field is set to to a value other than 11988// `PENDING`. 11989// * `NOT_FOUND` if the student ID provided is a valid student ID, but 11990// Classroom has no record of that student. 11991// * `ALREADY_EXISTS` if there is already a pending guardian invitation 11992// for 11993// the student and `invited_email_address` provided, or if the 11994// provided 11995// `invited_email_address` matches the Google account of an existing 11996// `Guardian` for this user. 11997func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall { 11998 c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11999 c.studentId = studentId 12000 c.guardianinvitation = guardianinvitation 12001 return c 12002} 12003 12004// Fields allows partial responses to be retrieved. See 12005// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12006// for more information. 12007func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall { 12008 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12009 return c 12010} 12011 12012// Context sets the context to be used in this call's Do method. Any 12013// pending HTTP request will be aborted if the provided context is 12014// canceled. 12015func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall { 12016 c.ctx_ = ctx 12017 return c 12018} 12019 12020// Header returns an http.Header that can be modified by the caller to 12021// add HTTP headers to the request. 12022func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header { 12023 if c.header_ == nil { 12024 c.header_ = make(http.Header) 12025 } 12026 return c.header_ 12027} 12028 12029func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 12030 reqHeaders := make(http.Header) 12031 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 12032 for k, v := range c.header_ { 12033 reqHeaders[k] = v 12034 } 12035 reqHeaders.Set("User-Agent", c.s.userAgent()) 12036 var body io.Reader = nil 12037 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12038 if err != nil { 12039 return nil, err 12040 } 12041 reqHeaders.Set("Content-Type", "application/json") 12042 c.urlParams_.Set("alt", alt) 12043 c.urlParams_.Set("prettyPrint", "false") 12044 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12045 urls += "?" + c.urlParams_.Encode() 12046 req, err := http.NewRequest("POST", urls, body) 12047 if err != nil { 12048 return nil, err 12049 } 12050 req.Header = reqHeaders 12051 googleapi.Expand(req.URL, map[string]string{ 12052 "studentId": c.studentId, 12053 }) 12054 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12055} 12056 12057// Do executes the "classroom.userProfiles.guardianInvitations.create" call. 12058// Exactly one of *GuardianInvitation or error will be non-nil. Any 12059// non-2xx status code is an error. Response headers are in either 12060// *GuardianInvitation.ServerResponse.Header or (if a response was 12061// returned at all) in error.(*googleapi.Error).Header. Use 12062// googleapi.IsNotModified to check whether the returned error was 12063// because http.StatusNotModified was returned. 12064func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12065 gensupport.SetOptions(c.urlParams_, opts...) 12066 res, err := c.doRequest("json") 12067 if res != nil && res.StatusCode == http.StatusNotModified { 12068 if res.Body != nil { 12069 res.Body.Close() 12070 } 12071 return nil, &googleapi.Error{ 12072 Code: res.StatusCode, 12073 Header: res.Header, 12074 } 12075 } 12076 if err != nil { 12077 return nil, err 12078 } 12079 defer googleapi.CloseBody(res) 12080 if err := googleapi.CheckResponse(res); err != nil { 12081 return nil, err 12082 } 12083 ret := &GuardianInvitation{ 12084 ServerResponse: googleapi.ServerResponse{ 12085 Header: res.Header, 12086 HTTPStatusCode: res.StatusCode, 12087 }, 12088 } 12089 target := &ret 12090 if err := gensupport.DecodeResponse(target, res); err != nil { 12091 return nil, err 12092 } 12093 return ret, nil 12094 // { 12095 // "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.", 12096 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12097 // "httpMethod": "POST", 12098 // "id": "classroom.userProfiles.guardianInvitations.create", 12099 // "parameterOrder": [ 12100 // "studentId" 12101 // ], 12102 // "parameters": { 12103 // "studentId": { 12104 // "description": "ID of the student (in standard format)", 12105 // "location": "path", 12106 // "required": true, 12107 // "type": "string" 12108 // } 12109 // }, 12110 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12111 // "request": { 12112 // "$ref": "GuardianInvitation" 12113 // }, 12114 // "response": { 12115 // "$ref": "GuardianInvitation" 12116 // }, 12117 // "scopes": [ 12118 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12119 // ] 12120 // } 12121 12122} 12123 12124// method id "classroom.userProfiles.guardianInvitations.get": 12125 12126type UserProfilesGuardianInvitationsGetCall struct { 12127 s *Service 12128 studentId string 12129 invitationId string 12130 urlParams_ gensupport.URLParams 12131 ifNoneMatch_ string 12132 ctx_ context.Context 12133 header_ http.Header 12134} 12135 12136// Get: Returns a specific guardian invitation. 12137// 12138// This method returns the following error codes: 12139// 12140// * `PERMISSION_DENIED` if the requesting user is not permitted to 12141// view 12142// guardian invitations for the student identified by the 12143// `student_id`, if 12144// guardians are not enabled for the domain in question, or for other 12145// access errors. 12146// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12147// cannot 12148// be recognized (it is not an email address, nor a `student_id` from 12149// the 12150// API, nor the literal string `me`). 12151// * `NOT_FOUND` if Classroom cannot find any record of the given 12152// student or 12153// `invitation_id`. May also be returned if the student exists, but 12154// the 12155// requesting user does not have access to see that student. 12156func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall { 12157 c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12158 c.studentId = studentId 12159 c.invitationId = invitationId 12160 return c 12161} 12162 12163// Fields allows partial responses to be retrieved. See 12164// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12165// for more information. 12166func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall { 12167 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12168 return c 12169} 12170 12171// IfNoneMatch sets the optional parameter which makes the operation 12172// fail if the object's ETag matches the given value. This is useful for 12173// getting updates only after the object has changed since the last 12174// request. Use googleapi.IsNotModified to check whether the response 12175// error from Do is the result of In-None-Match. 12176func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall { 12177 c.ifNoneMatch_ = entityTag 12178 return c 12179} 12180 12181// Context sets the context to be used in this call's Do method. Any 12182// pending HTTP request will be aborted if the provided context is 12183// canceled. 12184func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall { 12185 c.ctx_ = ctx 12186 return c 12187} 12188 12189// Header returns an http.Header that can be modified by the caller to 12190// add HTTP headers to the request. 12191func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header { 12192 if c.header_ == nil { 12193 c.header_ = make(http.Header) 12194 } 12195 return c.header_ 12196} 12197 12198func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) { 12199 reqHeaders := make(http.Header) 12200 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 12201 for k, v := range c.header_ { 12202 reqHeaders[k] = v 12203 } 12204 reqHeaders.Set("User-Agent", c.s.userAgent()) 12205 if c.ifNoneMatch_ != "" { 12206 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12207 } 12208 var body io.Reader = nil 12209 c.urlParams_.Set("alt", alt) 12210 c.urlParams_.Set("prettyPrint", "false") 12211 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12212 urls += "?" + c.urlParams_.Encode() 12213 req, err := http.NewRequest("GET", urls, body) 12214 if err != nil { 12215 return nil, err 12216 } 12217 req.Header = reqHeaders 12218 googleapi.Expand(req.URL, map[string]string{ 12219 "studentId": c.studentId, 12220 "invitationId": c.invitationId, 12221 }) 12222 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12223} 12224 12225// Do executes the "classroom.userProfiles.guardianInvitations.get" call. 12226// Exactly one of *GuardianInvitation or error will be non-nil. Any 12227// non-2xx status code is an error. Response headers are in either 12228// *GuardianInvitation.ServerResponse.Header or (if a response was 12229// returned at all) in error.(*googleapi.Error).Header. Use 12230// googleapi.IsNotModified to check whether the returned error was 12231// because http.StatusNotModified was returned. 12232func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12233 gensupport.SetOptions(c.urlParams_, opts...) 12234 res, err := c.doRequest("json") 12235 if res != nil && res.StatusCode == http.StatusNotModified { 12236 if res.Body != nil { 12237 res.Body.Close() 12238 } 12239 return nil, &googleapi.Error{ 12240 Code: res.StatusCode, 12241 Header: res.Header, 12242 } 12243 } 12244 if err != nil { 12245 return nil, err 12246 } 12247 defer googleapi.CloseBody(res) 12248 if err := googleapi.CheckResponse(res); err != nil { 12249 return nil, err 12250 } 12251 ret := &GuardianInvitation{ 12252 ServerResponse: googleapi.ServerResponse{ 12253 Header: res.Header, 12254 HTTPStatusCode: res.StatusCode, 12255 }, 12256 } 12257 target := &ret 12258 if err := gensupport.DecodeResponse(target, res); err != nil { 12259 return nil, err 12260 } 12261 return ret, nil 12262 // { 12263 // "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.", 12264 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12265 // "httpMethod": "GET", 12266 // "id": "classroom.userProfiles.guardianInvitations.get", 12267 // "parameterOrder": [ 12268 // "studentId", 12269 // "invitationId" 12270 // ], 12271 // "parameters": { 12272 // "invitationId": { 12273 // "description": "The `id` field of the `GuardianInvitation` being requested.", 12274 // "location": "path", 12275 // "required": true, 12276 // "type": "string" 12277 // }, 12278 // "studentId": { 12279 // "description": "The ID of the student whose guardian invitation is being requested.", 12280 // "location": "path", 12281 // "required": true, 12282 // "type": "string" 12283 // } 12284 // }, 12285 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12286 // "response": { 12287 // "$ref": "GuardianInvitation" 12288 // }, 12289 // "scopes": [ 12290 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12291 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12292 // ] 12293 // } 12294 12295} 12296 12297// method id "classroom.userProfiles.guardianInvitations.list": 12298 12299type UserProfilesGuardianInvitationsListCall struct { 12300 s *Service 12301 studentId string 12302 urlParams_ gensupport.URLParams 12303 ifNoneMatch_ string 12304 ctx_ context.Context 12305 header_ http.Header 12306} 12307 12308// List: Returns a list of guardian invitations that the requesting user 12309// is 12310// permitted to view, filtered by the parameters provided. 12311// 12312// This method returns the following error codes: 12313// 12314// * `PERMISSION_DENIED` if a `student_id` is specified, and the 12315// requesting 12316// user is not permitted to view guardian invitations for that 12317// student, if 12318// "-" is specified as the `student_id` and the user is not a 12319// domain 12320// administrator, if guardians are not enabled for the domain in 12321// question, 12322// or for other access errors. 12323// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12324// cannot 12325// be recognized (it is not an email address, nor a `student_id` from 12326// the 12327// API, nor the literal string `me`). May also be returned if an 12328// invalid 12329// `page_token` or `state` is provided. 12330// * `NOT_FOUND` if a `student_id` is specified, and its format can be 12331// recognized, but Classroom has no record of that student. 12332func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall { 12333 c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12334 c.studentId = studentId 12335 return c 12336} 12337 12338// InvitedEmailAddress sets the optional parameter 12339// "invitedEmailAddress": If specified, only results with the specified 12340// `invited_email_address` 12341// will be returned. 12342func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall { 12343 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 12344 return c 12345} 12346 12347// PageSize sets the optional parameter "pageSize": Maximum number of 12348// items to return. Zero or unspecified indicates that the 12349// server may assign a maximum. 12350// 12351// The server may return fewer than the specified number of results. 12352func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall { 12353 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 12354 return c 12355} 12356 12357// PageToken sets the optional parameter "pageToken": 12358// nextPageToken 12359// value returned from a previous 12360// list call, 12361// indicating that the subsequent page of results should be 12362// returned. 12363// 12364// The list request 12365// must be otherwise identical to the one that resulted in this token. 12366func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall { 12367 c.urlParams_.Set("pageToken", pageToken) 12368 return c 12369} 12370 12371// States sets the optional parameter "states": If specified, only 12372// results with the specified `state` values will be 12373// returned. Otherwise, results with a `state` of `PENDING` will be 12374// returned. 12375// 12376// Possible values: 12377// "GUARDIAN_INVITATION_STATE_UNSPECIFIED" 12378// "PENDING" 12379// "COMPLETE" 12380func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall { 12381 c.urlParams_.SetMulti("states", append([]string{}, states...)) 12382 return c 12383} 12384 12385// Fields allows partial responses to be retrieved. See 12386// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12387// for more information. 12388func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall { 12389 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12390 return c 12391} 12392 12393// IfNoneMatch sets the optional parameter which makes the operation 12394// fail if the object's ETag matches the given value. This is useful for 12395// getting updates only after the object has changed since the last 12396// request. Use googleapi.IsNotModified to check whether the response 12397// error from Do is the result of In-None-Match. 12398func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall { 12399 c.ifNoneMatch_ = entityTag 12400 return c 12401} 12402 12403// Context sets the context to be used in this call's Do method. Any 12404// pending HTTP request will be aborted if the provided context is 12405// canceled. 12406func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall { 12407 c.ctx_ = ctx 12408 return c 12409} 12410 12411// Header returns an http.Header that can be modified by the caller to 12412// add HTTP headers to the request. 12413func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header { 12414 if c.header_ == nil { 12415 c.header_ = make(http.Header) 12416 } 12417 return c.header_ 12418} 12419 12420func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) { 12421 reqHeaders := make(http.Header) 12422 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 12423 for k, v := range c.header_ { 12424 reqHeaders[k] = v 12425 } 12426 reqHeaders.Set("User-Agent", c.s.userAgent()) 12427 if c.ifNoneMatch_ != "" { 12428 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12429 } 12430 var body io.Reader = nil 12431 c.urlParams_.Set("alt", alt) 12432 c.urlParams_.Set("prettyPrint", "false") 12433 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12434 urls += "?" + c.urlParams_.Encode() 12435 req, err := http.NewRequest("GET", urls, body) 12436 if err != nil { 12437 return nil, err 12438 } 12439 req.Header = reqHeaders 12440 googleapi.Expand(req.URL, map[string]string{ 12441 "studentId": c.studentId, 12442 }) 12443 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12444} 12445 12446// Do executes the "classroom.userProfiles.guardianInvitations.list" call. 12447// Exactly one of *ListGuardianInvitationsResponse or error will be 12448// non-nil. Any non-2xx status code is an error. Response headers are in 12449// either *ListGuardianInvitationsResponse.ServerResponse.Header or (if 12450// a response was returned at all) in error.(*googleapi.Error).Header. 12451// Use googleapi.IsNotModified to check whether the returned error was 12452// because http.StatusNotModified was returned. 12453func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) { 12454 gensupport.SetOptions(c.urlParams_, opts...) 12455 res, err := c.doRequest("json") 12456 if res != nil && res.StatusCode == http.StatusNotModified { 12457 if res.Body != nil { 12458 res.Body.Close() 12459 } 12460 return nil, &googleapi.Error{ 12461 Code: res.StatusCode, 12462 Header: res.Header, 12463 } 12464 } 12465 if err != nil { 12466 return nil, err 12467 } 12468 defer googleapi.CloseBody(res) 12469 if err := googleapi.CheckResponse(res); err != nil { 12470 return nil, err 12471 } 12472 ret := &ListGuardianInvitationsResponse{ 12473 ServerResponse: googleapi.ServerResponse{ 12474 Header: res.Header, 12475 HTTPStatusCode: res.StatusCode, 12476 }, 12477 } 12478 target := &ret 12479 if err := gensupport.DecodeResponse(target, res); err != nil { 12480 return nil, err 12481 } 12482 return ret, nil 12483 // { 12484 // "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.", 12485 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12486 // "httpMethod": "GET", 12487 // "id": "classroom.userProfiles.guardianInvitations.list", 12488 // "parameterOrder": [ 12489 // "studentId" 12490 // ], 12491 // "parameters": { 12492 // "invitedEmailAddress": { 12493 // "description": "If specified, only results with the specified `invited_email_address`\nwill be returned.", 12494 // "location": "query", 12495 // "type": "string" 12496 // }, 12497 // "pageSize": { 12498 // "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.", 12499 // "format": "int32", 12500 // "location": "query", 12501 // "type": "integer" 12502 // }, 12503 // "pageToken": { 12504 // "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.", 12505 // "location": "query", 12506 // "type": "string" 12507 // }, 12508 // "states": { 12509 // "description": "If specified, only results with the specified `state` values will be\nreturned. Otherwise, results with a `state` of `PENDING` will be returned.", 12510 // "enum": [ 12511 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED", 12512 // "PENDING", 12513 // "COMPLETE" 12514 // ], 12515 // "location": "query", 12516 // "repeated": true, 12517 // "type": "string" 12518 // }, 12519 // "studentId": { 12520 // "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.", 12521 // "location": "path", 12522 // "required": true, 12523 // "type": "string" 12524 // } 12525 // }, 12526 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12527 // "response": { 12528 // "$ref": "ListGuardianInvitationsResponse" 12529 // }, 12530 // "scopes": [ 12531 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12532 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12533 // ] 12534 // } 12535 12536} 12537 12538// Pages invokes f for each page of results. 12539// A non-nil error returned from f will halt the iteration. 12540// The provided context supersedes any context provided to the Context method. 12541func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error { 12542 c.ctx_ = ctx 12543 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12544 for { 12545 x, err := c.Do() 12546 if err != nil { 12547 return err 12548 } 12549 if err := f(x); err != nil { 12550 return err 12551 } 12552 if x.NextPageToken == "" { 12553 return nil 12554 } 12555 c.PageToken(x.NextPageToken) 12556 } 12557} 12558 12559// method id "classroom.userProfiles.guardianInvitations.patch": 12560 12561type UserProfilesGuardianInvitationsPatchCall struct { 12562 s *Service 12563 studentId string 12564 invitationId string 12565 guardianinvitation *GuardianInvitation 12566 urlParams_ gensupport.URLParams 12567 ctx_ context.Context 12568 header_ http.Header 12569} 12570 12571// Patch: Modifies a guardian invitation. 12572// 12573// Currently, the only valid modification is to change the `state` 12574// from 12575// `PENDING` to `COMPLETE`. This has the effect of withdrawing the 12576// invitation. 12577// 12578// This method returns the following error codes: 12579// 12580// * `PERMISSION_DENIED` if the current user does not have permission 12581// to 12582// manage guardians, if guardians are not enabled for the domain in 12583// question 12584// or for other access errors. 12585// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` 12586// state. 12587// * `INVALID_ARGUMENT` if the format of the student ID provided 12588// cannot be recognized (it is not an email address, nor a `user_id` 12589// from 12590// this API), or if the passed `GuardianInvitation` has a `state` 12591// other than 12592// `COMPLETE`, or if it modifies fields other than `state`. 12593// * `NOT_FOUND` if the student ID provided is a valid student ID, but 12594// Classroom has no record of that student, or if the `id` field does 12595// not 12596// refer to a guardian invitation known to Classroom. 12597func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall { 12598 c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12599 c.studentId = studentId 12600 c.invitationId = invitationId 12601 c.guardianinvitation = guardianinvitation 12602 return c 12603} 12604 12605// UpdateMask sets the optional parameter "updateMask": Mask that 12606// identifies which fields on the course to update. 12607// This field is required to do an update. The update will fail if 12608// invalid 12609// fields are specified. The following fields are valid: 12610// 12611// * `state` 12612// 12613// When set in a query parameter, this field should be specified 12614// as 12615// 12616// `updateMask=<field1>,<field2>,...` 12617func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall { 12618 c.urlParams_.Set("updateMask", updateMask) 12619 return c 12620} 12621 12622// Fields allows partial responses to be retrieved. See 12623// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12624// for more information. 12625func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall { 12626 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12627 return c 12628} 12629 12630// Context sets the context to be used in this call's Do method. Any 12631// pending HTTP request will be aborted if the provided context is 12632// canceled. 12633func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall { 12634 c.ctx_ = ctx 12635 return c 12636} 12637 12638// Header returns an http.Header that can be modified by the caller to 12639// add HTTP headers to the request. 12640func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header { 12641 if c.header_ == nil { 12642 c.header_ = make(http.Header) 12643 } 12644 return c.header_ 12645} 12646 12647func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) { 12648 reqHeaders := make(http.Header) 12649 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 12650 for k, v := range c.header_ { 12651 reqHeaders[k] = v 12652 } 12653 reqHeaders.Set("User-Agent", c.s.userAgent()) 12654 var body io.Reader = nil 12655 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12656 if err != nil { 12657 return nil, err 12658 } 12659 reqHeaders.Set("Content-Type", "application/json") 12660 c.urlParams_.Set("alt", alt) 12661 c.urlParams_.Set("prettyPrint", "false") 12662 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12663 urls += "?" + c.urlParams_.Encode() 12664 req, err := http.NewRequest("PATCH", urls, body) 12665 if err != nil { 12666 return nil, err 12667 } 12668 req.Header = reqHeaders 12669 googleapi.Expand(req.URL, map[string]string{ 12670 "studentId": c.studentId, 12671 "invitationId": c.invitationId, 12672 }) 12673 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12674} 12675 12676// Do executes the "classroom.userProfiles.guardianInvitations.patch" call. 12677// Exactly one of *GuardianInvitation or error will be non-nil. Any 12678// non-2xx status code is an error. Response headers are in either 12679// *GuardianInvitation.ServerResponse.Header or (if a response was 12680// returned at all) in error.(*googleapi.Error).Header. Use 12681// googleapi.IsNotModified to check whether the returned error was 12682// because http.StatusNotModified was returned. 12683func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12684 gensupport.SetOptions(c.urlParams_, opts...) 12685 res, err := c.doRequest("json") 12686 if res != nil && res.StatusCode == http.StatusNotModified { 12687 if res.Body != nil { 12688 res.Body.Close() 12689 } 12690 return nil, &googleapi.Error{ 12691 Code: res.StatusCode, 12692 Header: res.Header, 12693 } 12694 } 12695 if err != nil { 12696 return nil, err 12697 } 12698 defer googleapi.CloseBody(res) 12699 if err := googleapi.CheckResponse(res); err != nil { 12700 return nil, err 12701 } 12702 ret := &GuardianInvitation{ 12703 ServerResponse: googleapi.ServerResponse{ 12704 Header: res.Header, 12705 HTTPStatusCode: res.StatusCode, 12706 }, 12707 } 12708 target := &ret 12709 if err := gensupport.DecodeResponse(target, res); err != nil { 12710 return nil, err 12711 } 12712 return ret, nil 12713 // { 12714 // "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.", 12715 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12716 // "httpMethod": "PATCH", 12717 // "id": "classroom.userProfiles.guardianInvitations.patch", 12718 // "parameterOrder": [ 12719 // "studentId", 12720 // "invitationId" 12721 // ], 12722 // "parameters": { 12723 // "invitationId": { 12724 // "description": "The `id` field of the `GuardianInvitation` to be modified.", 12725 // "location": "path", 12726 // "required": true, 12727 // "type": "string" 12728 // }, 12729 // "studentId": { 12730 // "description": "The ID of the student whose guardian invitation is to be modified.", 12731 // "location": "path", 12732 // "required": true, 12733 // "type": "string" 12734 // }, 12735 // "updateMask": { 12736 // "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* `state`\n\nWhen set in a query parameter, this field should be specified as\n\n`updateMask=\u003cfield1\u003e,\u003cfield2\u003e,...`", 12737 // "format": "google-fieldmask", 12738 // "location": "query", 12739 // "type": "string" 12740 // } 12741 // }, 12742 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12743 // "request": { 12744 // "$ref": "GuardianInvitation" 12745 // }, 12746 // "response": { 12747 // "$ref": "GuardianInvitation" 12748 // }, 12749 // "scopes": [ 12750 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12751 // ] 12752 // } 12753 12754} 12755 12756// method id "classroom.userProfiles.guardians.delete": 12757 12758type UserProfilesGuardiansDeleteCall struct { 12759 s *Service 12760 studentId string 12761 guardianId string 12762 urlParams_ gensupport.URLParams 12763 ctx_ context.Context 12764 header_ http.Header 12765} 12766 12767// Delete: Deletes a guardian. 12768// 12769// The guardian will no longer receive guardian notifications and the 12770// guardian 12771// will no longer be accessible via the API. 12772// 12773// This method returns the following error codes: 12774// 12775// * `PERMISSION_DENIED` if no user that matches the provided 12776// `student_id` 12777// is visible to the requesting user, if the requesting user is not 12778// permitted to manage guardians for the student identified by the 12779// `student_id`, if guardians are not enabled for the domain in 12780// question, 12781// or for other access errors. 12782// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12783// cannot 12784// be recognized (it is not an email address, nor a `student_id` from 12785// the 12786// API). 12787// * `NOT_FOUND` if the requesting user is permitted to modify guardians 12788// for 12789// the requested `student_id`, but no `Guardian` record exists for 12790// that 12791// student with the provided `guardian_id`. 12792func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall { 12793 c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12794 c.studentId = studentId 12795 c.guardianId = guardianId 12796 return c 12797} 12798 12799// Fields allows partial responses to be retrieved. See 12800// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12801// for more information. 12802func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall { 12803 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12804 return c 12805} 12806 12807// Context sets the context to be used in this call's Do method. Any 12808// pending HTTP request will be aborted if the provided context is 12809// canceled. 12810func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall { 12811 c.ctx_ = ctx 12812 return c 12813} 12814 12815// Header returns an http.Header that can be modified by the caller to 12816// add HTTP headers to the request. 12817func (c *UserProfilesGuardiansDeleteCall) Header() http.Header { 12818 if c.header_ == nil { 12819 c.header_ = make(http.Header) 12820 } 12821 return c.header_ 12822} 12823 12824func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) { 12825 reqHeaders := make(http.Header) 12826 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 12827 for k, v := range c.header_ { 12828 reqHeaders[k] = v 12829 } 12830 reqHeaders.Set("User-Agent", c.s.userAgent()) 12831 var body io.Reader = nil 12832 c.urlParams_.Set("alt", alt) 12833 c.urlParams_.Set("prettyPrint", "false") 12834 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 12835 urls += "?" + c.urlParams_.Encode() 12836 req, err := http.NewRequest("DELETE", urls, body) 12837 if err != nil { 12838 return nil, err 12839 } 12840 req.Header = reqHeaders 12841 googleapi.Expand(req.URL, map[string]string{ 12842 "studentId": c.studentId, 12843 "guardianId": c.guardianId, 12844 }) 12845 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12846} 12847 12848// Do executes the "classroom.userProfiles.guardians.delete" call. 12849// Exactly one of *Empty or error will be non-nil. Any non-2xx status 12850// code is an error. Response headers are in either 12851// *Empty.ServerResponse.Header or (if a response was returned at all) 12852// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12853// check whether the returned error was because http.StatusNotModified 12854// was returned. 12855func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 12856 gensupport.SetOptions(c.urlParams_, opts...) 12857 res, err := c.doRequest("json") 12858 if res != nil && res.StatusCode == http.StatusNotModified { 12859 if res.Body != nil { 12860 res.Body.Close() 12861 } 12862 return nil, &googleapi.Error{ 12863 Code: res.StatusCode, 12864 Header: res.Header, 12865 } 12866 } 12867 if err != nil { 12868 return nil, err 12869 } 12870 defer googleapi.CloseBody(res) 12871 if err := googleapi.CheckResponse(res); err != nil { 12872 return nil, err 12873 } 12874 ret := &Empty{ 12875 ServerResponse: googleapi.ServerResponse{ 12876 Header: res.Header, 12877 HTTPStatusCode: res.StatusCode, 12878 }, 12879 } 12880 target := &ret 12881 if err := gensupport.DecodeResponse(target, res); err != nil { 12882 return nil, err 12883 } 12884 return ret, nil 12885 // { 12886 // "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`.", 12887 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12888 // "httpMethod": "DELETE", 12889 // "id": "classroom.userProfiles.guardians.delete", 12890 // "parameterOrder": [ 12891 // "studentId", 12892 // "guardianId" 12893 // ], 12894 // "parameters": { 12895 // "guardianId": { 12896 // "description": "The `id` field from a `Guardian`.", 12897 // "location": "path", 12898 // "required": true, 12899 // "type": "string" 12900 // }, 12901 // "studentId": { 12902 // "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", 12903 // "location": "path", 12904 // "required": true, 12905 // "type": "string" 12906 // } 12907 // }, 12908 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12909 // "response": { 12910 // "$ref": "Empty" 12911 // }, 12912 // "scopes": [ 12913 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12914 // ] 12915 // } 12916 12917} 12918 12919// method id "classroom.userProfiles.guardians.get": 12920 12921type UserProfilesGuardiansGetCall struct { 12922 s *Service 12923 studentId string 12924 guardianId string 12925 urlParams_ gensupport.URLParams 12926 ifNoneMatch_ string 12927 ctx_ context.Context 12928 header_ http.Header 12929} 12930 12931// Get: Returns a specific guardian. 12932// 12933// This method returns the following error codes: 12934// 12935// * `PERMISSION_DENIED` if no user that matches the provided 12936// `student_id` 12937// is visible to the requesting user, if the requesting user is not 12938// permitted to view guardian information for the student identified 12939// by the 12940// `student_id`, if guardians are not enabled for the domain in 12941// question, 12942// or for other access errors. 12943// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12944// cannot 12945// be recognized (it is not an email address, nor a `student_id` from 12946// the 12947// API, nor the literal string `me`). 12948// * `NOT_FOUND` if the requesting user is permitted to view guardians 12949// for 12950// the requested `student_id`, but no `Guardian` record exists for 12951// that 12952// student that matches the provided `guardian_id`. 12953func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall { 12954 c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12955 c.studentId = studentId 12956 c.guardianId = guardianId 12957 return c 12958} 12959 12960// Fields allows partial responses to be retrieved. See 12961// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12962// for more information. 12963func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall { 12964 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12965 return c 12966} 12967 12968// IfNoneMatch sets the optional parameter which makes the operation 12969// fail if the object's ETag matches the given value. This is useful for 12970// getting updates only after the object has changed since the last 12971// request. Use googleapi.IsNotModified to check whether the response 12972// error from Do is the result of In-None-Match. 12973func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall { 12974 c.ifNoneMatch_ = entityTag 12975 return c 12976} 12977 12978// Context sets the context to be used in this call's Do method. Any 12979// pending HTTP request will be aborted if the provided context is 12980// canceled. 12981func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall { 12982 c.ctx_ = ctx 12983 return c 12984} 12985 12986// Header returns an http.Header that can be modified by the caller to 12987// add HTTP headers to the request. 12988func (c *UserProfilesGuardiansGetCall) Header() http.Header { 12989 if c.header_ == nil { 12990 c.header_ = make(http.Header) 12991 } 12992 return c.header_ 12993} 12994 12995func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) { 12996 reqHeaders := make(http.Header) 12997 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 12998 for k, v := range c.header_ { 12999 reqHeaders[k] = v 13000 } 13001 reqHeaders.Set("User-Agent", c.s.userAgent()) 13002 if c.ifNoneMatch_ != "" { 13003 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13004 } 13005 var body io.Reader = nil 13006 c.urlParams_.Set("alt", alt) 13007 c.urlParams_.Set("prettyPrint", "false") 13008 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13009 urls += "?" + c.urlParams_.Encode() 13010 req, err := http.NewRequest("GET", urls, body) 13011 if err != nil { 13012 return nil, err 13013 } 13014 req.Header = reqHeaders 13015 googleapi.Expand(req.URL, map[string]string{ 13016 "studentId": c.studentId, 13017 "guardianId": c.guardianId, 13018 }) 13019 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13020} 13021 13022// Do executes the "classroom.userProfiles.guardians.get" call. 13023// Exactly one of *Guardian or error will be non-nil. Any non-2xx status 13024// code is an error. Response headers are in either 13025// *Guardian.ServerResponse.Header or (if a response was returned at 13026// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13027// to check whether the returned error was because 13028// http.StatusNotModified was returned. 13029func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) { 13030 gensupport.SetOptions(c.urlParams_, opts...) 13031 res, err := c.doRequest("json") 13032 if res != nil && res.StatusCode == http.StatusNotModified { 13033 if res.Body != nil { 13034 res.Body.Close() 13035 } 13036 return nil, &googleapi.Error{ 13037 Code: res.StatusCode, 13038 Header: res.Header, 13039 } 13040 } 13041 if err != nil { 13042 return nil, err 13043 } 13044 defer googleapi.CloseBody(res) 13045 if err := googleapi.CheckResponse(res); err != nil { 13046 return nil, err 13047 } 13048 ret := &Guardian{ 13049 ServerResponse: googleapi.ServerResponse{ 13050 Header: res.Header, 13051 HTTPStatusCode: res.StatusCode, 13052 }, 13053 } 13054 target := &ret 13055 if err := gensupport.DecodeResponse(target, res); err != nil { 13056 return nil, err 13057 } 13058 return ret, nil 13059 // { 13060 // "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`.", 13061 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13062 // "httpMethod": "GET", 13063 // "id": "classroom.userProfiles.guardians.get", 13064 // "parameterOrder": [ 13065 // "studentId", 13066 // "guardianId" 13067 // ], 13068 // "parameters": { 13069 // "guardianId": { 13070 // "description": "The `id` field from a `Guardian`.", 13071 // "location": "path", 13072 // "required": true, 13073 // "type": "string" 13074 // }, 13075 // "studentId": { 13076 // "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", 13077 // "location": "path", 13078 // "required": true, 13079 // "type": "string" 13080 // } 13081 // }, 13082 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13083 // "response": { 13084 // "$ref": "Guardian" 13085 // }, 13086 // "scopes": [ 13087 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13088 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13089 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13090 // ] 13091 // } 13092 13093} 13094 13095// method id "classroom.userProfiles.guardians.list": 13096 13097type UserProfilesGuardiansListCall struct { 13098 s *Service 13099 studentId string 13100 urlParams_ gensupport.URLParams 13101 ifNoneMatch_ string 13102 ctx_ context.Context 13103 header_ http.Header 13104} 13105 13106// List: Returns a list of guardians that the requesting user is 13107// permitted to 13108// view, restricted to those that match the request. 13109// 13110// To list guardians for any student that the requesting user may 13111// view 13112// guardians for, use the literal character `-` for the student 13113// ID. 13114// 13115// This method returns the following error codes: 13116// 13117// * `PERMISSION_DENIED` if a `student_id` is specified, and the 13118// requesting 13119// user is not permitted to view guardian information for that 13120// student, if 13121// "-" is specified as the `student_id` and the user is not a 13122// domain 13123// administrator, if guardians are not enabled for the domain in 13124// question, 13125// if the `invited_email_address` filter is set by a user who is not 13126// a 13127// domain administrator, or for other access errors. 13128// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 13129// cannot 13130// be recognized (it is not an email address, nor a `student_id` from 13131// the 13132// API, nor the literal string `me`). May also be returned if an 13133// invalid 13134// `page_token` is provided. 13135// * `NOT_FOUND` if a `student_id` is specified, and its format can be 13136// recognized, but Classroom has no record of that student. 13137func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall { 13138 c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13139 c.studentId = studentId 13140 return c 13141} 13142 13143// InvitedEmailAddress sets the optional parameter 13144// "invitedEmailAddress": Filter results by the email address that the 13145// original invitation was sent 13146// to, resulting in this guardian link. 13147// This filter can only be used by domain administrators. 13148func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall { 13149 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 13150 return c 13151} 13152 13153// PageSize sets the optional parameter "pageSize": Maximum number of 13154// items to return. Zero or unspecified indicates that the 13155// server may assign a maximum. 13156// 13157// The server may return fewer than the specified number of results. 13158func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall { 13159 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 13160 return c 13161} 13162 13163// PageToken sets the optional parameter "pageToken": 13164// nextPageToken 13165// value returned from a previous 13166// list call, 13167// indicating that the subsequent page of results should be 13168// returned. 13169// 13170// The list request 13171// must be otherwise identical to the one that resulted in this token. 13172func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall { 13173 c.urlParams_.Set("pageToken", pageToken) 13174 return c 13175} 13176 13177// Fields allows partial responses to be retrieved. See 13178// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13179// for more information. 13180func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall { 13181 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13182 return c 13183} 13184 13185// IfNoneMatch sets the optional parameter which makes the operation 13186// fail if the object's ETag matches the given value. This is useful for 13187// getting updates only after the object has changed since the last 13188// request. Use googleapi.IsNotModified to check whether the response 13189// error from Do is the result of In-None-Match. 13190func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall { 13191 c.ifNoneMatch_ = entityTag 13192 return c 13193} 13194 13195// Context sets the context to be used in this call's Do method. Any 13196// pending HTTP request will be aborted if the provided context is 13197// canceled. 13198func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall { 13199 c.ctx_ = ctx 13200 return c 13201} 13202 13203// Header returns an http.Header that can be modified by the caller to 13204// add HTTP headers to the request. 13205func (c *UserProfilesGuardiansListCall) Header() http.Header { 13206 if c.header_ == nil { 13207 c.header_ = make(http.Header) 13208 } 13209 return c.header_ 13210} 13211 13212func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) { 13213 reqHeaders := make(http.Header) 13214 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 13215 for k, v := range c.header_ { 13216 reqHeaders[k] = v 13217 } 13218 reqHeaders.Set("User-Agent", c.s.userAgent()) 13219 if c.ifNoneMatch_ != "" { 13220 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13221 } 13222 var body io.Reader = nil 13223 c.urlParams_.Set("alt", alt) 13224 c.urlParams_.Set("prettyPrint", "false") 13225 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians") 13226 urls += "?" + c.urlParams_.Encode() 13227 req, err := http.NewRequest("GET", urls, body) 13228 if err != nil { 13229 return nil, err 13230 } 13231 req.Header = reqHeaders 13232 googleapi.Expand(req.URL, map[string]string{ 13233 "studentId": c.studentId, 13234 }) 13235 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13236} 13237 13238// Do executes the "classroom.userProfiles.guardians.list" call. 13239// Exactly one of *ListGuardiansResponse or error will be non-nil. Any 13240// non-2xx status code is an error. Response headers are in either 13241// *ListGuardiansResponse.ServerResponse.Header or (if a response was 13242// returned at all) in error.(*googleapi.Error).Header. Use 13243// googleapi.IsNotModified to check whether the returned error was 13244// because http.StatusNotModified was returned. 13245func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) { 13246 gensupport.SetOptions(c.urlParams_, opts...) 13247 res, err := c.doRequest("json") 13248 if res != nil && res.StatusCode == http.StatusNotModified { 13249 if res.Body != nil { 13250 res.Body.Close() 13251 } 13252 return nil, &googleapi.Error{ 13253 Code: res.StatusCode, 13254 Header: res.Header, 13255 } 13256 } 13257 if err != nil { 13258 return nil, err 13259 } 13260 defer googleapi.CloseBody(res) 13261 if err := googleapi.CheckResponse(res); err != nil { 13262 return nil, err 13263 } 13264 ret := &ListGuardiansResponse{ 13265 ServerResponse: googleapi.ServerResponse{ 13266 Header: res.Header, 13267 HTTPStatusCode: res.StatusCode, 13268 }, 13269 } 13270 target := &ret 13271 if err := gensupport.DecodeResponse(target, res); err != nil { 13272 return nil, err 13273 } 13274 return ret, nil 13275 // { 13276 // "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.", 13277 // "flatPath": "v1/userProfiles/{studentId}/guardians", 13278 // "httpMethod": "GET", 13279 // "id": "classroom.userProfiles.guardians.list", 13280 // "parameterOrder": [ 13281 // "studentId" 13282 // ], 13283 // "parameters": { 13284 // "invitedEmailAddress": { 13285 // "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.", 13286 // "location": "query", 13287 // "type": "string" 13288 // }, 13289 // "pageSize": { 13290 // "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.", 13291 // "format": "int32", 13292 // "location": "query", 13293 // "type": "integer" 13294 // }, 13295 // "pageToken": { 13296 // "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.", 13297 // "location": "query", 13298 // "type": "string" 13299 // }, 13300 // "studentId": { 13301 // "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.", 13302 // "location": "path", 13303 // "required": true, 13304 // "type": "string" 13305 // } 13306 // }, 13307 // "path": "v1/userProfiles/{studentId}/guardians", 13308 // "response": { 13309 // "$ref": "ListGuardiansResponse" 13310 // }, 13311 // "scopes": [ 13312 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13313 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13314 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13315 // ] 13316 // } 13317 13318} 13319 13320// Pages invokes f for each page of results. 13321// A non-nil error returned from f will halt the iteration. 13322// The provided context supersedes any context provided to the Context method. 13323func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error { 13324 c.ctx_ = ctx 13325 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13326 for { 13327 x, err := c.Do() 13328 if err != nil { 13329 return err 13330 } 13331 if err := f(x); err != nil { 13332 return err 13333 } 13334 if x.NextPageToken == "" { 13335 return nil 13336 } 13337 c.PageToken(x.NextPageToken) 13338 } 13339} 13340