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 gensupport "google.golang.org/api/gensupport" 57 googleapi "google.golang.org/api/googleapi" 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 for k, v := range c.header_ { 3373 reqHeaders[k] = v 3374 } 3375 reqHeaders.Set("User-Agent", c.s.userAgent()) 3376 var body io.Reader = nil 3377 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3378 if err != nil { 3379 return nil, err 3380 } 3381 reqHeaders.Set("Content-Type", "application/json") 3382 c.urlParams_.Set("alt", alt) 3383 c.urlParams_.Set("prettyPrint", "false") 3384 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3385 urls += "?" + c.urlParams_.Encode() 3386 req, err := http.NewRequest("POST", urls, body) 3387 if err != nil { 3388 return nil, err 3389 } 3390 req.Header = reqHeaders 3391 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3392} 3393 3394// Do executes the "classroom.courses.create" call. 3395// Exactly one of *Course or error will be non-nil. Any non-2xx status 3396// code is an error. Response headers are in either 3397// *Course.ServerResponse.Header or (if a response was returned at all) 3398// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3399// check whether the returned error was because http.StatusNotModified 3400// was returned. 3401func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3402 gensupport.SetOptions(c.urlParams_, opts...) 3403 res, err := c.doRequest("json") 3404 if res != nil && res.StatusCode == http.StatusNotModified { 3405 if res.Body != nil { 3406 res.Body.Close() 3407 } 3408 return nil, &googleapi.Error{ 3409 Code: res.StatusCode, 3410 Header: res.Header, 3411 } 3412 } 3413 if err != nil { 3414 return nil, err 3415 } 3416 defer googleapi.CloseBody(res) 3417 if err := googleapi.CheckResponse(res); err != nil { 3418 return nil, err 3419 } 3420 ret := &Course{ 3421 ServerResponse: googleapi.ServerResponse{ 3422 Header: res.Header, 3423 HTTPStatusCode: res.StatusCode, 3424 }, 3425 } 3426 target := &ret 3427 if err := gensupport.DecodeResponse(target, res); err != nil { 3428 return nil, err 3429 } 3430 return ret, nil 3431 // { 3432 // "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.", 3433 // "flatPath": "v1/courses", 3434 // "httpMethod": "POST", 3435 // "id": "classroom.courses.create", 3436 // "parameterOrder": [], 3437 // "parameters": {}, 3438 // "path": "v1/courses", 3439 // "request": { 3440 // "$ref": "Course" 3441 // }, 3442 // "response": { 3443 // "$ref": "Course" 3444 // }, 3445 // "scopes": [ 3446 // "https://www.googleapis.com/auth/classroom.courses" 3447 // ] 3448 // } 3449 3450} 3451 3452// method id "classroom.courses.delete": 3453 3454type CoursesDeleteCall struct { 3455 s *Service 3456 id string 3457 urlParams_ gensupport.URLParams 3458 ctx_ context.Context 3459 header_ http.Header 3460} 3461 3462// Delete: Deletes a course. 3463// 3464// This method returns the following error codes: 3465// 3466// * `PERMISSION_DENIED` if the requesting user is not permitted to 3467// delete the 3468// requested course or for access errors. 3469// * `NOT_FOUND` if no course exists with the requested ID. 3470func (r *CoursesService) Delete(id string) *CoursesDeleteCall { 3471 c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3472 c.id = id 3473 return c 3474} 3475 3476// Fields allows partial responses to be retrieved. See 3477// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3478// for more information. 3479func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall { 3480 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3481 return c 3482} 3483 3484// Context sets the context to be used in this call's Do method. Any 3485// pending HTTP request will be aborted if the provided context is 3486// canceled. 3487func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall { 3488 c.ctx_ = ctx 3489 return c 3490} 3491 3492// Header returns an http.Header that can be modified by the caller to 3493// add HTTP headers to the request. 3494func (c *CoursesDeleteCall) Header() http.Header { 3495 if c.header_ == nil { 3496 c.header_ = make(http.Header) 3497 } 3498 return c.header_ 3499} 3500 3501func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) { 3502 reqHeaders := make(http.Header) 3503 for k, v := range c.header_ { 3504 reqHeaders[k] = v 3505 } 3506 reqHeaders.Set("User-Agent", c.s.userAgent()) 3507 var body io.Reader = nil 3508 c.urlParams_.Set("alt", alt) 3509 c.urlParams_.Set("prettyPrint", "false") 3510 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3511 urls += "?" + c.urlParams_.Encode() 3512 req, err := http.NewRequest("DELETE", urls, body) 3513 if err != nil { 3514 return nil, err 3515 } 3516 req.Header = reqHeaders 3517 googleapi.Expand(req.URL, map[string]string{ 3518 "id": c.id, 3519 }) 3520 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3521} 3522 3523// Do executes the "classroom.courses.delete" call. 3524// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3525// code is an error. Response headers are in either 3526// *Empty.ServerResponse.Header or (if a response was returned at all) 3527// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3528// check whether the returned error was because http.StatusNotModified 3529// was returned. 3530func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3531 gensupport.SetOptions(c.urlParams_, opts...) 3532 res, err := c.doRequest("json") 3533 if res != nil && res.StatusCode == http.StatusNotModified { 3534 if res.Body != nil { 3535 res.Body.Close() 3536 } 3537 return nil, &googleapi.Error{ 3538 Code: res.StatusCode, 3539 Header: res.Header, 3540 } 3541 } 3542 if err != nil { 3543 return nil, err 3544 } 3545 defer googleapi.CloseBody(res) 3546 if err := googleapi.CheckResponse(res); err != nil { 3547 return nil, err 3548 } 3549 ret := &Empty{ 3550 ServerResponse: googleapi.ServerResponse{ 3551 Header: res.Header, 3552 HTTPStatusCode: res.StatusCode, 3553 }, 3554 } 3555 target := &ret 3556 if err := gensupport.DecodeResponse(target, res); err != nil { 3557 return nil, err 3558 } 3559 return ret, nil 3560 // { 3561 // "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.", 3562 // "flatPath": "v1/courses/{id}", 3563 // "httpMethod": "DELETE", 3564 // "id": "classroom.courses.delete", 3565 // "parameterOrder": [ 3566 // "id" 3567 // ], 3568 // "parameters": { 3569 // "id": { 3570 // "description": "Identifier of the course to delete.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3571 // "location": "path", 3572 // "required": true, 3573 // "type": "string" 3574 // } 3575 // }, 3576 // "path": "v1/courses/{id}", 3577 // "response": { 3578 // "$ref": "Empty" 3579 // }, 3580 // "scopes": [ 3581 // "https://www.googleapis.com/auth/classroom.courses" 3582 // ] 3583 // } 3584 3585} 3586 3587// method id "classroom.courses.get": 3588 3589type CoursesGetCall struct { 3590 s *Service 3591 id string 3592 urlParams_ gensupport.URLParams 3593 ifNoneMatch_ string 3594 ctx_ context.Context 3595 header_ http.Header 3596} 3597 3598// Get: Returns a course. 3599// 3600// This method returns the following error codes: 3601// 3602// * `PERMISSION_DENIED` if the requesting user is not permitted to 3603// access the 3604// requested course or for access errors. 3605// * `NOT_FOUND` if no course exists with the requested ID. 3606func (r *CoursesService) Get(id string) *CoursesGetCall { 3607 c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3608 c.id = id 3609 return c 3610} 3611 3612// Fields allows partial responses to be retrieved. See 3613// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3614// for more information. 3615func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall { 3616 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3617 return c 3618} 3619 3620// IfNoneMatch sets the optional parameter which makes the operation 3621// fail if the object's ETag matches the given value. This is useful for 3622// getting updates only after the object has changed since the last 3623// request. Use googleapi.IsNotModified to check whether the response 3624// error from Do is the result of In-None-Match. 3625func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall { 3626 c.ifNoneMatch_ = entityTag 3627 return c 3628} 3629 3630// Context sets the context to be used in this call's Do method. Any 3631// pending HTTP request will be aborted if the provided context is 3632// canceled. 3633func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall { 3634 c.ctx_ = ctx 3635 return c 3636} 3637 3638// Header returns an http.Header that can be modified by the caller to 3639// add HTTP headers to the request. 3640func (c *CoursesGetCall) Header() http.Header { 3641 if c.header_ == nil { 3642 c.header_ = make(http.Header) 3643 } 3644 return c.header_ 3645} 3646 3647func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) { 3648 reqHeaders := make(http.Header) 3649 for k, v := range c.header_ { 3650 reqHeaders[k] = v 3651 } 3652 reqHeaders.Set("User-Agent", c.s.userAgent()) 3653 if c.ifNoneMatch_ != "" { 3654 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3655 } 3656 var body io.Reader = nil 3657 c.urlParams_.Set("alt", alt) 3658 c.urlParams_.Set("prettyPrint", "false") 3659 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3660 urls += "?" + c.urlParams_.Encode() 3661 req, err := http.NewRequest("GET", urls, body) 3662 if err != nil { 3663 return nil, err 3664 } 3665 req.Header = reqHeaders 3666 googleapi.Expand(req.URL, map[string]string{ 3667 "id": c.id, 3668 }) 3669 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3670} 3671 3672// Do executes the "classroom.courses.get" call. 3673// Exactly one of *Course or error will be non-nil. Any non-2xx status 3674// code is an error. Response headers are in either 3675// *Course.ServerResponse.Header or (if a response was returned at all) 3676// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3677// check whether the returned error was because http.StatusNotModified 3678// was returned. 3679func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3680 gensupport.SetOptions(c.urlParams_, opts...) 3681 res, err := c.doRequest("json") 3682 if res != nil && res.StatusCode == http.StatusNotModified { 3683 if res.Body != nil { 3684 res.Body.Close() 3685 } 3686 return nil, &googleapi.Error{ 3687 Code: res.StatusCode, 3688 Header: res.Header, 3689 } 3690 } 3691 if err != nil { 3692 return nil, err 3693 } 3694 defer googleapi.CloseBody(res) 3695 if err := googleapi.CheckResponse(res); err != nil { 3696 return nil, err 3697 } 3698 ret := &Course{ 3699 ServerResponse: googleapi.ServerResponse{ 3700 Header: res.Header, 3701 HTTPStatusCode: res.StatusCode, 3702 }, 3703 } 3704 target := &ret 3705 if err := gensupport.DecodeResponse(target, res); err != nil { 3706 return nil, err 3707 } 3708 return ret, nil 3709 // { 3710 // "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.", 3711 // "flatPath": "v1/courses/{id}", 3712 // "httpMethod": "GET", 3713 // "id": "classroom.courses.get", 3714 // "parameterOrder": [ 3715 // "id" 3716 // ], 3717 // "parameters": { 3718 // "id": { 3719 // "description": "Identifier of the course to return.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3720 // "location": "path", 3721 // "required": true, 3722 // "type": "string" 3723 // } 3724 // }, 3725 // "path": "v1/courses/{id}", 3726 // "response": { 3727 // "$ref": "Course" 3728 // }, 3729 // "scopes": [ 3730 // "https://www.googleapis.com/auth/classroom.courses", 3731 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3732 // ] 3733 // } 3734 3735} 3736 3737// method id "classroom.courses.list": 3738 3739type CoursesListCall struct { 3740 s *Service 3741 urlParams_ gensupport.URLParams 3742 ifNoneMatch_ string 3743 ctx_ context.Context 3744 header_ http.Header 3745} 3746 3747// List: Returns a list of courses that the requesting user is permitted 3748// to view, 3749// restricted to those that match the request. Returned courses are 3750// ordered by 3751// creation time, with the most recently created coming first. 3752// 3753// This method returns the following error codes: 3754// 3755// * `PERMISSION_DENIED` for access errors. 3756// * `INVALID_ARGUMENT` if the query argument is malformed. 3757// * `NOT_FOUND` if any users specified in the query arguments do not 3758// exist. 3759func (r *CoursesService) List() *CoursesListCall { 3760 c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3761 return c 3762} 3763 3764// CourseStates sets the optional parameter "courseStates": Restricts 3765// returned courses to those in one of the specified states 3766// The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED. 3767// 3768// Possible values: 3769// "COURSE_STATE_UNSPECIFIED" 3770// "ACTIVE" 3771// "ARCHIVED" 3772// "PROVISIONED" 3773// "DECLINED" 3774// "SUSPENDED" 3775func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall { 3776 c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...)) 3777 return c 3778} 3779 3780// PageSize sets the optional parameter "pageSize": Maximum number of 3781// items to return. Zero or unspecified indicates that the 3782// server may assign a maximum. 3783// 3784// The server may return fewer than the specified number of results. 3785func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall { 3786 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3787 return c 3788} 3789 3790// PageToken sets the optional parameter "pageToken": 3791// nextPageToken 3792// value returned from a previous 3793// list call, 3794// indicating that the subsequent page of results should be 3795// returned. 3796// 3797// The list request must be 3798// otherwise identical to the one that resulted in this token. 3799func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall { 3800 c.urlParams_.Set("pageToken", pageToken) 3801 return c 3802} 3803 3804// StudentId sets the optional parameter "studentId": Restricts returned 3805// courses to those having a student with the specified 3806// identifier. The identifier can be one of the following: 3807// 3808// * the numeric identifier for the user 3809// * the email address of the user 3810// * the string literal "me", indicating the requesting user 3811func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall { 3812 c.urlParams_.Set("studentId", studentId) 3813 return c 3814} 3815 3816// TeacherId sets the optional parameter "teacherId": Restricts returned 3817// courses to those having a teacher with the specified 3818// identifier. The identifier can be one of the following: 3819// 3820// * the numeric identifier for the user 3821// * the email address of the user 3822// * the string literal "me", indicating the requesting user 3823func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall { 3824 c.urlParams_.Set("teacherId", teacherId) 3825 return c 3826} 3827 3828// Fields allows partial responses to be retrieved. See 3829// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3830// for more information. 3831func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall { 3832 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3833 return c 3834} 3835 3836// IfNoneMatch sets the optional parameter which makes the operation 3837// fail if the object's ETag matches the given value. This is useful for 3838// getting updates only after the object has changed since the last 3839// request. Use googleapi.IsNotModified to check whether the response 3840// error from Do is the result of In-None-Match. 3841func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall { 3842 c.ifNoneMatch_ = entityTag 3843 return c 3844} 3845 3846// Context sets the context to be used in this call's Do method. Any 3847// pending HTTP request will be aborted if the provided context is 3848// canceled. 3849func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall { 3850 c.ctx_ = ctx 3851 return c 3852} 3853 3854// Header returns an http.Header that can be modified by the caller to 3855// add HTTP headers to the request. 3856func (c *CoursesListCall) Header() http.Header { 3857 if c.header_ == nil { 3858 c.header_ = make(http.Header) 3859 } 3860 return c.header_ 3861} 3862 3863func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) { 3864 reqHeaders := make(http.Header) 3865 for k, v := range c.header_ { 3866 reqHeaders[k] = v 3867 } 3868 reqHeaders.Set("User-Agent", c.s.userAgent()) 3869 if c.ifNoneMatch_ != "" { 3870 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3871 } 3872 var body io.Reader = nil 3873 c.urlParams_.Set("alt", alt) 3874 c.urlParams_.Set("prettyPrint", "false") 3875 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3876 urls += "?" + c.urlParams_.Encode() 3877 req, err := http.NewRequest("GET", urls, body) 3878 if err != nil { 3879 return nil, err 3880 } 3881 req.Header = reqHeaders 3882 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3883} 3884 3885// Do executes the "classroom.courses.list" call. 3886// Exactly one of *ListCoursesResponse or error will be non-nil. Any 3887// non-2xx status code is an error. Response headers are in either 3888// *ListCoursesResponse.ServerResponse.Header or (if a response was 3889// returned at all) in error.(*googleapi.Error).Header. Use 3890// googleapi.IsNotModified to check whether the returned error was 3891// because http.StatusNotModified was returned. 3892func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) { 3893 gensupport.SetOptions(c.urlParams_, opts...) 3894 res, err := c.doRequest("json") 3895 if res != nil && res.StatusCode == http.StatusNotModified { 3896 if res.Body != nil { 3897 res.Body.Close() 3898 } 3899 return nil, &googleapi.Error{ 3900 Code: res.StatusCode, 3901 Header: res.Header, 3902 } 3903 } 3904 if err != nil { 3905 return nil, err 3906 } 3907 defer googleapi.CloseBody(res) 3908 if err := googleapi.CheckResponse(res); err != nil { 3909 return nil, err 3910 } 3911 ret := &ListCoursesResponse{ 3912 ServerResponse: googleapi.ServerResponse{ 3913 Header: res.Header, 3914 HTTPStatusCode: res.StatusCode, 3915 }, 3916 } 3917 target := &ret 3918 if err := gensupport.DecodeResponse(target, res); err != nil { 3919 return nil, err 3920 } 3921 return ret, nil 3922 // { 3923 // "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.", 3924 // "flatPath": "v1/courses", 3925 // "httpMethod": "GET", 3926 // "id": "classroom.courses.list", 3927 // "parameterOrder": [], 3928 // "parameters": { 3929 // "courseStates": { 3930 // "description": "Restricts returned courses to those in one of the specified states\nThe default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.", 3931 // "enum": [ 3932 // "COURSE_STATE_UNSPECIFIED", 3933 // "ACTIVE", 3934 // "ARCHIVED", 3935 // "PROVISIONED", 3936 // "DECLINED", 3937 // "SUSPENDED" 3938 // ], 3939 // "location": "query", 3940 // "repeated": true, 3941 // "type": "string" 3942 // }, 3943 // "pageSize": { 3944 // "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.", 3945 // "format": "int32", 3946 // "location": "query", 3947 // "type": "integer" 3948 // }, 3949 // "pageToken": { 3950 // "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.", 3951 // "location": "query", 3952 // "type": "string" 3953 // }, 3954 // "studentId": { 3955 // "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", 3956 // "location": "query", 3957 // "type": "string" 3958 // }, 3959 // "teacherId": { 3960 // "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", 3961 // "location": "query", 3962 // "type": "string" 3963 // } 3964 // }, 3965 // "path": "v1/courses", 3966 // "response": { 3967 // "$ref": "ListCoursesResponse" 3968 // }, 3969 // "scopes": [ 3970 // "https://www.googleapis.com/auth/classroom.courses", 3971 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3972 // ] 3973 // } 3974 3975} 3976 3977// Pages invokes f for each page of results. 3978// A non-nil error returned from f will halt the iteration. 3979// The provided context supersedes any context provided to the Context method. 3980func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error { 3981 c.ctx_ = ctx 3982 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3983 for { 3984 x, err := c.Do() 3985 if err != nil { 3986 return err 3987 } 3988 if err := f(x); err != nil { 3989 return err 3990 } 3991 if x.NextPageToken == "" { 3992 return nil 3993 } 3994 c.PageToken(x.NextPageToken) 3995 } 3996} 3997 3998// method id "classroom.courses.patch": 3999 4000type CoursesPatchCall struct { 4001 s *Service 4002 id string 4003 course *Course 4004 urlParams_ gensupport.URLParams 4005 ctx_ context.Context 4006 header_ http.Header 4007} 4008 4009// Patch: Updates one or more fields in a course. 4010// 4011// This method returns the following error codes: 4012// 4013// * `PERMISSION_DENIED` if the requesting user is not permitted to 4014// modify the 4015// requested course or for access errors. 4016// * `NOT_FOUND` if no course exists with the requested ID. 4017// * `INVALID_ARGUMENT` if invalid fields are specified in the update 4018// mask or 4019// if no update mask is supplied. 4020// * `FAILED_PRECONDITION` for the following request errors: 4021// * CourseNotModifiable 4022func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall { 4023 c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4024 c.id = id 4025 c.course = course 4026 return c 4027} 4028 4029// UpdateMask sets the optional parameter "updateMask": Mask that 4030// identifies which fields on the course to update. 4031// This field is required to do an update. The update will fail if 4032// invalid 4033// fields are specified. The following fields are valid: 4034// 4035// * `name` 4036// * `section` 4037// * `descriptionHeading` 4038// * `description` 4039// * `room` 4040// * `courseState` 4041// * `ownerId` 4042// 4043// Note: patches to ownerId are treated as being effective immediately, 4044// but in 4045// practice it may take some time for the ownership transfer of all 4046// affected 4047// resources to complete. 4048// 4049// When set in a query parameter, this field should be specified 4050// as 4051// 4052// `updateMask=<field1>,<field2>,...` 4053func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall { 4054 c.urlParams_.Set("updateMask", updateMask) 4055 return c 4056} 4057 4058// Fields allows partial responses to be retrieved. See 4059// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4060// for more information. 4061func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall { 4062 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4063 return c 4064} 4065 4066// Context sets the context to be used in this call's Do method. Any 4067// pending HTTP request will be aborted if the provided context is 4068// canceled. 4069func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall { 4070 c.ctx_ = ctx 4071 return c 4072} 4073 4074// Header returns an http.Header that can be modified by the caller to 4075// add HTTP headers to the request. 4076func (c *CoursesPatchCall) Header() http.Header { 4077 if c.header_ == nil { 4078 c.header_ = make(http.Header) 4079 } 4080 return c.header_ 4081} 4082 4083func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) { 4084 reqHeaders := make(http.Header) 4085 for k, v := range c.header_ { 4086 reqHeaders[k] = v 4087 } 4088 reqHeaders.Set("User-Agent", c.s.userAgent()) 4089 var body io.Reader = nil 4090 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4091 if err != nil { 4092 return nil, err 4093 } 4094 reqHeaders.Set("Content-Type", "application/json") 4095 c.urlParams_.Set("alt", alt) 4096 c.urlParams_.Set("prettyPrint", "false") 4097 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4098 urls += "?" + c.urlParams_.Encode() 4099 req, err := http.NewRequest("PATCH", urls, body) 4100 if err != nil { 4101 return nil, err 4102 } 4103 req.Header = reqHeaders 4104 googleapi.Expand(req.URL, map[string]string{ 4105 "id": c.id, 4106 }) 4107 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4108} 4109 4110// Do executes the "classroom.courses.patch" call. 4111// Exactly one of *Course or error will be non-nil. Any non-2xx status 4112// code is an error. Response headers are in either 4113// *Course.ServerResponse.Header or (if a response was returned at all) 4114// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4115// check whether the returned error was because http.StatusNotModified 4116// was returned. 4117func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4118 gensupport.SetOptions(c.urlParams_, opts...) 4119 res, err := c.doRequest("json") 4120 if res != nil && res.StatusCode == http.StatusNotModified { 4121 if res.Body != nil { 4122 res.Body.Close() 4123 } 4124 return nil, &googleapi.Error{ 4125 Code: res.StatusCode, 4126 Header: res.Header, 4127 } 4128 } 4129 if err != nil { 4130 return nil, err 4131 } 4132 defer googleapi.CloseBody(res) 4133 if err := googleapi.CheckResponse(res); err != nil { 4134 return nil, err 4135 } 4136 ret := &Course{ 4137 ServerResponse: googleapi.ServerResponse{ 4138 Header: res.Header, 4139 HTTPStatusCode: res.StatusCode, 4140 }, 4141 } 4142 target := &ret 4143 if err := gensupport.DecodeResponse(target, res); err != nil { 4144 return nil, err 4145 } 4146 return ret, nil 4147 // { 4148 // "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", 4149 // "flatPath": "v1/courses/{id}", 4150 // "httpMethod": "PATCH", 4151 // "id": "classroom.courses.patch", 4152 // "parameterOrder": [ 4153 // "id" 4154 // ], 4155 // "parameters": { 4156 // "id": { 4157 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4158 // "location": "path", 4159 // "required": true, 4160 // "type": "string" 4161 // }, 4162 // "updateMask": { 4163 // "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,...`", 4164 // "format": "google-fieldmask", 4165 // "location": "query", 4166 // "type": "string" 4167 // } 4168 // }, 4169 // "path": "v1/courses/{id}", 4170 // "request": { 4171 // "$ref": "Course" 4172 // }, 4173 // "response": { 4174 // "$ref": "Course" 4175 // }, 4176 // "scopes": [ 4177 // "https://www.googleapis.com/auth/classroom.courses" 4178 // ] 4179 // } 4180 4181} 4182 4183// method id "classroom.courses.update": 4184 4185type CoursesUpdateCall struct { 4186 s *Service 4187 id string 4188 course *Course 4189 urlParams_ gensupport.URLParams 4190 ctx_ context.Context 4191 header_ http.Header 4192} 4193 4194// Update: Updates a course. 4195// 4196// This method returns the following error codes: 4197// 4198// * `PERMISSION_DENIED` if the requesting user is not permitted to 4199// modify the 4200// requested course or for access errors. 4201// * `NOT_FOUND` if no course exists with the requested ID. 4202// * `FAILED_PRECONDITION` for the following request errors: 4203// * CourseNotModifiable 4204func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall { 4205 c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4206 c.id = id 4207 c.course = course 4208 return c 4209} 4210 4211// Fields allows partial responses to be retrieved. See 4212// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4213// for more information. 4214func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall { 4215 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4216 return c 4217} 4218 4219// Context sets the context to be used in this call's Do method. Any 4220// pending HTTP request will be aborted if the provided context is 4221// canceled. 4222func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall { 4223 c.ctx_ = ctx 4224 return c 4225} 4226 4227// Header returns an http.Header that can be modified by the caller to 4228// add HTTP headers to the request. 4229func (c *CoursesUpdateCall) Header() http.Header { 4230 if c.header_ == nil { 4231 c.header_ = make(http.Header) 4232 } 4233 return c.header_ 4234} 4235 4236func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) { 4237 reqHeaders := make(http.Header) 4238 for k, v := range c.header_ { 4239 reqHeaders[k] = v 4240 } 4241 reqHeaders.Set("User-Agent", c.s.userAgent()) 4242 var body io.Reader = nil 4243 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4244 if err != nil { 4245 return nil, err 4246 } 4247 reqHeaders.Set("Content-Type", "application/json") 4248 c.urlParams_.Set("alt", alt) 4249 c.urlParams_.Set("prettyPrint", "false") 4250 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4251 urls += "?" + c.urlParams_.Encode() 4252 req, err := http.NewRequest("PUT", urls, body) 4253 if err != nil { 4254 return nil, err 4255 } 4256 req.Header = reqHeaders 4257 googleapi.Expand(req.URL, map[string]string{ 4258 "id": c.id, 4259 }) 4260 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4261} 4262 4263// Do executes the "classroom.courses.update" call. 4264// Exactly one of *Course or error will be non-nil. Any non-2xx status 4265// code is an error. Response headers are in either 4266// *Course.ServerResponse.Header or (if a response was returned at all) 4267// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4268// check whether the returned error was because http.StatusNotModified 4269// was returned. 4270func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4271 gensupport.SetOptions(c.urlParams_, opts...) 4272 res, err := c.doRequest("json") 4273 if res != nil && res.StatusCode == http.StatusNotModified { 4274 if res.Body != nil { 4275 res.Body.Close() 4276 } 4277 return nil, &googleapi.Error{ 4278 Code: res.StatusCode, 4279 Header: res.Header, 4280 } 4281 } 4282 if err != nil { 4283 return nil, err 4284 } 4285 defer googleapi.CloseBody(res) 4286 if err := googleapi.CheckResponse(res); err != nil { 4287 return nil, err 4288 } 4289 ret := &Course{ 4290 ServerResponse: googleapi.ServerResponse{ 4291 Header: res.Header, 4292 HTTPStatusCode: res.StatusCode, 4293 }, 4294 } 4295 target := &ret 4296 if err := gensupport.DecodeResponse(target, res); err != nil { 4297 return nil, err 4298 } 4299 return ret, nil 4300 // { 4301 // "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", 4302 // "flatPath": "v1/courses/{id}", 4303 // "httpMethod": "PUT", 4304 // "id": "classroom.courses.update", 4305 // "parameterOrder": [ 4306 // "id" 4307 // ], 4308 // "parameters": { 4309 // "id": { 4310 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4311 // "location": "path", 4312 // "required": true, 4313 // "type": "string" 4314 // } 4315 // }, 4316 // "path": "v1/courses/{id}", 4317 // "request": { 4318 // "$ref": "Course" 4319 // }, 4320 // "response": { 4321 // "$ref": "Course" 4322 // }, 4323 // "scopes": [ 4324 // "https://www.googleapis.com/auth/classroom.courses" 4325 // ] 4326 // } 4327 4328} 4329 4330// method id "classroom.courses.aliases.create": 4331 4332type CoursesAliasesCreateCall struct { 4333 s *Service 4334 courseId string 4335 coursealias *CourseAlias 4336 urlParams_ gensupport.URLParams 4337 ctx_ context.Context 4338 header_ http.Header 4339} 4340 4341// Create: Creates an alias for a course. 4342// 4343// This method returns the following error codes: 4344// 4345// * `PERMISSION_DENIED` if the requesting user is not permitted to 4346// create the 4347// alias or for access errors. 4348// * `NOT_FOUND` if the course does not exist. 4349// * `ALREADY_EXISTS` if the alias already exists. 4350// * `FAILED_PRECONDITION` if the alias requested does not make sense 4351// for the 4352// requesting user or course (for example, if a user not in a domain 4353// attempts to access a domain-scoped alias). 4354func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall { 4355 c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4356 c.courseId = courseId 4357 c.coursealias = coursealias 4358 return c 4359} 4360 4361// Fields allows partial responses to be retrieved. See 4362// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4363// for more information. 4364func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall { 4365 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4366 return c 4367} 4368 4369// Context sets the context to be used in this call's Do method. Any 4370// pending HTTP request will be aborted if the provided context is 4371// canceled. 4372func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall { 4373 c.ctx_ = ctx 4374 return c 4375} 4376 4377// Header returns an http.Header that can be modified by the caller to 4378// add HTTP headers to the request. 4379func (c *CoursesAliasesCreateCall) Header() http.Header { 4380 if c.header_ == nil { 4381 c.header_ = make(http.Header) 4382 } 4383 return c.header_ 4384} 4385 4386func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) { 4387 reqHeaders := make(http.Header) 4388 for k, v := range c.header_ { 4389 reqHeaders[k] = v 4390 } 4391 reqHeaders.Set("User-Agent", c.s.userAgent()) 4392 var body io.Reader = nil 4393 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias) 4394 if err != nil { 4395 return nil, err 4396 } 4397 reqHeaders.Set("Content-Type", "application/json") 4398 c.urlParams_.Set("alt", alt) 4399 c.urlParams_.Set("prettyPrint", "false") 4400 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4401 urls += "?" + c.urlParams_.Encode() 4402 req, err := http.NewRequest("POST", urls, body) 4403 if err != nil { 4404 return nil, err 4405 } 4406 req.Header = reqHeaders 4407 googleapi.Expand(req.URL, map[string]string{ 4408 "courseId": c.courseId, 4409 }) 4410 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4411} 4412 4413// Do executes the "classroom.courses.aliases.create" call. 4414// Exactly one of *CourseAlias or error will be non-nil. Any non-2xx 4415// status code is an error. Response headers are in either 4416// *CourseAlias.ServerResponse.Header or (if a response was returned at 4417// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4418// to check whether the returned error was because 4419// http.StatusNotModified was returned. 4420func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) { 4421 gensupport.SetOptions(c.urlParams_, opts...) 4422 res, err := c.doRequest("json") 4423 if res != nil && res.StatusCode == http.StatusNotModified { 4424 if res.Body != nil { 4425 res.Body.Close() 4426 } 4427 return nil, &googleapi.Error{ 4428 Code: res.StatusCode, 4429 Header: res.Header, 4430 } 4431 } 4432 if err != nil { 4433 return nil, err 4434 } 4435 defer googleapi.CloseBody(res) 4436 if err := googleapi.CheckResponse(res); err != nil { 4437 return nil, err 4438 } 4439 ret := &CourseAlias{ 4440 ServerResponse: googleapi.ServerResponse{ 4441 Header: res.Header, 4442 HTTPStatusCode: res.StatusCode, 4443 }, 4444 } 4445 target := &ret 4446 if err := gensupport.DecodeResponse(target, res); err != nil { 4447 return nil, err 4448 } 4449 return ret, nil 4450 // { 4451 // "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).", 4452 // "flatPath": "v1/courses/{courseId}/aliases", 4453 // "httpMethod": "POST", 4454 // "id": "classroom.courses.aliases.create", 4455 // "parameterOrder": [ 4456 // "courseId" 4457 // ], 4458 // "parameters": { 4459 // "courseId": { 4460 // "description": "Identifier of the course to alias.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4461 // "location": "path", 4462 // "required": true, 4463 // "type": "string" 4464 // } 4465 // }, 4466 // "path": "v1/courses/{courseId}/aliases", 4467 // "request": { 4468 // "$ref": "CourseAlias" 4469 // }, 4470 // "response": { 4471 // "$ref": "CourseAlias" 4472 // }, 4473 // "scopes": [ 4474 // "https://www.googleapis.com/auth/classroom.courses" 4475 // ] 4476 // } 4477 4478} 4479 4480// method id "classroom.courses.aliases.delete": 4481 4482type CoursesAliasesDeleteCall struct { 4483 s *Service 4484 courseId string 4485 aliasid string 4486 urlParams_ gensupport.URLParams 4487 ctx_ context.Context 4488 header_ http.Header 4489} 4490 4491// Delete: Deletes an alias of a course. 4492// 4493// This method returns the following error codes: 4494// 4495// * `PERMISSION_DENIED` if the requesting user is not permitted to 4496// remove the 4497// alias or for access errors. 4498// * `NOT_FOUND` if the alias does not exist. 4499// * `FAILED_PRECONDITION` if the alias requested does not make sense 4500// for the 4501// requesting user or course (for example, if a user not in a domain 4502// attempts to delete a domain-scoped alias). 4503func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall { 4504 c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4505 c.courseId = courseId 4506 c.aliasid = aliasid 4507 return c 4508} 4509 4510// Fields allows partial responses to be retrieved. See 4511// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4512// for more information. 4513func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall { 4514 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4515 return c 4516} 4517 4518// Context sets the context to be used in this call's Do method. Any 4519// pending HTTP request will be aborted if the provided context is 4520// canceled. 4521func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall { 4522 c.ctx_ = ctx 4523 return c 4524} 4525 4526// Header returns an http.Header that can be modified by the caller to 4527// add HTTP headers to the request. 4528func (c *CoursesAliasesDeleteCall) Header() http.Header { 4529 if c.header_ == nil { 4530 c.header_ = make(http.Header) 4531 } 4532 return c.header_ 4533} 4534 4535func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) { 4536 reqHeaders := make(http.Header) 4537 for k, v := range c.header_ { 4538 reqHeaders[k] = v 4539 } 4540 reqHeaders.Set("User-Agent", c.s.userAgent()) 4541 var body io.Reader = nil 4542 c.urlParams_.Set("alt", alt) 4543 c.urlParams_.Set("prettyPrint", "false") 4544 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}") 4545 urls += "?" + c.urlParams_.Encode() 4546 req, err := http.NewRequest("DELETE", urls, body) 4547 if err != nil { 4548 return nil, err 4549 } 4550 req.Header = reqHeaders 4551 googleapi.Expand(req.URL, map[string]string{ 4552 "courseId": c.courseId, 4553 "alias": c.aliasid, 4554 }) 4555 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4556} 4557 4558// Do executes the "classroom.courses.aliases.delete" call. 4559// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4560// code is an error. Response headers are in either 4561// *Empty.ServerResponse.Header or (if a response was returned at all) 4562// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4563// check whether the returned error was because http.StatusNotModified 4564// was returned. 4565func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4566 gensupport.SetOptions(c.urlParams_, opts...) 4567 res, err := c.doRequest("json") 4568 if res != nil && res.StatusCode == http.StatusNotModified { 4569 if res.Body != nil { 4570 res.Body.Close() 4571 } 4572 return nil, &googleapi.Error{ 4573 Code: res.StatusCode, 4574 Header: res.Header, 4575 } 4576 } 4577 if err != nil { 4578 return nil, err 4579 } 4580 defer googleapi.CloseBody(res) 4581 if err := googleapi.CheckResponse(res); err != nil { 4582 return nil, err 4583 } 4584 ret := &Empty{ 4585 ServerResponse: googleapi.ServerResponse{ 4586 Header: res.Header, 4587 HTTPStatusCode: res.StatusCode, 4588 }, 4589 } 4590 target := &ret 4591 if err := gensupport.DecodeResponse(target, res); err != nil { 4592 return nil, err 4593 } 4594 return ret, nil 4595 // { 4596 // "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).", 4597 // "flatPath": "v1/courses/{courseId}/aliases/{alias}", 4598 // "httpMethod": "DELETE", 4599 // "id": "classroom.courses.aliases.delete", 4600 // "parameterOrder": [ 4601 // "courseId", 4602 // "alias" 4603 // ], 4604 // "parameters": { 4605 // "alias": { 4606 // "description": "Alias to delete.\nThis may not be the Classroom-assigned identifier.", 4607 // "location": "path", 4608 // "required": true, 4609 // "type": "string" 4610 // }, 4611 // "courseId": { 4612 // "description": "Identifier of the course whose alias should be deleted.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4613 // "location": "path", 4614 // "required": true, 4615 // "type": "string" 4616 // } 4617 // }, 4618 // "path": "v1/courses/{courseId}/aliases/{alias}", 4619 // "response": { 4620 // "$ref": "Empty" 4621 // }, 4622 // "scopes": [ 4623 // "https://www.googleapis.com/auth/classroom.courses" 4624 // ] 4625 // } 4626 4627} 4628 4629// method id "classroom.courses.aliases.list": 4630 4631type CoursesAliasesListCall struct { 4632 s *Service 4633 courseId string 4634 urlParams_ gensupport.URLParams 4635 ifNoneMatch_ string 4636 ctx_ context.Context 4637 header_ http.Header 4638} 4639 4640// List: Returns a list of aliases for a course. 4641// 4642// This method returns the following error codes: 4643// 4644// * `PERMISSION_DENIED` if the requesting user is not permitted to 4645// access the 4646// course or for access errors. 4647// * `NOT_FOUND` if the course does not exist. 4648func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall { 4649 c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4650 c.courseId = courseId 4651 return c 4652} 4653 4654// PageSize sets the optional parameter "pageSize": Maximum number of 4655// items to return. Zero or unspecified indicates that the 4656// server may assign a maximum. 4657// 4658// The server may return fewer than the specified number of results. 4659func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall { 4660 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4661 return c 4662} 4663 4664// PageToken sets the optional parameter "pageToken": 4665// nextPageToken 4666// value returned from a previous 4667// list call, 4668// indicating that the subsequent page of results should be 4669// returned. 4670// 4671// The list request 4672// must be otherwise identical to the one that resulted in this token. 4673func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall { 4674 c.urlParams_.Set("pageToken", pageToken) 4675 return c 4676} 4677 4678// Fields allows partial responses to be retrieved. See 4679// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4680// for more information. 4681func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall { 4682 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4683 return c 4684} 4685 4686// IfNoneMatch sets the optional parameter which makes the operation 4687// fail if the object's ETag matches the given value. This is useful for 4688// getting updates only after the object has changed since the last 4689// request. Use googleapi.IsNotModified to check whether the response 4690// error from Do is the result of In-None-Match. 4691func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall { 4692 c.ifNoneMatch_ = entityTag 4693 return c 4694} 4695 4696// Context sets the context to be used in this call's Do method. Any 4697// pending HTTP request will be aborted if the provided context is 4698// canceled. 4699func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall { 4700 c.ctx_ = ctx 4701 return c 4702} 4703 4704// Header returns an http.Header that can be modified by the caller to 4705// add HTTP headers to the request. 4706func (c *CoursesAliasesListCall) Header() http.Header { 4707 if c.header_ == nil { 4708 c.header_ = make(http.Header) 4709 } 4710 return c.header_ 4711} 4712 4713func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) { 4714 reqHeaders := make(http.Header) 4715 for k, v := range c.header_ { 4716 reqHeaders[k] = v 4717 } 4718 reqHeaders.Set("User-Agent", c.s.userAgent()) 4719 if c.ifNoneMatch_ != "" { 4720 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4721 } 4722 var body io.Reader = nil 4723 c.urlParams_.Set("alt", alt) 4724 c.urlParams_.Set("prettyPrint", "false") 4725 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4726 urls += "?" + c.urlParams_.Encode() 4727 req, err := http.NewRequest("GET", urls, body) 4728 if err != nil { 4729 return nil, err 4730 } 4731 req.Header = reqHeaders 4732 googleapi.Expand(req.URL, map[string]string{ 4733 "courseId": c.courseId, 4734 }) 4735 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4736} 4737 4738// Do executes the "classroom.courses.aliases.list" call. 4739// Exactly one of *ListCourseAliasesResponse or error will be non-nil. 4740// Any non-2xx status code is an error. Response headers are in either 4741// *ListCourseAliasesResponse.ServerResponse.Header or (if a response 4742// was returned at all) in error.(*googleapi.Error).Header. Use 4743// googleapi.IsNotModified to check whether the returned error was 4744// because http.StatusNotModified was returned. 4745func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) { 4746 gensupport.SetOptions(c.urlParams_, opts...) 4747 res, err := c.doRequest("json") 4748 if res != nil && res.StatusCode == http.StatusNotModified { 4749 if res.Body != nil { 4750 res.Body.Close() 4751 } 4752 return nil, &googleapi.Error{ 4753 Code: res.StatusCode, 4754 Header: res.Header, 4755 } 4756 } 4757 if err != nil { 4758 return nil, err 4759 } 4760 defer googleapi.CloseBody(res) 4761 if err := googleapi.CheckResponse(res); err != nil { 4762 return nil, err 4763 } 4764 ret := &ListCourseAliasesResponse{ 4765 ServerResponse: googleapi.ServerResponse{ 4766 Header: res.Header, 4767 HTTPStatusCode: res.StatusCode, 4768 }, 4769 } 4770 target := &ret 4771 if err := gensupport.DecodeResponse(target, res); err != nil { 4772 return nil, err 4773 } 4774 return ret, nil 4775 // { 4776 // "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.", 4777 // "flatPath": "v1/courses/{courseId}/aliases", 4778 // "httpMethod": "GET", 4779 // "id": "classroom.courses.aliases.list", 4780 // "parameterOrder": [ 4781 // "courseId" 4782 // ], 4783 // "parameters": { 4784 // "courseId": { 4785 // "description": "The identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4786 // "location": "path", 4787 // "required": true, 4788 // "type": "string" 4789 // }, 4790 // "pageSize": { 4791 // "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.", 4792 // "format": "int32", 4793 // "location": "query", 4794 // "type": "integer" 4795 // }, 4796 // "pageToken": { 4797 // "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.", 4798 // "location": "query", 4799 // "type": "string" 4800 // } 4801 // }, 4802 // "path": "v1/courses/{courseId}/aliases", 4803 // "response": { 4804 // "$ref": "ListCourseAliasesResponse" 4805 // }, 4806 // "scopes": [ 4807 // "https://www.googleapis.com/auth/classroom.courses", 4808 // "https://www.googleapis.com/auth/classroom.courses.readonly" 4809 // ] 4810 // } 4811 4812} 4813 4814// Pages invokes f for each page of results. 4815// A non-nil error returned from f will halt the iteration. 4816// The provided context supersedes any context provided to the Context method. 4817func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error { 4818 c.ctx_ = ctx 4819 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4820 for { 4821 x, err := c.Do() 4822 if err != nil { 4823 return err 4824 } 4825 if err := f(x); err != nil { 4826 return err 4827 } 4828 if x.NextPageToken == "" { 4829 return nil 4830 } 4831 c.PageToken(x.NextPageToken) 4832 } 4833} 4834 4835// method id "classroom.courses.announcements.create": 4836 4837type CoursesAnnouncementsCreateCall struct { 4838 s *Service 4839 courseId string 4840 announcement *Announcement 4841 urlParams_ gensupport.URLParams 4842 ctx_ context.Context 4843 header_ http.Header 4844} 4845 4846// Create: Creates an announcement. 4847// 4848// This method returns the following error codes: 4849// 4850// * `PERMISSION_DENIED` if the requesting user is not permitted to 4851// access the 4852// requested course, create announcements in the requested course, share 4853// a 4854// Drive attachment, or for access errors. 4855// * `INVALID_ARGUMENT` if the request is malformed. 4856// * `NOT_FOUND` if the requested course does not exist. 4857// * `FAILED_PRECONDITION` for the following request error: 4858// * AttachmentNotVisible 4859func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall { 4860 c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4861 c.courseId = courseId 4862 c.announcement = announcement 4863 return c 4864} 4865 4866// Fields allows partial responses to be retrieved. See 4867// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4868// for more information. 4869func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall { 4870 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4871 return c 4872} 4873 4874// Context sets the context to be used in this call's Do method. Any 4875// pending HTTP request will be aborted if the provided context is 4876// canceled. 4877func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall { 4878 c.ctx_ = ctx 4879 return c 4880} 4881 4882// Header returns an http.Header that can be modified by the caller to 4883// add HTTP headers to the request. 4884func (c *CoursesAnnouncementsCreateCall) Header() http.Header { 4885 if c.header_ == nil { 4886 c.header_ = make(http.Header) 4887 } 4888 return c.header_ 4889} 4890 4891func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) { 4892 reqHeaders := make(http.Header) 4893 for k, v := range c.header_ { 4894 reqHeaders[k] = v 4895 } 4896 reqHeaders.Set("User-Agent", c.s.userAgent()) 4897 var body io.Reader = nil 4898 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 4899 if err != nil { 4900 return nil, err 4901 } 4902 reqHeaders.Set("Content-Type", "application/json") 4903 c.urlParams_.Set("alt", alt) 4904 c.urlParams_.Set("prettyPrint", "false") 4905 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 4906 urls += "?" + c.urlParams_.Encode() 4907 req, err := http.NewRequest("POST", urls, body) 4908 if err != nil { 4909 return nil, err 4910 } 4911 req.Header = reqHeaders 4912 googleapi.Expand(req.URL, map[string]string{ 4913 "courseId": c.courseId, 4914 }) 4915 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4916} 4917 4918// Do executes the "classroom.courses.announcements.create" call. 4919// Exactly one of *Announcement or error will be non-nil. Any non-2xx 4920// status code is an error. Response headers are in either 4921// *Announcement.ServerResponse.Header or (if a response was returned at 4922// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4923// to check whether the returned error was because 4924// http.StatusNotModified was returned. 4925func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 4926 gensupport.SetOptions(c.urlParams_, opts...) 4927 res, err := c.doRequest("json") 4928 if res != nil && res.StatusCode == http.StatusNotModified { 4929 if res.Body != nil { 4930 res.Body.Close() 4931 } 4932 return nil, &googleapi.Error{ 4933 Code: res.StatusCode, 4934 Header: res.Header, 4935 } 4936 } 4937 if err != nil { 4938 return nil, err 4939 } 4940 defer googleapi.CloseBody(res) 4941 if err := googleapi.CheckResponse(res); err != nil { 4942 return nil, err 4943 } 4944 ret := &Announcement{ 4945 ServerResponse: googleapi.ServerResponse{ 4946 Header: res.Header, 4947 HTTPStatusCode: res.StatusCode, 4948 }, 4949 } 4950 target := &ret 4951 if err := gensupport.DecodeResponse(target, res); err != nil { 4952 return nil, err 4953 } 4954 return ret, nil 4955 // { 4956 // "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", 4957 // "flatPath": "v1/courses/{courseId}/announcements", 4958 // "httpMethod": "POST", 4959 // "id": "classroom.courses.announcements.create", 4960 // "parameterOrder": [ 4961 // "courseId" 4962 // ], 4963 // "parameters": { 4964 // "courseId": { 4965 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4966 // "location": "path", 4967 // "required": true, 4968 // "type": "string" 4969 // } 4970 // }, 4971 // "path": "v1/courses/{courseId}/announcements", 4972 // "request": { 4973 // "$ref": "Announcement" 4974 // }, 4975 // "response": { 4976 // "$ref": "Announcement" 4977 // }, 4978 // "scopes": [ 4979 // "https://www.googleapis.com/auth/classroom.announcements" 4980 // ] 4981 // } 4982 4983} 4984 4985// method id "classroom.courses.announcements.delete": 4986 4987type CoursesAnnouncementsDeleteCall struct { 4988 s *Service 4989 courseId string 4990 id string 4991 urlParams_ gensupport.URLParams 4992 ctx_ context.Context 4993 header_ http.Header 4994} 4995 4996// Delete: Deletes an announcement. 4997// 4998// This request must be made by the Developer Console project of 4999// the 5000// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5001// used to 5002// create the corresponding announcement item. 5003// 5004// This method returns the following error codes: 5005// 5006// * `PERMISSION_DENIED` if the requesting developer project did not 5007// create 5008// the corresponding announcement, if the requesting user is not 5009// permitted 5010// to delete the requested course or for access errors. 5011// * `FAILED_PRECONDITION` if the requested announcement has already 5012// been 5013// deleted. 5014// * `NOT_FOUND` if no course exists with the requested ID. 5015func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall { 5016 c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5017 c.courseId = courseId 5018 c.id = id 5019 return c 5020} 5021 5022// Fields allows partial responses to be retrieved. See 5023// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5024// for more information. 5025func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall { 5026 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5027 return c 5028} 5029 5030// Context sets the context to be used in this call's Do method. Any 5031// pending HTTP request will be aborted if the provided context is 5032// canceled. 5033func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall { 5034 c.ctx_ = ctx 5035 return c 5036} 5037 5038// Header returns an http.Header that can be modified by the caller to 5039// add HTTP headers to the request. 5040func (c *CoursesAnnouncementsDeleteCall) Header() http.Header { 5041 if c.header_ == nil { 5042 c.header_ = make(http.Header) 5043 } 5044 return c.header_ 5045} 5046 5047func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) { 5048 reqHeaders := make(http.Header) 5049 for k, v := range c.header_ { 5050 reqHeaders[k] = v 5051 } 5052 reqHeaders.Set("User-Agent", c.s.userAgent()) 5053 var body io.Reader = nil 5054 c.urlParams_.Set("alt", alt) 5055 c.urlParams_.Set("prettyPrint", "false") 5056 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5057 urls += "?" + c.urlParams_.Encode() 5058 req, err := http.NewRequest("DELETE", urls, body) 5059 if err != nil { 5060 return nil, err 5061 } 5062 req.Header = reqHeaders 5063 googleapi.Expand(req.URL, map[string]string{ 5064 "courseId": c.courseId, 5065 "id": c.id, 5066 }) 5067 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5068} 5069 5070// Do executes the "classroom.courses.announcements.delete" call. 5071// Exactly one of *Empty or error will be non-nil. Any non-2xx status 5072// code is an error. Response headers are in either 5073// *Empty.ServerResponse.Header or (if a response was returned at all) 5074// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5075// check whether the returned error was because http.StatusNotModified 5076// was returned. 5077func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 5078 gensupport.SetOptions(c.urlParams_, opts...) 5079 res, err := c.doRequest("json") 5080 if res != nil && res.StatusCode == http.StatusNotModified { 5081 if res.Body != nil { 5082 res.Body.Close() 5083 } 5084 return nil, &googleapi.Error{ 5085 Code: res.StatusCode, 5086 Header: res.Header, 5087 } 5088 } 5089 if err != nil { 5090 return nil, err 5091 } 5092 defer googleapi.CloseBody(res) 5093 if err := googleapi.CheckResponse(res); err != nil { 5094 return nil, err 5095 } 5096 ret := &Empty{ 5097 ServerResponse: googleapi.ServerResponse{ 5098 Header: res.Header, 5099 HTTPStatusCode: res.StatusCode, 5100 }, 5101 } 5102 target := &ret 5103 if err := gensupport.DecodeResponse(target, res); err != nil { 5104 return nil, err 5105 } 5106 return ret, nil 5107 // { 5108 // "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.", 5109 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5110 // "httpMethod": "DELETE", 5111 // "id": "classroom.courses.announcements.delete", 5112 // "parameterOrder": [ 5113 // "courseId", 5114 // "id" 5115 // ], 5116 // "parameters": { 5117 // "courseId": { 5118 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5119 // "location": "path", 5120 // "required": true, 5121 // "type": "string" 5122 // }, 5123 // "id": { 5124 // "description": "Identifier of the announcement to delete.\nThis identifier is a Classroom-assigned identifier.", 5125 // "location": "path", 5126 // "required": true, 5127 // "type": "string" 5128 // } 5129 // }, 5130 // "path": "v1/courses/{courseId}/announcements/{id}", 5131 // "response": { 5132 // "$ref": "Empty" 5133 // }, 5134 // "scopes": [ 5135 // "https://www.googleapis.com/auth/classroom.announcements" 5136 // ] 5137 // } 5138 5139} 5140 5141// method id "classroom.courses.announcements.get": 5142 5143type CoursesAnnouncementsGetCall struct { 5144 s *Service 5145 courseId string 5146 id string 5147 urlParams_ gensupport.URLParams 5148 ifNoneMatch_ string 5149 ctx_ context.Context 5150 header_ http.Header 5151} 5152 5153// Get: Returns an announcement. 5154// 5155// This method returns the following error codes: 5156// 5157// * `PERMISSION_DENIED` if the requesting user is not permitted to 5158// access the 5159// requested course or announcement, or for access errors. 5160// * `INVALID_ARGUMENT` if the request is malformed. 5161// * `NOT_FOUND` if the requested course or announcement does not exist. 5162func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall { 5163 c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5164 c.courseId = courseId 5165 c.id = id 5166 return c 5167} 5168 5169// Fields allows partial responses to be retrieved. See 5170// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5171// for more information. 5172func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall { 5173 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5174 return c 5175} 5176 5177// IfNoneMatch sets the optional parameter which makes the operation 5178// fail if the object's ETag matches the given value. This is useful for 5179// getting updates only after the object has changed since the last 5180// request. Use googleapi.IsNotModified to check whether the response 5181// error from Do is the result of In-None-Match. 5182func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall { 5183 c.ifNoneMatch_ = entityTag 5184 return c 5185} 5186 5187// Context sets the context to be used in this call's Do method. Any 5188// pending HTTP request will be aborted if the provided context is 5189// canceled. 5190func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall { 5191 c.ctx_ = ctx 5192 return c 5193} 5194 5195// Header returns an http.Header that can be modified by the caller to 5196// add HTTP headers to the request. 5197func (c *CoursesAnnouncementsGetCall) Header() http.Header { 5198 if c.header_ == nil { 5199 c.header_ = make(http.Header) 5200 } 5201 return c.header_ 5202} 5203 5204func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) { 5205 reqHeaders := make(http.Header) 5206 for k, v := range c.header_ { 5207 reqHeaders[k] = v 5208 } 5209 reqHeaders.Set("User-Agent", c.s.userAgent()) 5210 if c.ifNoneMatch_ != "" { 5211 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5212 } 5213 var body io.Reader = nil 5214 c.urlParams_.Set("alt", alt) 5215 c.urlParams_.Set("prettyPrint", "false") 5216 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5217 urls += "?" + c.urlParams_.Encode() 5218 req, err := http.NewRequest("GET", urls, body) 5219 if err != nil { 5220 return nil, err 5221 } 5222 req.Header = reqHeaders 5223 googleapi.Expand(req.URL, map[string]string{ 5224 "courseId": c.courseId, 5225 "id": c.id, 5226 }) 5227 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5228} 5229 5230// Do executes the "classroom.courses.announcements.get" call. 5231// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5232// status code is an error. Response headers are in either 5233// *Announcement.ServerResponse.Header or (if a response was returned at 5234// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5235// to check whether the returned error was because 5236// http.StatusNotModified was returned. 5237func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5238 gensupport.SetOptions(c.urlParams_, opts...) 5239 res, err := c.doRequest("json") 5240 if res != nil && res.StatusCode == http.StatusNotModified { 5241 if res.Body != nil { 5242 res.Body.Close() 5243 } 5244 return nil, &googleapi.Error{ 5245 Code: res.StatusCode, 5246 Header: res.Header, 5247 } 5248 } 5249 if err != nil { 5250 return nil, err 5251 } 5252 defer googleapi.CloseBody(res) 5253 if err := googleapi.CheckResponse(res); err != nil { 5254 return nil, err 5255 } 5256 ret := &Announcement{ 5257 ServerResponse: googleapi.ServerResponse{ 5258 Header: res.Header, 5259 HTTPStatusCode: res.StatusCode, 5260 }, 5261 } 5262 target := &ret 5263 if err := gensupport.DecodeResponse(target, res); err != nil { 5264 return nil, err 5265 } 5266 return ret, nil 5267 // { 5268 // "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.", 5269 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5270 // "httpMethod": "GET", 5271 // "id": "classroom.courses.announcements.get", 5272 // "parameterOrder": [ 5273 // "courseId", 5274 // "id" 5275 // ], 5276 // "parameters": { 5277 // "courseId": { 5278 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5279 // "location": "path", 5280 // "required": true, 5281 // "type": "string" 5282 // }, 5283 // "id": { 5284 // "description": "Identifier of the announcement.", 5285 // "location": "path", 5286 // "required": true, 5287 // "type": "string" 5288 // } 5289 // }, 5290 // "path": "v1/courses/{courseId}/announcements/{id}", 5291 // "response": { 5292 // "$ref": "Announcement" 5293 // }, 5294 // "scopes": [ 5295 // "https://www.googleapis.com/auth/classroom.announcements", 5296 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5297 // ] 5298 // } 5299 5300} 5301 5302// method id "classroom.courses.announcements.list": 5303 5304type CoursesAnnouncementsListCall struct { 5305 s *Service 5306 courseId string 5307 urlParams_ gensupport.URLParams 5308 ifNoneMatch_ string 5309 ctx_ context.Context 5310 header_ http.Header 5311} 5312 5313// List: Returns a list of announcements that the requester is permitted 5314// to view. 5315// 5316// Course students may only view `PUBLISHED` announcements. Course 5317// teachers 5318// and domain administrators may view all announcements. 5319// 5320// This method returns the following error codes: 5321// 5322// * `PERMISSION_DENIED` if the requesting user is not permitted to 5323// access 5324// the requested course or for access errors. 5325// * `INVALID_ARGUMENT` if the request is malformed. 5326// * `NOT_FOUND` if the requested course does not exist. 5327func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall { 5328 c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5329 c.courseId = courseId 5330 return c 5331} 5332 5333// AnnouncementStates sets the optional parameter "announcementStates": 5334// Restriction on the `state` of announcements returned. 5335// If this argument is left unspecified, the default value is 5336// `PUBLISHED`. 5337// 5338// Possible values: 5339// "ANNOUNCEMENT_STATE_UNSPECIFIED" 5340// "PUBLISHED" 5341// "DRAFT" 5342// "DELETED" 5343func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall { 5344 c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...)) 5345 return c 5346} 5347 5348// OrderBy sets the optional parameter "orderBy": Optional sort ordering 5349// for results. A comma-separated list of fields with 5350// an optional sort direction keyword. Supported field is 5351// `updateTime`. 5352// Supported direction keywords are `asc` and `desc`. 5353// If not specified, `updateTime desc` is the default 5354// behavior. 5355// Examples: `updateTime asc`, `updateTime` 5356func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall { 5357 c.urlParams_.Set("orderBy", orderBy) 5358 return c 5359} 5360 5361// PageSize sets the optional parameter "pageSize": Maximum number of 5362// items to return. Zero or unspecified indicates that the 5363// server may assign a maximum. 5364// 5365// The server may return fewer than the specified number of results. 5366func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall { 5367 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5368 return c 5369} 5370 5371// PageToken sets the optional parameter "pageToken": 5372// nextPageToken 5373// value returned from a previous 5374// list call, 5375// indicating that the subsequent page of results should be 5376// returned. 5377// 5378// The list request 5379// must be otherwise identical to the one that resulted in this token. 5380func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall { 5381 c.urlParams_.Set("pageToken", pageToken) 5382 return c 5383} 5384 5385// Fields allows partial responses to be retrieved. See 5386// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5387// for more information. 5388func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall { 5389 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5390 return c 5391} 5392 5393// IfNoneMatch sets the optional parameter which makes the operation 5394// fail if the object's ETag matches the given value. This is useful for 5395// getting updates only after the object has changed since the last 5396// request. Use googleapi.IsNotModified to check whether the response 5397// error from Do is the result of In-None-Match. 5398func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall { 5399 c.ifNoneMatch_ = entityTag 5400 return c 5401} 5402 5403// Context sets the context to be used in this call's Do method. Any 5404// pending HTTP request will be aborted if the provided context is 5405// canceled. 5406func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall { 5407 c.ctx_ = ctx 5408 return c 5409} 5410 5411// Header returns an http.Header that can be modified by the caller to 5412// add HTTP headers to the request. 5413func (c *CoursesAnnouncementsListCall) Header() http.Header { 5414 if c.header_ == nil { 5415 c.header_ = make(http.Header) 5416 } 5417 return c.header_ 5418} 5419 5420func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) { 5421 reqHeaders := make(http.Header) 5422 for k, v := range c.header_ { 5423 reqHeaders[k] = v 5424 } 5425 reqHeaders.Set("User-Agent", c.s.userAgent()) 5426 if c.ifNoneMatch_ != "" { 5427 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5428 } 5429 var body io.Reader = nil 5430 c.urlParams_.Set("alt", alt) 5431 c.urlParams_.Set("prettyPrint", "false") 5432 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 5433 urls += "?" + c.urlParams_.Encode() 5434 req, err := http.NewRequest("GET", urls, body) 5435 if err != nil { 5436 return nil, err 5437 } 5438 req.Header = reqHeaders 5439 googleapi.Expand(req.URL, map[string]string{ 5440 "courseId": c.courseId, 5441 }) 5442 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5443} 5444 5445// Do executes the "classroom.courses.announcements.list" call. 5446// Exactly one of *ListAnnouncementsResponse or error will be non-nil. 5447// Any non-2xx status code is an error. Response headers are in either 5448// *ListAnnouncementsResponse.ServerResponse.Header or (if a response 5449// was returned at all) in error.(*googleapi.Error).Header. Use 5450// googleapi.IsNotModified to check whether the returned error was 5451// because http.StatusNotModified was returned. 5452func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) { 5453 gensupport.SetOptions(c.urlParams_, opts...) 5454 res, err := c.doRequest("json") 5455 if res != nil && res.StatusCode == http.StatusNotModified { 5456 if res.Body != nil { 5457 res.Body.Close() 5458 } 5459 return nil, &googleapi.Error{ 5460 Code: res.StatusCode, 5461 Header: res.Header, 5462 } 5463 } 5464 if err != nil { 5465 return nil, err 5466 } 5467 defer googleapi.CloseBody(res) 5468 if err := googleapi.CheckResponse(res); err != nil { 5469 return nil, err 5470 } 5471 ret := &ListAnnouncementsResponse{ 5472 ServerResponse: googleapi.ServerResponse{ 5473 Header: res.Header, 5474 HTTPStatusCode: res.StatusCode, 5475 }, 5476 } 5477 target := &ret 5478 if err := gensupport.DecodeResponse(target, res); err != nil { 5479 return nil, err 5480 } 5481 return ret, nil 5482 // { 5483 // "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.", 5484 // "flatPath": "v1/courses/{courseId}/announcements", 5485 // "httpMethod": "GET", 5486 // "id": "classroom.courses.announcements.list", 5487 // "parameterOrder": [ 5488 // "courseId" 5489 // ], 5490 // "parameters": { 5491 // "announcementStates": { 5492 // "description": "Restriction on the `state` of announcements returned.\nIf this argument is left unspecified, the default value is `PUBLISHED`.", 5493 // "enum": [ 5494 // "ANNOUNCEMENT_STATE_UNSPECIFIED", 5495 // "PUBLISHED", 5496 // "DRAFT", 5497 // "DELETED" 5498 // ], 5499 // "location": "query", 5500 // "repeated": true, 5501 // "type": "string" 5502 // }, 5503 // "courseId": { 5504 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5505 // "location": "path", 5506 // "required": true, 5507 // "type": "string" 5508 // }, 5509 // "orderBy": { 5510 // "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`", 5511 // "location": "query", 5512 // "type": "string" 5513 // }, 5514 // "pageSize": { 5515 // "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.", 5516 // "format": "int32", 5517 // "location": "query", 5518 // "type": "integer" 5519 // }, 5520 // "pageToken": { 5521 // "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.", 5522 // "location": "query", 5523 // "type": "string" 5524 // } 5525 // }, 5526 // "path": "v1/courses/{courseId}/announcements", 5527 // "response": { 5528 // "$ref": "ListAnnouncementsResponse" 5529 // }, 5530 // "scopes": [ 5531 // "https://www.googleapis.com/auth/classroom.announcements", 5532 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5533 // ] 5534 // } 5535 5536} 5537 5538// Pages invokes f for each page of results. 5539// A non-nil error returned from f will halt the iteration. 5540// The provided context supersedes any context provided to the Context method. 5541func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error { 5542 c.ctx_ = ctx 5543 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5544 for { 5545 x, err := c.Do() 5546 if err != nil { 5547 return err 5548 } 5549 if err := f(x); err != nil { 5550 return err 5551 } 5552 if x.NextPageToken == "" { 5553 return nil 5554 } 5555 c.PageToken(x.NextPageToken) 5556 } 5557} 5558 5559// method id "classroom.courses.announcements.modifyAssignees": 5560 5561type CoursesAnnouncementsModifyAssigneesCall struct { 5562 s *Service 5563 courseId string 5564 id string 5565 modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest 5566 urlParams_ gensupport.URLParams 5567 ctx_ context.Context 5568 header_ http.Header 5569} 5570 5571// ModifyAssignees: Modifies assignee mode and options of an 5572// announcement. 5573// 5574// Only a teacher of the course that contains the announcement may 5575// call this method. 5576// 5577// This method returns the following error codes: 5578// 5579// * `PERMISSION_DENIED` if the requesting user is not permitted to 5580// access the 5581// requested course or course work or for access errors. 5582// * `INVALID_ARGUMENT` if the request is malformed. 5583// * `NOT_FOUND` if the requested course or course work does not exist. 5584func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall { 5585 c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5586 c.courseId = courseId 5587 c.id = id 5588 c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest 5589 return c 5590} 5591 5592// Fields allows partial responses to be retrieved. See 5593// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5594// for more information. 5595func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall { 5596 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5597 return c 5598} 5599 5600// Context sets the context to be used in this call's Do method. Any 5601// pending HTTP request will be aborted if the provided context is 5602// canceled. 5603func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall { 5604 c.ctx_ = ctx 5605 return c 5606} 5607 5608// Header returns an http.Header that can be modified by the caller to 5609// add HTTP headers to the request. 5610func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header { 5611 if c.header_ == nil { 5612 c.header_ = make(http.Header) 5613 } 5614 return c.header_ 5615} 5616 5617func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 5618 reqHeaders := make(http.Header) 5619 for k, v := range c.header_ { 5620 reqHeaders[k] = v 5621 } 5622 reqHeaders.Set("User-Agent", c.s.userAgent()) 5623 var body io.Reader = nil 5624 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest) 5625 if err != nil { 5626 return nil, err 5627 } 5628 reqHeaders.Set("Content-Type", "application/json") 5629 c.urlParams_.Set("alt", alt) 5630 c.urlParams_.Set("prettyPrint", "false") 5631 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees") 5632 urls += "?" + c.urlParams_.Encode() 5633 req, err := http.NewRequest("POST", urls, body) 5634 if err != nil { 5635 return nil, err 5636 } 5637 req.Header = reqHeaders 5638 googleapi.Expand(req.URL, map[string]string{ 5639 "courseId": c.courseId, 5640 "id": c.id, 5641 }) 5642 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5643} 5644 5645// Do executes the "classroom.courses.announcements.modifyAssignees" call. 5646// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5647// status code is an error. Response headers are in either 5648// *Announcement.ServerResponse.Header or (if a response was returned at 5649// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5650// to check whether the returned error was because 5651// http.StatusNotModified was returned. 5652func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5653 gensupport.SetOptions(c.urlParams_, opts...) 5654 res, err := c.doRequest("json") 5655 if res != nil && res.StatusCode == http.StatusNotModified { 5656 if res.Body != nil { 5657 res.Body.Close() 5658 } 5659 return nil, &googleapi.Error{ 5660 Code: res.StatusCode, 5661 Header: res.Header, 5662 } 5663 } 5664 if err != nil { 5665 return nil, err 5666 } 5667 defer googleapi.CloseBody(res) 5668 if err := googleapi.CheckResponse(res); err != nil { 5669 return nil, err 5670 } 5671 ret := &Announcement{ 5672 ServerResponse: googleapi.ServerResponse{ 5673 Header: res.Header, 5674 HTTPStatusCode: res.StatusCode, 5675 }, 5676 } 5677 target := &ret 5678 if err := gensupport.DecodeResponse(target, res); err != nil { 5679 return nil, err 5680 } 5681 return ret, nil 5682 // { 5683 // "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.", 5684 // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5685 // "httpMethod": "POST", 5686 // "id": "classroom.courses.announcements.modifyAssignees", 5687 // "parameterOrder": [ 5688 // "courseId", 5689 // "id" 5690 // ], 5691 // "parameters": { 5692 // "courseId": { 5693 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5694 // "location": "path", 5695 // "required": true, 5696 // "type": "string" 5697 // }, 5698 // "id": { 5699 // "description": "Identifier of the announcement.", 5700 // "location": "path", 5701 // "required": true, 5702 // "type": "string" 5703 // } 5704 // }, 5705 // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5706 // "request": { 5707 // "$ref": "ModifyAnnouncementAssigneesRequest" 5708 // }, 5709 // "response": { 5710 // "$ref": "Announcement" 5711 // }, 5712 // "scopes": [ 5713 // "https://www.googleapis.com/auth/classroom.announcements" 5714 // ] 5715 // } 5716 5717} 5718 5719// method id "classroom.courses.announcements.patch": 5720 5721type CoursesAnnouncementsPatchCall struct { 5722 s *Service 5723 courseId string 5724 id string 5725 announcement *Announcement 5726 urlParams_ gensupport.URLParams 5727 ctx_ context.Context 5728 header_ http.Header 5729} 5730 5731// Patch: Updates one or more fields of an announcement. 5732// 5733// This method returns the following error codes: 5734// 5735// * `PERMISSION_DENIED` if the requesting developer project did not 5736// create 5737// the corresponding announcement or for access errors. 5738// * `INVALID_ARGUMENT` if the request is malformed. 5739// * `FAILED_PRECONDITION` if the requested announcement has already 5740// been 5741// deleted. 5742// * `NOT_FOUND` if the requested course or announcement does not exist 5743func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall { 5744 c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5745 c.courseId = courseId 5746 c.id = id 5747 c.announcement = announcement 5748 return c 5749} 5750 5751// UpdateMask sets the optional parameter "updateMask": Mask that 5752// identifies which fields on the announcement to update. 5753// This field is required to do an update. The update fails if 5754// invalid 5755// fields are specified. If a field supports empty values, it can be 5756// cleared 5757// by specifying it in the update mask and not in the Announcement 5758// object. If 5759// a field that does not support empty values is included in the update 5760// mask 5761// and not set in the Announcement object, an `INVALID_ARGUMENT` error 5762// will be 5763// returned. 5764// 5765// The following fields may be specified by teachers: 5766// 5767// * `text` 5768// * `state` 5769// * `scheduled_time` 5770func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall { 5771 c.urlParams_.Set("updateMask", updateMask) 5772 return c 5773} 5774 5775// Fields allows partial responses to be retrieved. See 5776// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5777// for more information. 5778func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall { 5779 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5780 return c 5781} 5782 5783// Context sets the context to be used in this call's Do method. Any 5784// pending HTTP request will be aborted if the provided context is 5785// canceled. 5786func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall { 5787 c.ctx_ = ctx 5788 return c 5789} 5790 5791// Header returns an http.Header that can be modified by the caller to 5792// add HTTP headers to the request. 5793func (c *CoursesAnnouncementsPatchCall) Header() http.Header { 5794 if c.header_ == nil { 5795 c.header_ = make(http.Header) 5796 } 5797 return c.header_ 5798} 5799 5800func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) { 5801 reqHeaders := make(http.Header) 5802 for k, v := range c.header_ { 5803 reqHeaders[k] = v 5804 } 5805 reqHeaders.Set("User-Agent", c.s.userAgent()) 5806 var body io.Reader = nil 5807 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 5808 if err != nil { 5809 return nil, err 5810 } 5811 reqHeaders.Set("Content-Type", "application/json") 5812 c.urlParams_.Set("alt", alt) 5813 c.urlParams_.Set("prettyPrint", "false") 5814 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5815 urls += "?" + c.urlParams_.Encode() 5816 req, err := http.NewRequest("PATCH", urls, body) 5817 if err != nil { 5818 return nil, err 5819 } 5820 req.Header = reqHeaders 5821 googleapi.Expand(req.URL, map[string]string{ 5822 "courseId": c.courseId, 5823 "id": c.id, 5824 }) 5825 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5826} 5827 5828// Do executes the "classroom.courses.announcements.patch" call. 5829// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5830// status code is an error. Response headers are in either 5831// *Announcement.ServerResponse.Header or (if a response was returned at 5832// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5833// to check whether the returned error was because 5834// http.StatusNotModified was returned. 5835func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5836 gensupport.SetOptions(c.urlParams_, opts...) 5837 res, err := c.doRequest("json") 5838 if res != nil && res.StatusCode == http.StatusNotModified { 5839 if res.Body != nil { 5840 res.Body.Close() 5841 } 5842 return nil, &googleapi.Error{ 5843 Code: res.StatusCode, 5844 Header: res.Header, 5845 } 5846 } 5847 if err != nil { 5848 return nil, err 5849 } 5850 defer googleapi.CloseBody(res) 5851 if err := googleapi.CheckResponse(res); err != nil { 5852 return nil, err 5853 } 5854 ret := &Announcement{ 5855 ServerResponse: googleapi.ServerResponse{ 5856 Header: res.Header, 5857 HTTPStatusCode: res.StatusCode, 5858 }, 5859 } 5860 target := &ret 5861 if err := gensupport.DecodeResponse(target, res); err != nil { 5862 return nil, err 5863 } 5864 return ret, nil 5865 // { 5866 // "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", 5867 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5868 // "httpMethod": "PATCH", 5869 // "id": "classroom.courses.announcements.patch", 5870 // "parameterOrder": [ 5871 // "courseId", 5872 // "id" 5873 // ], 5874 // "parameters": { 5875 // "courseId": { 5876 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5877 // "location": "path", 5878 // "required": true, 5879 // "type": "string" 5880 // }, 5881 // "id": { 5882 // "description": "Identifier of the announcement.", 5883 // "location": "path", 5884 // "required": true, 5885 // "type": "string" 5886 // }, 5887 // "updateMask": { 5888 // "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`", 5889 // "format": "google-fieldmask", 5890 // "location": "query", 5891 // "type": "string" 5892 // } 5893 // }, 5894 // "path": "v1/courses/{courseId}/announcements/{id}", 5895 // "request": { 5896 // "$ref": "Announcement" 5897 // }, 5898 // "response": { 5899 // "$ref": "Announcement" 5900 // }, 5901 // "scopes": [ 5902 // "https://www.googleapis.com/auth/classroom.announcements" 5903 // ] 5904 // } 5905 5906} 5907 5908// method id "classroom.courses.courseWork.create": 5909 5910type CoursesCourseWorkCreateCall struct { 5911 s *Service 5912 courseId string 5913 coursework *CourseWork 5914 urlParams_ gensupport.URLParams 5915 ctx_ context.Context 5916 header_ http.Header 5917} 5918 5919// Create: Creates course work. 5920// 5921// The resulting course work (and corresponding student submissions) 5922// are 5923// associated with the Developer Console project of the 5924// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5925// used to 5926// make the request. Classroom API requests to modify course work and 5927// student 5928// submissions must be made with an OAuth client ID from the 5929// associated 5930// Developer Console project. 5931// 5932// This method returns the following error codes: 5933// 5934// * `PERMISSION_DENIED` if the requesting user is not permitted to 5935// access the 5936// requested course, create course work in the requested course, share 5937// a 5938// Drive attachment, or for access errors. 5939// * `INVALID_ARGUMENT` if the request is malformed. 5940// * `NOT_FOUND` if the requested course does not exist. 5941// * `FAILED_PRECONDITION` for the following request error: 5942// * AttachmentNotVisible 5943func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall { 5944 c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5945 c.courseId = courseId 5946 c.coursework = coursework 5947 return c 5948} 5949 5950// Fields allows partial responses to be retrieved. See 5951// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5952// for more information. 5953func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall { 5954 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5955 return c 5956} 5957 5958// Context sets the context to be used in this call's Do method. Any 5959// pending HTTP request will be aborted if the provided context is 5960// canceled. 5961func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall { 5962 c.ctx_ = ctx 5963 return c 5964} 5965 5966// Header returns an http.Header that can be modified by the caller to 5967// add HTTP headers to the request. 5968func (c *CoursesCourseWorkCreateCall) Header() http.Header { 5969 if c.header_ == nil { 5970 c.header_ = make(http.Header) 5971 } 5972 return c.header_ 5973} 5974 5975func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) { 5976 reqHeaders := make(http.Header) 5977 for k, v := range c.header_ { 5978 reqHeaders[k] = v 5979 } 5980 reqHeaders.Set("User-Agent", c.s.userAgent()) 5981 var body io.Reader = nil 5982 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 5983 if err != nil { 5984 return nil, err 5985 } 5986 reqHeaders.Set("Content-Type", "application/json") 5987 c.urlParams_.Set("alt", alt) 5988 c.urlParams_.Set("prettyPrint", "false") 5989 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 5990 urls += "?" + c.urlParams_.Encode() 5991 req, err := http.NewRequest("POST", urls, body) 5992 if err != nil { 5993 return nil, err 5994 } 5995 req.Header = reqHeaders 5996 googleapi.Expand(req.URL, map[string]string{ 5997 "courseId": c.courseId, 5998 }) 5999 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6000} 6001 6002// Do executes the "classroom.courses.courseWork.create" call. 6003// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6004// status code is an error. Response headers are in either 6005// *CourseWork.ServerResponse.Header or (if a response was returned at 6006// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6007// to check whether the returned error was because 6008// http.StatusNotModified was returned. 6009func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6010 gensupport.SetOptions(c.urlParams_, opts...) 6011 res, err := c.doRequest("json") 6012 if res != nil && res.StatusCode == http.StatusNotModified { 6013 if res.Body != nil { 6014 res.Body.Close() 6015 } 6016 return nil, &googleapi.Error{ 6017 Code: res.StatusCode, 6018 Header: res.Header, 6019 } 6020 } 6021 if err != nil { 6022 return nil, err 6023 } 6024 defer googleapi.CloseBody(res) 6025 if err := googleapi.CheckResponse(res); err != nil { 6026 return nil, err 6027 } 6028 ret := &CourseWork{ 6029 ServerResponse: googleapi.ServerResponse{ 6030 Header: res.Header, 6031 HTTPStatusCode: res.StatusCode, 6032 }, 6033 } 6034 target := &ret 6035 if err := gensupport.DecodeResponse(target, res); err != nil { 6036 return nil, err 6037 } 6038 return ret, nil 6039 // { 6040 // "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", 6041 // "flatPath": "v1/courses/{courseId}/courseWork", 6042 // "httpMethod": "POST", 6043 // "id": "classroom.courses.courseWork.create", 6044 // "parameterOrder": [ 6045 // "courseId" 6046 // ], 6047 // "parameters": { 6048 // "courseId": { 6049 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6050 // "location": "path", 6051 // "required": true, 6052 // "type": "string" 6053 // } 6054 // }, 6055 // "path": "v1/courses/{courseId}/courseWork", 6056 // "request": { 6057 // "$ref": "CourseWork" 6058 // }, 6059 // "response": { 6060 // "$ref": "CourseWork" 6061 // }, 6062 // "scopes": [ 6063 // "https://www.googleapis.com/auth/classroom.coursework.students" 6064 // ] 6065 // } 6066 6067} 6068 6069// method id "classroom.courses.courseWork.delete": 6070 6071type CoursesCourseWorkDeleteCall struct { 6072 s *Service 6073 courseId string 6074 id string 6075 urlParams_ gensupport.URLParams 6076 ctx_ context.Context 6077 header_ http.Header 6078} 6079 6080// Delete: Deletes a course work. 6081// 6082// This request must be made by the Developer Console project of 6083// the 6084// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6085// used to 6086// create the corresponding course work item. 6087// 6088// This method returns the following error codes: 6089// 6090// * `PERMISSION_DENIED` if the requesting developer project did not 6091// create 6092// the corresponding course work, if the requesting user is not 6093// permitted 6094// to delete the requested course or for access errors. 6095// * `FAILED_PRECONDITION` if the requested course work has already 6096// been 6097// deleted. 6098// * `NOT_FOUND` if no course exists with the requested ID. 6099func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall { 6100 c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6101 c.courseId = courseId 6102 c.id = id 6103 return c 6104} 6105 6106// Fields allows partial responses to be retrieved. See 6107// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6108// for more information. 6109func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall { 6110 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6111 return c 6112} 6113 6114// Context sets the context to be used in this call's Do method. Any 6115// pending HTTP request will be aborted if the provided context is 6116// canceled. 6117func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall { 6118 c.ctx_ = ctx 6119 return c 6120} 6121 6122// Header returns an http.Header that can be modified by the caller to 6123// add HTTP headers to the request. 6124func (c *CoursesCourseWorkDeleteCall) Header() http.Header { 6125 if c.header_ == nil { 6126 c.header_ = make(http.Header) 6127 } 6128 return c.header_ 6129} 6130 6131func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) { 6132 reqHeaders := make(http.Header) 6133 for k, v := range c.header_ { 6134 reqHeaders[k] = v 6135 } 6136 reqHeaders.Set("User-Agent", c.s.userAgent()) 6137 var body io.Reader = nil 6138 c.urlParams_.Set("alt", alt) 6139 c.urlParams_.Set("prettyPrint", "false") 6140 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6141 urls += "?" + c.urlParams_.Encode() 6142 req, err := http.NewRequest("DELETE", urls, body) 6143 if err != nil { 6144 return nil, err 6145 } 6146 req.Header = reqHeaders 6147 googleapi.Expand(req.URL, map[string]string{ 6148 "courseId": c.courseId, 6149 "id": c.id, 6150 }) 6151 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6152} 6153 6154// Do executes the "classroom.courses.courseWork.delete" call. 6155// Exactly one of *Empty or error will be non-nil. Any non-2xx status 6156// code is an error. Response headers are in either 6157// *Empty.ServerResponse.Header or (if a response was returned at all) 6158// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6159// check whether the returned error was because http.StatusNotModified 6160// was returned. 6161func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 6162 gensupport.SetOptions(c.urlParams_, opts...) 6163 res, err := c.doRequest("json") 6164 if res != nil && res.StatusCode == http.StatusNotModified { 6165 if res.Body != nil { 6166 res.Body.Close() 6167 } 6168 return nil, &googleapi.Error{ 6169 Code: res.StatusCode, 6170 Header: res.Header, 6171 } 6172 } 6173 if err != nil { 6174 return nil, err 6175 } 6176 defer googleapi.CloseBody(res) 6177 if err := googleapi.CheckResponse(res); err != nil { 6178 return nil, err 6179 } 6180 ret := &Empty{ 6181 ServerResponse: googleapi.ServerResponse{ 6182 Header: res.Header, 6183 HTTPStatusCode: res.StatusCode, 6184 }, 6185 } 6186 target := &ret 6187 if err := gensupport.DecodeResponse(target, res); err != nil { 6188 return nil, err 6189 } 6190 return ret, nil 6191 // { 6192 // "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.", 6193 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6194 // "httpMethod": "DELETE", 6195 // "id": "classroom.courses.courseWork.delete", 6196 // "parameterOrder": [ 6197 // "courseId", 6198 // "id" 6199 // ], 6200 // "parameters": { 6201 // "courseId": { 6202 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6203 // "location": "path", 6204 // "required": true, 6205 // "type": "string" 6206 // }, 6207 // "id": { 6208 // "description": "Identifier of the course work to delete.\nThis identifier is a Classroom-assigned identifier.", 6209 // "location": "path", 6210 // "required": true, 6211 // "type": "string" 6212 // } 6213 // }, 6214 // "path": "v1/courses/{courseId}/courseWork/{id}", 6215 // "response": { 6216 // "$ref": "Empty" 6217 // }, 6218 // "scopes": [ 6219 // "https://www.googleapis.com/auth/classroom.coursework.students" 6220 // ] 6221 // } 6222 6223} 6224 6225// method id "classroom.courses.courseWork.get": 6226 6227type CoursesCourseWorkGetCall struct { 6228 s *Service 6229 courseId string 6230 id string 6231 urlParams_ gensupport.URLParams 6232 ifNoneMatch_ string 6233 ctx_ context.Context 6234 header_ http.Header 6235} 6236 6237// Get: Returns course work. 6238// 6239// This method returns the following error codes: 6240// 6241// * `PERMISSION_DENIED` if the requesting user is not permitted to 6242// access the 6243// requested course or course work, or for access errors. 6244// * `INVALID_ARGUMENT` if the request is malformed. 6245// * `NOT_FOUND` if the requested course or course work does not exist. 6246func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall { 6247 c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6248 c.courseId = courseId 6249 c.id = id 6250 return c 6251} 6252 6253// Fields allows partial responses to be retrieved. See 6254// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6255// for more information. 6256func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall { 6257 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6258 return c 6259} 6260 6261// IfNoneMatch sets the optional parameter which makes the operation 6262// fail if the object's ETag matches the given value. This is useful for 6263// getting updates only after the object has changed since the last 6264// request. Use googleapi.IsNotModified to check whether the response 6265// error from Do is the result of In-None-Match. 6266func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall { 6267 c.ifNoneMatch_ = entityTag 6268 return c 6269} 6270 6271// Context sets the context to be used in this call's Do method. Any 6272// pending HTTP request will be aborted if the provided context is 6273// canceled. 6274func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall { 6275 c.ctx_ = ctx 6276 return c 6277} 6278 6279// Header returns an http.Header that can be modified by the caller to 6280// add HTTP headers to the request. 6281func (c *CoursesCourseWorkGetCall) Header() http.Header { 6282 if c.header_ == nil { 6283 c.header_ = make(http.Header) 6284 } 6285 return c.header_ 6286} 6287 6288func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) { 6289 reqHeaders := make(http.Header) 6290 for k, v := range c.header_ { 6291 reqHeaders[k] = v 6292 } 6293 reqHeaders.Set("User-Agent", c.s.userAgent()) 6294 if c.ifNoneMatch_ != "" { 6295 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6296 } 6297 var body io.Reader = nil 6298 c.urlParams_.Set("alt", alt) 6299 c.urlParams_.Set("prettyPrint", "false") 6300 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6301 urls += "?" + c.urlParams_.Encode() 6302 req, err := http.NewRequest("GET", urls, body) 6303 if err != nil { 6304 return nil, err 6305 } 6306 req.Header = reqHeaders 6307 googleapi.Expand(req.URL, map[string]string{ 6308 "courseId": c.courseId, 6309 "id": c.id, 6310 }) 6311 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6312} 6313 6314// Do executes the "classroom.courses.courseWork.get" call. 6315// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6316// status code is an error. Response headers are in either 6317// *CourseWork.ServerResponse.Header or (if a response was returned at 6318// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6319// to check whether the returned error was because 6320// http.StatusNotModified was returned. 6321func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6322 gensupport.SetOptions(c.urlParams_, opts...) 6323 res, err := c.doRequest("json") 6324 if res != nil && res.StatusCode == http.StatusNotModified { 6325 if res.Body != nil { 6326 res.Body.Close() 6327 } 6328 return nil, &googleapi.Error{ 6329 Code: res.StatusCode, 6330 Header: res.Header, 6331 } 6332 } 6333 if err != nil { 6334 return nil, err 6335 } 6336 defer googleapi.CloseBody(res) 6337 if err := googleapi.CheckResponse(res); err != nil { 6338 return nil, err 6339 } 6340 ret := &CourseWork{ 6341 ServerResponse: googleapi.ServerResponse{ 6342 Header: res.Header, 6343 HTTPStatusCode: res.StatusCode, 6344 }, 6345 } 6346 target := &ret 6347 if err := gensupport.DecodeResponse(target, res); err != nil { 6348 return nil, err 6349 } 6350 return ret, nil 6351 // { 6352 // "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.", 6353 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6354 // "httpMethod": "GET", 6355 // "id": "classroom.courses.courseWork.get", 6356 // "parameterOrder": [ 6357 // "courseId", 6358 // "id" 6359 // ], 6360 // "parameters": { 6361 // "courseId": { 6362 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6363 // "location": "path", 6364 // "required": true, 6365 // "type": "string" 6366 // }, 6367 // "id": { 6368 // "description": "Identifier of the course work.", 6369 // "location": "path", 6370 // "required": true, 6371 // "type": "string" 6372 // } 6373 // }, 6374 // "path": "v1/courses/{courseId}/courseWork/{id}", 6375 // "response": { 6376 // "$ref": "CourseWork" 6377 // }, 6378 // "scopes": [ 6379 // "https://www.googleapis.com/auth/classroom.coursework.me", 6380 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6381 // "https://www.googleapis.com/auth/classroom.coursework.students", 6382 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6383 // ] 6384 // } 6385 6386} 6387 6388// method id "classroom.courses.courseWork.list": 6389 6390type CoursesCourseWorkListCall struct { 6391 s *Service 6392 courseId string 6393 urlParams_ gensupport.URLParams 6394 ifNoneMatch_ string 6395 ctx_ context.Context 6396 header_ http.Header 6397} 6398 6399// List: Returns a list of course work that the requester is permitted 6400// to view. 6401// 6402// Course students may only view `PUBLISHED` course work. Course 6403// teachers 6404// and domain administrators may view all course work. 6405// 6406// This method returns the following error codes: 6407// 6408// * `PERMISSION_DENIED` if the requesting user is not permitted to 6409// access 6410// the requested course or for access errors. 6411// * `INVALID_ARGUMENT` if the request is malformed. 6412// * `NOT_FOUND` if the requested course does not exist. 6413func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall { 6414 c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6415 c.courseId = courseId 6416 return c 6417} 6418 6419// CourseWorkStates sets the optional parameter "courseWorkStates": 6420// Restriction on the work status to return. Only courseWork that 6421// matches 6422// is returned. If unspecified, items with a work status of 6423// `PUBLISHED` 6424// is returned. 6425// 6426// Possible values: 6427// "COURSE_WORK_STATE_UNSPECIFIED" 6428// "PUBLISHED" 6429// "DRAFT" 6430// "DELETED" 6431func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall { 6432 c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...)) 6433 return c 6434} 6435 6436// OrderBy sets the optional parameter "orderBy": Optional sort ordering 6437// for results. A comma-separated list of fields with 6438// an optional sort direction keyword. Supported fields are 6439// `updateTime` 6440// and `dueDate`. Supported direction keywords are `asc` and `desc`. 6441// If not specified, `updateTime desc` is the default 6442// behavior. 6443// Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc` 6444func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall { 6445 c.urlParams_.Set("orderBy", orderBy) 6446 return c 6447} 6448 6449// PageSize sets the optional parameter "pageSize": Maximum number of 6450// items to return. Zero or unspecified indicates that the 6451// server may assign a maximum. 6452// 6453// The server may return fewer than the specified number of results. 6454func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall { 6455 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6456 return c 6457} 6458 6459// PageToken sets the optional parameter "pageToken": 6460// nextPageToken 6461// value returned from a previous 6462// list call, 6463// indicating that the subsequent page of results should be 6464// returned. 6465// 6466// The list request 6467// must be otherwise identical to the one that resulted in this token. 6468func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall { 6469 c.urlParams_.Set("pageToken", pageToken) 6470 return c 6471} 6472 6473// Fields allows partial responses to be retrieved. See 6474// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6475// for more information. 6476func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall { 6477 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6478 return c 6479} 6480 6481// IfNoneMatch sets the optional parameter which makes the operation 6482// fail if the object's ETag matches the given value. This is useful for 6483// getting updates only after the object has changed since the last 6484// request. Use googleapi.IsNotModified to check whether the response 6485// error from Do is the result of In-None-Match. 6486func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall { 6487 c.ifNoneMatch_ = entityTag 6488 return c 6489} 6490 6491// Context sets the context to be used in this call's Do method. Any 6492// pending HTTP request will be aborted if the provided context is 6493// canceled. 6494func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall { 6495 c.ctx_ = ctx 6496 return c 6497} 6498 6499// Header returns an http.Header that can be modified by the caller to 6500// add HTTP headers to the request. 6501func (c *CoursesCourseWorkListCall) Header() http.Header { 6502 if c.header_ == nil { 6503 c.header_ = make(http.Header) 6504 } 6505 return c.header_ 6506} 6507 6508func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) { 6509 reqHeaders := make(http.Header) 6510 for k, v := range c.header_ { 6511 reqHeaders[k] = v 6512 } 6513 reqHeaders.Set("User-Agent", c.s.userAgent()) 6514 if c.ifNoneMatch_ != "" { 6515 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6516 } 6517 var body io.Reader = nil 6518 c.urlParams_.Set("alt", alt) 6519 c.urlParams_.Set("prettyPrint", "false") 6520 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6521 urls += "?" + c.urlParams_.Encode() 6522 req, err := http.NewRequest("GET", urls, body) 6523 if err != nil { 6524 return nil, err 6525 } 6526 req.Header = reqHeaders 6527 googleapi.Expand(req.URL, map[string]string{ 6528 "courseId": c.courseId, 6529 }) 6530 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6531} 6532 6533// Do executes the "classroom.courses.courseWork.list" call. 6534// Exactly one of *ListCourseWorkResponse or error will be non-nil. Any 6535// non-2xx status code is an error. Response headers are in either 6536// *ListCourseWorkResponse.ServerResponse.Header or (if a response was 6537// returned at all) in error.(*googleapi.Error).Header. Use 6538// googleapi.IsNotModified to check whether the returned error was 6539// because http.StatusNotModified was returned. 6540func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) { 6541 gensupport.SetOptions(c.urlParams_, opts...) 6542 res, err := c.doRequest("json") 6543 if res != nil && res.StatusCode == http.StatusNotModified { 6544 if res.Body != nil { 6545 res.Body.Close() 6546 } 6547 return nil, &googleapi.Error{ 6548 Code: res.StatusCode, 6549 Header: res.Header, 6550 } 6551 } 6552 if err != nil { 6553 return nil, err 6554 } 6555 defer googleapi.CloseBody(res) 6556 if err := googleapi.CheckResponse(res); err != nil { 6557 return nil, err 6558 } 6559 ret := &ListCourseWorkResponse{ 6560 ServerResponse: googleapi.ServerResponse{ 6561 Header: res.Header, 6562 HTTPStatusCode: res.StatusCode, 6563 }, 6564 } 6565 target := &ret 6566 if err := gensupport.DecodeResponse(target, res); err != nil { 6567 return nil, err 6568 } 6569 return ret, nil 6570 // { 6571 // "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.", 6572 // "flatPath": "v1/courses/{courseId}/courseWork", 6573 // "httpMethod": "GET", 6574 // "id": "classroom.courses.courseWork.list", 6575 // "parameterOrder": [ 6576 // "courseId" 6577 // ], 6578 // "parameters": { 6579 // "courseId": { 6580 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6581 // "location": "path", 6582 // "required": true, 6583 // "type": "string" 6584 // }, 6585 // "courseWorkStates": { 6586 // "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.", 6587 // "enum": [ 6588 // "COURSE_WORK_STATE_UNSPECIFIED", 6589 // "PUBLISHED", 6590 // "DRAFT", 6591 // "DELETED" 6592 // ], 6593 // "location": "query", 6594 // "repeated": true, 6595 // "type": "string" 6596 // }, 6597 // "orderBy": { 6598 // "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`", 6599 // "location": "query", 6600 // "type": "string" 6601 // }, 6602 // "pageSize": { 6603 // "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.", 6604 // "format": "int32", 6605 // "location": "query", 6606 // "type": "integer" 6607 // }, 6608 // "pageToken": { 6609 // "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.", 6610 // "location": "query", 6611 // "type": "string" 6612 // } 6613 // }, 6614 // "path": "v1/courses/{courseId}/courseWork", 6615 // "response": { 6616 // "$ref": "ListCourseWorkResponse" 6617 // }, 6618 // "scopes": [ 6619 // "https://www.googleapis.com/auth/classroom.coursework.me", 6620 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6621 // "https://www.googleapis.com/auth/classroom.coursework.students", 6622 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6623 // ] 6624 // } 6625 6626} 6627 6628// Pages invokes f for each page of results. 6629// A non-nil error returned from f will halt the iteration. 6630// The provided context supersedes any context provided to the Context method. 6631func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error { 6632 c.ctx_ = ctx 6633 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6634 for { 6635 x, err := c.Do() 6636 if err != nil { 6637 return err 6638 } 6639 if err := f(x); err != nil { 6640 return err 6641 } 6642 if x.NextPageToken == "" { 6643 return nil 6644 } 6645 c.PageToken(x.NextPageToken) 6646 } 6647} 6648 6649// method id "classroom.courses.courseWork.modifyAssignees": 6650 6651type CoursesCourseWorkModifyAssigneesCall struct { 6652 s *Service 6653 courseId string 6654 id string 6655 modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest 6656 urlParams_ gensupport.URLParams 6657 ctx_ context.Context 6658 header_ http.Header 6659} 6660 6661// ModifyAssignees: Modifies assignee mode and options of a 6662// coursework. 6663// 6664// Only a teacher of the course that contains the coursework may 6665// call this method. 6666// 6667// This method returns the following error codes: 6668// 6669// * `PERMISSION_DENIED` if the requesting user is not permitted to 6670// access the 6671// requested course or course work or for access errors. 6672// * `INVALID_ARGUMENT` if the request is malformed. 6673// * `NOT_FOUND` if the requested course or course work does not exist. 6674func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall { 6675 c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6676 c.courseId = courseId 6677 c.id = id 6678 c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest 6679 return c 6680} 6681 6682// Fields allows partial responses to be retrieved. See 6683// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6684// for more information. 6685func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall { 6686 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6687 return c 6688} 6689 6690// Context sets the context to be used in this call's Do method. Any 6691// pending HTTP request will be aborted if the provided context is 6692// canceled. 6693func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall { 6694 c.ctx_ = ctx 6695 return c 6696} 6697 6698// Header returns an http.Header that can be modified by the caller to 6699// add HTTP headers to the request. 6700func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header { 6701 if c.header_ == nil { 6702 c.header_ = make(http.Header) 6703 } 6704 return c.header_ 6705} 6706 6707func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 6708 reqHeaders := make(http.Header) 6709 for k, v := range c.header_ { 6710 reqHeaders[k] = v 6711 } 6712 reqHeaders.Set("User-Agent", c.s.userAgent()) 6713 var body io.Reader = nil 6714 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest) 6715 if err != nil { 6716 return nil, err 6717 } 6718 reqHeaders.Set("Content-Type", "application/json") 6719 c.urlParams_.Set("alt", alt) 6720 c.urlParams_.Set("prettyPrint", "false") 6721 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees") 6722 urls += "?" + c.urlParams_.Encode() 6723 req, err := http.NewRequest("POST", urls, body) 6724 if err != nil { 6725 return nil, err 6726 } 6727 req.Header = reqHeaders 6728 googleapi.Expand(req.URL, map[string]string{ 6729 "courseId": c.courseId, 6730 "id": c.id, 6731 }) 6732 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6733} 6734 6735// Do executes the "classroom.courses.courseWork.modifyAssignees" call. 6736// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6737// status code is an error. Response headers are in either 6738// *CourseWork.ServerResponse.Header or (if a response was returned at 6739// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6740// to check whether the returned error was because 6741// http.StatusNotModified was returned. 6742func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6743 gensupport.SetOptions(c.urlParams_, opts...) 6744 res, err := c.doRequest("json") 6745 if res != nil && res.StatusCode == http.StatusNotModified { 6746 if res.Body != nil { 6747 res.Body.Close() 6748 } 6749 return nil, &googleapi.Error{ 6750 Code: res.StatusCode, 6751 Header: res.Header, 6752 } 6753 } 6754 if err != nil { 6755 return nil, err 6756 } 6757 defer googleapi.CloseBody(res) 6758 if err := googleapi.CheckResponse(res); err != nil { 6759 return nil, err 6760 } 6761 ret := &CourseWork{ 6762 ServerResponse: googleapi.ServerResponse{ 6763 Header: res.Header, 6764 HTTPStatusCode: res.StatusCode, 6765 }, 6766 } 6767 target := &ret 6768 if err := gensupport.DecodeResponse(target, res); err != nil { 6769 return nil, err 6770 } 6771 return ret, nil 6772 // { 6773 // "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.", 6774 // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6775 // "httpMethod": "POST", 6776 // "id": "classroom.courses.courseWork.modifyAssignees", 6777 // "parameterOrder": [ 6778 // "courseId", 6779 // "id" 6780 // ], 6781 // "parameters": { 6782 // "courseId": { 6783 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6784 // "location": "path", 6785 // "required": true, 6786 // "type": "string" 6787 // }, 6788 // "id": { 6789 // "description": "Identifier of the coursework.", 6790 // "location": "path", 6791 // "required": true, 6792 // "type": "string" 6793 // } 6794 // }, 6795 // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6796 // "request": { 6797 // "$ref": "ModifyCourseWorkAssigneesRequest" 6798 // }, 6799 // "response": { 6800 // "$ref": "CourseWork" 6801 // }, 6802 // "scopes": [ 6803 // "https://www.googleapis.com/auth/classroom.coursework.students" 6804 // ] 6805 // } 6806 6807} 6808 6809// method id "classroom.courses.courseWork.patch": 6810 6811type CoursesCourseWorkPatchCall struct { 6812 s *Service 6813 courseId string 6814 id string 6815 coursework *CourseWork 6816 urlParams_ gensupport.URLParams 6817 ctx_ context.Context 6818 header_ http.Header 6819} 6820 6821// Patch: Updates one or more fields of a course work. 6822// 6823// See google.classroom.v1.CourseWork for details 6824// of which fields may be updated and who may change them. 6825// 6826// This request must be made by the Developer Console project of 6827// the 6828// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6829// used to 6830// create the corresponding course work item. 6831// 6832// This method returns the following error codes: 6833// 6834// * `PERMISSION_DENIED` if the requesting developer project did not 6835// create 6836// the corresponding course work, if the user is not permitted to make 6837// the 6838// requested modification to the student submission, or for 6839// access errors. 6840// * `INVALID_ARGUMENT` if the request is malformed. 6841// * `FAILED_PRECONDITION` if the requested course work has already 6842// been 6843// deleted. 6844// * `NOT_FOUND` if the requested course, course work, or student 6845// submission 6846// does not exist. 6847func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall { 6848 c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6849 c.courseId = courseId 6850 c.id = id 6851 c.coursework = coursework 6852 return c 6853} 6854 6855// UpdateMask sets the optional parameter "updateMask": Mask that 6856// identifies which fields on the course work to update. 6857// This field is required to do an update. The update fails if 6858// invalid 6859// fields are specified. If a field supports empty values, it can be 6860// cleared 6861// by specifying it in the update mask and not in the CourseWork object. 6862// If a 6863// field that does not support empty values is included in the update 6864// mask and 6865// not set in the CourseWork object, an `INVALID_ARGUMENT` error will 6866// be 6867// returned. 6868// 6869// The following fields may be specified by teachers: 6870// 6871// * `title` 6872// * `description` 6873// * `state` 6874// * `due_date` 6875// * `due_time` 6876// * `max_points` 6877// * `scheduled_time` 6878// * `submission_modification_mode` 6879// * `topic_id` 6880func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall { 6881 c.urlParams_.Set("updateMask", updateMask) 6882 return c 6883} 6884 6885// Fields allows partial responses to be retrieved. See 6886// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6887// for more information. 6888func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall { 6889 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6890 return c 6891} 6892 6893// Context sets the context to be used in this call's Do method. Any 6894// pending HTTP request will be aborted if the provided context is 6895// canceled. 6896func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall { 6897 c.ctx_ = ctx 6898 return c 6899} 6900 6901// Header returns an http.Header that can be modified by the caller to 6902// add HTTP headers to the request. 6903func (c *CoursesCourseWorkPatchCall) Header() http.Header { 6904 if c.header_ == nil { 6905 c.header_ = make(http.Header) 6906 } 6907 return c.header_ 6908} 6909 6910func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) { 6911 reqHeaders := make(http.Header) 6912 for k, v := range c.header_ { 6913 reqHeaders[k] = v 6914 } 6915 reqHeaders.Set("User-Agent", c.s.userAgent()) 6916 var body io.Reader = nil 6917 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6918 if err != nil { 6919 return nil, err 6920 } 6921 reqHeaders.Set("Content-Type", "application/json") 6922 c.urlParams_.Set("alt", alt) 6923 c.urlParams_.Set("prettyPrint", "false") 6924 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6925 urls += "?" + c.urlParams_.Encode() 6926 req, err := http.NewRequest("PATCH", urls, body) 6927 if err != nil { 6928 return nil, err 6929 } 6930 req.Header = reqHeaders 6931 googleapi.Expand(req.URL, map[string]string{ 6932 "courseId": c.courseId, 6933 "id": c.id, 6934 }) 6935 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6936} 6937 6938// Do executes the "classroom.courses.courseWork.patch" call. 6939// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6940// status code is an error. Response headers are in either 6941// *CourseWork.ServerResponse.Header or (if a response was returned at 6942// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6943// to check whether the returned error was because 6944// http.StatusNotModified was returned. 6945func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6946 gensupport.SetOptions(c.urlParams_, opts...) 6947 res, err := c.doRequest("json") 6948 if res != nil && res.StatusCode == http.StatusNotModified { 6949 if res.Body != nil { 6950 res.Body.Close() 6951 } 6952 return nil, &googleapi.Error{ 6953 Code: res.StatusCode, 6954 Header: res.Header, 6955 } 6956 } 6957 if err != nil { 6958 return nil, err 6959 } 6960 defer googleapi.CloseBody(res) 6961 if err := googleapi.CheckResponse(res); err != nil { 6962 return nil, err 6963 } 6964 ret := &CourseWork{ 6965 ServerResponse: googleapi.ServerResponse{ 6966 Header: res.Header, 6967 HTTPStatusCode: res.StatusCode, 6968 }, 6969 } 6970 target := &ret 6971 if err := gensupport.DecodeResponse(target, res); err != nil { 6972 return nil, err 6973 } 6974 return ret, nil 6975 // { 6976 // "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.", 6977 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6978 // "httpMethod": "PATCH", 6979 // "id": "classroom.courses.courseWork.patch", 6980 // "parameterOrder": [ 6981 // "courseId", 6982 // "id" 6983 // ], 6984 // "parameters": { 6985 // "courseId": { 6986 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6987 // "location": "path", 6988 // "required": true, 6989 // "type": "string" 6990 // }, 6991 // "id": { 6992 // "description": "Identifier of the course work.", 6993 // "location": "path", 6994 // "required": true, 6995 // "type": "string" 6996 // }, 6997 // "updateMask": { 6998 // "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`", 6999 // "format": "google-fieldmask", 7000 // "location": "query", 7001 // "type": "string" 7002 // } 7003 // }, 7004 // "path": "v1/courses/{courseId}/courseWork/{id}", 7005 // "request": { 7006 // "$ref": "CourseWork" 7007 // }, 7008 // "response": { 7009 // "$ref": "CourseWork" 7010 // }, 7011 // "scopes": [ 7012 // "https://www.googleapis.com/auth/classroom.coursework.students" 7013 // ] 7014 // } 7015 7016} 7017 7018// method id "classroom.courses.courseWork.studentSubmissions.get": 7019 7020type CoursesCourseWorkStudentSubmissionsGetCall struct { 7021 s *Service 7022 courseId string 7023 courseWorkId string 7024 id string 7025 urlParams_ gensupport.URLParams 7026 ifNoneMatch_ string 7027 ctx_ context.Context 7028 header_ http.Header 7029} 7030 7031// Get: Returns a student submission. 7032// 7033// * `PERMISSION_DENIED` if the requesting user is not permitted to 7034// access the 7035// requested course, course work, or student submission or for 7036// access errors. 7037// * `INVALID_ARGUMENT` if the request is malformed. 7038// * `NOT_FOUND` if the requested course, course work, or student 7039// submission 7040// does not exist. 7041func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall { 7042 c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7043 c.courseId = courseId 7044 c.courseWorkId = courseWorkId 7045 c.id = id 7046 return c 7047} 7048 7049// Fields allows partial responses to be retrieved. See 7050// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7051// for more information. 7052func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall { 7053 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7054 return c 7055} 7056 7057// IfNoneMatch sets the optional parameter which makes the operation 7058// fail if the object's ETag matches the given value. This is useful for 7059// getting updates only after the object has changed since the last 7060// request. Use googleapi.IsNotModified to check whether the response 7061// error from Do is the result of In-None-Match. 7062func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall { 7063 c.ifNoneMatch_ = entityTag 7064 return c 7065} 7066 7067// Context sets the context to be used in this call's Do method. Any 7068// pending HTTP request will be aborted if the provided context is 7069// canceled. 7070func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall { 7071 c.ctx_ = ctx 7072 return c 7073} 7074 7075// Header returns an http.Header that can be modified by the caller to 7076// add HTTP headers to the request. 7077func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header { 7078 if c.header_ == nil { 7079 c.header_ = make(http.Header) 7080 } 7081 return c.header_ 7082} 7083 7084func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) { 7085 reqHeaders := make(http.Header) 7086 for k, v := range c.header_ { 7087 reqHeaders[k] = v 7088 } 7089 reqHeaders.Set("User-Agent", c.s.userAgent()) 7090 if c.ifNoneMatch_ != "" { 7091 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7092 } 7093 var body io.Reader = nil 7094 c.urlParams_.Set("alt", alt) 7095 c.urlParams_.Set("prettyPrint", "false") 7096 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7097 urls += "?" + c.urlParams_.Encode() 7098 req, err := http.NewRequest("GET", urls, body) 7099 if err != nil { 7100 return nil, err 7101 } 7102 req.Header = reqHeaders 7103 googleapi.Expand(req.URL, map[string]string{ 7104 "courseId": c.courseId, 7105 "courseWorkId": c.courseWorkId, 7106 "id": c.id, 7107 }) 7108 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7109} 7110 7111// Do executes the "classroom.courses.courseWork.studentSubmissions.get" call. 7112// Exactly one of *StudentSubmission or error will be non-nil. Any 7113// non-2xx status code is an error. Response headers are in either 7114// *StudentSubmission.ServerResponse.Header or (if a response was 7115// returned at all) in error.(*googleapi.Error).Header. Use 7116// googleapi.IsNotModified to check whether the returned error was 7117// because http.StatusNotModified was returned. 7118func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7119 gensupport.SetOptions(c.urlParams_, opts...) 7120 res, err := c.doRequest("json") 7121 if res != nil && res.StatusCode == http.StatusNotModified { 7122 if res.Body != nil { 7123 res.Body.Close() 7124 } 7125 return nil, &googleapi.Error{ 7126 Code: res.StatusCode, 7127 Header: res.Header, 7128 } 7129 } 7130 if err != nil { 7131 return nil, err 7132 } 7133 defer googleapi.CloseBody(res) 7134 if err := googleapi.CheckResponse(res); err != nil { 7135 return nil, err 7136 } 7137 ret := &StudentSubmission{ 7138 ServerResponse: googleapi.ServerResponse{ 7139 Header: res.Header, 7140 HTTPStatusCode: res.StatusCode, 7141 }, 7142 } 7143 target := &ret 7144 if err := gensupport.DecodeResponse(target, res); err != nil { 7145 return nil, err 7146 } 7147 return ret, nil 7148 // { 7149 // "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.", 7150 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7151 // "httpMethod": "GET", 7152 // "id": "classroom.courses.courseWork.studentSubmissions.get", 7153 // "parameterOrder": [ 7154 // "courseId", 7155 // "courseWorkId", 7156 // "id" 7157 // ], 7158 // "parameters": { 7159 // "courseId": { 7160 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7161 // "location": "path", 7162 // "required": true, 7163 // "type": "string" 7164 // }, 7165 // "courseWorkId": { 7166 // "description": "Identifier of the course work.", 7167 // "location": "path", 7168 // "required": true, 7169 // "type": "string" 7170 // }, 7171 // "id": { 7172 // "description": "Identifier of the student submission.", 7173 // "location": "path", 7174 // "required": true, 7175 // "type": "string" 7176 // } 7177 // }, 7178 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7179 // "response": { 7180 // "$ref": "StudentSubmission" 7181 // }, 7182 // "scopes": [ 7183 // "https://www.googleapis.com/auth/classroom.coursework.me", 7184 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7185 // "https://www.googleapis.com/auth/classroom.coursework.students", 7186 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7187 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7188 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7189 // ] 7190 // } 7191 7192} 7193 7194// method id "classroom.courses.courseWork.studentSubmissions.list": 7195 7196type CoursesCourseWorkStudentSubmissionsListCall struct { 7197 s *Service 7198 courseId string 7199 courseWorkId string 7200 urlParams_ gensupport.URLParams 7201 ifNoneMatch_ string 7202 ctx_ context.Context 7203 header_ http.Header 7204} 7205 7206// List: Returns a list of student submissions that the requester is 7207// permitted to 7208// view, factoring in the OAuth scopes of the request. 7209// `-` may be specified as the `course_work_id` to include 7210// student 7211// submissions for multiple course work items. 7212// 7213// Course students may only view their own work. Course teachers 7214// and domain administrators may view all student submissions. 7215// 7216// This method returns the following error codes: 7217// 7218// * `PERMISSION_DENIED` if the requesting user is not permitted to 7219// access the 7220// requested course or course work, or for access errors. 7221// * `INVALID_ARGUMENT` if the request is malformed. 7222// * `NOT_FOUND` if the requested course does not exist. 7223func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall { 7224 c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7225 c.courseId = courseId 7226 c.courseWorkId = courseWorkId 7227 return c 7228} 7229 7230// Late sets the optional parameter "late": Requested lateness value. If 7231// specified, returned student submissions are 7232// restricted by the requested value. 7233// If unspecified, submissions are returned regardless of `late` value. 7234// 7235// Possible values: 7236// "LATE_VALUES_UNSPECIFIED" 7237// "LATE_ONLY" 7238// "NOT_LATE_ONLY" 7239func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall { 7240 c.urlParams_.Set("late", late) 7241 return c 7242} 7243 7244// PageSize sets the optional parameter "pageSize": Maximum number of 7245// items to return. Zero or unspecified indicates that the 7246// server may assign a maximum. 7247// 7248// The server may return fewer than the specified number of results. 7249func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall { 7250 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 7251 return c 7252} 7253 7254// PageToken sets the optional parameter "pageToken": 7255// nextPageToken 7256// value returned from a previous 7257// list call, 7258// indicating that the subsequent page of results should be 7259// returned. 7260// 7261// The list request 7262// must be otherwise identical to the one that resulted in this token. 7263func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall { 7264 c.urlParams_.Set("pageToken", pageToken) 7265 return c 7266} 7267 7268// States sets the optional parameter "states": Requested submission 7269// states. If specified, returned student submissions 7270// match one of the specified submission states. 7271// 7272// Possible values: 7273// "SUBMISSION_STATE_UNSPECIFIED" 7274// "NEW" 7275// "CREATED" 7276// "TURNED_IN" 7277// "RETURNED" 7278// "RECLAIMED_BY_STUDENT" 7279func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall { 7280 c.urlParams_.SetMulti("states", append([]string{}, states...)) 7281 return c 7282} 7283 7284// UserId sets the optional parameter "userId": Optional argument to 7285// restrict returned student work to those owned by the 7286// student with the specified identifier. The identifier can be one of 7287// the 7288// following: 7289// 7290// * the numeric identifier for the user 7291// * the email address of the user 7292// * the string literal "me", indicating the requesting user 7293func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall { 7294 c.urlParams_.Set("userId", userId) 7295 return c 7296} 7297 7298// Fields allows partial responses to be retrieved. See 7299// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7300// for more information. 7301func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall { 7302 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7303 return c 7304} 7305 7306// IfNoneMatch sets the optional parameter which makes the operation 7307// fail if the object's ETag matches the given value. This is useful for 7308// getting updates only after the object has changed since the last 7309// request. Use googleapi.IsNotModified to check whether the response 7310// error from Do is the result of In-None-Match. 7311func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall { 7312 c.ifNoneMatch_ = entityTag 7313 return c 7314} 7315 7316// Context sets the context to be used in this call's Do method. Any 7317// pending HTTP request will be aborted if the provided context is 7318// canceled. 7319func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall { 7320 c.ctx_ = ctx 7321 return c 7322} 7323 7324// Header returns an http.Header that can be modified by the caller to 7325// add HTTP headers to the request. 7326func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header { 7327 if c.header_ == nil { 7328 c.header_ = make(http.Header) 7329 } 7330 return c.header_ 7331} 7332 7333func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) { 7334 reqHeaders := make(http.Header) 7335 for k, v := range c.header_ { 7336 reqHeaders[k] = v 7337 } 7338 reqHeaders.Set("User-Agent", c.s.userAgent()) 7339 if c.ifNoneMatch_ != "" { 7340 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7341 } 7342 var body io.Reader = nil 7343 c.urlParams_.Set("alt", alt) 7344 c.urlParams_.Set("prettyPrint", "false") 7345 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions") 7346 urls += "?" + c.urlParams_.Encode() 7347 req, err := http.NewRequest("GET", urls, body) 7348 if err != nil { 7349 return nil, err 7350 } 7351 req.Header = reqHeaders 7352 googleapi.Expand(req.URL, map[string]string{ 7353 "courseId": c.courseId, 7354 "courseWorkId": c.courseWorkId, 7355 }) 7356 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7357} 7358 7359// Do executes the "classroom.courses.courseWork.studentSubmissions.list" call. 7360// Exactly one of *ListStudentSubmissionsResponse or error will be 7361// non-nil. Any non-2xx status code is an error. Response headers are in 7362// either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a 7363// response was returned at all) in error.(*googleapi.Error).Header. Use 7364// googleapi.IsNotModified to check whether the returned error was 7365// because http.StatusNotModified was returned. 7366func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) { 7367 gensupport.SetOptions(c.urlParams_, opts...) 7368 res, err := c.doRequest("json") 7369 if res != nil && res.StatusCode == http.StatusNotModified { 7370 if res.Body != nil { 7371 res.Body.Close() 7372 } 7373 return nil, &googleapi.Error{ 7374 Code: res.StatusCode, 7375 Header: res.Header, 7376 } 7377 } 7378 if err != nil { 7379 return nil, err 7380 } 7381 defer googleapi.CloseBody(res) 7382 if err := googleapi.CheckResponse(res); err != nil { 7383 return nil, err 7384 } 7385 ret := &ListStudentSubmissionsResponse{ 7386 ServerResponse: googleapi.ServerResponse{ 7387 Header: res.Header, 7388 HTTPStatusCode: res.StatusCode, 7389 }, 7390 } 7391 target := &ret 7392 if err := gensupport.DecodeResponse(target, res); err != nil { 7393 return nil, err 7394 } 7395 return ret, nil 7396 // { 7397 // "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.", 7398 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7399 // "httpMethod": "GET", 7400 // "id": "classroom.courses.courseWork.studentSubmissions.list", 7401 // "parameterOrder": [ 7402 // "courseId", 7403 // "courseWorkId" 7404 // ], 7405 // "parameters": { 7406 // "courseId": { 7407 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7408 // "location": "path", 7409 // "required": true, 7410 // "type": "string" 7411 // }, 7412 // "courseWorkId": { 7413 // "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.", 7414 // "location": "path", 7415 // "required": true, 7416 // "type": "string" 7417 // }, 7418 // "late": { 7419 // "description": "Requested lateness value. If specified, returned student submissions are\nrestricted by the requested value.\nIf unspecified, submissions are returned regardless of `late` value.", 7420 // "enum": [ 7421 // "LATE_VALUES_UNSPECIFIED", 7422 // "LATE_ONLY", 7423 // "NOT_LATE_ONLY" 7424 // ], 7425 // "location": "query", 7426 // "type": "string" 7427 // }, 7428 // "pageSize": { 7429 // "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.", 7430 // "format": "int32", 7431 // "location": "query", 7432 // "type": "integer" 7433 // }, 7434 // "pageToken": { 7435 // "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.", 7436 // "location": "query", 7437 // "type": "string" 7438 // }, 7439 // "states": { 7440 // "description": "Requested submission states. If specified, returned student submissions\nmatch one of the specified submission states.", 7441 // "enum": [ 7442 // "SUBMISSION_STATE_UNSPECIFIED", 7443 // "NEW", 7444 // "CREATED", 7445 // "TURNED_IN", 7446 // "RETURNED", 7447 // "RECLAIMED_BY_STUDENT" 7448 // ], 7449 // "location": "query", 7450 // "repeated": true, 7451 // "type": "string" 7452 // }, 7453 // "userId": { 7454 // "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", 7455 // "location": "query", 7456 // "type": "string" 7457 // } 7458 // }, 7459 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7460 // "response": { 7461 // "$ref": "ListStudentSubmissionsResponse" 7462 // }, 7463 // "scopes": [ 7464 // "https://www.googleapis.com/auth/classroom.coursework.me", 7465 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7466 // "https://www.googleapis.com/auth/classroom.coursework.students", 7467 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7468 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7469 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7470 // ] 7471 // } 7472 7473} 7474 7475// Pages invokes f for each page of results. 7476// A non-nil error returned from f will halt the iteration. 7477// The provided context supersedes any context provided to the Context method. 7478func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error { 7479 c.ctx_ = ctx 7480 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7481 for { 7482 x, err := c.Do() 7483 if err != nil { 7484 return err 7485 } 7486 if err := f(x); err != nil { 7487 return err 7488 } 7489 if x.NextPageToken == "" { 7490 return nil 7491 } 7492 c.PageToken(x.NextPageToken) 7493 } 7494} 7495 7496// method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments": 7497 7498type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct { 7499 s *Service 7500 courseId string 7501 courseWorkId string 7502 id string 7503 modifyattachmentsrequest *ModifyAttachmentsRequest 7504 urlParams_ gensupport.URLParams 7505 ctx_ context.Context 7506 header_ http.Header 7507} 7508 7509// ModifyAttachments: Modifies attachments of student 7510// submission. 7511// 7512// Attachments may only be added to student submissions belonging to 7513// course 7514// work objects with a `workType` of `ASSIGNMENT`. 7515// 7516// This request must be made by the Developer Console project of 7517// the 7518// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7519// used to 7520// create the corresponding course work item. 7521// 7522// This method returns the following error codes: 7523// 7524// * `PERMISSION_DENIED` if the requesting user is not permitted to 7525// access the 7526// requested course or course work, if the user is not permitted to 7527// modify 7528// attachments on the requested student submission, or for 7529// access errors. 7530// * `INVALID_ARGUMENT` if the request is malformed. 7531// * `NOT_FOUND` if the requested course, course work, or student 7532// submission 7533// does not exist. 7534func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7535 c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7536 c.courseId = courseId 7537 c.courseWorkId = courseWorkId 7538 c.id = id 7539 c.modifyattachmentsrequest = modifyattachmentsrequest 7540 return c 7541} 7542 7543// Fields allows partial responses to be retrieved. See 7544// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7545// for more information. 7546func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7547 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7548 return c 7549} 7550 7551// Context sets the context to be used in this call's Do method. Any 7552// pending HTTP request will be aborted if the provided context is 7553// canceled. 7554func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7555 c.ctx_ = ctx 7556 return c 7557} 7558 7559// Header returns an http.Header that can be modified by the caller to 7560// add HTTP headers to the request. 7561func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header { 7562 if c.header_ == nil { 7563 c.header_ = make(http.Header) 7564 } 7565 return c.header_ 7566} 7567 7568func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) { 7569 reqHeaders := make(http.Header) 7570 for k, v := range c.header_ { 7571 reqHeaders[k] = v 7572 } 7573 reqHeaders.Set("User-Agent", c.s.userAgent()) 7574 var body io.Reader = nil 7575 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest) 7576 if err != nil { 7577 return nil, err 7578 } 7579 reqHeaders.Set("Content-Type", "application/json") 7580 c.urlParams_.Set("alt", alt) 7581 c.urlParams_.Set("prettyPrint", "false") 7582 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments") 7583 urls += "?" + c.urlParams_.Encode() 7584 req, err := http.NewRequest("POST", urls, body) 7585 if err != nil { 7586 return nil, err 7587 } 7588 req.Header = reqHeaders 7589 googleapi.Expand(req.URL, map[string]string{ 7590 "courseId": c.courseId, 7591 "courseWorkId": c.courseWorkId, 7592 "id": c.id, 7593 }) 7594 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7595} 7596 7597// Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call. 7598// Exactly one of *StudentSubmission or error will be non-nil. Any 7599// non-2xx status code is an error. Response headers are in either 7600// *StudentSubmission.ServerResponse.Header or (if a response was 7601// returned at all) in error.(*googleapi.Error).Header. Use 7602// googleapi.IsNotModified to check whether the returned error was 7603// because http.StatusNotModified was returned. 7604func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7605 gensupport.SetOptions(c.urlParams_, opts...) 7606 res, err := c.doRequest("json") 7607 if res != nil && res.StatusCode == http.StatusNotModified { 7608 if res.Body != nil { 7609 res.Body.Close() 7610 } 7611 return nil, &googleapi.Error{ 7612 Code: res.StatusCode, 7613 Header: res.Header, 7614 } 7615 } 7616 if err != nil { 7617 return nil, err 7618 } 7619 defer googleapi.CloseBody(res) 7620 if err := googleapi.CheckResponse(res); err != nil { 7621 return nil, err 7622 } 7623 ret := &StudentSubmission{ 7624 ServerResponse: googleapi.ServerResponse{ 7625 Header: res.Header, 7626 HTTPStatusCode: res.StatusCode, 7627 }, 7628 } 7629 target := &ret 7630 if err := gensupport.DecodeResponse(target, res); err != nil { 7631 return nil, err 7632 } 7633 return ret, nil 7634 // { 7635 // "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.", 7636 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7637 // "httpMethod": "POST", 7638 // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments", 7639 // "parameterOrder": [ 7640 // "courseId", 7641 // "courseWorkId", 7642 // "id" 7643 // ], 7644 // "parameters": { 7645 // "courseId": { 7646 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7647 // "location": "path", 7648 // "required": true, 7649 // "type": "string" 7650 // }, 7651 // "courseWorkId": { 7652 // "description": "Identifier of the course work.", 7653 // "location": "path", 7654 // "required": true, 7655 // "type": "string" 7656 // }, 7657 // "id": { 7658 // "description": "Identifier of the student submission.", 7659 // "location": "path", 7660 // "required": true, 7661 // "type": "string" 7662 // } 7663 // }, 7664 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7665 // "request": { 7666 // "$ref": "ModifyAttachmentsRequest" 7667 // }, 7668 // "response": { 7669 // "$ref": "StudentSubmission" 7670 // }, 7671 // "scopes": [ 7672 // "https://www.googleapis.com/auth/classroom.coursework.me", 7673 // "https://www.googleapis.com/auth/classroom.coursework.students" 7674 // ] 7675 // } 7676 7677} 7678 7679// method id "classroom.courses.courseWork.studentSubmissions.patch": 7680 7681type CoursesCourseWorkStudentSubmissionsPatchCall struct { 7682 s *Service 7683 courseId string 7684 courseWorkId string 7685 id string 7686 studentsubmission *StudentSubmission 7687 urlParams_ gensupport.URLParams 7688 ctx_ context.Context 7689 header_ http.Header 7690} 7691 7692// Patch: Updates one or more fields of a student submission. 7693// 7694// See google.classroom.v1.StudentSubmission for details 7695// of which fields may be updated and who may change them. 7696// 7697// This request must be made by the Developer Console project of 7698// the 7699// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7700// used to 7701// create the corresponding course work item. 7702// 7703// This method returns the following error codes: 7704// 7705// * `PERMISSION_DENIED` if the requesting developer project did not 7706// create 7707// the corresponding course work, if the user is not permitted to make 7708// the 7709// requested modification to the student submission, or for 7710// access errors. 7711// * `INVALID_ARGUMENT` if the request is malformed. 7712// * `NOT_FOUND` if the requested course, course work, or student 7713// submission 7714// does not exist. 7715func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall { 7716 c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7717 c.courseId = courseId 7718 c.courseWorkId = courseWorkId 7719 c.id = id 7720 c.studentsubmission = studentsubmission 7721 return c 7722} 7723 7724// UpdateMask sets the optional parameter "updateMask": Mask that 7725// identifies which fields on the student submission to update. 7726// This field is required to do an update. The update fails if 7727// invalid 7728// fields are specified. 7729// 7730// The following fields may be specified by teachers: 7731// 7732// * `draft_grade` 7733// * `assigned_grade` 7734func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall { 7735 c.urlParams_.Set("updateMask", updateMask) 7736 return c 7737} 7738 7739// Fields allows partial responses to be retrieved. See 7740// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7741// for more information. 7742func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall { 7743 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7744 return c 7745} 7746 7747// Context sets the context to be used in this call's Do method. Any 7748// pending HTTP request will be aborted if the provided context is 7749// canceled. 7750func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall { 7751 c.ctx_ = ctx 7752 return c 7753} 7754 7755// Header returns an http.Header that can be modified by the caller to 7756// add HTTP headers to the request. 7757func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header { 7758 if c.header_ == nil { 7759 c.header_ = make(http.Header) 7760 } 7761 return c.header_ 7762} 7763 7764func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) { 7765 reqHeaders := make(http.Header) 7766 for k, v := range c.header_ { 7767 reqHeaders[k] = v 7768 } 7769 reqHeaders.Set("User-Agent", c.s.userAgent()) 7770 var body io.Reader = nil 7771 body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission) 7772 if err != nil { 7773 return nil, err 7774 } 7775 reqHeaders.Set("Content-Type", "application/json") 7776 c.urlParams_.Set("alt", alt) 7777 c.urlParams_.Set("prettyPrint", "false") 7778 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7779 urls += "?" + c.urlParams_.Encode() 7780 req, err := http.NewRequest("PATCH", urls, body) 7781 if err != nil { 7782 return nil, err 7783 } 7784 req.Header = reqHeaders 7785 googleapi.Expand(req.URL, map[string]string{ 7786 "courseId": c.courseId, 7787 "courseWorkId": c.courseWorkId, 7788 "id": c.id, 7789 }) 7790 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7791} 7792 7793// Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call. 7794// Exactly one of *StudentSubmission or error will be non-nil. Any 7795// non-2xx status code is an error. Response headers are in either 7796// *StudentSubmission.ServerResponse.Header or (if a response was 7797// returned at all) in error.(*googleapi.Error).Header. Use 7798// googleapi.IsNotModified to check whether the returned error was 7799// because http.StatusNotModified was returned. 7800func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7801 gensupport.SetOptions(c.urlParams_, opts...) 7802 res, err := c.doRequest("json") 7803 if res != nil && res.StatusCode == http.StatusNotModified { 7804 if res.Body != nil { 7805 res.Body.Close() 7806 } 7807 return nil, &googleapi.Error{ 7808 Code: res.StatusCode, 7809 Header: res.Header, 7810 } 7811 } 7812 if err != nil { 7813 return nil, err 7814 } 7815 defer googleapi.CloseBody(res) 7816 if err := googleapi.CheckResponse(res); err != nil { 7817 return nil, err 7818 } 7819 ret := &StudentSubmission{ 7820 ServerResponse: googleapi.ServerResponse{ 7821 Header: res.Header, 7822 HTTPStatusCode: res.StatusCode, 7823 }, 7824 } 7825 target := &ret 7826 if err := gensupport.DecodeResponse(target, res); err != nil { 7827 return nil, err 7828 } 7829 return ret, nil 7830 // { 7831 // "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.", 7832 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7833 // "httpMethod": "PATCH", 7834 // "id": "classroom.courses.courseWork.studentSubmissions.patch", 7835 // "parameterOrder": [ 7836 // "courseId", 7837 // "courseWorkId", 7838 // "id" 7839 // ], 7840 // "parameters": { 7841 // "courseId": { 7842 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7843 // "location": "path", 7844 // "required": true, 7845 // "type": "string" 7846 // }, 7847 // "courseWorkId": { 7848 // "description": "Identifier of the course work.", 7849 // "location": "path", 7850 // "required": true, 7851 // "type": "string" 7852 // }, 7853 // "id": { 7854 // "description": "Identifier of the student submission.", 7855 // "location": "path", 7856 // "required": true, 7857 // "type": "string" 7858 // }, 7859 // "updateMask": { 7860 // "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`", 7861 // "format": "google-fieldmask", 7862 // "location": "query", 7863 // "type": "string" 7864 // } 7865 // }, 7866 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7867 // "request": { 7868 // "$ref": "StudentSubmission" 7869 // }, 7870 // "response": { 7871 // "$ref": "StudentSubmission" 7872 // }, 7873 // "scopes": [ 7874 // "https://www.googleapis.com/auth/classroom.coursework.me", 7875 // "https://www.googleapis.com/auth/classroom.coursework.students" 7876 // ] 7877 // } 7878 7879} 7880 7881// method id "classroom.courses.courseWork.studentSubmissions.reclaim": 7882 7883type CoursesCourseWorkStudentSubmissionsReclaimCall struct { 7884 s *Service 7885 courseId string 7886 courseWorkId string 7887 id string 7888 reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest 7889 urlParams_ gensupport.URLParams 7890 ctx_ context.Context 7891 header_ http.Header 7892} 7893 7894// Reclaim: Reclaims a student submission on behalf of the student that 7895// owns it. 7896// 7897// Reclaiming a student submission transfers ownership of attached 7898// Drive 7899// files to the student and updates the submission state. 7900// 7901// Only the student that owns the requested student submission may call 7902// this 7903// method, and only for a student submission that has been turned 7904// in. 7905// 7906// This request must be made by the Developer Console project of 7907// the 7908// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7909// used to 7910// create the corresponding course work item. 7911// 7912// This method returns the following error codes: 7913// 7914// * `PERMISSION_DENIED` if the requesting user is not permitted to 7915// access the 7916// requested course or course work, unsubmit the requested student 7917// submission, 7918// or for access errors. 7919// * `FAILED_PRECONDITION` if the student submission has not been turned 7920// in. 7921// * `INVALID_ARGUMENT` if the request is malformed. 7922// * `NOT_FOUND` if the requested course, course work, or student 7923// submission 7924// does not exist. 7925func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7926 c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7927 c.courseId = courseId 7928 c.courseWorkId = courseWorkId 7929 c.id = id 7930 c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest 7931 return c 7932} 7933 7934// Fields allows partial responses to be retrieved. See 7935// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7936// for more information. 7937func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7938 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7939 return c 7940} 7941 7942// Context sets the context to be used in this call's Do method. Any 7943// pending HTTP request will be aborted if the provided context is 7944// canceled. 7945func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7946 c.ctx_ = ctx 7947 return c 7948} 7949 7950// Header returns an http.Header that can be modified by the caller to 7951// add HTTP headers to the request. 7952func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header { 7953 if c.header_ == nil { 7954 c.header_ = make(http.Header) 7955 } 7956 return c.header_ 7957} 7958 7959func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) { 7960 reqHeaders := make(http.Header) 7961 for k, v := range c.header_ { 7962 reqHeaders[k] = v 7963 } 7964 reqHeaders.Set("User-Agent", c.s.userAgent()) 7965 var body io.Reader = nil 7966 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest) 7967 if err != nil { 7968 return nil, err 7969 } 7970 reqHeaders.Set("Content-Type", "application/json") 7971 c.urlParams_.Set("alt", alt) 7972 c.urlParams_.Set("prettyPrint", "false") 7973 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim") 7974 urls += "?" + c.urlParams_.Encode() 7975 req, err := http.NewRequest("POST", urls, body) 7976 if err != nil { 7977 return nil, err 7978 } 7979 req.Header = reqHeaders 7980 googleapi.Expand(req.URL, map[string]string{ 7981 "courseId": c.courseId, 7982 "courseWorkId": c.courseWorkId, 7983 "id": c.id, 7984 }) 7985 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7986} 7987 7988// Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call. 7989// Exactly one of *Empty or error will be non-nil. Any non-2xx status 7990// code is an error. Response headers are in either 7991// *Empty.ServerResponse.Header or (if a response was returned at all) 7992// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7993// check whether the returned error was because http.StatusNotModified 7994// was returned. 7995func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 7996 gensupport.SetOptions(c.urlParams_, opts...) 7997 res, err := c.doRequest("json") 7998 if res != nil && res.StatusCode == http.StatusNotModified { 7999 if res.Body != nil { 8000 res.Body.Close() 8001 } 8002 return nil, &googleapi.Error{ 8003 Code: res.StatusCode, 8004 Header: res.Header, 8005 } 8006 } 8007 if err != nil { 8008 return nil, err 8009 } 8010 defer googleapi.CloseBody(res) 8011 if err := googleapi.CheckResponse(res); err != nil { 8012 return nil, err 8013 } 8014 ret := &Empty{ 8015 ServerResponse: googleapi.ServerResponse{ 8016 Header: res.Header, 8017 HTTPStatusCode: res.StatusCode, 8018 }, 8019 } 8020 target := &ret 8021 if err := gensupport.DecodeResponse(target, res); err != nil { 8022 return nil, err 8023 } 8024 return ret, nil 8025 // { 8026 // "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.", 8027 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8028 // "httpMethod": "POST", 8029 // "id": "classroom.courses.courseWork.studentSubmissions.reclaim", 8030 // "parameterOrder": [ 8031 // "courseId", 8032 // "courseWorkId", 8033 // "id" 8034 // ], 8035 // "parameters": { 8036 // "courseId": { 8037 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8038 // "location": "path", 8039 // "required": true, 8040 // "type": "string" 8041 // }, 8042 // "courseWorkId": { 8043 // "description": "Identifier of the course work.", 8044 // "location": "path", 8045 // "required": true, 8046 // "type": "string" 8047 // }, 8048 // "id": { 8049 // "description": "Identifier of the student submission.", 8050 // "location": "path", 8051 // "required": true, 8052 // "type": "string" 8053 // } 8054 // }, 8055 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8056 // "request": { 8057 // "$ref": "ReclaimStudentSubmissionRequest" 8058 // }, 8059 // "response": { 8060 // "$ref": "Empty" 8061 // }, 8062 // "scopes": [ 8063 // "https://www.googleapis.com/auth/classroom.coursework.me" 8064 // ] 8065 // } 8066 8067} 8068 8069// method id "classroom.courses.courseWork.studentSubmissions.return": 8070 8071type CoursesCourseWorkStudentSubmissionsReturnCall struct { 8072 s *Service 8073 courseId string 8074 courseWorkId string 8075 id string 8076 returnstudentsubmissionrequest *ReturnStudentSubmissionRequest 8077 urlParams_ gensupport.URLParams 8078 ctx_ context.Context 8079 header_ http.Header 8080} 8081 8082// Return: Returns a student submission. 8083// 8084// Returning a student submission transfers ownership of attached 8085// Drive 8086// files to the student and may also update the submission state. 8087// Unlike the Classroom application, returning a student submission does 8088// not 8089// set assignedGrade to the draftGrade value. 8090// 8091// Only a teacher of the course that contains the requested student 8092// submission 8093// may call this method. 8094// 8095// This request must be made by the Developer Console project of 8096// the 8097// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8098// used to 8099// create the corresponding course work item. 8100// 8101// This method returns the following error codes: 8102// 8103// * `PERMISSION_DENIED` if the requesting user is not permitted to 8104// access the 8105// requested course or course work, return the requested student 8106// submission, 8107// or for access errors. 8108// * `INVALID_ARGUMENT` if the request is malformed. 8109// * `NOT_FOUND` if the requested course, course work, or student 8110// submission 8111// does not exist. 8112func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall { 8113 c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8114 c.courseId = courseId 8115 c.courseWorkId = courseWorkId 8116 c.id = id 8117 c.returnstudentsubmissionrequest = returnstudentsubmissionrequest 8118 return c 8119} 8120 8121// Fields allows partial responses to be retrieved. See 8122// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8123// for more information. 8124func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall { 8125 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8126 return c 8127} 8128 8129// Context sets the context to be used in this call's Do method. Any 8130// pending HTTP request will be aborted if the provided context is 8131// canceled. 8132func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall { 8133 c.ctx_ = ctx 8134 return c 8135} 8136 8137// Header returns an http.Header that can be modified by the caller to 8138// add HTTP headers to the request. 8139func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header { 8140 if c.header_ == nil { 8141 c.header_ = make(http.Header) 8142 } 8143 return c.header_ 8144} 8145 8146func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) { 8147 reqHeaders := make(http.Header) 8148 for k, v := range c.header_ { 8149 reqHeaders[k] = v 8150 } 8151 reqHeaders.Set("User-Agent", c.s.userAgent()) 8152 var body io.Reader = nil 8153 body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest) 8154 if err != nil { 8155 return nil, err 8156 } 8157 reqHeaders.Set("Content-Type", "application/json") 8158 c.urlParams_.Set("alt", alt) 8159 c.urlParams_.Set("prettyPrint", "false") 8160 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return") 8161 urls += "?" + c.urlParams_.Encode() 8162 req, err := http.NewRequest("POST", urls, body) 8163 if err != nil { 8164 return nil, err 8165 } 8166 req.Header = reqHeaders 8167 googleapi.Expand(req.URL, map[string]string{ 8168 "courseId": c.courseId, 8169 "courseWorkId": c.courseWorkId, 8170 "id": c.id, 8171 }) 8172 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8173} 8174 8175// Do executes the "classroom.courses.courseWork.studentSubmissions.return" call. 8176// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8177// code is an error. Response headers are in either 8178// *Empty.ServerResponse.Header or (if a response was returned at all) 8179// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8180// check whether the returned error was because http.StatusNotModified 8181// was returned. 8182func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8183 gensupport.SetOptions(c.urlParams_, opts...) 8184 res, err := c.doRequest("json") 8185 if res != nil && res.StatusCode == http.StatusNotModified { 8186 if res.Body != nil { 8187 res.Body.Close() 8188 } 8189 return nil, &googleapi.Error{ 8190 Code: res.StatusCode, 8191 Header: res.Header, 8192 } 8193 } 8194 if err != nil { 8195 return nil, err 8196 } 8197 defer googleapi.CloseBody(res) 8198 if err := googleapi.CheckResponse(res); err != nil { 8199 return nil, err 8200 } 8201 ret := &Empty{ 8202 ServerResponse: googleapi.ServerResponse{ 8203 Header: res.Header, 8204 HTTPStatusCode: res.StatusCode, 8205 }, 8206 } 8207 target := &ret 8208 if err := gensupport.DecodeResponse(target, res); err != nil { 8209 return nil, err 8210 } 8211 return ret, nil 8212 // { 8213 // "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.", 8214 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8215 // "httpMethod": "POST", 8216 // "id": "classroom.courses.courseWork.studentSubmissions.return", 8217 // "parameterOrder": [ 8218 // "courseId", 8219 // "courseWorkId", 8220 // "id" 8221 // ], 8222 // "parameters": { 8223 // "courseId": { 8224 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8225 // "location": "path", 8226 // "required": true, 8227 // "type": "string" 8228 // }, 8229 // "courseWorkId": { 8230 // "description": "Identifier of the course work.", 8231 // "location": "path", 8232 // "required": true, 8233 // "type": "string" 8234 // }, 8235 // "id": { 8236 // "description": "Identifier of the student submission.", 8237 // "location": "path", 8238 // "required": true, 8239 // "type": "string" 8240 // } 8241 // }, 8242 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8243 // "request": { 8244 // "$ref": "ReturnStudentSubmissionRequest" 8245 // }, 8246 // "response": { 8247 // "$ref": "Empty" 8248 // }, 8249 // "scopes": [ 8250 // "https://www.googleapis.com/auth/classroom.coursework.students" 8251 // ] 8252 // } 8253 8254} 8255 8256// method id "classroom.courses.courseWork.studentSubmissions.turnIn": 8257 8258type CoursesCourseWorkStudentSubmissionsTurnInCall struct { 8259 s *Service 8260 courseId string 8261 courseWorkId string 8262 id string 8263 turninstudentsubmissionrequest *TurnInStudentSubmissionRequest 8264 urlParams_ gensupport.URLParams 8265 ctx_ context.Context 8266 header_ http.Header 8267} 8268 8269// TurnIn: Turns in a student submission. 8270// 8271// Turning in a student submission transfers ownership of attached 8272// Drive 8273// files to the teacher and may also update the submission state. 8274// 8275// This may only be called by the student that owns the specified 8276// student 8277// submission. 8278// 8279// This request must be made by the Developer Console project of 8280// the 8281// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8282// used to 8283// create the corresponding course work item. 8284// 8285// This method returns the following error codes: 8286// 8287// * `PERMISSION_DENIED` if the requesting user is not permitted to 8288// access the 8289// requested course or course work, turn in the requested student 8290// submission, 8291// or for access errors. 8292// * `INVALID_ARGUMENT` if the request is malformed. 8293// * `NOT_FOUND` if the requested course, course work, or student 8294// submission 8295// does not exist. 8296func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8297 c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8298 c.courseId = courseId 8299 c.courseWorkId = courseWorkId 8300 c.id = id 8301 c.turninstudentsubmissionrequest = turninstudentsubmissionrequest 8302 return c 8303} 8304 8305// Fields allows partial responses to be retrieved. See 8306// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8307// for more information. 8308func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8309 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8310 return c 8311} 8312 8313// Context sets the context to be used in this call's Do method. Any 8314// pending HTTP request will be aborted if the provided context is 8315// canceled. 8316func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8317 c.ctx_ = ctx 8318 return c 8319} 8320 8321// Header returns an http.Header that can be modified by the caller to 8322// add HTTP headers to the request. 8323func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header { 8324 if c.header_ == nil { 8325 c.header_ = make(http.Header) 8326 } 8327 return c.header_ 8328} 8329 8330func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) { 8331 reqHeaders := make(http.Header) 8332 for k, v := range c.header_ { 8333 reqHeaders[k] = v 8334 } 8335 reqHeaders.Set("User-Agent", c.s.userAgent()) 8336 var body io.Reader = nil 8337 body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest) 8338 if err != nil { 8339 return nil, err 8340 } 8341 reqHeaders.Set("Content-Type", "application/json") 8342 c.urlParams_.Set("alt", alt) 8343 c.urlParams_.Set("prettyPrint", "false") 8344 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn") 8345 urls += "?" + c.urlParams_.Encode() 8346 req, err := http.NewRequest("POST", urls, body) 8347 if err != nil { 8348 return nil, err 8349 } 8350 req.Header = reqHeaders 8351 googleapi.Expand(req.URL, map[string]string{ 8352 "courseId": c.courseId, 8353 "courseWorkId": c.courseWorkId, 8354 "id": c.id, 8355 }) 8356 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8357} 8358 8359// Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call. 8360// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8361// code is an error. Response headers are in either 8362// *Empty.ServerResponse.Header or (if a response was returned at all) 8363// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8364// check whether the returned error was because http.StatusNotModified 8365// was returned. 8366func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8367 gensupport.SetOptions(c.urlParams_, opts...) 8368 res, err := c.doRequest("json") 8369 if res != nil && res.StatusCode == http.StatusNotModified { 8370 if res.Body != nil { 8371 res.Body.Close() 8372 } 8373 return nil, &googleapi.Error{ 8374 Code: res.StatusCode, 8375 Header: res.Header, 8376 } 8377 } 8378 if err != nil { 8379 return nil, err 8380 } 8381 defer googleapi.CloseBody(res) 8382 if err := googleapi.CheckResponse(res); err != nil { 8383 return nil, err 8384 } 8385 ret := &Empty{ 8386 ServerResponse: googleapi.ServerResponse{ 8387 Header: res.Header, 8388 HTTPStatusCode: res.StatusCode, 8389 }, 8390 } 8391 target := &ret 8392 if err := gensupport.DecodeResponse(target, res); err != nil { 8393 return nil, err 8394 } 8395 return ret, nil 8396 // { 8397 // "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.", 8398 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8399 // "httpMethod": "POST", 8400 // "id": "classroom.courses.courseWork.studentSubmissions.turnIn", 8401 // "parameterOrder": [ 8402 // "courseId", 8403 // "courseWorkId", 8404 // "id" 8405 // ], 8406 // "parameters": { 8407 // "courseId": { 8408 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8409 // "location": "path", 8410 // "required": true, 8411 // "type": "string" 8412 // }, 8413 // "courseWorkId": { 8414 // "description": "Identifier of the course work.", 8415 // "location": "path", 8416 // "required": true, 8417 // "type": "string" 8418 // }, 8419 // "id": { 8420 // "description": "Identifier of the student submission.", 8421 // "location": "path", 8422 // "required": true, 8423 // "type": "string" 8424 // } 8425 // }, 8426 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8427 // "request": { 8428 // "$ref": "TurnInStudentSubmissionRequest" 8429 // }, 8430 // "response": { 8431 // "$ref": "Empty" 8432 // }, 8433 // "scopes": [ 8434 // "https://www.googleapis.com/auth/classroom.coursework.me" 8435 // ] 8436 // } 8437 8438} 8439 8440// method id "classroom.courses.students.create": 8441 8442type CoursesStudentsCreateCall struct { 8443 s *Service 8444 courseId string 8445 student *Student 8446 urlParams_ gensupport.URLParams 8447 ctx_ context.Context 8448 header_ http.Header 8449} 8450 8451// Create: Adds a user as a student of a course. 8452// 8453// This method returns the following error codes: 8454// 8455// * `PERMISSION_DENIED` if the requesting user is not permitted to 8456// create 8457// students in this course or for access errors. 8458// * `NOT_FOUND` if the requested course ID does not exist. 8459// * `FAILED_PRECONDITION` if the requested user's account is 8460// disabled, 8461// for the following request errors: 8462// * CourseMemberLimitReached 8463// * CourseNotModifiable 8464// * UserGroupsMembershipLimitReached 8465// * `ALREADY_EXISTS` if the user is already a student or teacher in 8466// the 8467// course. 8468func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall { 8469 c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8470 c.courseId = courseId 8471 c.student = student 8472 return c 8473} 8474 8475// EnrollmentCode sets the optional parameter "enrollmentCode": 8476// Enrollment code of the course to create the student in. 8477// This code is required if userId 8478// corresponds to the requesting user; it may be omitted if the 8479// requesting 8480// user has administrative permissions to create students for any user. 8481func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall { 8482 c.urlParams_.Set("enrollmentCode", enrollmentCode) 8483 return c 8484} 8485 8486// Fields allows partial responses to be retrieved. See 8487// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8488// for more information. 8489func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall { 8490 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8491 return c 8492} 8493 8494// Context sets the context to be used in this call's Do method. Any 8495// pending HTTP request will be aborted if the provided context is 8496// canceled. 8497func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall { 8498 c.ctx_ = ctx 8499 return c 8500} 8501 8502// Header returns an http.Header that can be modified by the caller to 8503// add HTTP headers to the request. 8504func (c *CoursesStudentsCreateCall) Header() http.Header { 8505 if c.header_ == nil { 8506 c.header_ = make(http.Header) 8507 } 8508 return c.header_ 8509} 8510 8511func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) { 8512 reqHeaders := make(http.Header) 8513 for k, v := range c.header_ { 8514 reqHeaders[k] = v 8515 } 8516 reqHeaders.Set("User-Agent", c.s.userAgent()) 8517 var body io.Reader = nil 8518 body, err := googleapi.WithoutDataWrapper.JSONReader(c.student) 8519 if err != nil { 8520 return nil, err 8521 } 8522 reqHeaders.Set("Content-Type", "application/json") 8523 c.urlParams_.Set("alt", alt) 8524 c.urlParams_.Set("prettyPrint", "false") 8525 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 8526 urls += "?" + c.urlParams_.Encode() 8527 req, err := http.NewRequest("POST", urls, body) 8528 if err != nil { 8529 return nil, err 8530 } 8531 req.Header = reqHeaders 8532 googleapi.Expand(req.URL, map[string]string{ 8533 "courseId": c.courseId, 8534 }) 8535 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8536} 8537 8538// Do executes the "classroom.courses.students.create" call. 8539// Exactly one of *Student or error will be non-nil. Any non-2xx status 8540// code is an error. Response headers are in either 8541// *Student.ServerResponse.Header or (if a response was returned at all) 8542// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8543// check whether the returned error was because http.StatusNotModified 8544// was returned. 8545func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8546 gensupport.SetOptions(c.urlParams_, opts...) 8547 res, err := c.doRequest("json") 8548 if res != nil && res.StatusCode == http.StatusNotModified { 8549 if res.Body != nil { 8550 res.Body.Close() 8551 } 8552 return nil, &googleapi.Error{ 8553 Code: res.StatusCode, 8554 Header: res.Header, 8555 } 8556 } 8557 if err != nil { 8558 return nil, err 8559 } 8560 defer googleapi.CloseBody(res) 8561 if err := googleapi.CheckResponse(res); err != nil { 8562 return nil, err 8563 } 8564 ret := &Student{ 8565 ServerResponse: googleapi.ServerResponse{ 8566 Header: res.Header, 8567 HTTPStatusCode: res.StatusCode, 8568 }, 8569 } 8570 target := &ret 8571 if err := gensupport.DecodeResponse(target, res); err != nil { 8572 return nil, err 8573 } 8574 return ret, nil 8575 // { 8576 // "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.", 8577 // "flatPath": "v1/courses/{courseId}/students", 8578 // "httpMethod": "POST", 8579 // "id": "classroom.courses.students.create", 8580 // "parameterOrder": [ 8581 // "courseId" 8582 // ], 8583 // "parameters": { 8584 // "courseId": { 8585 // "description": "Identifier of the course to create the student in.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8586 // "location": "path", 8587 // "required": true, 8588 // "type": "string" 8589 // }, 8590 // "enrollmentCode": { 8591 // "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.", 8592 // "location": "query", 8593 // "type": "string" 8594 // } 8595 // }, 8596 // "path": "v1/courses/{courseId}/students", 8597 // "request": { 8598 // "$ref": "Student" 8599 // }, 8600 // "response": { 8601 // "$ref": "Student" 8602 // }, 8603 // "scopes": [ 8604 // "https://www.googleapis.com/auth/classroom.profile.emails", 8605 // "https://www.googleapis.com/auth/classroom.profile.photos", 8606 // "https://www.googleapis.com/auth/classroom.rosters" 8607 // ] 8608 // } 8609 8610} 8611 8612// method id "classroom.courses.students.delete": 8613 8614type CoursesStudentsDeleteCall struct { 8615 s *Service 8616 courseId string 8617 userId string 8618 urlParams_ gensupport.URLParams 8619 ctx_ context.Context 8620 header_ http.Header 8621} 8622 8623// Delete: Deletes a student of a course. 8624// 8625// This method returns the following error codes: 8626// 8627// * `PERMISSION_DENIED` if the requesting user is not permitted to 8628// delete 8629// students of this course or for access errors. 8630// * `NOT_FOUND` if no student of this course has the requested ID or if 8631// the 8632// course does not exist. 8633func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall { 8634 c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8635 c.courseId = courseId 8636 c.userId = userId 8637 return c 8638} 8639 8640// Fields allows partial responses to be retrieved. See 8641// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8642// for more information. 8643func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall { 8644 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8645 return c 8646} 8647 8648// Context sets the context to be used in this call's Do method. Any 8649// pending HTTP request will be aborted if the provided context is 8650// canceled. 8651func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall { 8652 c.ctx_ = ctx 8653 return c 8654} 8655 8656// Header returns an http.Header that can be modified by the caller to 8657// add HTTP headers to the request. 8658func (c *CoursesStudentsDeleteCall) Header() http.Header { 8659 if c.header_ == nil { 8660 c.header_ = make(http.Header) 8661 } 8662 return c.header_ 8663} 8664 8665func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) { 8666 reqHeaders := make(http.Header) 8667 for k, v := range c.header_ { 8668 reqHeaders[k] = v 8669 } 8670 reqHeaders.Set("User-Agent", c.s.userAgent()) 8671 var body io.Reader = nil 8672 c.urlParams_.Set("alt", alt) 8673 c.urlParams_.Set("prettyPrint", "false") 8674 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8675 urls += "?" + c.urlParams_.Encode() 8676 req, err := http.NewRequest("DELETE", urls, body) 8677 if err != nil { 8678 return nil, err 8679 } 8680 req.Header = reqHeaders 8681 googleapi.Expand(req.URL, map[string]string{ 8682 "courseId": c.courseId, 8683 "userId": c.userId, 8684 }) 8685 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8686} 8687 8688// Do executes the "classroom.courses.students.delete" call. 8689// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8690// code is an error. Response headers are in either 8691// *Empty.ServerResponse.Header or (if a response was returned at all) 8692// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8693// check whether the returned error was because http.StatusNotModified 8694// was returned. 8695func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8696 gensupport.SetOptions(c.urlParams_, opts...) 8697 res, err := c.doRequest("json") 8698 if res != nil && res.StatusCode == http.StatusNotModified { 8699 if res.Body != nil { 8700 res.Body.Close() 8701 } 8702 return nil, &googleapi.Error{ 8703 Code: res.StatusCode, 8704 Header: res.Header, 8705 } 8706 } 8707 if err != nil { 8708 return nil, err 8709 } 8710 defer googleapi.CloseBody(res) 8711 if err := googleapi.CheckResponse(res); err != nil { 8712 return nil, err 8713 } 8714 ret := &Empty{ 8715 ServerResponse: googleapi.ServerResponse{ 8716 Header: res.Header, 8717 HTTPStatusCode: res.StatusCode, 8718 }, 8719 } 8720 target := &ret 8721 if err := gensupport.DecodeResponse(target, res); err != nil { 8722 return nil, err 8723 } 8724 return ret, nil 8725 // { 8726 // "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.", 8727 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8728 // "httpMethod": "DELETE", 8729 // "id": "classroom.courses.students.delete", 8730 // "parameterOrder": [ 8731 // "courseId", 8732 // "userId" 8733 // ], 8734 // "parameters": { 8735 // "courseId": { 8736 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8737 // "location": "path", 8738 // "required": true, 8739 // "type": "string" 8740 // }, 8741 // "userId": { 8742 // "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", 8743 // "location": "path", 8744 // "required": true, 8745 // "type": "string" 8746 // } 8747 // }, 8748 // "path": "v1/courses/{courseId}/students/{userId}", 8749 // "response": { 8750 // "$ref": "Empty" 8751 // }, 8752 // "scopes": [ 8753 // "https://www.googleapis.com/auth/classroom.rosters" 8754 // ] 8755 // } 8756 8757} 8758 8759// method id "classroom.courses.students.get": 8760 8761type CoursesStudentsGetCall struct { 8762 s *Service 8763 courseId string 8764 userId string 8765 urlParams_ gensupport.URLParams 8766 ifNoneMatch_ string 8767 ctx_ context.Context 8768 header_ http.Header 8769} 8770 8771// Get: Returns a student of a course. 8772// 8773// This method returns the following error codes: 8774// 8775// * `PERMISSION_DENIED` if the requesting user is not permitted to 8776// view 8777// students of this course or for access errors. 8778// * `NOT_FOUND` if no student of this course has the requested ID or if 8779// the 8780// course does not exist. 8781func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall { 8782 c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8783 c.courseId = courseId 8784 c.userId = userId 8785 return c 8786} 8787 8788// Fields allows partial responses to be retrieved. See 8789// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8790// for more information. 8791func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall { 8792 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8793 return c 8794} 8795 8796// IfNoneMatch sets the optional parameter which makes the operation 8797// fail if the object's ETag matches the given value. This is useful for 8798// getting updates only after the object has changed since the last 8799// request. Use googleapi.IsNotModified to check whether the response 8800// error from Do is the result of In-None-Match. 8801func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall { 8802 c.ifNoneMatch_ = entityTag 8803 return c 8804} 8805 8806// Context sets the context to be used in this call's Do method. Any 8807// pending HTTP request will be aborted if the provided context is 8808// canceled. 8809func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall { 8810 c.ctx_ = ctx 8811 return c 8812} 8813 8814// Header returns an http.Header that can be modified by the caller to 8815// add HTTP headers to the request. 8816func (c *CoursesStudentsGetCall) Header() http.Header { 8817 if c.header_ == nil { 8818 c.header_ = make(http.Header) 8819 } 8820 return c.header_ 8821} 8822 8823func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) { 8824 reqHeaders := make(http.Header) 8825 for k, v := range c.header_ { 8826 reqHeaders[k] = v 8827 } 8828 reqHeaders.Set("User-Agent", c.s.userAgent()) 8829 if c.ifNoneMatch_ != "" { 8830 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8831 } 8832 var body io.Reader = nil 8833 c.urlParams_.Set("alt", alt) 8834 c.urlParams_.Set("prettyPrint", "false") 8835 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8836 urls += "?" + c.urlParams_.Encode() 8837 req, err := http.NewRequest("GET", urls, body) 8838 if err != nil { 8839 return nil, err 8840 } 8841 req.Header = reqHeaders 8842 googleapi.Expand(req.URL, map[string]string{ 8843 "courseId": c.courseId, 8844 "userId": c.userId, 8845 }) 8846 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8847} 8848 8849// Do executes the "classroom.courses.students.get" call. 8850// Exactly one of *Student or error will be non-nil. Any non-2xx status 8851// code is an error. Response headers are in either 8852// *Student.ServerResponse.Header or (if a response was returned at all) 8853// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8854// check whether the returned error was because http.StatusNotModified 8855// was returned. 8856func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8857 gensupport.SetOptions(c.urlParams_, opts...) 8858 res, err := c.doRequest("json") 8859 if res != nil && res.StatusCode == http.StatusNotModified { 8860 if res.Body != nil { 8861 res.Body.Close() 8862 } 8863 return nil, &googleapi.Error{ 8864 Code: res.StatusCode, 8865 Header: res.Header, 8866 } 8867 } 8868 if err != nil { 8869 return nil, err 8870 } 8871 defer googleapi.CloseBody(res) 8872 if err := googleapi.CheckResponse(res); err != nil { 8873 return nil, err 8874 } 8875 ret := &Student{ 8876 ServerResponse: googleapi.ServerResponse{ 8877 Header: res.Header, 8878 HTTPStatusCode: res.StatusCode, 8879 }, 8880 } 8881 target := &ret 8882 if err := gensupport.DecodeResponse(target, res); err != nil { 8883 return nil, err 8884 } 8885 return ret, nil 8886 // { 8887 // "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.", 8888 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8889 // "httpMethod": "GET", 8890 // "id": "classroom.courses.students.get", 8891 // "parameterOrder": [ 8892 // "courseId", 8893 // "userId" 8894 // ], 8895 // "parameters": { 8896 // "courseId": { 8897 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8898 // "location": "path", 8899 // "required": true, 8900 // "type": "string" 8901 // }, 8902 // "userId": { 8903 // "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", 8904 // "location": "path", 8905 // "required": true, 8906 // "type": "string" 8907 // } 8908 // }, 8909 // "path": "v1/courses/{courseId}/students/{userId}", 8910 // "response": { 8911 // "$ref": "Student" 8912 // }, 8913 // "scopes": [ 8914 // "https://www.googleapis.com/auth/classroom.profile.emails", 8915 // "https://www.googleapis.com/auth/classroom.profile.photos", 8916 // "https://www.googleapis.com/auth/classroom.rosters", 8917 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 8918 // ] 8919 // } 8920 8921} 8922 8923// method id "classroom.courses.students.list": 8924 8925type CoursesStudentsListCall struct { 8926 s *Service 8927 courseId string 8928 urlParams_ gensupport.URLParams 8929 ifNoneMatch_ string 8930 ctx_ context.Context 8931 header_ http.Header 8932} 8933 8934// List: Returns a list of students of this course that the requester 8935// is permitted to view. 8936// 8937// This method returns the following error codes: 8938// 8939// * `NOT_FOUND` if the course does not exist. 8940// * `PERMISSION_DENIED` for access errors. 8941func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall { 8942 c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8943 c.courseId = courseId 8944 return c 8945} 8946 8947// PageSize sets the optional parameter "pageSize": Maximum number of 8948// items to return. Zero means no maximum. 8949// 8950// The server may return fewer than the specified number of results. 8951func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall { 8952 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8953 return c 8954} 8955 8956// PageToken sets the optional parameter "pageToken": 8957// nextPageToken 8958// value returned from a previous 8959// list call, indicating that 8960// the subsequent page of results should be returned. 8961// 8962// The list request must be 8963// otherwise identical to the one that resulted in this token. 8964func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall { 8965 c.urlParams_.Set("pageToken", pageToken) 8966 return c 8967} 8968 8969// Fields allows partial responses to be retrieved. See 8970// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8971// for more information. 8972func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall { 8973 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8974 return c 8975} 8976 8977// IfNoneMatch sets the optional parameter which makes the operation 8978// fail if the object's ETag matches the given value. This is useful for 8979// getting updates only after the object has changed since the last 8980// request. Use googleapi.IsNotModified to check whether the response 8981// error from Do is the result of In-None-Match. 8982func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall { 8983 c.ifNoneMatch_ = entityTag 8984 return c 8985} 8986 8987// Context sets the context to be used in this call's Do method. Any 8988// pending HTTP request will be aborted if the provided context is 8989// canceled. 8990func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall { 8991 c.ctx_ = ctx 8992 return c 8993} 8994 8995// Header returns an http.Header that can be modified by the caller to 8996// add HTTP headers to the request. 8997func (c *CoursesStudentsListCall) Header() http.Header { 8998 if c.header_ == nil { 8999 c.header_ = make(http.Header) 9000 } 9001 return c.header_ 9002} 9003 9004func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) { 9005 reqHeaders := make(http.Header) 9006 for k, v := range c.header_ { 9007 reqHeaders[k] = v 9008 } 9009 reqHeaders.Set("User-Agent", c.s.userAgent()) 9010 if c.ifNoneMatch_ != "" { 9011 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9012 } 9013 var body io.Reader = nil 9014 c.urlParams_.Set("alt", alt) 9015 c.urlParams_.Set("prettyPrint", "false") 9016 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9017 urls += "?" + c.urlParams_.Encode() 9018 req, err := http.NewRequest("GET", urls, body) 9019 if err != nil { 9020 return nil, err 9021 } 9022 req.Header = reqHeaders 9023 googleapi.Expand(req.URL, map[string]string{ 9024 "courseId": c.courseId, 9025 }) 9026 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9027} 9028 9029// Do executes the "classroom.courses.students.list" call. 9030// Exactly one of *ListStudentsResponse or error will be non-nil. Any 9031// non-2xx status code is an error. Response headers are in either 9032// *ListStudentsResponse.ServerResponse.Header or (if a response was 9033// returned at all) in error.(*googleapi.Error).Header. Use 9034// googleapi.IsNotModified to check whether the returned error was 9035// because http.StatusNotModified was returned. 9036func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) { 9037 gensupport.SetOptions(c.urlParams_, opts...) 9038 res, err := c.doRequest("json") 9039 if res != nil && res.StatusCode == http.StatusNotModified { 9040 if res.Body != nil { 9041 res.Body.Close() 9042 } 9043 return nil, &googleapi.Error{ 9044 Code: res.StatusCode, 9045 Header: res.Header, 9046 } 9047 } 9048 if err != nil { 9049 return nil, err 9050 } 9051 defer googleapi.CloseBody(res) 9052 if err := googleapi.CheckResponse(res); err != nil { 9053 return nil, err 9054 } 9055 ret := &ListStudentsResponse{ 9056 ServerResponse: googleapi.ServerResponse{ 9057 Header: res.Header, 9058 HTTPStatusCode: res.StatusCode, 9059 }, 9060 } 9061 target := &ret 9062 if err := gensupport.DecodeResponse(target, res); err != nil { 9063 return nil, err 9064 } 9065 return ret, nil 9066 // { 9067 // "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.", 9068 // "flatPath": "v1/courses/{courseId}/students", 9069 // "httpMethod": "GET", 9070 // "id": "classroom.courses.students.list", 9071 // "parameterOrder": [ 9072 // "courseId" 9073 // ], 9074 // "parameters": { 9075 // "courseId": { 9076 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9077 // "location": "path", 9078 // "required": true, 9079 // "type": "string" 9080 // }, 9081 // "pageSize": { 9082 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9083 // "format": "int32", 9084 // "location": "query", 9085 // "type": "integer" 9086 // }, 9087 // "pageToken": { 9088 // "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.", 9089 // "location": "query", 9090 // "type": "string" 9091 // } 9092 // }, 9093 // "path": "v1/courses/{courseId}/students", 9094 // "response": { 9095 // "$ref": "ListStudentsResponse" 9096 // }, 9097 // "scopes": [ 9098 // "https://www.googleapis.com/auth/classroom.profile.emails", 9099 // "https://www.googleapis.com/auth/classroom.profile.photos", 9100 // "https://www.googleapis.com/auth/classroom.rosters", 9101 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9102 // ] 9103 // } 9104 9105} 9106 9107// Pages invokes f for each page of results. 9108// A non-nil error returned from f will halt the iteration. 9109// The provided context supersedes any context provided to the Context method. 9110func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error { 9111 c.ctx_ = ctx 9112 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9113 for { 9114 x, err := c.Do() 9115 if err != nil { 9116 return err 9117 } 9118 if err := f(x); err != nil { 9119 return err 9120 } 9121 if x.NextPageToken == "" { 9122 return nil 9123 } 9124 c.PageToken(x.NextPageToken) 9125 } 9126} 9127 9128// method id "classroom.courses.teachers.create": 9129 9130type CoursesTeachersCreateCall struct { 9131 s *Service 9132 courseId string 9133 teacher *Teacher 9134 urlParams_ gensupport.URLParams 9135 ctx_ context.Context 9136 header_ http.Header 9137} 9138 9139// Create: Creates a teacher of a course. 9140// 9141// This method returns the following error codes: 9142// 9143// * `PERMISSION_DENIED` if the requesting user is not permitted to 9144// create 9145// teachers in this course or for access errors. 9146// * `NOT_FOUND` if the requested course ID does not exist. 9147// * `FAILED_PRECONDITION` if the requested user's account is 9148// disabled, 9149// for the following request errors: 9150// * CourseMemberLimitReached 9151// * CourseNotModifiable 9152// * CourseTeacherLimitReached 9153// * UserGroupsMembershipLimitReached 9154// * `ALREADY_EXISTS` if the user is already a teacher or student in 9155// the 9156// course. 9157func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall { 9158 c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9159 c.courseId = courseId 9160 c.teacher = teacher 9161 return c 9162} 9163 9164// Fields allows partial responses to be retrieved. See 9165// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9166// for more information. 9167func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall { 9168 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9169 return c 9170} 9171 9172// Context sets the context to be used in this call's Do method. Any 9173// pending HTTP request will be aborted if the provided context is 9174// canceled. 9175func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall { 9176 c.ctx_ = ctx 9177 return c 9178} 9179 9180// Header returns an http.Header that can be modified by the caller to 9181// add HTTP headers to the request. 9182func (c *CoursesTeachersCreateCall) Header() http.Header { 9183 if c.header_ == nil { 9184 c.header_ = make(http.Header) 9185 } 9186 return c.header_ 9187} 9188 9189func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) { 9190 reqHeaders := make(http.Header) 9191 for k, v := range c.header_ { 9192 reqHeaders[k] = v 9193 } 9194 reqHeaders.Set("User-Agent", c.s.userAgent()) 9195 var body io.Reader = nil 9196 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher) 9197 if err != nil { 9198 return nil, err 9199 } 9200 reqHeaders.Set("Content-Type", "application/json") 9201 c.urlParams_.Set("alt", alt) 9202 c.urlParams_.Set("prettyPrint", "false") 9203 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9204 urls += "?" + c.urlParams_.Encode() 9205 req, err := http.NewRequest("POST", urls, body) 9206 if err != nil { 9207 return nil, err 9208 } 9209 req.Header = reqHeaders 9210 googleapi.Expand(req.URL, map[string]string{ 9211 "courseId": c.courseId, 9212 }) 9213 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9214} 9215 9216// Do executes the "classroom.courses.teachers.create" call. 9217// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9218// code is an error. Response headers are in either 9219// *Teacher.ServerResponse.Header or (if a response was returned at all) 9220// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9221// check whether the returned error was because http.StatusNotModified 9222// was returned. 9223func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9224 gensupport.SetOptions(c.urlParams_, opts...) 9225 res, err := c.doRequest("json") 9226 if res != nil && res.StatusCode == http.StatusNotModified { 9227 if res.Body != nil { 9228 res.Body.Close() 9229 } 9230 return nil, &googleapi.Error{ 9231 Code: res.StatusCode, 9232 Header: res.Header, 9233 } 9234 } 9235 if err != nil { 9236 return nil, err 9237 } 9238 defer googleapi.CloseBody(res) 9239 if err := googleapi.CheckResponse(res); err != nil { 9240 return nil, err 9241 } 9242 ret := &Teacher{ 9243 ServerResponse: googleapi.ServerResponse{ 9244 Header: res.Header, 9245 HTTPStatusCode: res.StatusCode, 9246 }, 9247 } 9248 target := &ret 9249 if err := gensupport.DecodeResponse(target, res); err != nil { 9250 return nil, err 9251 } 9252 return ret, nil 9253 // { 9254 // "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.", 9255 // "flatPath": "v1/courses/{courseId}/teachers", 9256 // "httpMethod": "POST", 9257 // "id": "classroom.courses.teachers.create", 9258 // "parameterOrder": [ 9259 // "courseId" 9260 // ], 9261 // "parameters": { 9262 // "courseId": { 9263 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9264 // "location": "path", 9265 // "required": true, 9266 // "type": "string" 9267 // } 9268 // }, 9269 // "path": "v1/courses/{courseId}/teachers", 9270 // "request": { 9271 // "$ref": "Teacher" 9272 // }, 9273 // "response": { 9274 // "$ref": "Teacher" 9275 // }, 9276 // "scopes": [ 9277 // "https://www.googleapis.com/auth/classroom.profile.emails", 9278 // "https://www.googleapis.com/auth/classroom.profile.photos", 9279 // "https://www.googleapis.com/auth/classroom.rosters" 9280 // ] 9281 // } 9282 9283} 9284 9285// method id "classroom.courses.teachers.delete": 9286 9287type CoursesTeachersDeleteCall struct { 9288 s *Service 9289 courseId string 9290 userId string 9291 urlParams_ gensupport.URLParams 9292 ctx_ context.Context 9293 header_ http.Header 9294} 9295 9296// Delete: Deletes a teacher of a course. 9297// 9298// This method returns the following error codes: 9299// 9300// * `PERMISSION_DENIED` if the requesting user is not permitted to 9301// delete 9302// teachers of this course or for access errors. 9303// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9304// the 9305// course does not exist. 9306// * `FAILED_PRECONDITION` if the requested ID belongs to the primary 9307// teacher 9308// of this course. 9309func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall { 9310 c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9311 c.courseId = courseId 9312 c.userId = userId 9313 return c 9314} 9315 9316// Fields allows partial responses to be retrieved. See 9317// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9318// for more information. 9319func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall { 9320 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9321 return c 9322} 9323 9324// Context sets the context to be used in this call's Do method. Any 9325// pending HTTP request will be aborted if the provided context is 9326// canceled. 9327func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall { 9328 c.ctx_ = ctx 9329 return c 9330} 9331 9332// Header returns an http.Header that can be modified by the caller to 9333// add HTTP headers to the request. 9334func (c *CoursesTeachersDeleteCall) Header() http.Header { 9335 if c.header_ == nil { 9336 c.header_ = make(http.Header) 9337 } 9338 return c.header_ 9339} 9340 9341func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) { 9342 reqHeaders := make(http.Header) 9343 for k, v := range c.header_ { 9344 reqHeaders[k] = v 9345 } 9346 reqHeaders.Set("User-Agent", c.s.userAgent()) 9347 var body io.Reader = nil 9348 c.urlParams_.Set("alt", alt) 9349 c.urlParams_.Set("prettyPrint", "false") 9350 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9351 urls += "?" + c.urlParams_.Encode() 9352 req, err := http.NewRequest("DELETE", urls, body) 9353 if err != nil { 9354 return nil, err 9355 } 9356 req.Header = reqHeaders 9357 googleapi.Expand(req.URL, map[string]string{ 9358 "courseId": c.courseId, 9359 "userId": c.userId, 9360 }) 9361 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9362} 9363 9364// Do executes the "classroom.courses.teachers.delete" call. 9365// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9366// code is an error. Response headers are in either 9367// *Empty.ServerResponse.Header or (if a response was returned at all) 9368// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9369// check whether the returned error was because http.StatusNotModified 9370// was returned. 9371func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9372 gensupport.SetOptions(c.urlParams_, opts...) 9373 res, err := c.doRequest("json") 9374 if res != nil && res.StatusCode == http.StatusNotModified { 9375 if res.Body != nil { 9376 res.Body.Close() 9377 } 9378 return nil, &googleapi.Error{ 9379 Code: res.StatusCode, 9380 Header: res.Header, 9381 } 9382 } 9383 if err != nil { 9384 return nil, err 9385 } 9386 defer googleapi.CloseBody(res) 9387 if err := googleapi.CheckResponse(res); err != nil { 9388 return nil, err 9389 } 9390 ret := &Empty{ 9391 ServerResponse: googleapi.ServerResponse{ 9392 Header: res.Header, 9393 HTTPStatusCode: res.StatusCode, 9394 }, 9395 } 9396 target := &ret 9397 if err := gensupport.DecodeResponse(target, res); err != nil { 9398 return nil, err 9399 } 9400 return ret, nil 9401 // { 9402 // "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.", 9403 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9404 // "httpMethod": "DELETE", 9405 // "id": "classroom.courses.teachers.delete", 9406 // "parameterOrder": [ 9407 // "courseId", 9408 // "userId" 9409 // ], 9410 // "parameters": { 9411 // "courseId": { 9412 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9413 // "location": "path", 9414 // "required": true, 9415 // "type": "string" 9416 // }, 9417 // "userId": { 9418 // "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", 9419 // "location": "path", 9420 // "required": true, 9421 // "type": "string" 9422 // } 9423 // }, 9424 // "path": "v1/courses/{courseId}/teachers/{userId}", 9425 // "response": { 9426 // "$ref": "Empty" 9427 // }, 9428 // "scopes": [ 9429 // "https://www.googleapis.com/auth/classroom.rosters" 9430 // ] 9431 // } 9432 9433} 9434 9435// method id "classroom.courses.teachers.get": 9436 9437type CoursesTeachersGetCall struct { 9438 s *Service 9439 courseId string 9440 userId string 9441 urlParams_ gensupport.URLParams 9442 ifNoneMatch_ string 9443 ctx_ context.Context 9444 header_ http.Header 9445} 9446 9447// Get: Returns a teacher of a course. 9448// 9449// This method returns the following error codes: 9450// 9451// * `PERMISSION_DENIED` if the requesting user is not permitted to 9452// view 9453// teachers of this course or for access errors. 9454// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9455// the 9456// course does not exist. 9457func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall { 9458 c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9459 c.courseId = courseId 9460 c.userId = userId 9461 return c 9462} 9463 9464// Fields allows partial responses to be retrieved. See 9465// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9466// for more information. 9467func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall { 9468 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9469 return c 9470} 9471 9472// IfNoneMatch sets the optional parameter which makes the operation 9473// fail if the object's ETag matches the given value. This is useful for 9474// getting updates only after the object has changed since the last 9475// request. Use googleapi.IsNotModified to check whether the response 9476// error from Do is the result of In-None-Match. 9477func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall { 9478 c.ifNoneMatch_ = entityTag 9479 return c 9480} 9481 9482// Context sets the context to be used in this call's Do method. Any 9483// pending HTTP request will be aborted if the provided context is 9484// canceled. 9485func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall { 9486 c.ctx_ = ctx 9487 return c 9488} 9489 9490// Header returns an http.Header that can be modified by the caller to 9491// add HTTP headers to the request. 9492func (c *CoursesTeachersGetCall) Header() http.Header { 9493 if c.header_ == nil { 9494 c.header_ = make(http.Header) 9495 } 9496 return c.header_ 9497} 9498 9499func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) { 9500 reqHeaders := make(http.Header) 9501 for k, v := range c.header_ { 9502 reqHeaders[k] = v 9503 } 9504 reqHeaders.Set("User-Agent", c.s.userAgent()) 9505 if c.ifNoneMatch_ != "" { 9506 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9507 } 9508 var body io.Reader = nil 9509 c.urlParams_.Set("alt", alt) 9510 c.urlParams_.Set("prettyPrint", "false") 9511 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9512 urls += "?" + c.urlParams_.Encode() 9513 req, err := http.NewRequest("GET", urls, body) 9514 if err != nil { 9515 return nil, err 9516 } 9517 req.Header = reqHeaders 9518 googleapi.Expand(req.URL, map[string]string{ 9519 "courseId": c.courseId, 9520 "userId": c.userId, 9521 }) 9522 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9523} 9524 9525// Do executes the "classroom.courses.teachers.get" call. 9526// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9527// code is an error. Response headers are in either 9528// *Teacher.ServerResponse.Header or (if a response was returned at all) 9529// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9530// check whether the returned error was because http.StatusNotModified 9531// was returned. 9532func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9533 gensupport.SetOptions(c.urlParams_, opts...) 9534 res, err := c.doRequest("json") 9535 if res != nil && res.StatusCode == http.StatusNotModified { 9536 if res.Body != nil { 9537 res.Body.Close() 9538 } 9539 return nil, &googleapi.Error{ 9540 Code: res.StatusCode, 9541 Header: res.Header, 9542 } 9543 } 9544 if err != nil { 9545 return nil, err 9546 } 9547 defer googleapi.CloseBody(res) 9548 if err := googleapi.CheckResponse(res); err != nil { 9549 return nil, err 9550 } 9551 ret := &Teacher{ 9552 ServerResponse: googleapi.ServerResponse{ 9553 Header: res.Header, 9554 HTTPStatusCode: res.StatusCode, 9555 }, 9556 } 9557 target := &ret 9558 if err := gensupport.DecodeResponse(target, res); err != nil { 9559 return nil, err 9560 } 9561 return ret, nil 9562 // { 9563 // "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.", 9564 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9565 // "httpMethod": "GET", 9566 // "id": "classroom.courses.teachers.get", 9567 // "parameterOrder": [ 9568 // "courseId", 9569 // "userId" 9570 // ], 9571 // "parameters": { 9572 // "courseId": { 9573 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9574 // "location": "path", 9575 // "required": true, 9576 // "type": "string" 9577 // }, 9578 // "userId": { 9579 // "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", 9580 // "location": "path", 9581 // "required": true, 9582 // "type": "string" 9583 // } 9584 // }, 9585 // "path": "v1/courses/{courseId}/teachers/{userId}", 9586 // "response": { 9587 // "$ref": "Teacher" 9588 // }, 9589 // "scopes": [ 9590 // "https://www.googleapis.com/auth/classroom.profile.emails", 9591 // "https://www.googleapis.com/auth/classroom.profile.photos", 9592 // "https://www.googleapis.com/auth/classroom.rosters", 9593 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9594 // ] 9595 // } 9596 9597} 9598 9599// method id "classroom.courses.teachers.list": 9600 9601type CoursesTeachersListCall struct { 9602 s *Service 9603 courseId string 9604 urlParams_ gensupport.URLParams 9605 ifNoneMatch_ string 9606 ctx_ context.Context 9607 header_ http.Header 9608} 9609 9610// List: Returns a list of teachers of this course that the requester 9611// is permitted to view. 9612// 9613// This method returns the following error codes: 9614// 9615// * `NOT_FOUND` if the course does not exist. 9616// * `PERMISSION_DENIED` for access errors. 9617func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall { 9618 c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9619 c.courseId = courseId 9620 return c 9621} 9622 9623// PageSize sets the optional parameter "pageSize": Maximum number of 9624// items to return. Zero means no maximum. 9625// 9626// The server may return fewer than the specified number of results. 9627func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall { 9628 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9629 return c 9630} 9631 9632// PageToken sets the optional parameter "pageToken": 9633// nextPageToken 9634// value returned from a previous 9635// list call, indicating that 9636// the subsequent page of results should be returned. 9637// 9638// The list request must be 9639// otherwise identical to the one that resulted in this token. 9640func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall { 9641 c.urlParams_.Set("pageToken", pageToken) 9642 return c 9643} 9644 9645// Fields allows partial responses to be retrieved. See 9646// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9647// for more information. 9648func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall { 9649 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9650 return c 9651} 9652 9653// IfNoneMatch sets the optional parameter which makes the operation 9654// fail if the object's ETag matches the given value. This is useful for 9655// getting updates only after the object has changed since the last 9656// request. Use googleapi.IsNotModified to check whether the response 9657// error from Do is the result of In-None-Match. 9658func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall { 9659 c.ifNoneMatch_ = entityTag 9660 return c 9661} 9662 9663// Context sets the context to be used in this call's Do method. Any 9664// pending HTTP request will be aborted if the provided context is 9665// canceled. 9666func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall { 9667 c.ctx_ = ctx 9668 return c 9669} 9670 9671// Header returns an http.Header that can be modified by the caller to 9672// add HTTP headers to the request. 9673func (c *CoursesTeachersListCall) Header() http.Header { 9674 if c.header_ == nil { 9675 c.header_ = make(http.Header) 9676 } 9677 return c.header_ 9678} 9679 9680func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) { 9681 reqHeaders := make(http.Header) 9682 for k, v := range c.header_ { 9683 reqHeaders[k] = v 9684 } 9685 reqHeaders.Set("User-Agent", c.s.userAgent()) 9686 if c.ifNoneMatch_ != "" { 9687 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9688 } 9689 var body io.Reader = nil 9690 c.urlParams_.Set("alt", alt) 9691 c.urlParams_.Set("prettyPrint", "false") 9692 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9693 urls += "?" + c.urlParams_.Encode() 9694 req, err := http.NewRequest("GET", urls, body) 9695 if err != nil { 9696 return nil, err 9697 } 9698 req.Header = reqHeaders 9699 googleapi.Expand(req.URL, map[string]string{ 9700 "courseId": c.courseId, 9701 }) 9702 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9703} 9704 9705// Do executes the "classroom.courses.teachers.list" call. 9706// Exactly one of *ListTeachersResponse or error will be non-nil. Any 9707// non-2xx status code is an error. Response headers are in either 9708// *ListTeachersResponse.ServerResponse.Header or (if a response was 9709// returned at all) in error.(*googleapi.Error).Header. Use 9710// googleapi.IsNotModified to check whether the returned error was 9711// because http.StatusNotModified was returned. 9712func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) { 9713 gensupport.SetOptions(c.urlParams_, opts...) 9714 res, err := c.doRequest("json") 9715 if res != nil && res.StatusCode == http.StatusNotModified { 9716 if res.Body != nil { 9717 res.Body.Close() 9718 } 9719 return nil, &googleapi.Error{ 9720 Code: res.StatusCode, 9721 Header: res.Header, 9722 } 9723 } 9724 if err != nil { 9725 return nil, err 9726 } 9727 defer googleapi.CloseBody(res) 9728 if err := googleapi.CheckResponse(res); err != nil { 9729 return nil, err 9730 } 9731 ret := &ListTeachersResponse{ 9732 ServerResponse: googleapi.ServerResponse{ 9733 Header: res.Header, 9734 HTTPStatusCode: res.StatusCode, 9735 }, 9736 } 9737 target := &ret 9738 if err := gensupport.DecodeResponse(target, res); err != nil { 9739 return nil, err 9740 } 9741 return ret, nil 9742 // { 9743 // "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.", 9744 // "flatPath": "v1/courses/{courseId}/teachers", 9745 // "httpMethod": "GET", 9746 // "id": "classroom.courses.teachers.list", 9747 // "parameterOrder": [ 9748 // "courseId" 9749 // ], 9750 // "parameters": { 9751 // "courseId": { 9752 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9753 // "location": "path", 9754 // "required": true, 9755 // "type": "string" 9756 // }, 9757 // "pageSize": { 9758 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9759 // "format": "int32", 9760 // "location": "query", 9761 // "type": "integer" 9762 // }, 9763 // "pageToken": { 9764 // "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.", 9765 // "location": "query", 9766 // "type": "string" 9767 // } 9768 // }, 9769 // "path": "v1/courses/{courseId}/teachers", 9770 // "response": { 9771 // "$ref": "ListTeachersResponse" 9772 // }, 9773 // "scopes": [ 9774 // "https://www.googleapis.com/auth/classroom.profile.emails", 9775 // "https://www.googleapis.com/auth/classroom.profile.photos", 9776 // "https://www.googleapis.com/auth/classroom.rosters", 9777 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9778 // ] 9779 // } 9780 9781} 9782 9783// Pages invokes f for each page of results. 9784// A non-nil error returned from f will halt the iteration. 9785// The provided context supersedes any context provided to the Context method. 9786func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error { 9787 c.ctx_ = ctx 9788 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9789 for { 9790 x, err := c.Do() 9791 if err != nil { 9792 return err 9793 } 9794 if err := f(x); err != nil { 9795 return err 9796 } 9797 if x.NextPageToken == "" { 9798 return nil 9799 } 9800 c.PageToken(x.NextPageToken) 9801 } 9802} 9803 9804// method id "classroom.courses.topics.create": 9805 9806type CoursesTopicsCreateCall struct { 9807 s *Service 9808 courseId string 9809 topic *Topic 9810 urlParams_ gensupport.URLParams 9811 ctx_ context.Context 9812 header_ http.Header 9813} 9814 9815// Create: Creates a topic. 9816// 9817// This method returns the following error codes: 9818// 9819// * `PERMISSION_DENIED` if the requesting user is not permitted to 9820// access the 9821// requested course, create a topic in the requested course, 9822// or for access errors. 9823// * `INVALID_ARGUMENT` if the request is malformed. 9824// * `NOT_FOUND` if the requested course does not exist. 9825func (r *CoursesTopicsService) Create(courseId string, topic *Topic) *CoursesTopicsCreateCall { 9826 c := &CoursesTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9827 c.courseId = courseId 9828 c.topic = topic 9829 return c 9830} 9831 9832// Fields allows partial responses to be retrieved. See 9833// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9834// for more information. 9835func (c *CoursesTopicsCreateCall) Fields(s ...googleapi.Field) *CoursesTopicsCreateCall { 9836 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9837 return c 9838} 9839 9840// Context sets the context to be used in this call's Do method. Any 9841// pending HTTP request will be aborted if the provided context is 9842// canceled. 9843func (c *CoursesTopicsCreateCall) Context(ctx context.Context) *CoursesTopicsCreateCall { 9844 c.ctx_ = ctx 9845 return c 9846} 9847 9848// Header returns an http.Header that can be modified by the caller to 9849// add HTTP headers to the request. 9850func (c *CoursesTopicsCreateCall) Header() http.Header { 9851 if c.header_ == nil { 9852 c.header_ = make(http.Header) 9853 } 9854 return c.header_ 9855} 9856 9857func (c *CoursesTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 9858 reqHeaders := make(http.Header) 9859 for k, v := range c.header_ { 9860 reqHeaders[k] = v 9861 } 9862 reqHeaders.Set("User-Agent", c.s.userAgent()) 9863 var body io.Reader = nil 9864 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 9865 if err != nil { 9866 return nil, err 9867 } 9868 reqHeaders.Set("Content-Type", "application/json") 9869 c.urlParams_.Set("alt", alt) 9870 c.urlParams_.Set("prettyPrint", "false") 9871 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 9872 urls += "?" + c.urlParams_.Encode() 9873 req, err := http.NewRequest("POST", urls, body) 9874 if err != nil { 9875 return nil, err 9876 } 9877 req.Header = reqHeaders 9878 googleapi.Expand(req.URL, map[string]string{ 9879 "courseId": c.courseId, 9880 }) 9881 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9882} 9883 9884// Do executes the "classroom.courses.topics.create" call. 9885// Exactly one of *Topic or error will be non-nil. Any non-2xx status 9886// code is an error. Response headers are in either 9887// *Topic.ServerResponse.Header or (if a response was returned at all) 9888// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9889// check whether the returned error was because http.StatusNotModified 9890// was returned. 9891func (c *CoursesTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 9892 gensupport.SetOptions(c.urlParams_, opts...) 9893 res, err := c.doRequest("json") 9894 if res != nil && res.StatusCode == http.StatusNotModified { 9895 if res.Body != nil { 9896 res.Body.Close() 9897 } 9898 return nil, &googleapi.Error{ 9899 Code: res.StatusCode, 9900 Header: res.Header, 9901 } 9902 } 9903 if err != nil { 9904 return nil, err 9905 } 9906 defer googleapi.CloseBody(res) 9907 if err := googleapi.CheckResponse(res); err != nil { 9908 return nil, err 9909 } 9910 ret := &Topic{ 9911 ServerResponse: googleapi.ServerResponse{ 9912 Header: res.Header, 9913 HTTPStatusCode: res.StatusCode, 9914 }, 9915 } 9916 target := &ret 9917 if err := gensupport.DecodeResponse(target, res); err != nil { 9918 return nil, err 9919 } 9920 return ret, nil 9921 // { 9922 // "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.", 9923 // "flatPath": "v1/courses/{courseId}/topics", 9924 // "httpMethod": "POST", 9925 // "id": "classroom.courses.topics.create", 9926 // "parameterOrder": [ 9927 // "courseId" 9928 // ], 9929 // "parameters": { 9930 // "courseId": { 9931 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9932 // "location": "path", 9933 // "required": true, 9934 // "type": "string" 9935 // } 9936 // }, 9937 // "path": "v1/courses/{courseId}/topics", 9938 // "request": { 9939 // "$ref": "Topic" 9940 // }, 9941 // "response": { 9942 // "$ref": "Topic" 9943 // }, 9944 // "scopes": [ 9945 // "https://www.googleapis.com/auth/classroom.topics" 9946 // ] 9947 // } 9948 9949} 9950 9951// method id "classroom.courses.topics.delete": 9952 9953type CoursesTopicsDeleteCall struct { 9954 s *Service 9955 courseId string 9956 id string 9957 urlParams_ gensupport.URLParams 9958 ctx_ context.Context 9959 header_ http.Header 9960} 9961 9962// Delete: Deletes a topic. 9963// 9964// This method returns the following error codes: 9965// 9966// * `PERMISSION_DENIED` if the requesting user is not allowed to delete 9967// the 9968// requested topic or for access errors. 9969// * `FAILED_PRECONDITION` if the requested topic has already 9970// been 9971// deleted. 9972// * `NOT_FOUND` if no course or topic exists with the requested ID. 9973func (r *CoursesTopicsService) Delete(courseId string, id string) *CoursesTopicsDeleteCall { 9974 c := &CoursesTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9975 c.courseId = courseId 9976 c.id = id 9977 return c 9978} 9979 9980// Fields allows partial responses to be retrieved. See 9981// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9982// for more information. 9983func (c *CoursesTopicsDeleteCall) Fields(s ...googleapi.Field) *CoursesTopicsDeleteCall { 9984 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9985 return c 9986} 9987 9988// Context sets the context to be used in this call's Do method. Any 9989// pending HTTP request will be aborted if the provided context is 9990// canceled. 9991func (c *CoursesTopicsDeleteCall) Context(ctx context.Context) *CoursesTopicsDeleteCall { 9992 c.ctx_ = ctx 9993 return c 9994} 9995 9996// Header returns an http.Header that can be modified by the caller to 9997// add HTTP headers to the request. 9998func (c *CoursesTopicsDeleteCall) Header() http.Header { 9999 if c.header_ == nil { 10000 c.header_ = make(http.Header) 10001 } 10002 return c.header_ 10003} 10004 10005func (c *CoursesTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 10006 reqHeaders := make(http.Header) 10007 for k, v := range c.header_ { 10008 reqHeaders[k] = v 10009 } 10010 reqHeaders.Set("User-Agent", c.s.userAgent()) 10011 var body io.Reader = nil 10012 c.urlParams_.Set("alt", alt) 10013 c.urlParams_.Set("prettyPrint", "false") 10014 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10015 urls += "?" + c.urlParams_.Encode() 10016 req, err := http.NewRequest("DELETE", urls, body) 10017 if err != nil { 10018 return nil, err 10019 } 10020 req.Header = reqHeaders 10021 googleapi.Expand(req.URL, map[string]string{ 10022 "courseId": c.courseId, 10023 "id": c.id, 10024 }) 10025 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10026} 10027 10028// Do executes the "classroom.courses.topics.delete" call. 10029// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10030// code is an error. Response headers are in either 10031// *Empty.ServerResponse.Header or (if a response was returned at all) 10032// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10033// check whether the returned error was because http.StatusNotModified 10034// was returned. 10035func (c *CoursesTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10036 gensupport.SetOptions(c.urlParams_, opts...) 10037 res, err := c.doRequest("json") 10038 if res != nil && res.StatusCode == http.StatusNotModified { 10039 if res.Body != nil { 10040 res.Body.Close() 10041 } 10042 return nil, &googleapi.Error{ 10043 Code: res.StatusCode, 10044 Header: res.Header, 10045 } 10046 } 10047 if err != nil { 10048 return nil, err 10049 } 10050 defer googleapi.CloseBody(res) 10051 if err := googleapi.CheckResponse(res); err != nil { 10052 return nil, err 10053 } 10054 ret := &Empty{ 10055 ServerResponse: googleapi.ServerResponse{ 10056 Header: res.Header, 10057 HTTPStatusCode: res.StatusCode, 10058 }, 10059 } 10060 target := &ret 10061 if err := gensupport.DecodeResponse(target, res); err != nil { 10062 return nil, err 10063 } 10064 return ret, nil 10065 // { 10066 // "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.", 10067 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10068 // "httpMethod": "DELETE", 10069 // "id": "classroom.courses.topics.delete", 10070 // "parameterOrder": [ 10071 // "courseId", 10072 // "id" 10073 // ], 10074 // "parameters": { 10075 // "courseId": { 10076 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10077 // "location": "path", 10078 // "required": true, 10079 // "type": "string" 10080 // }, 10081 // "id": { 10082 // "description": "Identifier of the topic to delete.", 10083 // "location": "path", 10084 // "required": true, 10085 // "type": "string" 10086 // } 10087 // }, 10088 // "path": "v1/courses/{courseId}/topics/{id}", 10089 // "response": { 10090 // "$ref": "Empty" 10091 // }, 10092 // "scopes": [ 10093 // "https://www.googleapis.com/auth/classroom.topics" 10094 // ] 10095 // } 10096 10097} 10098 10099// method id "classroom.courses.topics.get": 10100 10101type CoursesTopicsGetCall struct { 10102 s *Service 10103 courseId string 10104 id string 10105 urlParams_ gensupport.URLParams 10106 ifNoneMatch_ string 10107 ctx_ context.Context 10108 header_ http.Header 10109} 10110 10111// Get: Returns a topic. 10112// 10113// This method returns the following error codes: 10114// 10115// * `PERMISSION_DENIED` if the requesting user is not permitted to 10116// access the 10117// requested course or topic, or for access errors. 10118// * `INVALID_ARGUMENT` if the request is malformed. 10119// * `NOT_FOUND` if the requested course or topic does not exist. 10120func (r *CoursesTopicsService) Get(courseId string, id string) *CoursesTopicsGetCall { 10121 c := &CoursesTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10122 c.courseId = courseId 10123 c.id = id 10124 return c 10125} 10126 10127// Fields allows partial responses to be retrieved. See 10128// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10129// for more information. 10130func (c *CoursesTopicsGetCall) Fields(s ...googleapi.Field) *CoursesTopicsGetCall { 10131 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10132 return c 10133} 10134 10135// IfNoneMatch sets the optional parameter which makes the operation 10136// fail if the object's ETag matches the given value. This is useful for 10137// getting updates only after the object has changed since the last 10138// request. Use googleapi.IsNotModified to check whether the response 10139// error from Do is the result of In-None-Match. 10140func (c *CoursesTopicsGetCall) IfNoneMatch(entityTag string) *CoursesTopicsGetCall { 10141 c.ifNoneMatch_ = entityTag 10142 return c 10143} 10144 10145// Context sets the context to be used in this call's Do method. Any 10146// pending HTTP request will be aborted if the provided context is 10147// canceled. 10148func (c *CoursesTopicsGetCall) Context(ctx context.Context) *CoursesTopicsGetCall { 10149 c.ctx_ = ctx 10150 return c 10151} 10152 10153// Header returns an http.Header that can be modified by the caller to 10154// add HTTP headers to the request. 10155func (c *CoursesTopicsGetCall) Header() http.Header { 10156 if c.header_ == nil { 10157 c.header_ = make(http.Header) 10158 } 10159 return c.header_ 10160} 10161 10162func (c *CoursesTopicsGetCall) doRequest(alt string) (*http.Response, error) { 10163 reqHeaders := make(http.Header) 10164 for k, v := range c.header_ { 10165 reqHeaders[k] = v 10166 } 10167 reqHeaders.Set("User-Agent", c.s.userAgent()) 10168 if c.ifNoneMatch_ != "" { 10169 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10170 } 10171 var body io.Reader = nil 10172 c.urlParams_.Set("alt", alt) 10173 c.urlParams_.Set("prettyPrint", "false") 10174 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10175 urls += "?" + c.urlParams_.Encode() 10176 req, err := http.NewRequest("GET", urls, body) 10177 if err != nil { 10178 return nil, err 10179 } 10180 req.Header = reqHeaders 10181 googleapi.Expand(req.URL, map[string]string{ 10182 "courseId": c.courseId, 10183 "id": c.id, 10184 }) 10185 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10186} 10187 10188// Do executes the "classroom.courses.topics.get" call. 10189// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10190// code is an error. Response headers are in either 10191// *Topic.ServerResponse.Header or (if a response was returned at all) 10192// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10193// check whether the returned error was because http.StatusNotModified 10194// was returned. 10195func (c *CoursesTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10196 gensupport.SetOptions(c.urlParams_, opts...) 10197 res, err := c.doRequest("json") 10198 if res != nil && res.StatusCode == http.StatusNotModified { 10199 if res.Body != nil { 10200 res.Body.Close() 10201 } 10202 return nil, &googleapi.Error{ 10203 Code: res.StatusCode, 10204 Header: res.Header, 10205 } 10206 } 10207 if err != nil { 10208 return nil, err 10209 } 10210 defer googleapi.CloseBody(res) 10211 if err := googleapi.CheckResponse(res); err != nil { 10212 return nil, err 10213 } 10214 ret := &Topic{ 10215 ServerResponse: googleapi.ServerResponse{ 10216 Header: res.Header, 10217 HTTPStatusCode: res.StatusCode, 10218 }, 10219 } 10220 target := &ret 10221 if err := gensupport.DecodeResponse(target, res); err != nil { 10222 return nil, err 10223 } 10224 return ret, nil 10225 // { 10226 // "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.", 10227 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10228 // "httpMethod": "GET", 10229 // "id": "classroom.courses.topics.get", 10230 // "parameterOrder": [ 10231 // "courseId", 10232 // "id" 10233 // ], 10234 // "parameters": { 10235 // "courseId": { 10236 // "description": "Identifier of the course.", 10237 // "location": "path", 10238 // "required": true, 10239 // "type": "string" 10240 // }, 10241 // "id": { 10242 // "description": "Identifier of the topic.", 10243 // "location": "path", 10244 // "required": true, 10245 // "type": "string" 10246 // } 10247 // }, 10248 // "path": "v1/courses/{courseId}/topics/{id}", 10249 // "response": { 10250 // "$ref": "Topic" 10251 // }, 10252 // "scopes": [ 10253 // "https://www.googleapis.com/auth/classroom.topics", 10254 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10255 // ] 10256 // } 10257 10258} 10259 10260// method id "classroom.courses.topics.list": 10261 10262type CoursesTopicsListCall struct { 10263 s *Service 10264 courseId string 10265 urlParams_ gensupport.URLParams 10266 ifNoneMatch_ string 10267 ctx_ context.Context 10268 header_ http.Header 10269} 10270 10271// List: Returns the list of topics that the requester is permitted to 10272// view. 10273// 10274// This method returns the following error codes: 10275// 10276// * `PERMISSION_DENIED` if the requesting user is not permitted to 10277// access 10278// the requested course or for access errors. 10279// * `INVALID_ARGUMENT` if the request is malformed. 10280// * `NOT_FOUND` if the requested course does not exist. 10281func (r *CoursesTopicsService) List(courseId string) *CoursesTopicsListCall { 10282 c := &CoursesTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10283 c.courseId = courseId 10284 return c 10285} 10286 10287// PageSize sets the optional parameter "pageSize": Maximum number of 10288// items to return. Zero or unspecified indicates that the 10289// server may assign a maximum. 10290// 10291// The server may return fewer than the specified number of results. 10292func (c *CoursesTopicsListCall) PageSize(pageSize int64) *CoursesTopicsListCall { 10293 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10294 return c 10295} 10296 10297// PageToken sets the optional parameter "pageToken": 10298// nextPageToken 10299// value returned from a previous 10300// list call, 10301// indicating that the subsequent page of results should be 10302// returned. 10303// 10304// The list request 10305// must be otherwise identical to the one that resulted in this token. 10306func (c *CoursesTopicsListCall) PageToken(pageToken string) *CoursesTopicsListCall { 10307 c.urlParams_.Set("pageToken", pageToken) 10308 return c 10309} 10310 10311// Fields allows partial responses to be retrieved. See 10312// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10313// for more information. 10314func (c *CoursesTopicsListCall) Fields(s ...googleapi.Field) *CoursesTopicsListCall { 10315 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10316 return c 10317} 10318 10319// IfNoneMatch sets the optional parameter which makes the operation 10320// fail if the object's ETag matches the given value. This is useful for 10321// getting updates only after the object has changed since the last 10322// request. Use googleapi.IsNotModified to check whether the response 10323// error from Do is the result of In-None-Match. 10324func (c *CoursesTopicsListCall) IfNoneMatch(entityTag string) *CoursesTopicsListCall { 10325 c.ifNoneMatch_ = entityTag 10326 return c 10327} 10328 10329// Context sets the context to be used in this call's Do method. Any 10330// pending HTTP request will be aborted if the provided context is 10331// canceled. 10332func (c *CoursesTopicsListCall) Context(ctx context.Context) *CoursesTopicsListCall { 10333 c.ctx_ = ctx 10334 return c 10335} 10336 10337// Header returns an http.Header that can be modified by the caller to 10338// add HTTP headers to the request. 10339func (c *CoursesTopicsListCall) Header() http.Header { 10340 if c.header_ == nil { 10341 c.header_ = make(http.Header) 10342 } 10343 return c.header_ 10344} 10345 10346func (c *CoursesTopicsListCall) doRequest(alt string) (*http.Response, error) { 10347 reqHeaders := make(http.Header) 10348 for k, v := range c.header_ { 10349 reqHeaders[k] = v 10350 } 10351 reqHeaders.Set("User-Agent", c.s.userAgent()) 10352 if c.ifNoneMatch_ != "" { 10353 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10354 } 10355 var body io.Reader = nil 10356 c.urlParams_.Set("alt", alt) 10357 c.urlParams_.Set("prettyPrint", "false") 10358 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10359 urls += "?" + c.urlParams_.Encode() 10360 req, err := http.NewRequest("GET", urls, body) 10361 if err != nil { 10362 return nil, err 10363 } 10364 req.Header = reqHeaders 10365 googleapi.Expand(req.URL, map[string]string{ 10366 "courseId": c.courseId, 10367 }) 10368 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10369} 10370 10371// Do executes the "classroom.courses.topics.list" call. 10372// Exactly one of *ListTopicResponse or error will be non-nil. Any 10373// non-2xx status code is an error. Response headers are in either 10374// *ListTopicResponse.ServerResponse.Header or (if a response was 10375// returned at all) in error.(*googleapi.Error).Header. Use 10376// googleapi.IsNotModified to check whether the returned error was 10377// because http.StatusNotModified was returned. 10378func (c *CoursesTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicResponse, error) { 10379 gensupport.SetOptions(c.urlParams_, opts...) 10380 res, err := c.doRequest("json") 10381 if res != nil && res.StatusCode == http.StatusNotModified { 10382 if res.Body != nil { 10383 res.Body.Close() 10384 } 10385 return nil, &googleapi.Error{ 10386 Code: res.StatusCode, 10387 Header: res.Header, 10388 } 10389 } 10390 if err != nil { 10391 return nil, err 10392 } 10393 defer googleapi.CloseBody(res) 10394 if err := googleapi.CheckResponse(res); err != nil { 10395 return nil, err 10396 } 10397 ret := &ListTopicResponse{ 10398 ServerResponse: googleapi.ServerResponse{ 10399 Header: res.Header, 10400 HTTPStatusCode: res.StatusCode, 10401 }, 10402 } 10403 target := &ret 10404 if err := gensupport.DecodeResponse(target, res); err != nil { 10405 return nil, err 10406 } 10407 return ret, nil 10408 // { 10409 // "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.", 10410 // "flatPath": "v1/courses/{courseId}/topics", 10411 // "httpMethod": "GET", 10412 // "id": "classroom.courses.topics.list", 10413 // "parameterOrder": [ 10414 // "courseId" 10415 // ], 10416 // "parameters": { 10417 // "courseId": { 10418 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10419 // "location": "path", 10420 // "required": true, 10421 // "type": "string" 10422 // }, 10423 // "pageSize": { 10424 // "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.", 10425 // "format": "int32", 10426 // "location": "query", 10427 // "type": "integer" 10428 // }, 10429 // "pageToken": { 10430 // "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.", 10431 // "location": "query", 10432 // "type": "string" 10433 // } 10434 // }, 10435 // "path": "v1/courses/{courseId}/topics", 10436 // "response": { 10437 // "$ref": "ListTopicResponse" 10438 // }, 10439 // "scopes": [ 10440 // "https://www.googleapis.com/auth/classroom.topics", 10441 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10442 // ] 10443 // } 10444 10445} 10446 10447// Pages invokes f for each page of results. 10448// A non-nil error returned from f will halt the iteration. 10449// The provided context supersedes any context provided to the Context method. 10450func (c *CoursesTopicsListCall) Pages(ctx context.Context, f func(*ListTopicResponse) error) error { 10451 c.ctx_ = ctx 10452 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10453 for { 10454 x, err := c.Do() 10455 if err != nil { 10456 return err 10457 } 10458 if err := f(x); err != nil { 10459 return err 10460 } 10461 if x.NextPageToken == "" { 10462 return nil 10463 } 10464 c.PageToken(x.NextPageToken) 10465 } 10466} 10467 10468// method id "classroom.courses.topics.patch": 10469 10470type CoursesTopicsPatchCall struct { 10471 s *Service 10472 courseId string 10473 id string 10474 topic *Topic 10475 urlParams_ gensupport.URLParams 10476 ctx_ context.Context 10477 header_ http.Header 10478} 10479 10480// Patch: Updates one or more fields of a topic. 10481// 10482// This method returns the following error codes: 10483// 10484// * `PERMISSION_DENIED` if the requesting developer project did not 10485// create 10486// the corresponding topic or for access errors. 10487// * `INVALID_ARGUMENT` if the request is malformed. 10488// * `NOT_FOUND` if the requested course or topic does not exist 10489func (r *CoursesTopicsService) Patch(courseId string, id string, topic *Topic) *CoursesTopicsPatchCall { 10490 c := &CoursesTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10491 c.courseId = courseId 10492 c.id = id 10493 c.topic = topic 10494 return c 10495} 10496 10497// UpdateMask sets the optional parameter "updateMask": Mask that 10498// identifies which fields on the topic to update. 10499// This field is required to do an update. The update fails if 10500// invalid 10501// fields are specified. If a field supports empty values, it can be 10502// cleared 10503// by specifying it in the update mask and not in the Topic object. If 10504// a 10505// field that does not support empty values is included in the update 10506// mask and 10507// not set in the Topic object, an `INVALID_ARGUMENT` error will 10508// be 10509// returned. 10510// 10511// The following fields may be specified: 10512// 10513// * `name` 10514func (c *CoursesTopicsPatchCall) UpdateMask(updateMask string) *CoursesTopicsPatchCall { 10515 c.urlParams_.Set("updateMask", updateMask) 10516 return c 10517} 10518 10519// Fields allows partial responses to be retrieved. See 10520// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10521// for more information. 10522func (c *CoursesTopicsPatchCall) Fields(s ...googleapi.Field) *CoursesTopicsPatchCall { 10523 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10524 return c 10525} 10526 10527// Context sets the context to be used in this call's Do method. Any 10528// pending HTTP request will be aborted if the provided context is 10529// canceled. 10530func (c *CoursesTopicsPatchCall) Context(ctx context.Context) *CoursesTopicsPatchCall { 10531 c.ctx_ = ctx 10532 return c 10533} 10534 10535// Header returns an http.Header that can be modified by the caller to 10536// add HTTP headers to the request. 10537func (c *CoursesTopicsPatchCall) Header() http.Header { 10538 if c.header_ == nil { 10539 c.header_ = make(http.Header) 10540 } 10541 return c.header_ 10542} 10543 10544func (c *CoursesTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 10545 reqHeaders := make(http.Header) 10546 for k, v := range c.header_ { 10547 reqHeaders[k] = v 10548 } 10549 reqHeaders.Set("User-Agent", c.s.userAgent()) 10550 var body io.Reader = nil 10551 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 10552 if err != nil { 10553 return nil, err 10554 } 10555 reqHeaders.Set("Content-Type", "application/json") 10556 c.urlParams_.Set("alt", alt) 10557 c.urlParams_.Set("prettyPrint", "false") 10558 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10559 urls += "?" + c.urlParams_.Encode() 10560 req, err := http.NewRequest("PATCH", urls, body) 10561 if err != nil { 10562 return nil, err 10563 } 10564 req.Header = reqHeaders 10565 googleapi.Expand(req.URL, map[string]string{ 10566 "courseId": c.courseId, 10567 "id": c.id, 10568 }) 10569 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10570} 10571 10572// Do executes the "classroom.courses.topics.patch" call. 10573// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10574// code is an error. Response headers are in either 10575// *Topic.ServerResponse.Header or (if a response was returned at all) 10576// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10577// check whether the returned error was because http.StatusNotModified 10578// was returned. 10579func (c *CoursesTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10580 gensupport.SetOptions(c.urlParams_, opts...) 10581 res, err := c.doRequest("json") 10582 if res != nil && res.StatusCode == http.StatusNotModified { 10583 if res.Body != nil { 10584 res.Body.Close() 10585 } 10586 return nil, &googleapi.Error{ 10587 Code: res.StatusCode, 10588 Header: res.Header, 10589 } 10590 } 10591 if err != nil { 10592 return nil, err 10593 } 10594 defer googleapi.CloseBody(res) 10595 if err := googleapi.CheckResponse(res); err != nil { 10596 return nil, err 10597 } 10598 ret := &Topic{ 10599 ServerResponse: googleapi.ServerResponse{ 10600 Header: res.Header, 10601 HTTPStatusCode: res.StatusCode, 10602 }, 10603 } 10604 target := &ret 10605 if err := gensupport.DecodeResponse(target, res); err != nil { 10606 return nil, err 10607 } 10608 return ret, nil 10609 // { 10610 // "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", 10611 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10612 // "httpMethod": "PATCH", 10613 // "id": "classroom.courses.topics.patch", 10614 // "parameterOrder": [ 10615 // "courseId", 10616 // "id" 10617 // ], 10618 // "parameters": { 10619 // "courseId": { 10620 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10621 // "location": "path", 10622 // "required": true, 10623 // "type": "string" 10624 // }, 10625 // "id": { 10626 // "description": "Identifier of the topic.", 10627 // "location": "path", 10628 // "required": true, 10629 // "type": "string" 10630 // }, 10631 // "updateMask": { 10632 // "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`", 10633 // "format": "google-fieldmask", 10634 // "location": "query", 10635 // "type": "string" 10636 // } 10637 // }, 10638 // "path": "v1/courses/{courseId}/topics/{id}", 10639 // "request": { 10640 // "$ref": "Topic" 10641 // }, 10642 // "response": { 10643 // "$ref": "Topic" 10644 // }, 10645 // "scopes": [ 10646 // "https://www.googleapis.com/auth/classroom.topics" 10647 // ] 10648 // } 10649 10650} 10651 10652// method id "classroom.invitations.accept": 10653 10654type InvitationsAcceptCall struct { 10655 s *Service 10656 id string 10657 urlParams_ gensupport.URLParams 10658 ctx_ context.Context 10659 header_ http.Header 10660} 10661 10662// Accept: Accepts an invitation, removing it and adding the invited 10663// user to the 10664// teachers or students (as appropriate) of the specified course. Only 10665// the 10666// invited user may accept an invitation. 10667// 10668// This method returns the following error codes: 10669// 10670// * `PERMISSION_DENIED` if the requesting user is not permitted to 10671// accept the 10672// requested invitation or for access errors. 10673// * `FAILED_PRECONDITION` for the following request errors: 10674// * CourseMemberLimitReached 10675// * CourseNotModifiable 10676// * CourseTeacherLimitReached 10677// * UserGroupsMembershipLimitReached 10678// * `NOT_FOUND` if no invitation exists with the requested ID. 10679func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall { 10680 c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10681 c.id = id 10682 return c 10683} 10684 10685// Fields allows partial responses to be retrieved. See 10686// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10687// for more information. 10688func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall { 10689 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10690 return c 10691} 10692 10693// Context sets the context to be used in this call's Do method. Any 10694// pending HTTP request will be aborted if the provided context is 10695// canceled. 10696func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall { 10697 c.ctx_ = ctx 10698 return c 10699} 10700 10701// Header returns an http.Header that can be modified by the caller to 10702// add HTTP headers to the request. 10703func (c *InvitationsAcceptCall) Header() http.Header { 10704 if c.header_ == nil { 10705 c.header_ = make(http.Header) 10706 } 10707 return c.header_ 10708} 10709 10710func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) { 10711 reqHeaders := make(http.Header) 10712 for k, v := range c.header_ { 10713 reqHeaders[k] = v 10714 } 10715 reqHeaders.Set("User-Agent", c.s.userAgent()) 10716 var body io.Reader = nil 10717 c.urlParams_.Set("alt", alt) 10718 c.urlParams_.Set("prettyPrint", "false") 10719 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept") 10720 urls += "?" + c.urlParams_.Encode() 10721 req, err := http.NewRequest("POST", urls, body) 10722 if err != nil { 10723 return nil, err 10724 } 10725 req.Header = reqHeaders 10726 googleapi.Expand(req.URL, map[string]string{ 10727 "id": c.id, 10728 }) 10729 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10730} 10731 10732// Do executes the "classroom.invitations.accept" call. 10733// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10734// code is an error. Response headers are in either 10735// *Empty.ServerResponse.Header or (if a response was returned at all) 10736// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10737// check whether the returned error was because http.StatusNotModified 10738// was returned. 10739func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10740 gensupport.SetOptions(c.urlParams_, opts...) 10741 res, err := c.doRequest("json") 10742 if res != nil && res.StatusCode == http.StatusNotModified { 10743 if res.Body != nil { 10744 res.Body.Close() 10745 } 10746 return nil, &googleapi.Error{ 10747 Code: res.StatusCode, 10748 Header: res.Header, 10749 } 10750 } 10751 if err != nil { 10752 return nil, err 10753 } 10754 defer googleapi.CloseBody(res) 10755 if err := googleapi.CheckResponse(res); err != nil { 10756 return nil, err 10757 } 10758 ret := &Empty{ 10759 ServerResponse: googleapi.ServerResponse{ 10760 Header: res.Header, 10761 HTTPStatusCode: res.StatusCode, 10762 }, 10763 } 10764 target := &ret 10765 if err := gensupport.DecodeResponse(target, res); err != nil { 10766 return nil, err 10767 } 10768 return ret, nil 10769 // { 10770 // "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.", 10771 // "flatPath": "v1/invitations/{id}:accept", 10772 // "httpMethod": "POST", 10773 // "id": "classroom.invitations.accept", 10774 // "parameterOrder": [ 10775 // "id" 10776 // ], 10777 // "parameters": { 10778 // "id": { 10779 // "description": "Identifier of the invitation to accept.", 10780 // "location": "path", 10781 // "required": true, 10782 // "type": "string" 10783 // } 10784 // }, 10785 // "path": "v1/invitations/{id}:accept", 10786 // "response": { 10787 // "$ref": "Empty" 10788 // }, 10789 // "scopes": [ 10790 // "https://www.googleapis.com/auth/classroom.rosters" 10791 // ] 10792 // } 10793 10794} 10795 10796// method id "classroom.invitations.create": 10797 10798type InvitationsCreateCall struct { 10799 s *Service 10800 invitation *Invitation 10801 urlParams_ gensupport.URLParams 10802 ctx_ context.Context 10803 header_ http.Header 10804} 10805 10806// Create: Creates an invitation. Only one invitation for a user and 10807// course may exist 10808// at a time. Delete and re-create an invitation to make changes. 10809// 10810// This method returns the following error codes: 10811// 10812// * `PERMISSION_DENIED` if the requesting user is not permitted to 10813// create 10814// invitations for this course or for access errors. 10815// * `NOT_FOUND` if the course or the user does not exist. 10816// * `FAILED_PRECONDITION` if the requested user's account is disabled 10817// or if 10818// the user already has this role or a role with greater permissions. 10819// * `ALREADY_EXISTS` if an invitation for the specified user and 10820// course 10821// already exists. 10822func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall { 10823 c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10824 c.invitation = invitation 10825 return c 10826} 10827 10828// Fields allows partial responses to be retrieved. See 10829// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10830// for more information. 10831func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall { 10832 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10833 return c 10834} 10835 10836// Context sets the context to be used in this call's Do method. Any 10837// pending HTTP request will be aborted if the provided context is 10838// canceled. 10839func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall { 10840 c.ctx_ = ctx 10841 return c 10842} 10843 10844// Header returns an http.Header that can be modified by the caller to 10845// add HTTP headers to the request. 10846func (c *InvitationsCreateCall) Header() http.Header { 10847 if c.header_ == nil { 10848 c.header_ = make(http.Header) 10849 } 10850 return c.header_ 10851} 10852 10853func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 10854 reqHeaders := make(http.Header) 10855 for k, v := range c.header_ { 10856 reqHeaders[k] = v 10857 } 10858 reqHeaders.Set("User-Agent", c.s.userAgent()) 10859 var body io.Reader = nil 10860 body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation) 10861 if err != nil { 10862 return nil, err 10863 } 10864 reqHeaders.Set("Content-Type", "application/json") 10865 c.urlParams_.Set("alt", alt) 10866 c.urlParams_.Set("prettyPrint", "false") 10867 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 10868 urls += "?" + c.urlParams_.Encode() 10869 req, err := http.NewRequest("POST", urls, body) 10870 if err != nil { 10871 return nil, err 10872 } 10873 req.Header = reqHeaders 10874 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10875} 10876 10877// Do executes the "classroom.invitations.create" call. 10878// Exactly one of *Invitation or error will be non-nil. Any non-2xx 10879// status code is an error. Response headers are in either 10880// *Invitation.ServerResponse.Header or (if a response was returned at 10881// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10882// to check whether the returned error was because 10883// http.StatusNotModified was returned. 10884func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 10885 gensupport.SetOptions(c.urlParams_, opts...) 10886 res, err := c.doRequest("json") 10887 if res != nil && res.StatusCode == http.StatusNotModified { 10888 if res.Body != nil { 10889 res.Body.Close() 10890 } 10891 return nil, &googleapi.Error{ 10892 Code: res.StatusCode, 10893 Header: res.Header, 10894 } 10895 } 10896 if err != nil { 10897 return nil, err 10898 } 10899 defer googleapi.CloseBody(res) 10900 if err := googleapi.CheckResponse(res); err != nil { 10901 return nil, err 10902 } 10903 ret := &Invitation{ 10904 ServerResponse: googleapi.ServerResponse{ 10905 Header: res.Header, 10906 HTTPStatusCode: res.StatusCode, 10907 }, 10908 } 10909 target := &ret 10910 if err := gensupport.DecodeResponse(target, res); err != nil { 10911 return nil, err 10912 } 10913 return ret, nil 10914 // { 10915 // "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.", 10916 // "flatPath": "v1/invitations", 10917 // "httpMethod": "POST", 10918 // "id": "classroom.invitations.create", 10919 // "parameterOrder": [], 10920 // "parameters": {}, 10921 // "path": "v1/invitations", 10922 // "request": { 10923 // "$ref": "Invitation" 10924 // }, 10925 // "response": { 10926 // "$ref": "Invitation" 10927 // }, 10928 // "scopes": [ 10929 // "https://www.googleapis.com/auth/classroom.rosters" 10930 // ] 10931 // } 10932 10933} 10934 10935// method id "classroom.invitations.delete": 10936 10937type InvitationsDeleteCall struct { 10938 s *Service 10939 id string 10940 urlParams_ gensupport.URLParams 10941 ctx_ context.Context 10942 header_ http.Header 10943} 10944 10945// Delete: Deletes an invitation. 10946// 10947// This method returns the following error codes: 10948// 10949// * `PERMISSION_DENIED` if the requesting user is not permitted to 10950// delete the 10951// requested invitation or for access errors. 10952// * `NOT_FOUND` if no invitation exists with the requested ID. 10953func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall { 10954 c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10955 c.id = id 10956 return c 10957} 10958 10959// Fields allows partial responses to be retrieved. See 10960// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10961// for more information. 10962func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall { 10963 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10964 return c 10965} 10966 10967// Context sets the context to be used in this call's Do method. Any 10968// pending HTTP request will be aborted if the provided context is 10969// canceled. 10970func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall { 10971 c.ctx_ = ctx 10972 return c 10973} 10974 10975// Header returns an http.Header that can be modified by the caller to 10976// add HTTP headers to the request. 10977func (c *InvitationsDeleteCall) Header() http.Header { 10978 if c.header_ == nil { 10979 c.header_ = make(http.Header) 10980 } 10981 return c.header_ 10982} 10983 10984func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) { 10985 reqHeaders := make(http.Header) 10986 for k, v := range c.header_ { 10987 reqHeaders[k] = v 10988 } 10989 reqHeaders.Set("User-Agent", c.s.userAgent()) 10990 var body io.Reader = nil 10991 c.urlParams_.Set("alt", alt) 10992 c.urlParams_.Set("prettyPrint", "false") 10993 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 10994 urls += "?" + c.urlParams_.Encode() 10995 req, err := http.NewRequest("DELETE", urls, body) 10996 if err != nil { 10997 return nil, err 10998 } 10999 req.Header = reqHeaders 11000 googleapi.Expand(req.URL, map[string]string{ 11001 "id": c.id, 11002 }) 11003 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11004} 11005 11006// Do executes the "classroom.invitations.delete" call. 11007// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11008// code is an error. Response headers are in either 11009// *Empty.ServerResponse.Header or (if a response was returned at all) 11010// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11011// check whether the returned error was because http.StatusNotModified 11012// was returned. 11013func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11014 gensupport.SetOptions(c.urlParams_, opts...) 11015 res, err := c.doRequest("json") 11016 if res != nil && res.StatusCode == http.StatusNotModified { 11017 if res.Body != nil { 11018 res.Body.Close() 11019 } 11020 return nil, &googleapi.Error{ 11021 Code: res.StatusCode, 11022 Header: res.Header, 11023 } 11024 } 11025 if err != nil { 11026 return nil, err 11027 } 11028 defer googleapi.CloseBody(res) 11029 if err := googleapi.CheckResponse(res); err != nil { 11030 return nil, err 11031 } 11032 ret := &Empty{ 11033 ServerResponse: googleapi.ServerResponse{ 11034 Header: res.Header, 11035 HTTPStatusCode: res.StatusCode, 11036 }, 11037 } 11038 target := &ret 11039 if err := gensupport.DecodeResponse(target, res); err != nil { 11040 return nil, err 11041 } 11042 return ret, nil 11043 // { 11044 // "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.", 11045 // "flatPath": "v1/invitations/{id}", 11046 // "httpMethod": "DELETE", 11047 // "id": "classroom.invitations.delete", 11048 // "parameterOrder": [ 11049 // "id" 11050 // ], 11051 // "parameters": { 11052 // "id": { 11053 // "description": "Identifier of the invitation to delete.", 11054 // "location": "path", 11055 // "required": true, 11056 // "type": "string" 11057 // } 11058 // }, 11059 // "path": "v1/invitations/{id}", 11060 // "response": { 11061 // "$ref": "Empty" 11062 // }, 11063 // "scopes": [ 11064 // "https://www.googleapis.com/auth/classroom.rosters" 11065 // ] 11066 // } 11067 11068} 11069 11070// method id "classroom.invitations.get": 11071 11072type InvitationsGetCall struct { 11073 s *Service 11074 id string 11075 urlParams_ gensupport.URLParams 11076 ifNoneMatch_ string 11077 ctx_ context.Context 11078 header_ http.Header 11079} 11080 11081// Get: Returns an invitation. 11082// 11083// This method returns the following error codes: 11084// 11085// * `PERMISSION_DENIED` if the requesting user is not permitted to view 11086// the 11087// requested invitation or for access errors. 11088// * `NOT_FOUND` if no invitation exists with the requested ID. 11089func (r *InvitationsService) Get(id string) *InvitationsGetCall { 11090 c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11091 c.id = id 11092 return c 11093} 11094 11095// Fields allows partial responses to be retrieved. See 11096// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11097// for more information. 11098func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall { 11099 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11100 return c 11101} 11102 11103// IfNoneMatch sets the optional parameter which makes the operation 11104// fail if the object's ETag matches the given value. This is useful for 11105// getting updates only after the object has changed since the last 11106// request. Use googleapi.IsNotModified to check whether the response 11107// error from Do is the result of In-None-Match. 11108func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall { 11109 c.ifNoneMatch_ = entityTag 11110 return c 11111} 11112 11113// Context sets the context to be used in this call's Do method. Any 11114// pending HTTP request will be aborted if the provided context is 11115// canceled. 11116func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall { 11117 c.ctx_ = ctx 11118 return c 11119} 11120 11121// Header returns an http.Header that can be modified by the caller to 11122// add HTTP headers to the request. 11123func (c *InvitationsGetCall) Header() http.Header { 11124 if c.header_ == nil { 11125 c.header_ = make(http.Header) 11126 } 11127 return c.header_ 11128} 11129 11130func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) { 11131 reqHeaders := make(http.Header) 11132 for k, v := range c.header_ { 11133 reqHeaders[k] = v 11134 } 11135 reqHeaders.Set("User-Agent", c.s.userAgent()) 11136 if c.ifNoneMatch_ != "" { 11137 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11138 } 11139 var body io.Reader = nil 11140 c.urlParams_.Set("alt", alt) 11141 c.urlParams_.Set("prettyPrint", "false") 11142 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11143 urls += "?" + c.urlParams_.Encode() 11144 req, err := http.NewRequest("GET", urls, body) 11145 if err != nil { 11146 return nil, err 11147 } 11148 req.Header = reqHeaders 11149 googleapi.Expand(req.URL, map[string]string{ 11150 "id": c.id, 11151 }) 11152 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11153} 11154 11155// Do executes the "classroom.invitations.get" call. 11156// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11157// status code is an error. Response headers are in either 11158// *Invitation.ServerResponse.Header or (if a response was returned at 11159// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11160// to check whether the returned error was because 11161// http.StatusNotModified was returned. 11162func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11163 gensupport.SetOptions(c.urlParams_, opts...) 11164 res, err := c.doRequest("json") 11165 if res != nil && res.StatusCode == http.StatusNotModified { 11166 if res.Body != nil { 11167 res.Body.Close() 11168 } 11169 return nil, &googleapi.Error{ 11170 Code: res.StatusCode, 11171 Header: res.Header, 11172 } 11173 } 11174 if err != nil { 11175 return nil, err 11176 } 11177 defer googleapi.CloseBody(res) 11178 if err := googleapi.CheckResponse(res); err != nil { 11179 return nil, err 11180 } 11181 ret := &Invitation{ 11182 ServerResponse: googleapi.ServerResponse{ 11183 Header: res.Header, 11184 HTTPStatusCode: res.StatusCode, 11185 }, 11186 } 11187 target := &ret 11188 if err := gensupport.DecodeResponse(target, res); err != nil { 11189 return nil, err 11190 } 11191 return ret, nil 11192 // { 11193 // "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.", 11194 // "flatPath": "v1/invitations/{id}", 11195 // "httpMethod": "GET", 11196 // "id": "classroom.invitations.get", 11197 // "parameterOrder": [ 11198 // "id" 11199 // ], 11200 // "parameters": { 11201 // "id": { 11202 // "description": "Identifier of the invitation to return.", 11203 // "location": "path", 11204 // "required": true, 11205 // "type": "string" 11206 // } 11207 // }, 11208 // "path": "v1/invitations/{id}", 11209 // "response": { 11210 // "$ref": "Invitation" 11211 // }, 11212 // "scopes": [ 11213 // "https://www.googleapis.com/auth/classroom.rosters", 11214 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11215 // ] 11216 // } 11217 11218} 11219 11220// method id "classroom.invitations.list": 11221 11222type InvitationsListCall struct { 11223 s *Service 11224 urlParams_ gensupport.URLParams 11225 ifNoneMatch_ string 11226 ctx_ context.Context 11227 header_ http.Header 11228} 11229 11230// List: Returns a list of invitations that the requesting user is 11231// permitted to 11232// view, restricted to those that match the list request. 11233// 11234// *Note:* At least one of `user_id` or `course_id` must be supplied. 11235// Both 11236// fields can be supplied. 11237// 11238// This method returns the following error codes: 11239// 11240// * `PERMISSION_DENIED` for access errors. 11241func (r *InvitationsService) List() *InvitationsListCall { 11242 c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11243 return c 11244} 11245 11246// CourseId sets the optional parameter "courseId": Restricts returned 11247// invitations to those for a course with the specified 11248// identifier. 11249func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall { 11250 c.urlParams_.Set("courseId", courseId) 11251 return c 11252} 11253 11254// PageSize sets the optional parameter "pageSize": Maximum number of 11255// items to return. Zero means no maximum. 11256// 11257// The server may return fewer than the specified number of results. 11258func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall { 11259 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 11260 return c 11261} 11262 11263// PageToken sets the optional parameter "pageToken": 11264// nextPageToken 11265// value returned from a previous 11266// list call, indicating 11267// that the subsequent page of results should be returned. 11268// 11269// The list request must be 11270// otherwise identical to the one that resulted in this token. 11271func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall { 11272 c.urlParams_.Set("pageToken", pageToken) 11273 return c 11274} 11275 11276// UserId sets the optional parameter "userId": Restricts returned 11277// invitations to those for a specific user. The identifier 11278// can be one of the following: 11279// 11280// * the numeric identifier for the user 11281// * the email address of the user 11282// * the string literal "me", indicating the requesting user 11283func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall { 11284 c.urlParams_.Set("userId", userId) 11285 return c 11286} 11287 11288// Fields allows partial responses to be retrieved. See 11289// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11290// for more information. 11291func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall { 11292 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11293 return c 11294} 11295 11296// IfNoneMatch sets the optional parameter which makes the operation 11297// fail if the object's ETag matches the given value. This is useful for 11298// getting updates only after the object has changed since the last 11299// request. Use googleapi.IsNotModified to check whether the response 11300// error from Do is the result of In-None-Match. 11301func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall { 11302 c.ifNoneMatch_ = entityTag 11303 return c 11304} 11305 11306// Context sets the context to be used in this call's Do method. Any 11307// pending HTTP request will be aborted if the provided context is 11308// canceled. 11309func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall { 11310 c.ctx_ = ctx 11311 return c 11312} 11313 11314// Header returns an http.Header that can be modified by the caller to 11315// add HTTP headers to the request. 11316func (c *InvitationsListCall) Header() http.Header { 11317 if c.header_ == nil { 11318 c.header_ = make(http.Header) 11319 } 11320 return c.header_ 11321} 11322 11323func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) { 11324 reqHeaders := make(http.Header) 11325 for k, v := range c.header_ { 11326 reqHeaders[k] = v 11327 } 11328 reqHeaders.Set("User-Agent", c.s.userAgent()) 11329 if c.ifNoneMatch_ != "" { 11330 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11331 } 11332 var body io.Reader = nil 11333 c.urlParams_.Set("alt", alt) 11334 c.urlParams_.Set("prettyPrint", "false") 11335 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11336 urls += "?" + c.urlParams_.Encode() 11337 req, err := http.NewRequest("GET", urls, body) 11338 if err != nil { 11339 return nil, err 11340 } 11341 req.Header = reqHeaders 11342 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11343} 11344 11345// Do executes the "classroom.invitations.list" call. 11346// Exactly one of *ListInvitationsResponse or error will be non-nil. Any 11347// non-2xx status code is an error. Response headers are in either 11348// *ListInvitationsResponse.ServerResponse.Header or (if a response was 11349// returned at all) in error.(*googleapi.Error).Header. Use 11350// googleapi.IsNotModified to check whether the returned error was 11351// because http.StatusNotModified was returned. 11352func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) { 11353 gensupport.SetOptions(c.urlParams_, opts...) 11354 res, err := c.doRequest("json") 11355 if res != nil && res.StatusCode == http.StatusNotModified { 11356 if res.Body != nil { 11357 res.Body.Close() 11358 } 11359 return nil, &googleapi.Error{ 11360 Code: res.StatusCode, 11361 Header: res.Header, 11362 } 11363 } 11364 if err != nil { 11365 return nil, err 11366 } 11367 defer googleapi.CloseBody(res) 11368 if err := googleapi.CheckResponse(res); err != nil { 11369 return nil, err 11370 } 11371 ret := &ListInvitationsResponse{ 11372 ServerResponse: googleapi.ServerResponse{ 11373 Header: res.Header, 11374 HTTPStatusCode: res.StatusCode, 11375 }, 11376 } 11377 target := &ret 11378 if err := gensupport.DecodeResponse(target, res); err != nil { 11379 return nil, err 11380 } 11381 return ret, nil 11382 // { 11383 // "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.", 11384 // "flatPath": "v1/invitations", 11385 // "httpMethod": "GET", 11386 // "id": "classroom.invitations.list", 11387 // "parameterOrder": [], 11388 // "parameters": { 11389 // "courseId": { 11390 // "description": "Restricts returned invitations to those for a course with the specified\nidentifier.", 11391 // "location": "query", 11392 // "type": "string" 11393 // }, 11394 // "pageSize": { 11395 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 11396 // "format": "int32", 11397 // "location": "query", 11398 // "type": "integer" 11399 // }, 11400 // "pageToken": { 11401 // "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.", 11402 // "location": "query", 11403 // "type": "string" 11404 // }, 11405 // "userId": { 11406 // "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", 11407 // "location": "query", 11408 // "type": "string" 11409 // } 11410 // }, 11411 // "path": "v1/invitations", 11412 // "response": { 11413 // "$ref": "ListInvitationsResponse" 11414 // }, 11415 // "scopes": [ 11416 // "https://www.googleapis.com/auth/classroom.rosters", 11417 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11418 // ] 11419 // } 11420 11421} 11422 11423// Pages invokes f for each page of results. 11424// A non-nil error returned from f will halt the iteration. 11425// The provided context supersedes any context provided to the Context method. 11426func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error { 11427 c.ctx_ = ctx 11428 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 11429 for { 11430 x, err := c.Do() 11431 if err != nil { 11432 return err 11433 } 11434 if err := f(x); err != nil { 11435 return err 11436 } 11437 if x.NextPageToken == "" { 11438 return nil 11439 } 11440 c.PageToken(x.NextPageToken) 11441 } 11442} 11443 11444// method id "classroom.registrations.create": 11445 11446type RegistrationsCreateCall struct { 11447 s *Service 11448 registration *Registration 11449 urlParams_ gensupport.URLParams 11450 ctx_ context.Context 11451 header_ http.Header 11452} 11453 11454// Create: Creates a `Registration`, causing Classroom to start sending 11455// notifications 11456// from the provided `feed` to the destination provided in 11457// `cloudPubSubTopic`. 11458// 11459// Returns the created `Registration`. Currently, this will be the same 11460// as 11461// the argument, but with server-assigned fields such as `expiry_time` 11462// and 11463// `id` filled in. 11464// 11465// Note that any value specified for the `expiry_time` or `id` fields 11466// will be 11467// ignored. 11468// 11469// While Classroom may validate the `cloudPubSubTopic` and return errors 11470// on a 11471// best effort basis, it is the caller's responsibility to ensure that 11472// it 11473// exists and that Classroom has permission to publish to it. 11474// 11475// This method may return the following error codes: 11476// 11477// * `PERMISSION_DENIED` if: 11478// * the authenticated user does not have permission to receive 11479// notifications from the requested field; or 11480// * the credential provided does not include the appropriate scope 11481// for 11482// the requested feed. 11483// * another access error is encountered. 11484// * `INVALID_ARGUMENT` if: 11485// * no `cloudPubsubTopic` is specified, or the specified 11486// `cloudPubsubTopic` is not valid; or 11487// * no `feed` is specified, or the specified `feed` is not valid. 11488// * `NOT_FOUND` if: 11489// * the specified `feed` cannot be located, or the requesting user 11490// does 11491// not have permission to determine whether or not it exists; or 11492// * the specified `cloudPubsubTopic` cannot be located, or 11493// Classroom has 11494// not been granted permission to publish to it. 11495func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall { 11496 c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11497 c.registration = registration 11498 return c 11499} 11500 11501// Fields allows partial responses to be retrieved. See 11502// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11503// for more information. 11504func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall { 11505 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11506 return c 11507} 11508 11509// Context sets the context to be used in this call's Do method. Any 11510// pending HTTP request will be aborted if the provided context is 11511// canceled. 11512func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall { 11513 c.ctx_ = ctx 11514 return c 11515} 11516 11517// Header returns an http.Header that can be modified by the caller to 11518// add HTTP headers to the request. 11519func (c *RegistrationsCreateCall) Header() http.Header { 11520 if c.header_ == nil { 11521 c.header_ = make(http.Header) 11522 } 11523 return c.header_ 11524} 11525 11526func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) { 11527 reqHeaders := make(http.Header) 11528 for k, v := range c.header_ { 11529 reqHeaders[k] = v 11530 } 11531 reqHeaders.Set("User-Agent", c.s.userAgent()) 11532 var body io.Reader = nil 11533 body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration) 11534 if err != nil { 11535 return nil, err 11536 } 11537 reqHeaders.Set("Content-Type", "application/json") 11538 c.urlParams_.Set("alt", alt) 11539 c.urlParams_.Set("prettyPrint", "false") 11540 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations") 11541 urls += "?" + c.urlParams_.Encode() 11542 req, err := http.NewRequest("POST", urls, body) 11543 if err != nil { 11544 return nil, err 11545 } 11546 req.Header = reqHeaders 11547 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11548} 11549 11550// Do executes the "classroom.registrations.create" call. 11551// Exactly one of *Registration or error will be non-nil. Any non-2xx 11552// status code is an error. Response headers are in either 11553// *Registration.ServerResponse.Header or (if a response was returned at 11554// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11555// to check whether the returned error was because 11556// http.StatusNotModified was returned. 11557func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) { 11558 gensupport.SetOptions(c.urlParams_, opts...) 11559 res, err := c.doRequest("json") 11560 if res != nil && res.StatusCode == http.StatusNotModified { 11561 if res.Body != nil { 11562 res.Body.Close() 11563 } 11564 return nil, &googleapi.Error{ 11565 Code: res.StatusCode, 11566 Header: res.Header, 11567 } 11568 } 11569 if err != nil { 11570 return nil, err 11571 } 11572 defer googleapi.CloseBody(res) 11573 if err := googleapi.CheckResponse(res); err != nil { 11574 return nil, err 11575 } 11576 ret := &Registration{ 11577 ServerResponse: googleapi.ServerResponse{ 11578 Header: res.Header, 11579 HTTPStatusCode: res.StatusCode, 11580 }, 11581 } 11582 target := &ret 11583 if err := gensupport.DecodeResponse(target, res); err != nil { 11584 return nil, err 11585 } 11586 return ret, nil 11587 // { 11588 // "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.", 11589 // "flatPath": "v1/registrations", 11590 // "httpMethod": "POST", 11591 // "id": "classroom.registrations.create", 11592 // "parameterOrder": [], 11593 // "parameters": {}, 11594 // "path": "v1/registrations", 11595 // "request": { 11596 // "$ref": "Registration" 11597 // }, 11598 // "response": { 11599 // "$ref": "Registration" 11600 // }, 11601 // "scopes": [ 11602 // "https://www.googleapis.com/auth/classroom.push-notifications" 11603 // ] 11604 // } 11605 11606} 11607 11608// method id "classroom.registrations.delete": 11609 11610type RegistrationsDeleteCall struct { 11611 s *Service 11612 registrationId string 11613 urlParams_ gensupport.URLParams 11614 ctx_ context.Context 11615 header_ http.Header 11616} 11617 11618// Delete: Deletes a `Registration`, causing Classroom to stop sending 11619// notifications 11620// for that `Registration`. 11621func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall { 11622 c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11623 c.registrationId = registrationId 11624 return c 11625} 11626 11627// Fields allows partial responses to be retrieved. See 11628// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11629// for more information. 11630func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall { 11631 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11632 return c 11633} 11634 11635// Context sets the context to be used in this call's Do method. Any 11636// pending HTTP request will be aborted if the provided context is 11637// canceled. 11638func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall { 11639 c.ctx_ = ctx 11640 return c 11641} 11642 11643// Header returns an http.Header that can be modified by the caller to 11644// add HTTP headers to the request. 11645func (c *RegistrationsDeleteCall) Header() http.Header { 11646 if c.header_ == nil { 11647 c.header_ = make(http.Header) 11648 } 11649 return c.header_ 11650} 11651 11652func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11653 reqHeaders := make(http.Header) 11654 for k, v := range c.header_ { 11655 reqHeaders[k] = v 11656 } 11657 reqHeaders.Set("User-Agent", c.s.userAgent()) 11658 var body io.Reader = nil 11659 c.urlParams_.Set("alt", alt) 11660 c.urlParams_.Set("prettyPrint", "false") 11661 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}") 11662 urls += "?" + c.urlParams_.Encode() 11663 req, err := http.NewRequest("DELETE", urls, body) 11664 if err != nil { 11665 return nil, err 11666 } 11667 req.Header = reqHeaders 11668 googleapi.Expand(req.URL, map[string]string{ 11669 "registrationId": c.registrationId, 11670 }) 11671 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11672} 11673 11674// Do executes the "classroom.registrations.delete" call. 11675// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11676// code is an error. Response headers are in either 11677// *Empty.ServerResponse.Header or (if a response was returned at all) 11678// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11679// check whether the returned error was because http.StatusNotModified 11680// was returned. 11681func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11682 gensupport.SetOptions(c.urlParams_, opts...) 11683 res, err := c.doRequest("json") 11684 if res != nil && res.StatusCode == http.StatusNotModified { 11685 if res.Body != nil { 11686 res.Body.Close() 11687 } 11688 return nil, &googleapi.Error{ 11689 Code: res.StatusCode, 11690 Header: res.Header, 11691 } 11692 } 11693 if err != nil { 11694 return nil, err 11695 } 11696 defer googleapi.CloseBody(res) 11697 if err := googleapi.CheckResponse(res); err != nil { 11698 return nil, err 11699 } 11700 ret := &Empty{ 11701 ServerResponse: googleapi.ServerResponse{ 11702 Header: res.Header, 11703 HTTPStatusCode: res.StatusCode, 11704 }, 11705 } 11706 target := &ret 11707 if err := gensupport.DecodeResponse(target, res); err != nil { 11708 return nil, err 11709 } 11710 return ret, nil 11711 // { 11712 // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications\nfor that `Registration`.", 11713 // "flatPath": "v1/registrations/{registrationId}", 11714 // "httpMethod": "DELETE", 11715 // "id": "classroom.registrations.delete", 11716 // "parameterOrder": [ 11717 // "registrationId" 11718 // ], 11719 // "parameters": { 11720 // "registrationId": { 11721 // "description": "The `registration_id` of the `Registration` to be deleted.", 11722 // "location": "path", 11723 // "required": true, 11724 // "type": "string" 11725 // } 11726 // }, 11727 // "path": "v1/registrations/{registrationId}", 11728 // "response": { 11729 // "$ref": "Empty" 11730 // }, 11731 // "scopes": [ 11732 // "https://www.googleapis.com/auth/classroom.push-notifications" 11733 // ] 11734 // } 11735 11736} 11737 11738// method id "classroom.userProfiles.get": 11739 11740type UserProfilesGetCall struct { 11741 s *Service 11742 userId string 11743 urlParams_ gensupport.URLParams 11744 ifNoneMatch_ string 11745 ctx_ context.Context 11746 header_ http.Header 11747} 11748 11749// Get: Returns a user profile. 11750// 11751// This method returns the following error codes: 11752// 11753// * `PERMISSION_DENIED` if the requesting user is not permitted to 11754// access 11755// this user profile, if no profile exists with the requested ID, or 11756// for 11757// access errors. 11758func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall { 11759 c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11760 c.userId = userId 11761 return c 11762} 11763 11764// Fields allows partial responses to be retrieved. See 11765// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11766// for more information. 11767func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall { 11768 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11769 return c 11770} 11771 11772// IfNoneMatch sets the optional parameter which makes the operation 11773// fail if the object's ETag matches the given value. This is useful for 11774// getting updates only after the object has changed since the last 11775// request. Use googleapi.IsNotModified to check whether the response 11776// error from Do is the result of In-None-Match. 11777func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall { 11778 c.ifNoneMatch_ = entityTag 11779 return c 11780} 11781 11782// Context sets the context to be used in this call's Do method. Any 11783// pending HTTP request will be aborted if the provided context is 11784// canceled. 11785func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall { 11786 c.ctx_ = ctx 11787 return c 11788} 11789 11790// Header returns an http.Header that can be modified by the caller to 11791// add HTTP headers to the request. 11792func (c *UserProfilesGetCall) Header() http.Header { 11793 if c.header_ == nil { 11794 c.header_ = make(http.Header) 11795 } 11796 return c.header_ 11797} 11798 11799func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) { 11800 reqHeaders := make(http.Header) 11801 for k, v := range c.header_ { 11802 reqHeaders[k] = v 11803 } 11804 reqHeaders.Set("User-Agent", c.s.userAgent()) 11805 if c.ifNoneMatch_ != "" { 11806 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11807 } 11808 var body io.Reader = nil 11809 c.urlParams_.Set("alt", alt) 11810 c.urlParams_.Set("prettyPrint", "false") 11811 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}") 11812 urls += "?" + c.urlParams_.Encode() 11813 req, err := http.NewRequest("GET", urls, body) 11814 if err != nil { 11815 return nil, err 11816 } 11817 req.Header = reqHeaders 11818 googleapi.Expand(req.URL, map[string]string{ 11819 "userId": c.userId, 11820 }) 11821 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11822} 11823 11824// Do executes the "classroom.userProfiles.get" call. 11825// Exactly one of *UserProfile or error will be non-nil. Any non-2xx 11826// status code is an error. Response headers are in either 11827// *UserProfile.ServerResponse.Header or (if a response was returned at 11828// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11829// to check whether the returned error was because 11830// http.StatusNotModified was returned. 11831func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) { 11832 gensupport.SetOptions(c.urlParams_, opts...) 11833 res, err := c.doRequest("json") 11834 if res != nil && res.StatusCode == http.StatusNotModified { 11835 if res.Body != nil { 11836 res.Body.Close() 11837 } 11838 return nil, &googleapi.Error{ 11839 Code: res.StatusCode, 11840 Header: res.Header, 11841 } 11842 } 11843 if err != nil { 11844 return nil, err 11845 } 11846 defer googleapi.CloseBody(res) 11847 if err := googleapi.CheckResponse(res); err != nil { 11848 return nil, err 11849 } 11850 ret := &UserProfile{ 11851 ServerResponse: googleapi.ServerResponse{ 11852 Header: res.Header, 11853 HTTPStatusCode: res.StatusCode, 11854 }, 11855 } 11856 target := &ret 11857 if err := gensupport.DecodeResponse(target, res); err != nil { 11858 return nil, err 11859 } 11860 return ret, nil 11861 // { 11862 // "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.", 11863 // "flatPath": "v1/userProfiles/{userId}", 11864 // "httpMethod": "GET", 11865 // "id": "classroom.userProfiles.get", 11866 // "parameterOrder": [ 11867 // "userId" 11868 // ], 11869 // "parameters": { 11870 // "userId": { 11871 // "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", 11872 // "location": "path", 11873 // "required": true, 11874 // "type": "string" 11875 // } 11876 // }, 11877 // "path": "v1/userProfiles/{userId}", 11878 // "response": { 11879 // "$ref": "UserProfile" 11880 // }, 11881 // "scopes": [ 11882 // "https://www.googleapis.com/auth/classroom.profile.emails", 11883 // "https://www.googleapis.com/auth/classroom.profile.photos", 11884 // "https://www.googleapis.com/auth/classroom.rosters", 11885 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11886 // ] 11887 // } 11888 11889} 11890 11891// method id "classroom.userProfiles.guardianInvitations.create": 11892 11893type UserProfilesGuardianInvitationsCreateCall struct { 11894 s *Service 11895 studentId string 11896 guardianinvitation *GuardianInvitation 11897 urlParams_ gensupport.URLParams 11898 ctx_ context.Context 11899 header_ http.Header 11900} 11901 11902// Create: Creates a guardian invitation, and sends an email to the 11903// guardian asking 11904// them to confirm that they are the student's guardian. 11905// 11906// Once the guardian accepts the invitation, their `state` will change 11907// to 11908// `COMPLETED` and they will start receiving guardian notifications. 11909// A 11910// `Guardian` resource will also be created to represent the active 11911// guardian. 11912// 11913// The request object must have the `student_id` 11914// and 11915// `invited_email_address` fields set. Failing to set these fields, 11916// or 11917// setting any other fields in the request, will result in an 11918// error. 11919// 11920// This method returns the following error codes: 11921// 11922// * `PERMISSION_DENIED` if the current user does not have permission 11923// to 11924// manage guardians, if the guardian in question has already rejected 11925// too many requests for that student, if guardians are not enabled 11926// for the 11927// domain in question, or for other access errors. 11928// * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the 11929// guardian 11930// link limit. 11931// * `INVALID_ARGUMENT` if the guardian email address is not valid (for 11932// example, if it is too long), or if the format of the student ID 11933// provided 11934// cannot be recognized (it is not an email address, nor a `user_id` 11935// from 11936// this API). This error will also be returned if read-only fields are 11937// set, 11938// or if the `state` field is set to to a value other than 11939// `PENDING`. 11940// * `NOT_FOUND` if the student ID provided is a valid student ID, but 11941// Classroom has no record of that student. 11942// * `ALREADY_EXISTS` if there is already a pending guardian invitation 11943// for 11944// the student and `invited_email_address` provided, or if the 11945// provided 11946// `invited_email_address` matches the Google account of an existing 11947// `Guardian` for this user. 11948func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall { 11949 c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11950 c.studentId = studentId 11951 c.guardianinvitation = guardianinvitation 11952 return c 11953} 11954 11955// Fields allows partial responses to be retrieved. See 11956// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11957// for more information. 11958func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall { 11959 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11960 return c 11961} 11962 11963// Context sets the context to be used in this call's Do method. Any 11964// pending HTTP request will be aborted if the provided context is 11965// canceled. 11966func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall { 11967 c.ctx_ = ctx 11968 return c 11969} 11970 11971// Header returns an http.Header that can be modified by the caller to 11972// add HTTP headers to the request. 11973func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header { 11974 if c.header_ == nil { 11975 c.header_ = make(http.Header) 11976 } 11977 return c.header_ 11978} 11979 11980func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 11981 reqHeaders := make(http.Header) 11982 for k, v := range c.header_ { 11983 reqHeaders[k] = v 11984 } 11985 reqHeaders.Set("User-Agent", c.s.userAgent()) 11986 var body io.Reader = nil 11987 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 11988 if err != nil { 11989 return nil, err 11990 } 11991 reqHeaders.Set("Content-Type", "application/json") 11992 c.urlParams_.Set("alt", alt) 11993 c.urlParams_.Set("prettyPrint", "false") 11994 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 11995 urls += "?" + c.urlParams_.Encode() 11996 req, err := http.NewRequest("POST", urls, body) 11997 if err != nil { 11998 return nil, err 11999 } 12000 req.Header = reqHeaders 12001 googleapi.Expand(req.URL, map[string]string{ 12002 "studentId": c.studentId, 12003 }) 12004 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12005} 12006 12007// Do executes the "classroom.userProfiles.guardianInvitations.create" call. 12008// Exactly one of *GuardianInvitation or error will be non-nil. Any 12009// non-2xx status code is an error. Response headers are in either 12010// *GuardianInvitation.ServerResponse.Header or (if a response was 12011// returned at all) in error.(*googleapi.Error).Header. Use 12012// googleapi.IsNotModified to check whether the returned error was 12013// because http.StatusNotModified was returned. 12014func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12015 gensupport.SetOptions(c.urlParams_, opts...) 12016 res, err := c.doRequest("json") 12017 if res != nil && res.StatusCode == http.StatusNotModified { 12018 if res.Body != nil { 12019 res.Body.Close() 12020 } 12021 return nil, &googleapi.Error{ 12022 Code: res.StatusCode, 12023 Header: res.Header, 12024 } 12025 } 12026 if err != nil { 12027 return nil, err 12028 } 12029 defer googleapi.CloseBody(res) 12030 if err := googleapi.CheckResponse(res); err != nil { 12031 return nil, err 12032 } 12033 ret := &GuardianInvitation{ 12034 ServerResponse: googleapi.ServerResponse{ 12035 Header: res.Header, 12036 HTTPStatusCode: res.StatusCode, 12037 }, 12038 } 12039 target := &ret 12040 if err := gensupport.DecodeResponse(target, res); err != nil { 12041 return nil, err 12042 } 12043 return ret, nil 12044 // { 12045 // "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.", 12046 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12047 // "httpMethod": "POST", 12048 // "id": "classroom.userProfiles.guardianInvitations.create", 12049 // "parameterOrder": [ 12050 // "studentId" 12051 // ], 12052 // "parameters": { 12053 // "studentId": { 12054 // "description": "ID of the student (in standard format)", 12055 // "location": "path", 12056 // "required": true, 12057 // "type": "string" 12058 // } 12059 // }, 12060 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12061 // "request": { 12062 // "$ref": "GuardianInvitation" 12063 // }, 12064 // "response": { 12065 // "$ref": "GuardianInvitation" 12066 // }, 12067 // "scopes": [ 12068 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12069 // ] 12070 // } 12071 12072} 12073 12074// method id "classroom.userProfiles.guardianInvitations.get": 12075 12076type UserProfilesGuardianInvitationsGetCall struct { 12077 s *Service 12078 studentId string 12079 invitationId string 12080 urlParams_ gensupport.URLParams 12081 ifNoneMatch_ string 12082 ctx_ context.Context 12083 header_ http.Header 12084} 12085 12086// Get: Returns a specific guardian invitation. 12087// 12088// This method returns the following error codes: 12089// 12090// * `PERMISSION_DENIED` if the requesting user is not permitted to 12091// view 12092// guardian invitations for the student identified by the 12093// `student_id`, if 12094// guardians are not enabled for the domain in question, or for other 12095// access errors. 12096// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12097// cannot 12098// be recognized (it is not an email address, nor a `student_id` from 12099// the 12100// API, nor the literal string `me`). 12101// * `NOT_FOUND` if Classroom cannot find any record of the given 12102// student or 12103// `invitation_id`. May also be returned if the student exists, but 12104// the 12105// requesting user does not have access to see that student. 12106func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall { 12107 c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12108 c.studentId = studentId 12109 c.invitationId = invitationId 12110 return c 12111} 12112 12113// Fields allows partial responses to be retrieved. See 12114// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12115// for more information. 12116func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall { 12117 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12118 return c 12119} 12120 12121// IfNoneMatch sets the optional parameter which makes the operation 12122// fail if the object's ETag matches the given value. This is useful for 12123// getting updates only after the object has changed since the last 12124// request. Use googleapi.IsNotModified to check whether the response 12125// error from Do is the result of In-None-Match. 12126func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall { 12127 c.ifNoneMatch_ = entityTag 12128 return c 12129} 12130 12131// Context sets the context to be used in this call's Do method. Any 12132// pending HTTP request will be aborted if the provided context is 12133// canceled. 12134func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall { 12135 c.ctx_ = ctx 12136 return c 12137} 12138 12139// Header returns an http.Header that can be modified by the caller to 12140// add HTTP headers to the request. 12141func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header { 12142 if c.header_ == nil { 12143 c.header_ = make(http.Header) 12144 } 12145 return c.header_ 12146} 12147 12148func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) { 12149 reqHeaders := make(http.Header) 12150 for k, v := range c.header_ { 12151 reqHeaders[k] = v 12152 } 12153 reqHeaders.Set("User-Agent", c.s.userAgent()) 12154 if c.ifNoneMatch_ != "" { 12155 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12156 } 12157 var body io.Reader = nil 12158 c.urlParams_.Set("alt", alt) 12159 c.urlParams_.Set("prettyPrint", "false") 12160 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12161 urls += "?" + c.urlParams_.Encode() 12162 req, err := http.NewRequest("GET", urls, body) 12163 if err != nil { 12164 return nil, err 12165 } 12166 req.Header = reqHeaders 12167 googleapi.Expand(req.URL, map[string]string{ 12168 "studentId": c.studentId, 12169 "invitationId": c.invitationId, 12170 }) 12171 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12172} 12173 12174// Do executes the "classroom.userProfiles.guardianInvitations.get" call. 12175// Exactly one of *GuardianInvitation or error will be non-nil. Any 12176// non-2xx status code is an error. Response headers are in either 12177// *GuardianInvitation.ServerResponse.Header or (if a response was 12178// returned at all) in error.(*googleapi.Error).Header. Use 12179// googleapi.IsNotModified to check whether the returned error was 12180// because http.StatusNotModified was returned. 12181func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12182 gensupport.SetOptions(c.urlParams_, opts...) 12183 res, err := c.doRequest("json") 12184 if res != nil && res.StatusCode == http.StatusNotModified { 12185 if res.Body != nil { 12186 res.Body.Close() 12187 } 12188 return nil, &googleapi.Error{ 12189 Code: res.StatusCode, 12190 Header: res.Header, 12191 } 12192 } 12193 if err != nil { 12194 return nil, err 12195 } 12196 defer googleapi.CloseBody(res) 12197 if err := googleapi.CheckResponse(res); err != nil { 12198 return nil, err 12199 } 12200 ret := &GuardianInvitation{ 12201 ServerResponse: googleapi.ServerResponse{ 12202 Header: res.Header, 12203 HTTPStatusCode: res.StatusCode, 12204 }, 12205 } 12206 target := &ret 12207 if err := gensupport.DecodeResponse(target, res); err != nil { 12208 return nil, err 12209 } 12210 return ret, nil 12211 // { 12212 // "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.", 12213 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12214 // "httpMethod": "GET", 12215 // "id": "classroom.userProfiles.guardianInvitations.get", 12216 // "parameterOrder": [ 12217 // "studentId", 12218 // "invitationId" 12219 // ], 12220 // "parameters": { 12221 // "invitationId": { 12222 // "description": "The `id` field of the `GuardianInvitation` being requested.", 12223 // "location": "path", 12224 // "required": true, 12225 // "type": "string" 12226 // }, 12227 // "studentId": { 12228 // "description": "The ID of the student whose guardian invitation is being requested.", 12229 // "location": "path", 12230 // "required": true, 12231 // "type": "string" 12232 // } 12233 // }, 12234 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12235 // "response": { 12236 // "$ref": "GuardianInvitation" 12237 // }, 12238 // "scopes": [ 12239 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12240 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12241 // ] 12242 // } 12243 12244} 12245 12246// method id "classroom.userProfiles.guardianInvitations.list": 12247 12248type UserProfilesGuardianInvitationsListCall struct { 12249 s *Service 12250 studentId string 12251 urlParams_ gensupport.URLParams 12252 ifNoneMatch_ string 12253 ctx_ context.Context 12254 header_ http.Header 12255} 12256 12257// List: Returns a list of guardian invitations that the requesting user 12258// is 12259// permitted to view, filtered by the parameters provided. 12260// 12261// This method returns the following error codes: 12262// 12263// * `PERMISSION_DENIED` if a `student_id` is specified, and the 12264// requesting 12265// user is not permitted to view guardian invitations for that 12266// student, if 12267// "-" is specified as the `student_id` and the user is not a 12268// domain 12269// administrator, if guardians are not enabled for the domain in 12270// question, 12271// or for other access errors. 12272// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12273// cannot 12274// be recognized (it is not an email address, nor a `student_id` from 12275// the 12276// API, nor the literal string `me`). May also be returned if an 12277// invalid 12278// `page_token` or `state` is provided. 12279// * `NOT_FOUND` if a `student_id` is specified, and its format can be 12280// recognized, but Classroom has no record of that student. 12281func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall { 12282 c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12283 c.studentId = studentId 12284 return c 12285} 12286 12287// InvitedEmailAddress sets the optional parameter 12288// "invitedEmailAddress": If specified, only results with the specified 12289// `invited_email_address` 12290// will be returned. 12291func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall { 12292 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 12293 return c 12294} 12295 12296// PageSize sets the optional parameter "pageSize": Maximum number of 12297// items to return. Zero or unspecified indicates that the 12298// server may assign a maximum. 12299// 12300// The server may return fewer than the specified number of results. 12301func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall { 12302 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 12303 return c 12304} 12305 12306// PageToken sets the optional parameter "pageToken": 12307// nextPageToken 12308// value returned from a previous 12309// list call, 12310// indicating that the subsequent page of results should be 12311// returned. 12312// 12313// The list request 12314// must be otherwise identical to the one that resulted in this token. 12315func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall { 12316 c.urlParams_.Set("pageToken", pageToken) 12317 return c 12318} 12319 12320// States sets the optional parameter "states": If specified, only 12321// results with the specified `state` values will be 12322// returned. Otherwise, results with a `state` of `PENDING` will be 12323// returned. 12324// 12325// Possible values: 12326// "GUARDIAN_INVITATION_STATE_UNSPECIFIED" 12327// "PENDING" 12328// "COMPLETE" 12329func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall { 12330 c.urlParams_.SetMulti("states", append([]string{}, states...)) 12331 return c 12332} 12333 12334// Fields allows partial responses to be retrieved. See 12335// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12336// for more information. 12337func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall { 12338 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12339 return c 12340} 12341 12342// IfNoneMatch sets the optional parameter which makes the operation 12343// fail if the object's ETag matches the given value. This is useful for 12344// getting updates only after the object has changed since the last 12345// request. Use googleapi.IsNotModified to check whether the response 12346// error from Do is the result of In-None-Match. 12347func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall { 12348 c.ifNoneMatch_ = entityTag 12349 return c 12350} 12351 12352// Context sets the context to be used in this call's Do method. Any 12353// pending HTTP request will be aborted if the provided context is 12354// canceled. 12355func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall { 12356 c.ctx_ = ctx 12357 return c 12358} 12359 12360// Header returns an http.Header that can be modified by the caller to 12361// add HTTP headers to the request. 12362func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header { 12363 if c.header_ == nil { 12364 c.header_ = make(http.Header) 12365 } 12366 return c.header_ 12367} 12368 12369func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) { 12370 reqHeaders := make(http.Header) 12371 for k, v := range c.header_ { 12372 reqHeaders[k] = v 12373 } 12374 reqHeaders.Set("User-Agent", c.s.userAgent()) 12375 if c.ifNoneMatch_ != "" { 12376 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12377 } 12378 var body io.Reader = nil 12379 c.urlParams_.Set("alt", alt) 12380 c.urlParams_.Set("prettyPrint", "false") 12381 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12382 urls += "?" + c.urlParams_.Encode() 12383 req, err := http.NewRequest("GET", urls, body) 12384 if err != nil { 12385 return nil, err 12386 } 12387 req.Header = reqHeaders 12388 googleapi.Expand(req.URL, map[string]string{ 12389 "studentId": c.studentId, 12390 }) 12391 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12392} 12393 12394// Do executes the "classroom.userProfiles.guardianInvitations.list" call. 12395// Exactly one of *ListGuardianInvitationsResponse or error will be 12396// non-nil. Any non-2xx status code is an error. Response headers are in 12397// either *ListGuardianInvitationsResponse.ServerResponse.Header or (if 12398// a response was returned at all) in error.(*googleapi.Error).Header. 12399// Use googleapi.IsNotModified to check whether the returned error was 12400// because http.StatusNotModified was returned. 12401func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) { 12402 gensupport.SetOptions(c.urlParams_, opts...) 12403 res, err := c.doRequest("json") 12404 if res != nil && res.StatusCode == http.StatusNotModified { 12405 if res.Body != nil { 12406 res.Body.Close() 12407 } 12408 return nil, &googleapi.Error{ 12409 Code: res.StatusCode, 12410 Header: res.Header, 12411 } 12412 } 12413 if err != nil { 12414 return nil, err 12415 } 12416 defer googleapi.CloseBody(res) 12417 if err := googleapi.CheckResponse(res); err != nil { 12418 return nil, err 12419 } 12420 ret := &ListGuardianInvitationsResponse{ 12421 ServerResponse: googleapi.ServerResponse{ 12422 Header: res.Header, 12423 HTTPStatusCode: res.StatusCode, 12424 }, 12425 } 12426 target := &ret 12427 if err := gensupport.DecodeResponse(target, res); err != nil { 12428 return nil, err 12429 } 12430 return ret, nil 12431 // { 12432 // "description": "Returns a 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.", 12433 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12434 // "httpMethod": "GET", 12435 // "id": "classroom.userProfiles.guardianInvitations.list", 12436 // "parameterOrder": [ 12437 // "studentId" 12438 // ], 12439 // "parameters": { 12440 // "invitedEmailAddress": { 12441 // "description": "If specified, only results with the specified `invited_email_address`\nwill be returned.", 12442 // "location": "query", 12443 // "type": "string" 12444 // }, 12445 // "pageSize": { 12446 // "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.", 12447 // "format": "int32", 12448 // "location": "query", 12449 // "type": "integer" 12450 // }, 12451 // "pageToken": { 12452 // "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.", 12453 // "location": "query", 12454 // "type": "string" 12455 // }, 12456 // "states": { 12457 // "description": "If specified, only results with the specified `state` values will be\nreturned. Otherwise, results with a `state` of `PENDING` will be returned.", 12458 // "enum": [ 12459 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED", 12460 // "PENDING", 12461 // "COMPLETE" 12462 // ], 12463 // "location": "query", 12464 // "repeated": true, 12465 // "type": "string" 12466 // }, 12467 // "studentId": { 12468 // "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.", 12469 // "location": "path", 12470 // "required": true, 12471 // "type": "string" 12472 // } 12473 // }, 12474 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12475 // "response": { 12476 // "$ref": "ListGuardianInvitationsResponse" 12477 // }, 12478 // "scopes": [ 12479 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12480 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12481 // ] 12482 // } 12483 12484} 12485 12486// Pages invokes f for each page of results. 12487// A non-nil error returned from f will halt the iteration. 12488// The provided context supersedes any context provided to the Context method. 12489func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error { 12490 c.ctx_ = ctx 12491 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12492 for { 12493 x, err := c.Do() 12494 if err != nil { 12495 return err 12496 } 12497 if err := f(x); err != nil { 12498 return err 12499 } 12500 if x.NextPageToken == "" { 12501 return nil 12502 } 12503 c.PageToken(x.NextPageToken) 12504 } 12505} 12506 12507// method id "classroom.userProfiles.guardianInvitations.patch": 12508 12509type UserProfilesGuardianInvitationsPatchCall struct { 12510 s *Service 12511 studentId string 12512 invitationId string 12513 guardianinvitation *GuardianInvitation 12514 urlParams_ gensupport.URLParams 12515 ctx_ context.Context 12516 header_ http.Header 12517} 12518 12519// Patch: Modifies a guardian invitation. 12520// 12521// Currently, the only valid modification is to change the `state` 12522// from 12523// `PENDING` to `COMPLETE`. This has the effect of withdrawing the 12524// invitation. 12525// 12526// This method returns the following error codes: 12527// 12528// * `PERMISSION_DENIED` if the current user does not have permission 12529// to 12530// manage guardians, if guardians are not enabled for the domain in 12531// question 12532// or for other access errors. 12533// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` 12534// state. 12535// * `INVALID_ARGUMENT` if the format of the student ID provided 12536// cannot be recognized (it is not an email address, nor a `user_id` 12537// from 12538// this API), or if the passed `GuardianInvitation` has a `state` 12539// other than 12540// `COMPLETE`, or if it modifies fields other than `state`. 12541// * `NOT_FOUND` if the student ID provided is a valid student ID, but 12542// Classroom has no record of that student, or if the `id` field does 12543// not 12544// refer to a guardian invitation known to Classroom. 12545func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall { 12546 c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12547 c.studentId = studentId 12548 c.invitationId = invitationId 12549 c.guardianinvitation = guardianinvitation 12550 return c 12551} 12552 12553// UpdateMask sets the optional parameter "updateMask": Mask that 12554// identifies which fields on the course to update. 12555// This field is required to do an update. The update will fail if 12556// invalid 12557// fields are specified. The following fields are valid: 12558// 12559// * `state` 12560// 12561// When set in a query parameter, this field should be specified 12562// as 12563// 12564// `updateMask=<field1>,<field2>,...` 12565func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall { 12566 c.urlParams_.Set("updateMask", updateMask) 12567 return c 12568} 12569 12570// Fields allows partial responses to be retrieved. See 12571// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12572// for more information. 12573func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall { 12574 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12575 return c 12576} 12577 12578// Context sets the context to be used in this call's Do method. Any 12579// pending HTTP request will be aborted if the provided context is 12580// canceled. 12581func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall { 12582 c.ctx_ = ctx 12583 return c 12584} 12585 12586// Header returns an http.Header that can be modified by the caller to 12587// add HTTP headers to the request. 12588func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header { 12589 if c.header_ == nil { 12590 c.header_ = make(http.Header) 12591 } 12592 return c.header_ 12593} 12594 12595func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) { 12596 reqHeaders := make(http.Header) 12597 for k, v := range c.header_ { 12598 reqHeaders[k] = v 12599 } 12600 reqHeaders.Set("User-Agent", c.s.userAgent()) 12601 var body io.Reader = nil 12602 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12603 if err != nil { 12604 return nil, err 12605 } 12606 reqHeaders.Set("Content-Type", "application/json") 12607 c.urlParams_.Set("alt", alt) 12608 c.urlParams_.Set("prettyPrint", "false") 12609 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12610 urls += "?" + c.urlParams_.Encode() 12611 req, err := http.NewRequest("PATCH", urls, body) 12612 if err != nil { 12613 return nil, err 12614 } 12615 req.Header = reqHeaders 12616 googleapi.Expand(req.URL, map[string]string{ 12617 "studentId": c.studentId, 12618 "invitationId": c.invitationId, 12619 }) 12620 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12621} 12622 12623// Do executes the "classroom.userProfiles.guardianInvitations.patch" call. 12624// Exactly one of *GuardianInvitation or error will be non-nil. Any 12625// non-2xx status code is an error. Response headers are in either 12626// *GuardianInvitation.ServerResponse.Header or (if a response was 12627// returned at all) in error.(*googleapi.Error).Header. Use 12628// googleapi.IsNotModified to check whether the returned error was 12629// because http.StatusNotModified was returned. 12630func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12631 gensupport.SetOptions(c.urlParams_, opts...) 12632 res, err := c.doRequest("json") 12633 if res != nil && res.StatusCode == http.StatusNotModified { 12634 if res.Body != nil { 12635 res.Body.Close() 12636 } 12637 return nil, &googleapi.Error{ 12638 Code: res.StatusCode, 12639 Header: res.Header, 12640 } 12641 } 12642 if err != nil { 12643 return nil, err 12644 } 12645 defer googleapi.CloseBody(res) 12646 if err := googleapi.CheckResponse(res); err != nil { 12647 return nil, err 12648 } 12649 ret := &GuardianInvitation{ 12650 ServerResponse: googleapi.ServerResponse{ 12651 Header: res.Header, 12652 HTTPStatusCode: res.StatusCode, 12653 }, 12654 } 12655 target := &ret 12656 if err := gensupport.DecodeResponse(target, res); err != nil { 12657 return nil, err 12658 } 12659 return ret, nil 12660 // { 12661 // "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.", 12662 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12663 // "httpMethod": "PATCH", 12664 // "id": "classroom.userProfiles.guardianInvitations.patch", 12665 // "parameterOrder": [ 12666 // "studentId", 12667 // "invitationId" 12668 // ], 12669 // "parameters": { 12670 // "invitationId": { 12671 // "description": "The `id` field of the `GuardianInvitation` to be modified.", 12672 // "location": "path", 12673 // "required": true, 12674 // "type": "string" 12675 // }, 12676 // "studentId": { 12677 // "description": "The ID of the student whose guardian invitation is to be modified.", 12678 // "location": "path", 12679 // "required": true, 12680 // "type": "string" 12681 // }, 12682 // "updateMask": { 12683 // "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,...`", 12684 // "format": "google-fieldmask", 12685 // "location": "query", 12686 // "type": "string" 12687 // } 12688 // }, 12689 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12690 // "request": { 12691 // "$ref": "GuardianInvitation" 12692 // }, 12693 // "response": { 12694 // "$ref": "GuardianInvitation" 12695 // }, 12696 // "scopes": [ 12697 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12698 // ] 12699 // } 12700 12701} 12702 12703// method id "classroom.userProfiles.guardians.delete": 12704 12705type UserProfilesGuardiansDeleteCall struct { 12706 s *Service 12707 studentId string 12708 guardianId string 12709 urlParams_ gensupport.URLParams 12710 ctx_ context.Context 12711 header_ http.Header 12712} 12713 12714// Delete: Deletes a guardian. 12715// 12716// The guardian will no longer receive guardian notifications and the 12717// guardian 12718// will no longer be accessible via the API. 12719// 12720// This method returns the following error codes: 12721// 12722// * `PERMISSION_DENIED` if no user that matches the provided 12723// `student_id` 12724// is visible to the requesting user, if the requesting user is not 12725// permitted to manage guardians for the student identified by the 12726// `student_id`, if guardians are not enabled for the domain in 12727// question, 12728// or for other access errors. 12729// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12730// cannot 12731// be recognized (it is not an email address, nor a `student_id` from 12732// the 12733// API). 12734// * `NOT_FOUND` if the requesting user is permitted to modify guardians 12735// for 12736// the requested `student_id`, but no `Guardian` record exists for 12737// that 12738// student with the provided `guardian_id`. 12739func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall { 12740 c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12741 c.studentId = studentId 12742 c.guardianId = guardianId 12743 return c 12744} 12745 12746// Fields allows partial responses to be retrieved. See 12747// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12748// for more information. 12749func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall { 12750 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12751 return c 12752} 12753 12754// Context sets the context to be used in this call's Do method. Any 12755// pending HTTP request will be aborted if the provided context is 12756// canceled. 12757func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall { 12758 c.ctx_ = ctx 12759 return c 12760} 12761 12762// Header returns an http.Header that can be modified by the caller to 12763// add HTTP headers to the request. 12764func (c *UserProfilesGuardiansDeleteCall) Header() http.Header { 12765 if c.header_ == nil { 12766 c.header_ = make(http.Header) 12767 } 12768 return c.header_ 12769} 12770 12771func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) { 12772 reqHeaders := make(http.Header) 12773 for k, v := range c.header_ { 12774 reqHeaders[k] = v 12775 } 12776 reqHeaders.Set("User-Agent", c.s.userAgent()) 12777 var body io.Reader = nil 12778 c.urlParams_.Set("alt", alt) 12779 c.urlParams_.Set("prettyPrint", "false") 12780 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 12781 urls += "?" + c.urlParams_.Encode() 12782 req, err := http.NewRequest("DELETE", urls, body) 12783 if err != nil { 12784 return nil, err 12785 } 12786 req.Header = reqHeaders 12787 googleapi.Expand(req.URL, map[string]string{ 12788 "studentId": c.studentId, 12789 "guardianId": c.guardianId, 12790 }) 12791 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12792} 12793 12794// Do executes the "classroom.userProfiles.guardians.delete" call. 12795// Exactly one of *Empty or error will be non-nil. Any non-2xx status 12796// code is an error. Response headers are in either 12797// *Empty.ServerResponse.Header or (if a response was returned at all) 12798// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12799// check whether the returned error was because http.StatusNotModified 12800// was returned. 12801func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 12802 gensupport.SetOptions(c.urlParams_, opts...) 12803 res, err := c.doRequest("json") 12804 if res != nil && res.StatusCode == http.StatusNotModified { 12805 if res.Body != nil { 12806 res.Body.Close() 12807 } 12808 return nil, &googleapi.Error{ 12809 Code: res.StatusCode, 12810 Header: res.Header, 12811 } 12812 } 12813 if err != nil { 12814 return nil, err 12815 } 12816 defer googleapi.CloseBody(res) 12817 if err := googleapi.CheckResponse(res); err != nil { 12818 return nil, err 12819 } 12820 ret := &Empty{ 12821 ServerResponse: googleapi.ServerResponse{ 12822 Header: res.Header, 12823 HTTPStatusCode: res.StatusCode, 12824 }, 12825 } 12826 target := &ret 12827 if err := gensupport.DecodeResponse(target, res); err != nil { 12828 return nil, err 12829 } 12830 return ret, nil 12831 // { 12832 // "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`.", 12833 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12834 // "httpMethod": "DELETE", 12835 // "id": "classroom.userProfiles.guardians.delete", 12836 // "parameterOrder": [ 12837 // "studentId", 12838 // "guardianId" 12839 // ], 12840 // "parameters": { 12841 // "guardianId": { 12842 // "description": "The `id` field from a `Guardian`.", 12843 // "location": "path", 12844 // "required": true, 12845 // "type": "string" 12846 // }, 12847 // "studentId": { 12848 // "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", 12849 // "location": "path", 12850 // "required": true, 12851 // "type": "string" 12852 // } 12853 // }, 12854 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12855 // "response": { 12856 // "$ref": "Empty" 12857 // }, 12858 // "scopes": [ 12859 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12860 // ] 12861 // } 12862 12863} 12864 12865// method id "classroom.userProfiles.guardians.get": 12866 12867type UserProfilesGuardiansGetCall struct { 12868 s *Service 12869 studentId string 12870 guardianId string 12871 urlParams_ gensupport.URLParams 12872 ifNoneMatch_ string 12873 ctx_ context.Context 12874 header_ http.Header 12875} 12876 12877// Get: Returns a specific guardian. 12878// 12879// This method returns the following error codes: 12880// 12881// * `PERMISSION_DENIED` if no user that matches the provided 12882// `student_id` 12883// is visible to the requesting user, if the requesting user is not 12884// permitted to view guardian information for the student identified 12885// by the 12886// `student_id`, if guardians are not enabled for the domain in 12887// question, 12888// or for other access errors. 12889// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12890// cannot 12891// be recognized (it is not an email address, nor a `student_id` from 12892// the 12893// API, nor the literal string `me`). 12894// * `NOT_FOUND` if the requesting user is permitted to view guardians 12895// for 12896// the requested `student_id`, but no `Guardian` record exists for 12897// that 12898// student that matches the provided `guardian_id`. 12899func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall { 12900 c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12901 c.studentId = studentId 12902 c.guardianId = guardianId 12903 return c 12904} 12905 12906// Fields allows partial responses to be retrieved. See 12907// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12908// for more information. 12909func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall { 12910 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12911 return c 12912} 12913 12914// IfNoneMatch sets the optional parameter which makes the operation 12915// fail if the object's ETag matches the given value. This is useful for 12916// getting updates only after the object has changed since the last 12917// request. Use googleapi.IsNotModified to check whether the response 12918// error from Do is the result of In-None-Match. 12919func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall { 12920 c.ifNoneMatch_ = entityTag 12921 return c 12922} 12923 12924// Context sets the context to be used in this call's Do method. Any 12925// pending HTTP request will be aborted if the provided context is 12926// canceled. 12927func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall { 12928 c.ctx_ = ctx 12929 return c 12930} 12931 12932// Header returns an http.Header that can be modified by the caller to 12933// add HTTP headers to the request. 12934func (c *UserProfilesGuardiansGetCall) Header() http.Header { 12935 if c.header_ == nil { 12936 c.header_ = make(http.Header) 12937 } 12938 return c.header_ 12939} 12940 12941func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) { 12942 reqHeaders := make(http.Header) 12943 for k, v := range c.header_ { 12944 reqHeaders[k] = v 12945 } 12946 reqHeaders.Set("User-Agent", c.s.userAgent()) 12947 if c.ifNoneMatch_ != "" { 12948 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12949 } 12950 var body io.Reader = nil 12951 c.urlParams_.Set("alt", alt) 12952 c.urlParams_.Set("prettyPrint", "false") 12953 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 12954 urls += "?" + c.urlParams_.Encode() 12955 req, err := http.NewRequest("GET", urls, body) 12956 if err != nil { 12957 return nil, err 12958 } 12959 req.Header = reqHeaders 12960 googleapi.Expand(req.URL, map[string]string{ 12961 "studentId": c.studentId, 12962 "guardianId": c.guardianId, 12963 }) 12964 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12965} 12966 12967// Do executes the "classroom.userProfiles.guardians.get" call. 12968// Exactly one of *Guardian or error will be non-nil. Any non-2xx status 12969// code is an error. Response headers are in either 12970// *Guardian.ServerResponse.Header or (if a response was returned at 12971// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12972// to check whether the returned error was because 12973// http.StatusNotModified was returned. 12974func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) { 12975 gensupport.SetOptions(c.urlParams_, opts...) 12976 res, err := c.doRequest("json") 12977 if res != nil && res.StatusCode == http.StatusNotModified { 12978 if res.Body != nil { 12979 res.Body.Close() 12980 } 12981 return nil, &googleapi.Error{ 12982 Code: res.StatusCode, 12983 Header: res.Header, 12984 } 12985 } 12986 if err != nil { 12987 return nil, err 12988 } 12989 defer googleapi.CloseBody(res) 12990 if err := googleapi.CheckResponse(res); err != nil { 12991 return nil, err 12992 } 12993 ret := &Guardian{ 12994 ServerResponse: googleapi.ServerResponse{ 12995 Header: res.Header, 12996 HTTPStatusCode: res.StatusCode, 12997 }, 12998 } 12999 target := &ret 13000 if err := gensupport.DecodeResponse(target, res); err != nil { 13001 return nil, err 13002 } 13003 return ret, nil 13004 // { 13005 // "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`.", 13006 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13007 // "httpMethod": "GET", 13008 // "id": "classroom.userProfiles.guardians.get", 13009 // "parameterOrder": [ 13010 // "studentId", 13011 // "guardianId" 13012 // ], 13013 // "parameters": { 13014 // "guardianId": { 13015 // "description": "The `id` field from a `Guardian`.", 13016 // "location": "path", 13017 // "required": true, 13018 // "type": "string" 13019 // }, 13020 // "studentId": { 13021 // "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", 13022 // "location": "path", 13023 // "required": true, 13024 // "type": "string" 13025 // } 13026 // }, 13027 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13028 // "response": { 13029 // "$ref": "Guardian" 13030 // }, 13031 // "scopes": [ 13032 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13033 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13034 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13035 // ] 13036 // } 13037 13038} 13039 13040// method id "classroom.userProfiles.guardians.list": 13041 13042type UserProfilesGuardiansListCall struct { 13043 s *Service 13044 studentId string 13045 urlParams_ gensupport.URLParams 13046 ifNoneMatch_ string 13047 ctx_ context.Context 13048 header_ http.Header 13049} 13050 13051// List: Returns a list of guardians that the requesting user is 13052// permitted to 13053// view, restricted to those that match the request. 13054// 13055// To list guardians for any student that the requesting user may 13056// view 13057// guardians for, use the literal character `-` for the student 13058// ID. 13059// 13060// This method returns the following error codes: 13061// 13062// * `PERMISSION_DENIED` if a `student_id` is specified, and the 13063// requesting 13064// user is not permitted to view guardian information for that 13065// student, if 13066// "-" is specified as the `student_id` and the user is not a 13067// domain 13068// administrator, if guardians are not enabled for the domain in 13069// question, 13070// if the `invited_email_address` filter is set by a user who is not 13071// a 13072// domain administrator, or for other access errors. 13073// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 13074// cannot 13075// be recognized (it is not an email address, nor a `student_id` from 13076// the 13077// API, nor the literal string `me`). May also be returned if an 13078// invalid 13079// `page_token` is provided. 13080// * `NOT_FOUND` if a `student_id` is specified, and its format can be 13081// recognized, but Classroom has no record of that student. 13082func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall { 13083 c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13084 c.studentId = studentId 13085 return c 13086} 13087 13088// InvitedEmailAddress sets the optional parameter 13089// "invitedEmailAddress": Filter results by the email address that the 13090// original invitation was sent 13091// to, resulting in this guardian link. 13092// This filter can only be used by domain administrators. 13093func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall { 13094 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 13095 return c 13096} 13097 13098// PageSize sets the optional parameter "pageSize": Maximum number of 13099// items to return. Zero or unspecified indicates that the 13100// server may assign a maximum. 13101// 13102// The server may return fewer than the specified number of results. 13103func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall { 13104 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 13105 return c 13106} 13107 13108// PageToken sets the optional parameter "pageToken": 13109// nextPageToken 13110// value returned from a previous 13111// list call, 13112// indicating that the subsequent page of results should be 13113// returned. 13114// 13115// The list request 13116// must be otherwise identical to the one that resulted in this token. 13117func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall { 13118 c.urlParams_.Set("pageToken", pageToken) 13119 return c 13120} 13121 13122// Fields allows partial responses to be retrieved. See 13123// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13124// for more information. 13125func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall { 13126 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13127 return c 13128} 13129 13130// IfNoneMatch sets the optional parameter which makes the operation 13131// fail if the object's ETag matches the given value. This is useful for 13132// getting updates only after the object has changed since the last 13133// request. Use googleapi.IsNotModified to check whether the response 13134// error from Do is the result of In-None-Match. 13135func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall { 13136 c.ifNoneMatch_ = entityTag 13137 return c 13138} 13139 13140// Context sets the context to be used in this call's Do method. Any 13141// pending HTTP request will be aborted if the provided context is 13142// canceled. 13143func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall { 13144 c.ctx_ = ctx 13145 return c 13146} 13147 13148// Header returns an http.Header that can be modified by the caller to 13149// add HTTP headers to the request. 13150func (c *UserProfilesGuardiansListCall) Header() http.Header { 13151 if c.header_ == nil { 13152 c.header_ = make(http.Header) 13153 } 13154 return c.header_ 13155} 13156 13157func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) { 13158 reqHeaders := make(http.Header) 13159 for k, v := range c.header_ { 13160 reqHeaders[k] = v 13161 } 13162 reqHeaders.Set("User-Agent", c.s.userAgent()) 13163 if c.ifNoneMatch_ != "" { 13164 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13165 } 13166 var body io.Reader = nil 13167 c.urlParams_.Set("alt", alt) 13168 c.urlParams_.Set("prettyPrint", "false") 13169 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians") 13170 urls += "?" + c.urlParams_.Encode() 13171 req, err := http.NewRequest("GET", urls, body) 13172 if err != nil { 13173 return nil, err 13174 } 13175 req.Header = reqHeaders 13176 googleapi.Expand(req.URL, map[string]string{ 13177 "studentId": c.studentId, 13178 }) 13179 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13180} 13181 13182// Do executes the "classroom.userProfiles.guardians.list" call. 13183// Exactly one of *ListGuardiansResponse or error will be non-nil. Any 13184// non-2xx status code is an error. Response headers are in either 13185// *ListGuardiansResponse.ServerResponse.Header or (if a response was 13186// returned at all) in error.(*googleapi.Error).Header. Use 13187// googleapi.IsNotModified to check whether the returned error was 13188// because http.StatusNotModified was returned. 13189func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) { 13190 gensupport.SetOptions(c.urlParams_, opts...) 13191 res, err := c.doRequest("json") 13192 if res != nil && res.StatusCode == http.StatusNotModified { 13193 if res.Body != nil { 13194 res.Body.Close() 13195 } 13196 return nil, &googleapi.Error{ 13197 Code: res.StatusCode, 13198 Header: res.Header, 13199 } 13200 } 13201 if err != nil { 13202 return nil, err 13203 } 13204 defer googleapi.CloseBody(res) 13205 if err := googleapi.CheckResponse(res); err != nil { 13206 return nil, err 13207 } 13208 ret := &ListGuardiansResponse{ 13209 ServerResponse: googleapi.ServerResponse{ 13210 Header: res.Header, 13211 HTTPStatusCode: res.StatusCode, 13212 }, 13213 } 13214 target := &ret 13215 if err := gensupport.DecodeResponse(target, res); err != nil { 13216 return nil, err 13217 } 13218 return ret, nil 13219 // { 13220 // "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.", 13221 // "flatPath": "v1/userProfiles/{studentId}/guardians", 13222 // "httpMethod": "GET", 13223 // "id": "classroom.userProfiles.guardians.list", 13224 // "parameterOrder": [ 13225 // "studentId" 13226 // ], 13227 // "parameters": { 13228 // "invitedEmailAddress": { 13229 // "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.", 13230 // "location": "query", 13231 // "type": "string" 13232 // }, 13233 // "pageSize": { 13234 // "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.", 13235 // "format": "int32", 13236 // "location": "query", 13237 // "type": "integer" 13238 // }, 13239 // "pageToken": { 13240 // "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.", 13241 // "location": "query", 13242 // "type": "string" 13243 // }, 13244 // "studentId": { 13245 // "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.", 13246 // "location": "path", 13247 // "required": true, 13248 // "type": "string" 13249 // } 13250 // }, 13251 // "path": "v1/userProfiles/{studentId}/guardians", 13252 // "response": { 13253 // "$ref": "ListGuardiansResponse" 13254 // }, 13255 // "scopes": [ 13256 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13257 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13258 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13259 // ] 13260 // } 13261 13262} 13263 13264// Pages invokes f for each page of results. 13265// A non-nil error returned from f will halt the iteration. 13266// The provided context supersedes any context provided to the Context method. 13267func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error { 13268 c.ctx_ = ctx 13269 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13270 for { 13271 x, err := c.Do() 13272 if err != nil { 13273 return err 13274 } 13275 if err := f(x); err != nil { 13276 return err 13277 } 13278 if x.NextPageToken == "" { 13279 return nil 13280 } 13281 c.PageToken(x.NextPageToken) 13282 } 13283} 13284