1// Copyright 2020 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package classroom provides access to the Google Classroom API. 8// 9// For product documentation, see: https://developers.google.com/classroom/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/classroom/v1" 16// ... 17// ctx := context.Background() 18// classroomService, err := classroom.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// classroomService, err := classroom.NewService(ctx, option.WithScopes(classroom.ClassroomTopicsReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// classroomService, err := classroom.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// classroomService, err := classroom.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package classroom // import "google.golang.org/api/classroom/v1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "classroom:v1" 79const apiName = "classroom" 80const apiVersion = "v1" 81const basePath = "https://classroom.googleapis.com/" 82 83// OAuth2 scopes used by this API. 84const ( 85 // View and manage announcements in Google Classroom 86 ClassroomAnnouncementsScope = "https://www.googleapis.com/auth/classroom.announcements" 87 88 // View announcements in Google Classroom 89 ClassroomAnnouncementsReadonlyScope = "https://www.googleapis.com/auth/classroom.announcements.readonly" 90 91 // Manage your Google Classroom classes 92 ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses" 93 94 // View your Google Classroom classes 95 ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly" 96 97 // Manage your course work and view your grades in Google Classroom 98 ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me" 99 100 // View your course work and grades in Google Classroom 101 ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly" 102 103 // Manage course work and grades for students in the Google Classroom 104 // classes you teach and view the course work and grades for classes you 105 // administer 106 ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students" 107 108 // View course work and grades for students in the Google Classroom 109 // classes you teach or administer 110 ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 111 112 // View your Google Classroom guardians 113 ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly" 114 115 // View and manage guardians for students in your Google Classroom 116 // classes 117 ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students" 118 119 // View guardians for students in your Google Classroom classes 120 ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 121 122 // View the email addresses of people in your classes 123 ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails" 124 125 // View the profile photos of people in your classes 126 ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos" 127 128 // Receive notifications about your Google Classroom data 129 ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications" 130 131 // Manage your Google Classroom class rosters 132 ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters" 133 134 // View your Google Classroom class rosters 135 ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly" 136 137 // View your course work and grades in Google Classroom 138 ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly" 139 140 // View course work and grades for students in the Google Classroom 141 // classes you teach or administer 142 ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 143 144 // See, create, and edit topics in Google Classroom 145 ClassroomTopicsScope = "https://www.googleapis.com/auth/classroom.topics" 146 147 // View topics in Google Classroom 148 ClassroomTopicsReadonlyScope = "https://www.googleapis.com/auth/classroom.topics.readonly" 149) 150 151// NewService creates a new Service. 152func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 153 scopesOption := option.WithScopes( 154 "https://www.googleapis.com/auth/classroom.announcements", 155 "https://www.googleapis.com/auth/classroom.announcements.readonly", 156 "https://www.googleapis.com/auth/classroom.courses", 157 "https://www.googleapis.com/auth/classroom.courses.readonly", 158 "https://www.googleapis.com/auth/classroom.coursework.me", 159 "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 160 "https://www.googleapis.com/auth/classroom.coursework.students", 161 "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 162 "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 163 "https://www.googleapis.com/auth/classroom.guardianlinks.students", 164 "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly", 165 "https://www.googleapis.com/auth/classroom.profile.emails", 166 "https://www.googleapis.com/auth/classroom.profile.photos", 167 "https://www.googleapis.com/auth/classroom.push-notifications", 168 "https://www.googleapis.com/auth/classroom.rosters", 169 "https://www.googleapis.com/auth/classroom.rosters.readonly", 170 "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 171 "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly", 172 "https://www.googleapis.com/auth/classroom.topics", 173 "https://www.googleapis.com/auth/classroom.topics.readonly", 174 ) 175 // NOTE: prepend, so we don't override user-specified scopes. 176 opts = append([]option.ClientOption{scopesOption}, opts...) 177 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 178 client, endpoint, err := htransport.NewClient(ctx, opts...) 179 if err != nil { 180 return nil, err 181 } 182 s, err := New(client) 183 if err != nil { 184 return nil, err 185 } 186 if endpoint != "" { 187 s.BasePath = endpoint 188 } 189 return s, nil 190} 191 192// New creates a new Service. It uses the provided http.Client for requests. 193// 194// Deprecated: please use NewService instead. 195// To provide a custom HTTP client, use option.WithHTTPClient. 196// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 197func New(client *http.Client) (*Service, error) { 198 if client == nil { 199 return nil, errors.New("client is nil") 200 } 201 s := &Service{client: client, BasePath: basePath} 202 s.Courses = NewCoursesService(s) 203 s.Invitations = NewInvitationsService(s) 204 s.Registrations = NewRegistrationsService(s) 205 s.UserProfiles = NewUserProfilesService(s) 206 return s, nil 207} 208 209type Service struct { 210 client *http.Client 211 BasePath string // API endpoint base URL 212 UserAgent string // optional additional User-Agent fragment 213 214 Courses *CoursesService 215 216 Invitations *InvitationsService 217 218 Registrations *RegistrationsService 219 220 UserProfiles *UserProfilesService 221} 222 223func (s *Service) userAgent() string { 224 if s.UserAgent == "" { 225 return googleapi.UserAgent 226 } 227 return googleapi.UserAgent + " " + s.UserAgent 228} 229 230func NewCoursesService(s *Service) *CoursesService { 231 rs := &CoursesService{s: s} 232 rs.Aliases = NewCoursesAliasesService(s) 233 rs.Announcements = NewCoursesAnnouncementsService(s) 234 rs.CourseWork = NewCoursesCourseWorkService(s) 235 rs.Students = NewCoursesStudentsService(s) 236 rs.Teachers = NewCoursesTeachersService(s) 237 rs.Topics = NewCoursesTopicsService(s) 238 return rs 239} 240 241type CoursesService struct { 242 s *Service 243 244 Aliases *CoursesAliasesService 245 246 Announcements *CoursesAnnouncementsService 247 248 CourseWork *CoursesCourseWorkService 249 250 Students *CoursesStudentsService 251 252 Teachers *CoursesTeachersService 253 254 Topics *CoursesTopicsService 255} 256 257func NewCoursesAliasesService(s *Service) *CoursesAliasesService { 258 rs := &CoursesAliasesService{s: s} 259 return rs 260} 261 262type CoursesAliasesService struct { 263 s *Service 264} 265 266func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService { 267 rs := &CoursesAnnouncementsService{s: s} 268 return rs 269} 270 271type CoursesAnnouncementsService struct { 272 s *Service 273} 274 275func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService { 276 rs := &CoursesCourseWorkService{s: s} 277 rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s) 278 return rs 279} 280 281type CoursesCourseWorkService struct { 282 s *Service 283 284 StudentSubmissions *CoursesCourseWorkStudentSubmissionsService 285} 286 287func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService { 288 rs := &CoursesCourseWorkStudentSubmissionsService{s: s} 289 return rs 290} 291 292type CoursesCourseWorkStudentSubmissionsService struct { 293 s *Service 294} 295 296func NewCoursesStudentsService(s *Service) *CoursesStudentsService { 297 rs := &CoursesStudentsService{s: s} 298 return rs 299} 300 301type CoursesStudentsService struct { 302 s *Service 303} 304 305func NewCoursesTeachersService(s *Service) *CoursesTeachersService { 306 rs := &CoursesTeachersService{s: s} 307 return rs 308} 309 310type CoursesTeachersService struct { 311 s *Service 312} 313 314func NewCoursesTopicsService(s *Service) *CoursesTopicsService { 315 rs := &CoursesTopicsService{s: s} 316 return rs 317} 318 319type CoursesTopicsService struct { 320 s *Service 321} 322 323func NewInvitationsService(s *Service) *InvitationsService { 324 rs := &InvitationsService{s: s} 325 return rs 326} 327 328type InvitationsService struct { 329 s *Service 330} 331 332func NewRegistrationsService(s *Service) *RegistrationsService { 333 rs := &RegistrationsService{s: s} 334 return rs 335} 336 337type RegistrationsService struct { 338 s *Service 339} 340 341func NewUserProfilesService(s *Service) *UserProfilesService { 342 rs := &UserProfilesService{s: s} 343 rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s) 344 rs.Guardians = NewUserProfilesGuardiansService(s) 345 return rs 346} 347 348type UserProfilesService struct { 349 s *Service 350 351 GuardianInvitations *UserProfilesGuardianInvitationsService 352 353 Guardians *UserProfilesGuardiansService 354} 355 356func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService { 357 rs := &UserProfilesGuardianInvitationsService{s: s} 358 return rs 359} 360 361type UserProfilesGuardianInvitationsService struct { 362 s *Service 363} 364 365func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService { 366 rs := &UserProfilesGuardiansService{s: s} 367 return rs 368} 369 370type UserProfilesGuardiansService struct { 371 s *Service 372} 373 374// Announcement: Announcement created by a teacher for students of the 375// course 376type Announcement struct { 377 // AlternateLink: Absolute link to this announcement in the Classroom 378 // web UI. 379 // This is only populated if `state` is `PUBLISHED`. 380 // 381 // Read-only. 382 AlternateLink string `json:"alternateLink,omitempty"` 383 384 // AssigneeMode: Assignee mode of the announcement. 385 // If unspecified, the default value is `ALL_STUDENTS`. 386 // 387 // Possible values: 388 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 389 // returned. 390 // "ALL_STUDENTS" - All students can see the item. 391 // This is the default state. 392 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 393 AssigneeMode string `json:"assigneeMode,omitempty"` 394 395 // CourseId: Identifier of the course. 396 // 397 // Read-only. 398 CourseId string `json:"courseId,omitempty"` 399 400 // CreationTime: Timestamp when this announcement was 401 // created. 402 // 403 // Read-only. 404 CreationTime string `json:"creationTime,omitempty"` 405 406 // CreatorUserId: Identifier for the user that created the 407 // announcement. 408 // 409 // Read-only. 410 CreatorUserId string `json:"creatorUserId,omitempty"` 411 412 // Id: Classroom-assigned identifier of this announcement, unique per 413 // course. 414 // 415 // Read-only. 416 Id string `json:"id,omitempty"` 417 418 // IndividualStudentsOptions: Identifiers of students with access to the 419 // announcement. 420 // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`. 421 // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only 422 // students 423 // specified in this field will be able to see the announcement. 424 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 425 426 // Materials: Additional materials. 427 // 428 // Announcements must have no more than 20 material items. 429 Materials []*Material `json:"materials,omitempty"` 430 431 // ScheduledTime: Optional timestamp when this announcement is scheduled 432 // to be published. 433 ScheduledTime string `json:"scheduledTime,omitempty"` 434 435 // State: Status of this announcement. 436 // If unspecified, the default state is `DRAFT`. 437 // 438 // Possible values: 439 // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 440 // never returned. 441 // "PUBLISHED" - Status for announcement that has been published. 442 // This is the default state. 443 // "DRAFT" - Status for an announcement that is not yet 444 // published. 445 // Announcement in this state is visible only to course teachers and 446 // domain 447 // administrators. 448 // "DELETED" - Status for announcement that was published but is now 449 // deleted. 450 // Announcement in this state is visible only to course teachers and 451 // domain 452 // administrators. 453 // Announcement in this state is deleted after some time. 454 State string `json:"state,omitempty"` 455 456 // Text: Description of this announcement. 457 // The text must be a valid UTF-8 string containing no more 458 // than 30,000 characters. 459 Text string `json:"text,omitempty"` 460 461 // UpdateTime: Timestamp of the most recent change to this 462 // announcement. 463 // 464 // Read-only. 465 UpdateTime string `json:"updateTime,omitempty"` 466 467 // ServerResponse contains the HTTP response code and headers from the 468 // server. 469 googleapi.ServerResponse `json:"-"` 470 471 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 472 // unconditionally include in API requests. By default, fields with 473 // empty values are omitted from API requests. However, any non-pointer, 474 // non-interface field appearing in ForceSendFields will be sent to the 475 // server regardless of whether the field is empty or not. This may be 476 // used to include empty fields in Patch requests. 477 ForceSendFields []string `json:"-"` 478 479 // NullFields is a list of field names (e.g. "AlternateLink") to include 480 // in API requests with the JSON null value. By default, fields with 481 // empty values are omitted from API requests. However, any field with 482 // an empty value appearing in NullFields will be sent to the server as 483 // null. It is an error if a field in this list has a non-empty value. 484 // This may be used to include null fields in Patch requests. 485 NullFields []string `json:"-"` 486} 487 488func (s *Announcement) MarshalJSON() ([]byte, error) { 489 type NoMethod Announcement 490 raw := NoMethod(*s) 491 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 492} 493 494// Assignment: Additional details for assignments. 495type Assignment struct { 496 // StudentWorkFolder: Drive folder where attachments from student 497 // submissions are placed. 498 // This is only populated for course teachers and administrators. 499 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 500 501 // ForceSendFields is a list of field names (e.g. "StudentWorkFolder") 502 // to unconditionally include in API requests. By default, fields with 503 // empty values are omitted from API requests. However, any non-pointer, 504 // non-interface field appearing in ForceSendFields will be sent to the 505 // server regardless of whether the field is empty or not. This may be 506 // used to include empty fields in Patch requests. 507 ForceSendFields []string `json:"-"` 508 509 // NullFields is a list of field names (e.g. "StudentWorkFolder") to 510 // include in API requests with the JSON null value. By default, fields 511 // with empty values are omitted from API requests. However, any field 512 // with an empty value appearing in NullFields will be sent to the 513 // server as null. It is an error if a field in this list has a 514 // non-empty value. This may be used to include null fields in Patch 515 // requests. 516 NullFields []string `json:"-"` 517} 518 519func (s *Assignment) MarshalJSON() ([]byte, error) { 520 type NoMethod Assignment 521 raw := NoMethod(*s) 522 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 523} 524 525// AssignmentSubmission: Student work for an assignment. 526type AssignmentSubmission struct { 527 // Attachments: Attachments added by the student. 528 // Drive files that correspond to materials with a share mode 529 // of 530 // STUDENT_COPY may not exist yet if the student has not accessed 531 // the 532 // assignment in Classroom. 533 // 534 // Some attachment metadata is only populated if the requesting user 535 // has 536 // permission to access it. Identifier and alternate_link fields are 537 // always 538 // available, but others (e.g. title) may not be. 539 Attachments []*Attachment `json:"attachments,omitempty"` 540 541 // ForceSendFields is a list of field names (e.g. "Attachments") to 542 // unconditionally include in API requests. By default, fields with 543 // empty values are omitted from API requests. However, any non-pointer, 544 // non-interface field appearing in ForceSendFields will be sent to the 545 // server regardless of whether the field is empty or not. This may be 546 // used to include empty fields in Patch requests. 547 ForceSendFields []string `json:"-"` 548 549 // NullFields is a list of field names (e.g. "Attachments") to include 550 // in API requests with the JSON null value. By default, fields with 551 // empty values are omitted from API requests. However, any field with 552 // an empty value appearing in NullFields will be sent to the server as 553 // null. It is an error if a field in this list has a non-empty value. 554 // This may be used to include null fields in Patch requests. 555 NullFields []string `json:"-"` 556} 557 558func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) { 559 type NoMethod AssignmentSubmission 560 raw := NoMethod(*s) 561 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 562} 563 564// Attachment: Attachment added to student assignment work. 565// 566// When creating attachments, setting the `form` field is not supported. 567type Attachment struct { 568 // DriveFile: Google Drive file attachment. 569 DriveFile *DriveFile `json:"driveFile,omitempty"` 570 571 // Form: Google Forms attachment. 572 Form *Form `json:"form,omitempty"` 573 574 // Link: Link attachment. 575 Link *Link `json:"link,omitempty"` 576 577 // YouTubeVideo: Youtube video attachment. 578 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 579 580 // ForceSendFields is a list of field names (e.g. "DriveFile") to 581 // unconditionally include in API requests. By default, fields with 582 // empty values are omitted from API requests. However, any non-pointer, 583 // non-interface field appearing in ForceSendFields will be sent to the 584 // server regardless of whether the field is empty or not. This may be 585 // used to include empty fields in Patch requests. 586 ForceSendFields []string `json:"-"` 587 588 // NullFields is a list of field names (e.g. "DriveFile") to include in 589 // API requests with the JSON null value. By default, fields with empty 590 // values are omitted from API requests. However, any field with an 591 // empty value appearing in NullFields will be sent to the server as 592 // null. It is an error if a field in this list has a non-empty value. 593 // This may be used to include null fields in Patch requests. 594 NullFields []string `json:"-"` 595} 596 597func (s *Attachment) MarshalJSON() ([]byte, error) { 598 type NoMethod Attachment 599 raw := NoMethod(*s) 600 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 601} 602 603// CloudPubsubTopic: A reference to a Cloud Pub/Sub topic. 604// 605// To register for notifications, the owner of the topic must 606// grant 607// `classroom-notifications@system.gserviceaccount.com` the 608// `projects.topics.publish` permission. 609type CloudPubsubTopic struct { 610 // TopicName: The `name` field of a Cloud 611 // Pub/Sub 612 // [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1 613 // /projects.topics#Topic). 614 TopicName string `json:"topicName,omitempty"` 615 616 // ForceSendFields is a list of field names (e.g. "TopicName") to 617 // unconditionally include in API requests. By default, fields with 618 // empty values are omitted from API requests. However, any non-pointer, 619 // non-interface field appearing in ForceSendFields will be sent to the 620 // server regardless of whether the field is empty or not. This may be 621 // used to include empty fields in Patch requests. 622 ForceSendFields []string `json:"-"` 623 624 // NullFields is a list of field names (e.g. "TopicName") to include in 625 // API requests with the JSON null value. By default, fields with empty 626 // values are omitted from API requests. However, any field with an 627 // empty value appearing in NullFields will be sent to the server as 628 // null. It is an error if a field in this list has a non-empty value. 629 // This may be used to include null fields in Patch requests. 630 NullFields []string `json:"-"` 631} 632 633func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) { 634 type NoMethod CloudPubsubTopic 635 raw := NoMethod(*s) 636 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 637} 638 639// Course: A Course in Classroom. 640type Course struct { 641 // AlternateLink: Absolute link to this course in the Classroom web 642 // UI. 643 // 644 // Read-only. 645 AlternateLink string `json:"alternateLink,omitempty"` 646 647 // CalendarId: The Calendar ID for a calendar that all course members 648 // can see, to which 649 // Classroom adds events for course work and announcements in the 650 // course. 651 // 652 // Read-only. 653 CalendarId string `json:"calendarId,omitempty"` 654 655 // CourseGroupEmail: The email address of a Google group containing all 656 // members of the course. 657 // This group does not accept email and can only be used for 658 // permissions. 659 // 660 // Read-only. 661 CourseGroupEmail string `json:"courseGroupEmail,omitempty"` 662 663 // CourseMaterialSets: Sets of materials that appear on the "about" page 664 // of this course. 665 // 666 // Read-only. 667 CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"` 668 669 // CourseState: State of the course. 670 // If unspecified, the default state is `PROVISIONED`. 671 // 672 // Possible values: 673 // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 674 // message will use this value. 675 // "ACTIVE" - The course is active. 676 // "ARCHIVED" - The course has been archived. You cannot modify it 677 // except to change it 678 // to a different state. 679 // "PROVISIONED" - The course has been created, but not yet activated. 680 // It is accessible by 681 // the primary teacher and domain administrators, who may modify it 682 // or 683 // change it to the `ACTIVE` or `DECLINED` states. 684 // A course may only be changed to `PROVISIONED` if it is in the 685 // `DECLINED` 686 // state. 687 // "DECLINED" - The course has been created, but declined. It is 688 // accessible by the 689 // course owner and domain administrators, though it will not 690 // be 691 // displayed in the web UI. You cannot modify the course except to 692 // change it 693 // to the `PROVISIONED` state. 694 // A course may only be changed to `DECLINED` if it is in the 695 // `PROVISIONED` 696 // state. 697 // "SUSPENDED" - The course has been suspended. You cannot modify the 698 // course, and only the 699 // user identified by the `owner_id` can view the course. 700 // A course may be placed in this state if it potentially violates 701 // the 702 // Terms of Service. 703 CourseState string `json:"courseState,omitempty"` 704 705 // CreationTime: Creation time of the course. 706 // Specifying this field in a course update mask results in an 707 // error. 708 // 709 // Read-only. 710 CreationTime string `json:"creationTime,omitempty"` 711 712 // Description: Optional description. 713 // For example, "We'll be learning about the structure of 714 // living 715 // creatures from a combination of textbooks, guest lectures, and lab 716 // work. 717 // Expect to be excited!" 718 // If set, this field must be a valid UTF-8 string and no longer than 719 // 30,000 720 // characters. 721 Description string `json:"description,omitempty"` 722 723 // DescriptionHeading: Optional heading for the description. 724 // For example, "Welcome to 10th Grade Biology." 725 // If set, this field must be a valid UTF-8 string and no longer than 726 // 3600 727 // characters. 728 DescriptionHeading string `json:"descriptionHeading,omitempty"` 729 730 // EnrollmentCode: Enrollment code to use when joining this 731 // course. 732 // Specifying this field in a course update mask results in an 733 // error. 734 // 735 // Read-only. 736 EnrollmentCode string `json:"enrollmentCode,omitempty"` 737 738 // GuardiansEnabled: Whether or not guardian notifications are enabled 739 // for this course. 740 // 741 // Read-only. 742 GuardiansEnabled bool `json:"guardiansEnabled,omitempty"` 743 744 // Id: Identifier for this course assigned by Classroom. 745 // 746 // When 747 // creating a course, 748 // you may optionally set this identifier to an 749 // alias string in the 750 // request to create a corresponding alias. The `id` is still assigned 751 // by 752 // Classroom and cannot be updated after the course is 753 // created. 754 // 755 // Specifying this field in a course update mask results in an error. 756 Id string `json:"id,omitempty"` 757 758 // Name: Name of the course. 759 // For example, "10th Grade Biology". 760 // The name is required. It must be between 1 and 750 characters and a 761 // valid 762 // UTF-8 string. 763 Name string `json:"name,omitempty"` 764 765 // OwnerId: The identifier of the owner of a course. 766 // 767 // When specified as a parameter of a 768 // create course request, this 769 // field is required. 770 // The identifier can be one of the following: 771 // 772 // * the numeric identifier for the user 773 // * the email address of the user 774 // * the string literal "me", indicating the requesting user 775 // 776 // This must be set in a create request. Admins can also specify this 777 // field 778 // in a patch course request to 779 // transfer ownership. In other contexts, it is read-only. 780 OwnerId string `json:"ownerId,omitempty"` 781 782 // Room: Optional room location. 783 // For example, "301". 784 // If set, this field must be a valid UTF-8 string and no longer than 785 // 650 786 // characters. 787 Room string `json:"room,omitempty"` 788 789 // Section: Section of the course. 790 // For example, "Period 2". 791 // If set, this field must be a valid UTF-8 string and no longer than 792 // 2800 793 // characters. 794 Section string `json:"section,omitempty"` 795 796 // TeacherFolder: Information about a Drive Folder that is shared with 797 // all teachers of the 798 // course. 799 // 800 // This field will only be set for teachers of the course and 801 // domain 802 // administrators. 803 // 804 // Read-only. 805 TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"` 806 807 // TeacherGroupEmail: The email address of a Google group containing all 808 // teachers of the course. 809 // This group does not accept email and can only be used for 810 // permissions. 811 // 812 // Read-only. 813 TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"` 814 815 // UpdateTime: Time of the most recent update to this course. 816 // Specifying this field in a course update mask results in an 817 // error. 818 // 819 // Read-only. 820 UpdateTime string `json:"updateTime,omitempty"` 821 822 // ServerResponse contains the HTTP response code and headers from the 823 // server. 824 googleapi.ServerResponse `json:"-"` 825 826 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 827 // unconditionally include in API requests. By default, fields with 828 // empty values are omitted from API requests. However, any non-pointer, 829 // non-interface field appearing in ForceSendFields will be sent to the 830 // server regardless of whether the field is empty or not. This may be 831 // used to include empty fields in Patch requests. 832 ForceSendFields []string `json:"-"` 833 834 // NullFields is a list of field names (e.g. "AlternateLink") to include 835 // in API requests with the JSON null value. By default, fields with 836 // empty values are omitted from API requests. However, any field with 837 // an empty value appearing in NullFields will be sent to the server as 838 // null. It is an error if a field in this list has a non-empty value. 839 // This may be used to include null fields in Patch requests. 840 NullFields []string `json:"-"` 841} 842 843func (s *Course) MarshalJSON() ([]byte, error) { 844 type NoMethod Course 845 raw := NoMethod(*s) 846 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 847} 848 849// CourseAlias: Alternative identifier for a course. 850// 851// An alias uniquely identifies a course. It must be unique within one 852// of the 853// following scopes: 854// 855// * domain: A domain-scoped alias is visible to all users within the 856// alias 857// creator's domain and can be created only by a domain admin. A 858// domain-scoped 859// alias is often used when a course has an identifier external to 860// Classroom. 861// 862// * project: A project-scoped alias is visible to any request from 863// an 864// application using the Developer Console project ID that created the 865// alias 866// and can be created by any project. A project-scoped alias is often 867// used when 868// an application has alternative identifiers. A random value can also 869// be used 870// to avoid duplicate courses in the event of transmission failures, as 871// retrying 872// a request will return `ALREADY_EXISTS` if a previous one has 873// succeeded. 874type CourseAlias struct { 875 // Alias: Alias string. The format of the string indicates the desired 876 // alias scoping. 877 // 878 // * `d:<name>` indicates a domain-scoped alias. 879 // Example: `d:math_101` 880 // * `p:<name>` indicates a project-scoped alias. 881 // Example: `p:abc123` 882 // 883 // This field has a maximum length of 256 characters. 884 Alias string `json:"alias,omitempty"` 885 886 // ServerResponse contains the HTTP response code and headers from the 887 // server. 888 googleapi.ServerResponse `json:"-"` 889 890 // ForceSendFields is a list of field names (e.g. "Alias") to 891 // unconditionally include in API requests. By default, fields with 892 // empty values are omitted from API requests. However, any non-pointer, 893 // non-interface field appearing in ForceSendFields will be sent to the 894 // server regardless of whether the field is empty or not. This may be 895 // used to include empty fields in Patch requests. 896 ForceSendFields []string `json:"-"` 897 898 // NullFields is a list of field names (e.g. "Alias") to include in API 899 // requests with the JSON null value. By default, fields with empty 900 // values are omitted from API requests. However, any field with an 901 // empty value appearing in NullFields will be sent to the server as 902 // null. It is an error if a field in this list has a non-empty value. 903 // This may be used to include null fields in Patch requests. 904 NullFields []string `json:"-"` 905} 906 907func (s *CourseAlias) MarshalJSON() ([]byte, error) { 908 type NoMethod CourseAlias 909 raw := NoMethod(*s) 910 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 911} 912 913// CourseMaterial: A material attached to a course as part of a material 914// set. 915type CourseMaterial struct { 916 // DriveFile: Google Drive file attachment. 917 DriveFile *DriveFile `json:"driveFile,omitempty"` 918 919 // Form: Google Forms attachment. 920 Form *Form `json:"form,omitempty"` 921 922 // Link: Link atatchment. 923 Link *Link `json:"link,omitempty"` 924 925 // YouTubeVideo: Youtube video attachment. 926 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 927 928 // ForceSendFields is a list of field names (e.g. "DriveFile") to 929 // unconditionally include in API requests. By default, fields with 930 // empty values are omitted from API requests. However, any non-pointer, 931 // non-interface field appearing in ForceSendFields will be sent to the 932 // server regardless of whether the field is empty or not. This may be 933 // used to include empty fields in Patch requests. 934 ForceSendFields []string `json:"-"` 935 936 // NullFields is a list of field names (e.g. "DriveFile") to include in 937 // API requests with the JSON null value. By default, fields with empty 938 // values are omitted from API requests. However, any field with an 939 // empty value appearing in NullFields will be sent to the server as 940 // null. It is an error if a field in this list has a non-empty value. 941 // This may be used to include null fields in Patch requests. 942 NullFields []string `json:"-"` 943} 944 945func (s *CourseMaterial) MarshalJSON() ([]byte, error) { 946 type NoMethod CourseMaterial 947 raw := NoMethod(*s) 948 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 949} 950 951// CourseMaterialSet: A set of materials that appears on the "About" 952// page of the course. 953// These materials might include a syllabus, schedule, or other 954// background 955// information relating to the course as a whole. 956type CourseMaterialSet struct { 957 // Materials: Materials attached to this set. 958 Materials []*CourseMaterial `json:"materials,omitempty"` 959 960 // Title: Title for this set. 961 Title string `json:"title,omitempty"` 962 963 // ForceSendFields is a list of field names (e.g. "Materials") to 964 // unconditionally include in API requests. By default, fields with 965 // empty values are omitted from API requests. However, any non-pointer, 966 // non-interface field appearing in ForceSendFields will be sent to the 967 // server regardless of whether the field is empty or not. This may be 968 // used to include empty fields in Patch requests. 969 ForceSendFields []string `json:"-"` 970 971 // NullFields is a list of field names (e.g. "Materials") to include in 972 // API requests with the JSON null value. By default, fields with empty 973 // values are omitted from API requests. However, any field with an 974 // empty value appearing in NullFields will be sent to the server as 975 // null. It is an error if a field in this list has a non-empty value. 976 // This may be used to include null fields in Patch requests. 977 NullFields []string `json:"-"` 978} 979 980func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) { 981 type NoMethod CourseMaterialSet 982 raw := NoMethod(*s) 983 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 984} 985 986// CourseRosterChangesInfo: Information about a `Feed` with a 987// `feed_type` of `COURSE_ROSTER_CHANGES`. 988type CourseRosterChangesInfo struct { 989 // CourseId: The `course_id` of the course to subscribe to roster 990 // changes for. 991 CourseId string `json:"courseId,omitempty"` 992 993 // ForceSendFields is a list of field names (e.g. "CourseId") to 994 // unconditionally include in API requests. By default, fields with 995 // empty values are omitted from API requests. However, any non-pointer, 996 // non-interface field appearing in ForceSendFields will be sent to the 997 // server regardless of whether the field is empty or not. This may be 998 // used to include empty fields in Patch requests. 999 ForceSendFields []string `json:"-"` 1000 1001 // NullFields is a list of field names (e.g. "CourseId") to include in 1002 // API requests with the JSON null value. By default, fields with empty 1003 // values are omitted from API requests. However, any field with an 1004 // empty value appearing in NullFields will be sent to the server as 1005 // null. It is an error if a field in this list has a non-empty value. 1006 // This may be used to include null fields in Patch requests. 1007 NullFields []string `json:"-"` 1008} 1009 1010func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) { 1011 type NoMethod CourseRosterChangesInfo 1012 raw := NoMethod(*s) 1013 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1014} 1015 1016// CourseWork: Course work created by a teacher for students of the 1017// course. 1018type CourseWork struct { 1019 // AlternateLink: Absolute link to this course work in the Classroom web 1020 // UI. 1021 // This is only populated if `state` is `PUBLISHED`. 1022 // 1023 // Read-only. 1024 AlternateLink string `json:"alternateLink,omitempty"` 1025 1026 // AssigneeMode: Assignee mode of the coursework. 1027 // If unspecified, the default value is `ALL_STUDENTS`. 1028 // 1029 // Possible values: 1030 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 1031 // returned. 1032 // "ALL_STUDENTS" - All students can see the item. 1033 // This is the default state. 1034 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 1035 AssigneeMode string `json:"assigneeMode,omitempty"` 1036 1037 // Assignment: Assignment details. 1038 // This is populated only when `work_type` is `ASSIGNMENT`. 1039 // 1040 // Read-only. 1041 Assignment *Assignment `json:"assignment,omitempty"` 1042 1043 // AssociatedWithDeveloper: Whether this course work item is associated 1044 // with the Developer Console 1045 // project making the request. 1046 // 1047 // See google.classroom.Work.CreateCourseWork for 1048 // more 1049 // details. 1050 // 1051 // Read-only. 1052 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 1053 1054 // CourseId: Identifier of the course. 1055 // 1056 // Read-only. 1057 CourseId string `json:"courseId,omitempty"` 1058 1059 // CreationTime: Timestamp when this course work was 1060 // created. 1061 // 1062 // Read-only. 1063 CreationTime string `json:"creationTime,omitempty"` 1064 1065 // CreatorUserId: Identifier for the user that created the 1066 // coursework. 1067 // 1068 // Read-only. 1069 CreatorUserId string `json:"creatorUserId,omitempty"` 1070 1071 // Description: Optional description of this course work. 1072 // If set, the description must be a valid UTF-8 string containing no 1073 // more 1074 // than 30,000 characters. 1075 Description string `json:"description,omitempty"` 1076 1077 // DueDate: Optional date, in UTC, that submissions for this course work 1078 // are due. 1079 // This must be specified if `due_time` is specified. 1080 DueDate *Date `json:"dueDate,omitempty"` 1081 1082 // DueTime: Optional time of day, in UTC, that submissions for this 1083 // course work 1084 // are due. 1085 // This must be specified if `due_date` is specified. 1086 DueTime *TimeOfDay `json:"dueTime,omitempty"` 1087 1088 // Id: Classroom-assigned identifier of this course work, unique per 1089 // course. 1090 // 1091 // Read-only. 1092 Id string `json:"id,omitempty"` 1093 1094 // IndividualStudentsOptions: Identifiers of students with access to the 1095 // coursework. 1096 // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`. 1097 // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only 1098 // students 1099 // specified in this field will be assigned the coursework. 1100 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 1101 1102 // Materials: Additional materials. 1103 // 1104 // CourseWork must have no more than 20 material items. 1105 Materials []*Material `json:"materials,omitempty"` 1106 1107 // MaxPoints: Maximum grade for this course work. 1108 // If zero or unspecified, this assignment is considered ungraded. 1109 // This must be a non-negative integer value. 1110 MaxPoints float64 `json:"maxPoints,omitempty"` 1111 1112 // MultipleChoiceQuestion: Multiple choice question details. 1113 // For read operations, this field is populated only when `work_type` 1114 // is 1115 // `MULTIPLE_CHOICE_QUESTION`. 1116 // For write operations, this field must be specified when creating 1117 // course 1118 // work with a `work_type` of `MULTIPLE_CHOICE_QUESTION`, and it must 1119 // not be 1120 // set otherwise. 1121 MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"` 1122 1123 // ScheduledTime: Optional timestamp when this course work is scheduled 1124 // to be published. 1125 ScheduledTime string `json:"scheduledTime,omitempty"` 1126 1127 // State: Status of this course work. 1128 // If unspecified, the default state is `DRAFT`. 1129 // 1130 // Possible values: 1131 // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 1132 // returned. 1133 // "PUBLISHED" - Status for work that has been published. 1134 // This is the default state. 1135 // "DRAFT" - Status for work that is not yet published. 1136 // Work in this state is visible only to course teachers and 1137 // domain 1138 // administrators. 1139 // "DELETED" - Status for work that was published but is now 1140 // deleted. 1141 // Work in this state is visible only to course teachers and 1142 // domain 1143 // administrators. 1144 // Work in this state is deleted after some time. 1145 State string `json:"state,omitempty"` 1146 1147 // SubmissionModificationMode: Setting to determine when students are 1148 // allowed to modify submissions. 1149 // If unspecified, the default value is `MODIFIABLE_UNTIL_TURNED_IN`. 1150 // 1151 // Possible values: 1152 // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode 1153 // specified. This is never returned. 1154 // "MODIFIABLE_UNTIL_TURNED_IN" - Submissions can be modified before 1155 // being turned in. 1156 // "MODIFIABLE" - Submissions can be modified at any time. 1157 SubmissionModificationMode string `json:"submissionModificationMode,omitempty"` 1158 1159 // Title: Title of this course work. 1160 // The title must be a valid UTF-8 string containing between 1 and 1161 // 3000 1162 // characters. 1163 Title string `json:"title,omitempty"` 1164 1165 // TopicId: Identifier for the topic that this coursework is associated 1166 // with. 1167 // Must match an existing topic in the course. 1168 TopicId string `json:"topicId,omitempty"` 1169 1170 // UpdateTime: Timestamp of the most recent change to this course 1171 // work. 1172 // 1173 // Read-only. 1174 UpdateTime string `json:"updateTime,omitempty"` 1175 1176 // WorkType: Type of this course work. 1177 // 1178 // The type is set when the course work is created and cannot be 1179 // changed. 1180 // 1181 // Possible values: 1182 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 1183 // never returned. 1184 // "ASSIGNMENT" - An assignment. 1185 // "SHORT_ANSWER_QUESTION" - A short answer question. 1186 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 1187 WorkType string `json:"workType,omitempty"` 1188 1189 // ServerResponse contains the HTTP response code and headers from the 1190 // server. 1191 googleapi.ServerResponse `json:"-"` 1192 1193 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1194 // unconditionally include in API requests. By default, fields with 1195 // empty values are omitted from API requests. However, any non-pointer, 1196 // non-interface field appearing in ForceSendFields will be sent to the 1197 // server regardless of whether the field is empty or not. This may be 1198 // used to include empty fields in Patch requests. 1199 ForceSendFields []string `json:"-"` 1200 1201 // NullFields is a list of field names (e.g. "AlternateLink") to include 1202 // in API requests with the JSON null value. By default, fields with 1203 // empty values are omitted from API requests. However, any field with 1204 // an empty value appearing in NullFields will be sent to the server as 1205 // null. It is an error if a field in this list has a non-empty value. 1206 // This may be used to include null fields in Patch requests. 1207 NullFields []string `json:"-"` 1208} 1209 1210func (s *CourseWork) MarshalJSON() ([]byte, error) { 1211 type NoMethod CourseWork 1212 raw := NoMethod(*s) 1213 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1214} 1215 1216func (s *CourseWork) UnmarshalJSON(data []byte) error { 1217 type NoMethod CourseWork 1218 var s1 struct { 1219 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1220 *NoMethod 1221 } 1222 s1.NoMethod = (*NoMethod)(s) 1223 if err := json.Unmarshal(data, &s1); err != nil { 1224 return err 1225 } 1226 s.MaxPoints = float64(s1.MaxPoints) 1227 return nil 1228} 1229 1230// CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1231// of `COURSE_WORK_CHANGES`. 1232type CourseWorkChangesInfo struct { 1233 // CourseId: The `course_id` of the course to subscribe to work changes 1234 // for. 1235 CourseId string `json:"courseId,omitempty"` 1236 1237 // ForceSendFields is a list of field names (e.g. "CourseId") to 1238 // unconditionally include in API requests. By default, fields with 1239 // empty values are omitted from API requests. However, any non-pointer, 1240 // non-interface field appearing in ForceSendFields will be sent to the 1241 // server regardless of whether the field is empty or not. This may be 1242 // used to include empty fields in Patch requests. 1243 ForceSendFields []string `json:"-"` 1244 1245 // NullFields is a list of field names (e.g. "CourseId") to include in 1246 // API requests with the JSON null value. By default, fields with empty 1247 // values are omitted from API requests. However, any field with an 1248 // empty value appearing in NullFields will be sent to the server as 1249 // null. It is an error if a field in this list has a non-empty value. 1250 // This may be used to include null fields in Patch requests. 1251 NullFields []string `json:"-"` 1252} 1253 1254func (s *CourseWorkChangesInfo) MarshalJSON() ([]byte, error) { 1255 type NoMethod CourseWorkChangesInfo 1256 raw := NoMethod(*s) 1257 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1258} 1259 1260// Date: Represents a whole or partial calendar date, e.g. a birthday. 1261// The time of day 1262// and time zone are either specified elsewhere or are not significant. 1263// The date 1264// is relative to the Proleptic Gregorian Calendar. This can 1265// represent: 1266// 1267// * A full date, with non-zero year, month and day values 1268// * A month and day value, with a zero year, e.g. an anniversary 1269// * A year on its own, with zero month and day values 1270// * A year and month value, with a zero day, e.g. a credit card 1271// expiration date 1272// 1273// Related types are google.type.TimeOfDay and 1274// `google.protobuf.Timestamp`. 1275type Date struct { 1276 // Day: Day of month. Must be from 1 to 31 and valid for the year and 1277 // month, or 0 1278 // if specifying a year by itself or a year and month where the day is 1279 // not 1280 // significant. 1281 Day int64 `json:"day,omitempty"` 1282 1283 // Month: Month of year. Must be from 1 to 12, or 0 if specifying a year 1284 // without a 1285 // month and day. 1286 Month int64 `json:"month,omitempty"` 1287 1288 // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date 1289 // without 1290 // a year. 1291 Year int64 `json:"year,omitempty"` 1292 1293 // ForceSendFields is a list of field names (e.g. "Day") to 1294 // unconditionally include in API requests. By default, fields with 1295 // empty values are omitted from API requests. However, any non-pointer, 1296 // non-interface field appearing in ForceSendFields will be sent to the 1297 // server regardless of whether the field is empty or not. This may be 1298 // used to include empty fields in Patch requests. 1299 ForceSendFields []string `json:"-"` 1300 1301 // NullFields is a list of field names (e.g. "Day") to include in API 1302 // requests with the JSON null value. By default, fields with empty 1303 // values are omitted from API requests. However, any field with an 1304 // empty value appearing in NullFields will be sent to the server as 1305 // null. It is an error if a field in this list has a non-empty value. 1306 // This may be used to include null fields in Patch requests. 1307 NullFields []string `json:"-"` 1308} 1309 1310func (s *Date) MarshalJSON() ([]byte, error) { 1311 type NoMethod Date 1312 raw := NoMethod(*s) 1313 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1314} 1315 1316// DriveFile: Representation of a Google Drive file. 1317type DriveFile struct { 1318 // AlternateLink: URL that can be used to access the Drive 1319 // item. 1320 // 1321 // Read-only. 1322 AlternateLink string `json:"alternateLink,omitempty"` 1323 1324 // Id: Drive API resource ID. 1325 Id string `json:"id,omitempty"` 1326 1327 // ThumbnailUrl: URL of a thumbnail image of the Drive item. 1328 // 1329 // Read-only. 1330 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1331 1332 // Title: Title of the Drive item. 1333 // 1334 // Read-only. 1335 Title string `json:"title,omitempty"` 1336 1337 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1338 // unconditionally include in API requests. By default, fields with 1339 // empty values are omitted from API requests. However, any non-pointer, 1340 // non-interface field appearing in ForceSendFields will be sent to the 1341 // server regardless of whether the field is empty or not. This may be 1342 // used to include empty fields in Patch requests. 1343 ForceSendFields []string `json:"-"` 1344 1345 // NullFields is a list of field names (e.g. "AlternateLink") to include 1346 // in API requests with the JSON null value. By default, fields with 1347 // empty values are omitted from API requests. However, any field with 1348 // an empty value appearing in NullFields will be sent to the server as 1349 // null. It is an error if a field in this list has a non-empty value. 1350 // This may be used to include null fields in Patch requests. 1351 NullFields []string `json:"-"` 1352} 1353 1354func (s *DriveFile) MarshalJSON() ([]byte, error) { 1355 type NoMethod DriveFile 1356 raw := NoMethod(*s) 1357 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1358} 1359 1360// DriveFolder: Representation of a Google Drive folder. 1361type DriveFolder struct { 1362 // AlternateLink: URL that can be used to access the Drive 1363 // folder. 1364 // 1365 // Read-only. 1366 AlternateLink string `json:"alternateLink,omitempty"` 1367 1368 // Id: Drive API resource ID. 1369 Id string `json:"id,omitempty"` 1370 1371 // Title: Title of the Drive folder. 1372 // 1373 // Read-only. 1374 Title string `json:"title,omitempty"` 1375 1376 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1377 // unconditionally include in API requests. By default, fields with 1378 // empty values are omitted from API requests. However, any non-pointer, 1379 // non-interface field appearing in ForceSendFields will be sent to the 1380 // server regardless of whether the field is empty or not. This may be 1381 // used to include empty fields in Patch requests. 1382 ForceSendFields []string `json:"-"` 1383 1384 // NullFields is a list of field names (e.g. "AlternateLink") to include 1385 // in API requests with the JSON null value. By default, fields with 1386 // empty values are omitted from API requests. However, any field with 1387 // an empty value appearing in NullFields will be sent to the server as 1388 // null. It is an error if a field in this list has a non-empty value. 1389 // This may be used to include null fields in Patch requests. 1390 NullFields []string `json:"-"` 1391} 1392 1393func (s *DriveFolder) MarshalJSON() ([]byte, error) { 1394 type NoMethod DriveFolder 1395 raw := NoMethod(*s) 1396 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1397} 1398 1399// Empty: A generic empty message that you can re-use to avoid defining 1400// duplicated 1401// empty messages in your APIs. A typical example is to use it as the 1402// request 1403// or the response type of an API method. For instance: 1404// 1405// service Foo { 1406// rpc Bar(google.protobuf.Empty) returns 1407// (google.protobuf.Empty); 1408// } 1409// 1410// The JSON representation for `Empty` is empty JSON object `{}`. 1411type Empty struct { 1412 // ServerResponse contains the HTTP response code and headers from the 1413 // server. 1414 googleapi.ServerResponse `json:"-"` 1415} 1416 1417// Feed: A class of notifications that an application can register to 1418// receive. 1419// For example: "all roster changes for a domain". 1420type Feed struct { 1421 // CourseRosterChangesInfo: Information about a `Feed` with a 1422 // `feed_type` of `COURSE_ROSTER_CHANGES`. 1423 // This field must be specified if `feed_type` is 1424 // `COURSE_ROSTER_CHANGES`. 1425 CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"` 1426 1427 // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1428 // of `COURSE_WORK_CHANGES`. 1429 // This field must be specified if `feed_type` is `COURSE_WORK_CHANGES`. 1430 CourseWorkChangesInfo *CourseWorkChangesInfo `json:"courseWorkChangesInfo,omitempty"` 1431 1432 // FeedType: The type of feed. 1433 // 1434 // Possible values: 1435 // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided. 1436 // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular 1437 // domain. 1438 // 1439 // Notifications will be generated whenever a user joins or leaves a 1440 // course. 1441 // 1442 // No notifications will be generated when an invitation is created 1443 // or 1444 // deleted, but notifications will be generated when a user joins a 1445 // course 1446 // by accepting an invitation. 1447 // "COURSE_ROSTER_CHANGES" - All roster changes for a particular 1448 // course. 1449 // 1450 // Notifications will be generated whenever a user joins or leaves a 1451 // course. 1452 // 1453 // No notifications will be generated when an invitation is created 1454 // or 1455 // deleted, but notifications will be generated when a user joins a 1456 // course 1457 // by accepting an invitation. 1458 // "COURSE_WORK_CHANGES" - All course work activity for a particular 1459 // course. 1460 // 1461 // Notifications will be generated when a CourseWork 1462 // or 1463 // StudentSubmission object is created or modified. No notification will 1464 // be 1465 // generated when a StudentSubmission object is created in connection 1466 // with 1467 // the creation or modification of its parent CourseWork object (but 1468 // a 1469 // notification will be generated for that CourseWork object's creation 1470 // or 1471 // modification). 1472 FeedType string `json:"feedType,omitempty"` 1473 1474 // ForceSendFields is a list of field names (e.g. 1475 // "CourseRosterChangesInfo") to unconditionally include in API 1476 // requests. By default, fields with empty values are omitted from API 1477 // requests. However, any non-pointer, non-interface field appearing in 1478 // ForceSendFields will be sent to the server regardless of whether the 1479 // field is empty or not. This may be used to include empty fields in 1480 // Patch requests. 1481 ForceSendFields []string `json:"-"` 1482 1483 // NullFields is a list of field names (e.g. "CourseRosterChangesInfo") 1484 // to include in API requests with the JSON null value. By default, 1485 // fields with empty values are omitted from API requests. However, any 1486 // field with an empty value appearing in NullFields will be sent to the 1487 // server as null. It is an error if a field in this list has a 1488 // non-empty value. This may be used to include null fields in Patch 1489 // requests. 1490 NullFields []string `json:"-"` 1491} 1492 1493func (s *Feed) MarshalJSON() ([]byte, error) { 1494 type NoMethod Feed 1495 raw := NoMethod(*s) 1496 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1497} 1498 1499// Form: Google Forms item. 1500type Form struct { 1501 // FormUrl: URL of the form. 1502 FormUrl string `json:"formUrl,omitempty"` 1503 1504 // ResponseUrl: URL of the form responses document. 1505 // Only set if respsonses have been recorded and only when 1506 // the 1507 // requesting user is an editor of the form. 1508 // 1509 // Read-only. 1510 ResponseUrl string `json:"responseUrl,omitempty"` 1511 1512 // ThumbnailUrl: URL of a thumbnail image of the Form. 1513 // 1514 // Read-only. 1515 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1516 1517 // Title: Title of the Form. 1518 // 1519 // Read-only. 1520 Title string `json:"title,omitempty"` 1521 1522 // ForceSendFields is a list of field names (e.g. "FormUrl") to 1523 // unconditionally include in API requests. By default, fields with 1524 // empty values are omitted from API requests. However, any non-pointer, 1525 // non-interface field appearing in ForceSendFields will be sent to the 1526 // server regardless of whether the field is empty or not. This may be 1527 // used to include empty fields in Patch requests. 1528 ForceSendFields []string `json:"-"` 1529 1530 // NullFields is a list of field names (e.g. "FormUrl") to include in 1531 // API requests with the JSON null value. By default, fields with empty 1532 // values are omitted from API requests. However, any field with an 1533 // empty value appearing in NullFields will be sent to the server as 1534 // null. It is an error if a field in this list has a non-empty value. 1535 // This may be used to include null fields in Patch requests. 1536 NullFields []string `json:"-"` 1537} 1538 1539func (s *Form) MarshalJSON() ([]byte, error) { 1540 type NoMethod Form 1541 raw := NoMethod(*s) 1542 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1543} 1544 1545// GlobalPermission: Global user permission description. 1546type GlobalPermission struct { 1547 // Permission: Permission value. 1548 // 1549 // Possible values: 1550 // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not 1551 // returned and is not a 1552 // valid value. 1553 // "CREATE_COURSE" - User is permitted to create a course. 1554 Permission string `json:"permission,omitempty"` 1555 1556 // ForceSendFields is a list of field names (e.g. "Permission") to 1557 // unconditionally include in API requests. By default, fields with 1558 // empty values are omitted from API requests. However, any non-pointer, 1559 // non-interface field appearing in ForceSendFields will be sent to the 1560 // server regardless of whether the field is empty or not. This may be 1561 // used to include empty fields in Patch requests. 1562 ForceSendFields []string `json:"-"` 1563 1564 // NullFields is a list of field names (e.g. "Permission") to include in 1565 // API requests with the JSON null value. By default, fields with empty 1566 // values are omitted from API requests. However, any field with an 1567 // empty value appearing in NullFields will be sent to the server as 1568 // null. It is an error if a field in this list has a non-empty value. 1569 // This may be used to include null fields in Patch requests. 1570 NullFields []string `json:"-"` 1571} 1572 1573func (s *GlobalPermission) MarshalJSON() ([]byte, error) { 1574 type NoMethod GlobalPermission 1575 raw := NoMethod(*s) 1576 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1577} 1578 1579// GradeHistory: The history of each grade on this submission. 1580type GradeHistory struct { 1581 // ActorUserId: The teacher who made the grade change. 1582 ActorUserId string `json:"actorUserId,omitempty"` 1583 1584 // GradeChangeType: The type of grade change at this time in the 1585 // submission grade history. 1586 // 1587 // Possible values: 1588 // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This 1589 // should never be returned. 1590 // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of 1591 // the draft grade. 1592 // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator 1593 // of the assigned grade. 1594 // "MAX_POINTS_CHANGE" - A change in the denominator of the grade. 1595 GradeChangeType string `json:"gradeChangeType,omitempty"` 1596 1597 // GradeTimestamp: When the grade of the submission was changed. 1598 GradeTimestamp string `json:"gradeTimestamp,omitempty"` 1599 1600 // MaxPoints: The denominator of the grade at this time in the 1601 // submission grade 1602 // history. 1603 MaxPoints float64 `json:"maxPoints,omitempty"` 1604 1605 // PointsEarned: The numerator of the grade at this time in the 1606 // submission grade history. 1607 PointsEarned float64 `json:"pointsEarned,omitempty"` 1608 1609 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 1610 // unconditionally include in API requests. By default, fields with 1611 // empty values are omitted from API requests. However, any non-pointer, 1612 // non-interface field appearing in ForceSendFields will be sent to the 1613 // server regardless of whether the field is empty or not. This may be 1614 // used to include empty fields in Patch requests. 1615 ForceSendFields []string `json:"-"` 1616 1617 // NullFields is a list of field names (e.g. "ActorUserId") to include 1618 // in API requests with the JSON null value. By default, fields with 1619 // empty values are omitted from API requests. However, any field with 1620 // an empty value appearing in NullFields will be sent to the server as 1621 // null. It is an error if a field in this list has a non-empty value. 1622 // This may be used to include null fields in Patch requests. 1623 NullFields []string `json:"-"` 1624} 1625 1626func (s *GradeHistory) MarshalJSON() ([]byte, error) { 1627 type NoMethod GradeHistory 1628 raw := NoMethod(*s) 1629 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1630} 1631 1632func (s *GradeHistory) UnmarshalJSON(data []byte) error { 1633 type NoMethod GradeHistory 1634 var s1 struct { 1635 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1636 PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"` 1637 *NoMethod 1638 } 1639 s1.NoMethod = (*NoMethod)(s) 1640 if err := json.Unmarshal(data, &s1); err != nil { 1641 return err 1642 } 1643 s.MaxPoints = float64(s1.MaxPoints) 1644 s.PointsEarned = float64(s1.PointsEarned) 1645 return nil 1646} 1647 1648// Guardian: Association between a student and a guardian of that 1649// student. The guardian 1650// may receive information about the student's course work. 1651type Guardian struct { 1652 // GuardianId: Identifier for the guardian. 1653 GuardianId string `json:"guardianId,omitempty"` 1654 1655 // GuardianProfile: User profile for the guardian. 1656 GuardianProfile *UserProfile `json:"guardianProfile,omitempty"` 1657 1658 // InvitedEmailAddress: The email address to which the initial guardian 1659 // invitation was sent. 1660 // This field is only visible to domain administrators. 1661 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1662 1663 // StudentId: Identifier for the student to whom the guardian 1664 // relationship applies. 1665 StudentId string `json:"studentId,omitempty"` 1666 1667 // ServerResponse contains the HTTP response code and headers from the 1668 // server. 1669 googleapi.ServerResponse `json:"-"` 1670 1671 // ForceSendFields is a list of field names (e.g. "GuardianId") to 1672 // unconditionally include in API requests. By default, fields with 1673 // empty values are omitted from API requests. However, any non-pointer, 1674 // non-interface field appearing in ForceSendFields will be sent to the 1675 // server regardless of whether the field is empty or not. This may be 1676 // used to include empty fields in Patch requests. 1677 ForceSendFields []string `json:"-"` 1678 1679 // NullFields is a list of field names (e.g. "GuardianId") to include in 1680 // API requests with the JSON null value. By default, fields with empty 1681 // values are omitted from API requests. However, any field with an 1682 // empty value appearing in NullFields will be sent to the server as 1683 // null. It is an error if a field in this list has a non-empty value. 1684 // This may be used to include null fields in Patch requests. 1685 NullFields []string `json:"-"` 1686} 1687 1688func (s *Guardian) MarshalJSON() ([]byte, error) { 1689 type NoMethod Guardian 1690 raw := NoMethod(*s) 1691 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1692} 1693 1694// GuardianInvitation: An invitation to become the guardian of a 1695// specified user, sent to a specified 1696// email address. 1697type GuardianInvitation struct { 1698 // CreationTime: The time that this invitation was created. 1699 // 1700 // Read-only. 1701 CreationTime string `json:"creationTime,omitempty"` 1702 1703 // InvitationId: Unique identifier for this invitation. 1704 // 1705 // Read-only. 1706 InvitationId string `json:"invitationId,omitempty"` 1707 1708 // InvitedEmailAddress: Email address that the invitation was sent 1709 // to. 1710 // This field is only visible to domain administrators. 1711 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1712 1713 // State: The state that this invitation is in. 1714 // 1715 // Possible values: 1716 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 1717 // "PENDING" - The invitation is active and awaiting a response. 1718 // "COMPLETE" - The invitation is no longer active. It may have been 1719 // accepted, declined, 1720 // withdrawn or it may have expired. 1721 State string `json:"state,omitempty"` 1722 1723 // StudentId: ID of the student (in standard format) 1724 StudentId string `json:"studentId,omitempty"` 1725 1726 // ServerResponse contains the HTTP response code and headers from the 1727 // server. 1728 googleapi.ServerResponse `json:"-"` 1729 1730 // ForceSendFields is a list of field names (e.g. "CreationTime") to 1731 // unconditionally include in API requests. By default, fields with 1732 // empty values are omitted from API requests. However, any non-pointer, 1733 // non-interface field appearing in ForceSendFields will be sent to the 1734 // server regardless of whether the field is empty or not. This may be 1735 // used to include empty fields in Patch requests. 1736 ForceSendFields []string `json:"-"` 1737 1738 // NullFields is a list of field names (e.g. "CreationTime") to include 1739 // in API requests with the JSON null value. By default, fields with 1740 // empty values are omitted from API requests. However, any field with 1741 // an empty value appearing in NullFields will be sent to the server as 1742 // null. It is an error if a field in this list has a non-empty value. 1743 // This may be used to include null fields in Patch requests. 1744 NullFields []string `json:"-"` 1745} 1746 1747func (s *GuardianInvitation) MarshalJSON() ([]byte, error) { 1748 type NoMethod GuardianInvitation 1749 raw := NoMethod(*s) 1750 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1751} 1752 1753// IndividualStudentsOptions: Assignee details about a 1754// coursework/announcement. 1755// This field is set if and only if `assigneeMode` is 1756// `INDIVIDUAL_STUDENTS`. 1757type IndividualStudentsOptions struct { 1758 // StudentIds: Identifiers for the students that have access to 1759 // the 1760 // coursework/announcement. 1761 StudentIds []string `json:"studentIds,omitempty"` 1762 1763 // ForceSendFields is a list of field names (e.g. "StudentIds") to 1764 // unconditionally include in API requests. By default, fields with 1765 // empty values are omitted from API requests. However, any non-pointer, 1766 // non-interface field appearing in ForceSendFields will be sent to the 1767 // server regardless of whether the field is empty or not. This may be 1768 // used to include empty fields in Patch requests. 1769 ForceSendFields []string `json:"-"` 1770 1771 // NullFields is a list of field names (e.g. "StudentIds") to include in 1772 // API requests with the JSON null value. By default, fields with empty 1773 // values are omitted from API requests. However, any field with an 1774 // empty value appearing in NullFields will be sent to the server as 1775 // null. It is an error if a field in this list has a non-empty value. 1776 // This may be used to include null fields in Patch requests. 1777 NullFields []string `json:"-"` 1778} 1779 1780func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) { 1781 type NoMethod IndividualStudentsOptions 1782 raw := NoMethod(*s) 1783 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1784} 1785 1786// Invitation: An invitation to join a course. 1787type Invitation struct { 1788 // CourseId: Identifier of the course to invite the user to. 1789 CourseId string `json:"courseId,omitempty"` 1790 1791 // Id: Identifier assigned by Classroom. 1792 // 1793 // Read-only. 1794 Id string `json:"id,omitempty"` 1795 1796 // Role: Role to invite the user to have. 1797 // Must not be `COURSE_ROLE_UNSPECIFIED`. 1798 // 1799 // Possible values: 1800 // "COURSE_ROLE_UNSPECIFIED" - No course role. 1801 // "STUDENT" - Student in the course. 1802 // "TEACHER" - Teacher of the course. 1803 // "OWNER" - Owner of the course. 1804 Role string `json:"role,omitempty"` 1805 1806 // UserId: Identifier of the invited user. 1807 // 1808 // When specified as a parameter of a request, this identifier can be 1809 // set to 1810 // one of the following: 1811 // 1812 // * the numeric identifier for the user 1813 // * the email address of the user 1814 // * the string literal "me", indicating the requesting user 1815 UserId string `json:"userId,omitempty"` 1816 1817 // ServerResponse contains the HTTP response code and headers from the 1818 // server. 1819 googleapi.ServerResponse `json:"-"` 1820 1821 // ForceSendFields is a list of field names (e.g. "CourseId") to 1822 // unconditionally include in API requests. By default, fields with 1823 // empty values are omitted from API requests. However, any non-pointer, 1824 // non-interface field appearing in ForceSendFields will be sent to the 1825 // server regardless of whether the field is empty or not. This may be 1826 // used to include empty fields in Patch requests. 1827 ForceSendFields []string `json:"-"` 1828 1829 // NullFields is a list of field names (e.g. "CourseId") to include in 1830 // API requests with the JSON null value. By default, fields with empty 1831 // values are omitted from API requests. However, any field with an 1832 // empty value appearing in NullFields will be sent to the server as 1833 // null. It is an error if a field in this list has a non-empty value. 1834 // This may be used to include null fields in Patch requests. 1835 NullFields []string `json:"-"` 1836} 1837 1838func (s *Invitation) MarshalJSON() ([]byte, error) { 1839 type NoMethod Invitation 1840 raw := NoMethod(*s) 1841 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1842} 1843 1844// Link: URL item. 1845type Link struct { 1846 // ThumbnailUrl: URL of a thumbnail image of the target URL. 1847 // 1848 // Read-only. 1849 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1850 1851 // Title: Title of the target of the URL. 1852 // 1853 // Read-only. 1854 Title string `json:"title,omitempty"` 1855 1856 // Url: URL to link to. 1857 // This must be a valid UTF-8 string containing between 1 and 2024 1858 // characters. 1859 Url string `json:"url,omitempty"` 1860 1861 // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to 1862 // unconditionally include in API requests. By default, fields with 1863 // empty values are omitted from API requests. However, any non-pointer, 1864 // non-interface field appearing in ForceSendFields will be sent to the 1865 // server regardless of whether the field is empty or not. This may be 1866 // used to include empty fields in Patch requests. 1867 ForceSendFields []string `json:"-"` 1868 1869 // NullFields is a list of field names (e.g. "ThumbnailUrl") to include 1870 // in API requests with the JSON null value. By default, fields with 1871 // empty values are omitted from API requests. However, any field with 1872 // an empty value appearing in NullFields will be sent to the server as 1873 // null. It is an error if a field in this list has a non-empty value. 1874 // This may be used to include null fields in Patch requests. 1875 NullFields []string `json:"-"` 1876} 1877 1878func (s *Link) MarshalJSON() ([]byte, error) { 1879 type NoMethod Link 1880 raw := NoMethod(*s) 1881 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1882} 1883 1884// ListAnnouncementsResponse: Response when listing course work. 1885type ListAnnouncementsResponse struct { 1886 // Announcements: Announcement items that match the request. 1887 Announcements []*Announcement `json:"announcements,omitempty"` 1888 1889 // NextPageToken: Token identifying the next page of results to return. 1890 // If empty, no further 1891 // results are available. 1892 NextPageToken string `json:"nextPageToken,omitempty"` 1893 1894 // ServerResponse contains the HTTP response code and headers from the 1895 // server. 1896 googleapi.ServerResponse `json:"-"` 1897 1898 // ForceSendFields is a list of field names (e.g. "Announcements") to 1899 // unconditionally include in API requests. By default, fields with 1900 // empty values are omitted from API requests. However, any non-pointer, 1901 // non-interface field appearing in ForceSendFields will be sent to the 1902 // server regardless of whether the field is empty or not. This may be 1903 // used to include empty fields in Patch requests. 1904 ForceSendFields []string `json:"-"` 1905 1906 // NullFields is a list of field names (e.g. "Announcements") to include 1907 // in API requests with the JSON null value. By default, fields with 1908 // empty values are omitted from API requests. However, any field with 1909 // an empty value appearing in NullFields will be sent to the server as 1910 // null. It is an error if a field in this list has a non-empty value. 1911 // This may be used to include null fields in Patch requests. 1912 NullFields []string `json:"-"` 1913} 1914 1915func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) { 1916 type NoMethod ListAnnouncementsResponse 1917 raw := NoMethod(*s) 1918 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1919} 1920 1921// ListCourseAliasesResponse: Response when listing course aliases. 1922type ListCourseAliasesResponse struct { 1923 // Aliases: The course aliases. 1924 Aliases []*CourseAlias `json:"aliases,omitempty"` 1925 1926 // NextPageToken: Token identifying the next page of results to return. 1927 // If empty, no further 1928 // results are available. 1929 NextPageToken string `json:"nextPageToken,omitempty"` 1930 1931 // ServerResponse contains the HTTP response code and headers from the 1932 // server. 1933 googleapi.ServerResponse `json:"-"` 1934 1935 // ForceSendFields is a list of field names (e.g. "Aliases") to 1936 // unconditionally include in API requests. By default, fields with 1937 // empty values are omitted from API requests. However, any non-pointer, 1938 // non-interface field appearing in ForceSendFields will be sent to the 1939 // server regardless of whether the field is empty or not. This may be 1940 // used to include empty fields in Patch requests. 1941 ForceSendFields []string `json:"-"` 1942 1943 // NullFields is a list of field names (e.g. "Aliases") to include in 1944 // API requests with the JSON null value. By default, fields with empty 1945 // values are omitted from API requests. However, any field with an 1946 // empty value appearing in NullFields will be sent to the server as 1947 // null. It is an error if a field in this list has a non-empty value. 1948 // This may be used to include null fields in Patch requests. 1949 NullFields []string `json:"-"` 1950} 1951 1952func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) { 1953 type NoMethod ListCourseAliasesResponse 1954 raw := NoMethod(*s) 1955 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1956} 1957 1958// ListCourseWorkResponse: Response when listing course work. 1959type ListCourseWorkResponse struct { 1960 // CourseWork: Course work items that match the request. 1961 CourseWork []*CourseWork `json:"courseWork,omitempty"` 1962 1963 // NextPageToken: Token identifying the next page of results to return. 1964 // If empty, no further 1965 // results are available. 1966 NextPageToken string `json:"nextPageToken,omitempty"` 1967 1968 // ServerResponse contains the HTTP response code and headers from the 1969 // server. 1970 googleapi.ServerResponse `json:"-"` 1971 1972 // ForceSendFields is a list of field names (e.g. "CourseWork") to 1973 // unconditionally include in API requests. By default, fields with 1974 // empty values are omitted from API requests. However, any non-pointer, 1975 // non-interface field appearing in ForceSendFields will be sent to the 1976 // server regardless of whether the field is empty or not. This may be 1977 // used to include empty fields in Patch requests. 1978 ForceSendFields []string `json:"-"` 1979 1980 // NullFields is a list of field names (e.g. "CourseWork") to include in 1981 // API requests with the JSON null value. By default, fields with empty 1982 // values are omitted from API requests. However, any field with an 1983 // empty value appearing in NullFields will be sent to the server as 1984 // null. It is an error if a field in this list has a non-empty value. 1985 // This may be used to include null fields in Patch requests. 1986 NullFields []string `json:"-"` 1987} 1988 1989func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) { 1990 type NoMethod ListCourseWorkResponse 1991 raw := NoMethod(*s) 1992 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1993} 1994 1995// ListCoursesResponse: Response when listing courses. 1996type ListCoursesResponse struct { 1997 // Courses: Courses that match the list request. 1998 Courses []*Course `json:"courses,omitempty"` 1999 2000 // NextPageToken: Token identifying the next page of results to return. 2001 // If empty, no further 2002 // results are available. 2003 NextPageToken string `json:"nextPageToken,omitempty"` 2004 2005 // ServerResponse contains the HTTP response code and headers from the 2006 // server. 2007 googleapi.ServerResponse `json:"-"` 2008 2009 // ForceSendFields is a list of field names (e.g. "Courses") to 2010 // unconditionally include in API requests. By default, fields with 2011 // empty values are omitted from API requests. However, any non-pointer, 2012 // non-interface field appearing in ForceSendFields will be sent to the 2013 // server regardless of whether the field is empty or not. This may be 2014 // used to include empty fields in Patch requests. 2015 ForceSendFields []string `json:"-"` 2016 2017 // NullFields is a list of field names (e.g. "Courses") to include in 2018 // API requests with the JSON null value. By default, fields with empty 2019 // values are omitted from API requests. However, any field with an 2020 // empty value appearing in NullFields will be sent to the server as 2021 // null. It is an error if a field in this list has a non-empty value. 2022 // This may be used to include null fields in Patch requests. 2023 NullFields []string `json:"-"` 2024} 2025 2026func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) { 2027 type NoMethod ListCoursesResponse 2028 raw := NoMethod(*s) 2029 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2030} 2031 2032// ListGuardianInvitationsResponse: Response when listing guardian 2033// invitations. 2034type ListGuardianInvitationsResponse struct { 2035 // GuardianInvitations: Guardian invitations that matched the list 2036 // request. 2037 GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"` 2038 2039 // NextPageToken: Token identifying the next page of results to return. 2040 // If empty, no further 2041 // results are available. 2042 NextPageToken string `json:"nextPageToken,omitempty"` 2043 2044 // ServerResponse contains the HTTP response code and headers from the 2045 // server. 2046 googleapi.ServerResponse `json:"-"` 2047 2048 // ForceSendFields is a list of field names (e.g. "GuardianInvitations") 2049 // to unconditionally include in API requests. By default, fields with 2050 // empty values are omitted from API requests. However, any non-pointer, 2051 // non-interface field appearing in ForceSendFields will be sent to the 2052 // server regardless of whether the field is empty or not. This may be 2053 // used to include empty fields in Patch requests. 2054 ForceSendFields []string `json:"-"` 2055 2056 // NullFields is a list of field names (e.g. "GuardianInvitations") to 2057 // include in API requests with the JSON null value. By default, fields 2058 // with empty values are omitted from API requests. However, any field 2059 // with an empty value appearing in NullFields will be sent to the 2060 // server as null. It is an error if a field in this list has a 2061 // non-empty value. This may be used to include null fields in Patch 2062 // requests. 2063 NullFields []string `json:"-"` 2064} 2065 2066func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) { 2067 type NoMethod ListGuardianInvitationsResponse 2068 raw := NoMethod(*s) 2069 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2070} 2071 2072// ListGuardiansResponse: Response when listing guardians. 2073type ListGuardiansResponse struct { 2074 // Guardians: Guardians on this page of results that met the criteria 2075 // specified in 2076 // the request. 2077 Guardians []*Guardian `json:"guardians,omitempty"` 2078 2079 // NextPageToken: Token identifying the next page of results to return. 2080 // If empty, no further 2081 // results are available. 2082 NextPageToken string `json:"nextPageToken,omitempty"` 2083 2084 // ServerResponse contains the HTTP response code and headers from the 2085 // server. 2086 googleapi.ServerResponse `json:"-"` 2087 2088 // ForceSendFields is a list of field names (e.g. "Guardians") to 2089 // unconditionally include in API requests. By default, fields with 2090 // empty values are omitted from API requests. However, any non-pointer, 2091 // non-interface field appearing in ForceSendFields will be sent to the 2092 // server regardless of whether the field is empty or not. This may be 2093 // used to include empty fields in Patch requests. 2094 ForceSendFields []string `json:"-"` 2095 2096 // NullFields is a list of field names (e.g. "Guardians") to include in 2097 // API requests with the JSON null value. By default, fields with empty 2098 // values are omitted from API requests. However, any field with an 2099 // empty value appearing in NullFields will be sent to the server as 2100 // null. It is an error if a field in this list has a non-empty value. 2101 // This may be used to include null fields in Patch requests. 2102 NullFields []string `json:"-"` 2103} 2104 2105func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) { 2106 type NoMethod ListGuardiansResponse 2107 raw := NoMethod(*s) 2108 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2109} 2110 2111// ListInvitationsResponse: Response when listing invitations. 2112type ListInvitationsResponse struct { 2113 // Invitations: Invitations that match the list request. 2114 Invitations []*Invitation `json:"invitations,omitempty"` 2115 2116 // NextPageToken: Token identifying the next page of results to return. 2117 // If empty, no further 2118 // results are available. 2119 NextPageToken string `json:"nextPageToken,omitempty"` 2120 2121 // ServerResponse contains the HTTP response code and headers from the 2122 // server. 2123 googleapi.ServerResponse `json:"-"` 2124 2125 // ForceSendFields is a list of field names (e.g. "Invitations") to 2126 // unconditionally include in API requests. By default, fields with 2127 // empty values are omitted from API requests. However, any non-pointer, 2128 // non-interface field appearing in ForceSendFields will be sent to the 2129 // server regardless of whether the field is empty or not. This may be 2130 // used to include empty fields in Patch requests. 2131 ForceSendFields []string `json:"-"` 2132 2133 // NullFields is a list of field names (e.g. "Invitations") to include 2134 // in API requests with the JSON null value. By default, fields with 2135 // empty values are omitted from API requests. However, any field with 2136 // an empty value appearing in NullFields will be sent to the server as 2137 // null. It is an error if a field in this list has a non-empty value. 2138 // This may be used to include null fields in Patch requests. 2139 NullFields []string `json:"-"` 2140} 2141 2142func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) { 2143 type NoMethod ListInvitationsResponse 2144 raw := NoMethod(*s) 2145 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2146} 2147 2148// ListStudentSubmissionsResponse: Response when listing student 2149// submissions. 2150type ListStudentSubmissionsResponse struct { 2151 // NextPageToken: Token identifying the next page of results to return. 2152 // If empty, no further 2153 // results are available. 2154 NextPageToken string `json:"nextPageToken,omitempty"` 2155 2156 // StudentSubmissions: Student work that matches the request. 2157 StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"` 2158 2159 // ServerResponse contains the HTTP response code and headers from the 2160 // server. 2161 googleapi.ServerResponse `json:"-"` 2162 2163 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2164 // unconditionally include in API requests. By default, fields with 2165 // empty values are omitted from API requests. However, any non-pointer, 2166 // non-interface field appearing in ForceSendFields will be sent to the 2167 // server regardless of whether the field is empty or not. This may be 2168 // used to include empty fields in Patch requests. 2169 ForceSendFields []string `json:"-"` 2170 2171 // NullFields is a list of field names (e.g. "NextPageToken") to include 2172 // in API requests with the JSON null value. By default, fields with 2173 // empty values are omitted from API requests. However, any field with 2174 // an empty value appearing in NullFields will be sent to the server as 2175 // null. It is an error if a field in this list has a non-empty value. 2176 // This may be used to include null fields in Patch requests. 2177 NullFields []string `json:"-"` 2178} 2179 2180func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) { 2181 type NoMethod ListStudentSubmissionsResponse 2182 raw := NoMethod(*s) 2183 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2184} 2185 2186// ListStudentsResponse: Response when listing students. 2187type ListStudentsResponse struct { 2188 // NextPageToken: Token identifying the next page of results to return. 2189 // If empty, no further 2190 // results are available. 2191 NextPageToken string `json:"nextPageToken,omitempty"` 2192 2193 // Students: Students who match the list request. 2194 Students []*Student `json:"students,omitempty"` 2195 2196 // ServerResponse contains the HTTP response code and headers from the 2197 // server. 2198 googleapi.ServerResponse `json:"-"` 2199 2200 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2201 // unconditionally include in API requests. By default, fields with 2202 // empty values are omitted from API requests. However, any non-pointer, 2203 // non-interface field appearing in ForceSendFields will be sent to the 2204 // server regardless of whether the field is empty or not. This may be 2205 // used to include empty fields in Patch requests. 2206 ForceSendFields []string `json:"-"` 2207 2208 // NullFields is a list of field names (e.g. "NextPageToken") to include 2209 // in API requests with the JSON null value. By default, fields with 2210 // empty values are omitted from API requests. However, any field with 2211 // an empty value appearing in NullFields will be sent to the server as 2212 // null. It is an error if a field in this list has a non-empty value. 2213 // This may be used to include null fields in Patch requests. 2214 NullFields []string `json:"-"` 2215} 2216 2217func (s *ListStudentsResponse) MarshalJSON() ([]byte, error) { 2218 type NoMethod ListStudentsResponse 2219 raw := NoMethod(*s) 2220 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2221} 2222 2223// ListTeachersResponse: Response when listing teachers. 2224type ListTeachersResponse struct { 2225 // NextPageToken: Token identifying the next page of results to return. 2226 // If empty, no further 2227 // results are available. 2228 NextPageToken string `json:"nextPageToken,omitempty"` 2229 2230 // Teachers: Teachers who match the list request. 2231 Teachers []*Teacher `json:"teachers,omitempty"` 2232 2233 // ServerResponse contains the HTTP response code and headers from the 2234 // server. 2235 googleapi.ServerResponse `json:"-"` 2236 2237 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2238 // unconditionally include in API requests. By default, fields with 2239 // empty values are omitted from API requests. However, any non-pointer, 2240 // non-interface field appearing in ForceSendFields will be sent to the 2241 // server regardless of whether the field is empty or not. This may be 2242 // used to include empty fields in Patch requests. 2243 ForceSendFields []string `json:"-"` 2244 2245 // NullFields is a list of field names (e.g. "NextPageToken") to include 2246 // in API requests with the JSON null value. By default, fields with 2247 // empty values are omitted from API requests. However, any field with 2248 // an empty value appearing in NullFields will be sent to the server as 2249 // null. It is an error if a field in this list has a non-empty value. 2250 // This may be used to include null fields in Patch requests. 2251 NullFields []string `json:"-"` 2252} 2253 2254func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) { 2255 type NoMethod ListTeachersResponse 2256 raw := NoMethod(*s) 2257 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2258} 2259 2260// ListTopicResponse: Response when listing topics. 2261type ListTopicResponse struct { 2262 // NextPageToken: Token identifying the next page of results to return. 2263 // If empty, no further 2264 // results are available. 2265 NextPageToken string `json:"nextPageToken,omitempty"` 2266 2267 // Topic: Topic items that match the request. 2268 Topic []*Topic `json:"topic,omitempty"` 2269 2270 // ServerResponse contains the HTTP response code and headers from the 2271 // server. 2272 googleapi.ServerResponse `json:"-"` 2273 2274 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2275 // unconditionally include in API requests. By default, fields with 2276 // empty values are omitted from API requests. However, any non-pointer, 2277 // non-interface field appearing in ForceSendFields will be sent to the 2278 // server regardless of whether the field is empty or not. This may be 2279 // used to include empty fields in Patch requests. 2280 ForceSendFields []string `json:"-"` 2281 2282 // NullFields is a list of field names (e.g. "NextPageToken") to include 2283 // in API requests with the JSON null value. By default, fields with 2284 // empty values are omitted from API requests. However, any field with 2285 // an empty value appearing in NullFields will be sent to the server as 2286 // null. It is an error if a field in this list has a non-empty value. 2287 // This may be used to include null fields in Patch requests. 2288 NullFields []string `json:"-"` 2289} 2290 2291func (s *ListTopicResponse) MarshalJSON() ([]byte, error) { 2292 type NoMethod ListTopicResponse 2293 raw := NoMethod(*s) 2294 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2295} 2296 2297// Material: Material attached to course work. 2298// 2299// When creating attachments, setting the `form` field is not supported. 2300type Material struct { 2301 // DriveFile: Google Drive file material. 2302 DriveFile *SharedDriveFile `json:"driveFile,omitempty"` 2303 2304 // Form: Google Forms material. 2305 Form *Form `json:"form,omitempty"` 2306 2307 // Link: Link material. On creation, will be upgraded to a more 2308 // appropriate type 2309 // if possible, and this will be reflected in the response. 2310 Link *Link `json:"link,omitempty"` 2311 2312 // YoutubeVideo: YouTube video material. 2313 YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"` 2314 2315 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2316 // unconditionally include in API requests. By default, fields with 2317 // empty values are omitted from API requests. However, any non-pointer, 2318 // non-interface field appearing in ForceSendFields will be sent to the 2319 // server regardless of whether the field is empty or not. This may be 2320 // used to include empty fields in Patch requests. 2321 ForceSendFields []string `json:"-"` 2322 2323 // NullFields is a list of field names (e.g. "DriveFile") to include in 2324 // API requests with the JSON null value. By default, fields with empty 2325 // values are omitted from API requests. However, any field with an 2326 // empty value appearing in NullFields will be sent to the server as 2327 // null. It is an error if a field in this list has a non-empty value. 2328 // This may be used to include null fields in Patch requests. 2329 NullFields []string `json:"-"` 2330} 2331 2332func (s *Material) MarshalJSON() ([]byte, error) { 2333 type NoMethod Material 2334 raw := NoMethod(*s) 2335 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2336} 2337 2338// ModifyAnnouncementAssigneesRequest: Request to modify assignee mode 2339// and options of an announcement. 2340type ModifyAnnouncementAssigneesRequest struct { 2341 // AssigneeMode: Mode of the announcement describing whether it will be 2342 // accessible by all 2343 // students or specified individual students. 2344 // 2345 // Possible values: 2346 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2347 // returned. 2348 // "ALL_STUDENTS" - All students can see the item. 2349 // This is the default state. 2350 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2351 AssigneeMode string `json:"assigneeMode,omitempty"` 2352 2353 // ModifyIndividualStudentsOptions: Set which students can view or 2354 // cannot view the announcement. 2355 // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2356 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2357 2358 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2359 // unconditionally include in API requests. By default, fields with 2360 // empty values are omitted from API requests. However, any non-pointer, 2361 // non-interface field appearing in ForceSendFields will be sent to the 2362 // server regardless of whether the field is empty or not. This may be 2363 // used to include empty fields in Patch requests. 2364 ForceSendFields []string `json:"-"` 2365 2366 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2367 // in API requests with the JSON null value. By default, fields with 2368 // empty values are omitted from API requests. However, any field with 2369 // an empty value appearing in NullFields will be sent to the server as 2370 // null. It is an error if a field in this list has a non-empty value. 2371 // This may be used to include null fields in Patch requests. 2372 NullFields []string `json:"-"` 2373} 2374 2375func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) { 2376 type NoMethod ModifyAnnouncementAssigneesRequest 2377 raw := NoMethod(*s) 2378 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2379} 2380 2381// ModifyAttachmentsRequest: Request to modify the attachments of a 2382// student submission. 2383type ModifyAttachmentsRequest struct { 2384 // AddAttachments: Attachments to add. 2385 // A student submission may not have more than 20 attachments. 2386 // 2387 // Form attachments are not supported. 2388 AddAttachments []*Attachment `json:"addAttachments,omitempty"` 2389 2390 // ForceSendFields is a list of field names (e.g. "AddAttachments") to 2391 // unconditionally include in API requests. By default, fields with 2392 // empty values are omitted from API requests. However, any non-pointer, 2393 // non-interface field appearing in ForceSendFields will be sent to the 2394 // server regardless of whether the field is empty or not. This may be 2395 // used to include empty fields in Patch requests. 2396 ForceSendFields []string `json:"-"` 2397 2398 // NullFields is a list of field names (e.g. "AddAttachments") to 2399 // include in API requests with the JSON null value. By default, fields 2400 // with empty values are omitted from API requests. However, any field 2401 // with an empty value appearing in NullFields will be sent to the 2402 // server as null. It is an error if a field in this list has a 2403 // non-empty value. This may be used to include null fields in Patch 2404 // requests. 2405 NullFields []string `json:"-"` 2406} 2407 2408func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) { 2409 type NoMethod ModifyAttachmentsRequest 2410 raw := NoMethod(*s) 2411 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2412} 2413 2414// ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and 2415// options of a coursework. 2416type ModifyCourseWorkAssigneesRequest struct { 2417 // AssigneeMode: Mode of the coursework describing whether it will be 2418 // assigned to all 2419 // students or specified individual students. 2420 // 2421 // Possible values: 2422 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2423 // returned. 2424 // "ALL_STUDENTS" - All students can see the item. 2425 // This is the default state. 2426 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2427 AssigneeMode string `json:"assigneeMode,omitempty"` 2428 2429 // ModifyIndividualStudentsOptions: Set which students are assigned or 2430 // not assigned to the coursework. 2431 // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2432 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2433 2434 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2435 // unconditionally include in API requests. By default, fields with 2436 // empty values are omitted from API requests. However, any non-pointer, 2437 // non-interface field appearing in ForceSendFields will be sent to the 2438 // server regardless of whether the field is empty or not. This may be 2439 // used to include empty fields in Patch requests. 2440 ForceSendFields []string `json:"-"` 2441 2442 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2443 // in API requests with the JSON null value. By default, fields with 2444 // empty values are omitted from API requests. However, any field with 2445 // an empty value appearing in NullFields will be sent to the server as 2446 // null. It is an error if a field in this list has a non-empty value. 2447 // This may be used to include null fields in Patch requests. 2448 NullFields []string `json:"-"` 2449} 2450 2451func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) { 2452 type NoMethod ModifyCourseWorkAssigneesRequest 2453 raw := NoMethod(*s) 2454 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2455} 2456 2457// ModifyIndividualStudentsOptions: Contains fields to add or remove 2458// students from a course work or announcement 2459// where the `assigneeMode` is set to `INDIVIDUAL_STUDENTS`. 2460type ModifyIndividualStudentsOptions struct { 2461 // AddStudentIds: Ids of students to be added as having access to 2462 // this 2463 // coursework/announcement. 2464 AddStudentIds []string `json:"addStudentIds,omitempty"` 2465 2466 // RemoveStudentIds: Ids of students to be removed from having access to 2467 // this 2468 // coursework/announcement. 2469 RemoveStudentIds []string `json:"removeStudentIds,omitempty"` 2470 2471 // ForceSendFields is a list of field names (e.g. "AddStudentIds") to 2472 // unconditionally include in API requests. By default, fields with 2473 // empty values are omitted from API requests. However, any non-pointer, 2474 // non-interface field appearing in ForceSendFields will be sent to the 2475 // server regardless of whether the field is empty or not. This may be 2476 // used to include empty fields in Patch requests. 2477 ForceSendFields []string `json:"-"` 2478 2479 // NullFields is a list of field names (e.g. "AddStudentIds") to include 2480 // in API requests with the JSON null value. By default, fields with 2481 // empty values are omitted from API requests. However, any field with 2482 // an empty value appearing in NullFields will be sent to the server as 2483 // null. It is an error if a field in this list has a non-empty value. 2484 // This may be used to include null fields in Patch requests. 2485 NullFields []string `json:"-"` 2486} 2487 2488func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) { 2489 type NoMethod ModifyIndividualStudentsOptions 2490 raw := NoMethod(*s) 2491 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2492} 2493 2494// MultipleChoiceQuestion: Additional details for multiple-choice 2495// questions. 2496type MultipleChoiceQuestion struct { 2497 // Choices: Possible choices. 2498 Choices []string `json:"choices,omitempty"` 2499 2500 // ForceSendFields is a list of field names (e.g. "Choices") to 2501 // unconditionally include in API requests. By default, fields with 2502 // empty values are omitted from API requests. However, any non-pointer, 2503 // non-interface field appearing in ForceSendFields will be sent to the 2504 // server regardless of whether the field is empty or not. This may be 2505 // used to include empty fields in Patch requests. 2506 ForceSendFields []string `json:"-"` 2507 2508 // NullFields is a list of field names (e.g. "Choices") to include in 2509 // API requests with the JSON null value. By default, fields with empty 2510 // values are omitted from API requests. However, any field with an 2511 // empty value appearing in NullFields will be sent to the server as 2512 // null. It is an error if a field in this list has a non-empty value. 2513 // This may be used to include null fields in Patch requests. 2514 NullFields []string `json:"-"` 2515} 2516 2517func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) { 2518 type NoMethod MultipleChoiceQuestion 2519 raw := NoMethod(*s) 2520 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2521} 2522 2523// MultipleChoiceSubmission: Student work for a multiple-choice 2524// question. 2525type MultipleChoiceSubmission struct { 2526 // Answer: Student's select choice. 2527 Answer string `json:"answer,omitempty"` 2528 2529 // ForceSendFields is a list of field names (e.g. "Answer") to 2530 // unconditionally include in API requests. By default, fields with 2531 // empty values are omitted from API requests. However, any non-pointer, 2532 // non-interface field appearing in ForceSendFields will be sent to the 2533 // server regardless of whether the field is empty or not. This may be 2534 // used to include empty fields in Patch requests. 2535 ForceSendFields []string `json:"-"` 2536 2537 // NullFields is a list of field names (e.g. "Answer") to include in API 2538 // requests with the JSON null value. By default, fields with empty 2539 // values are omitted from API requests. However, any field with an 2540 // empty value appearing in NullFields will be sent to the server as 2541 // null. It is an error if a field in this list has a non-empty value. 2542 // This may be used to include null fields in Patch requests. 2543 NullFields []string `json:"-"` 2544} 2545 2546func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) { 2547 type NoMethod MultipleChoiceSubmission 2548 raw := NoMethod(*s) 2549 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2550} 2551 2552// Name: Details of the user's name. 2553type Name struct { 2554 // FamilyName: The user's last name. 2555 // 2556 // Read-only. 2557 FamilyName string `json:"familyName,omitempty"` 2558 2559 // FullName: The user's full name formed by concatenating the first and 2560 // last name 2561 // values. 2562 // 2563 // Read-only. 2564 FullName string `json:"fullName,omitempty"` 2565 2566 // GivenName: The user's first name. 2567 // 2568 // Read-only. 2569 GivenName string `json:"givenName,omitempty"` 2570 2571 // ForceSendFields is a list of field names (e.g. "FamilyName") to 2572 // unconditionally include in API requests. By default, fields with 2573 // empty values are omitted from API requests. However, any non-pointer, 2574 // non-interface field appearing in ForceSendFields will be sent to the 2575 // server regardless of whether the field is empty or not. This may be 2576 // used to include empty fields in Patch requests. 2577 ForceSendFields []string `json:"-"` 2578 2579 // NullFields is a list of field names (e.g. "FamilyName") to include in 2580 // API requests with the JSON null value. By default, fields with empty 2581 // values are omitted from API requests. However, any field with an 2582 // empty value appearing in NullFields will be sent to the server as 2583 // null. It is an error if a field in this list has a non-empty value. 2584 // This may be used to include null fields in Patch requests. 2585 NullFields []string `json:"-"` 2586} 2587 2588func (s *Name) MarshalJSON() ([]byte, error) { 2589 type NoMethod Name 2590 raw := NoMethod(*s) 2591 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2592} 2593 2594// ReclaimStudentSubmissionRequest: Request to reclaim a student 2595// submission. 2596type ReclaimStudentSubmissionRequest struct { 2597} 2598 2599// Registration: An instruction to Classroom to send notifications from 2600// the `feed` to the 2601// provided destination. 2602type Registration struct { 2603 // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to 2604 // be sent to. 2605 CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"` 2606 2607 // ExpiryTime: The time until which the `Registration` is 2608 // effective. 2609 // 2610 // This is a read-only field assigned by the server. 2611 ExpiryTime string `json:"expiryTime,omitempty"` 2612 2613 // Feed: Specification for the class of notifications that Classroom 2614 // should deliver 2615 // to the destination. 2616 Feed *Feed `json:"feed,omitempty"` 2617 2618 // RegistrationId: A server-generated unique identifier for this 2619 // `Registration`. 2620 // 2621 // Read-only. 2622 RegistrationId string `json:"registrationId,omitempty"` 2623 2624 // ServerResponse contains the HTTP response code and headers from the 2625 // server. 2626 googleapi.ServerResponse `json:"-"` 2627 2628 // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to 2629 // unconditionally include in API requests. By default, fields with 2630 // empty values are omitted from API requests. However, any non-pointer, 2631 // non-interface field appearing in ForceSendFields will be sent to the 2632 // server regardless of whether the field is empty or not. This may be 2633 // used to include empty fields in Patch requests. 2634 ForceSendFields []string `json:"-"` 2635 2636 // NullFields is a list of field names (e.g. "CloudPubsubTopic") to 2637 // include in API requests with the JSON null value. By default, fields 2638 // with empty values are omitted from API requests. However, any field 2639 // with an empty value appearing in NullFields will be sent to the 2640 // server as null. It is an error if a field in this list has a 2641 // non-empty value. This may be used to include null fields in Patch 2642 // requests. 2643 NullFields []string `json:"-"` 2644} 2645 2646func (s *Registration) MarshalJSON() ([]byte, error) { 2647 type NoMethod Registration 2648 raw := NoMethod(*s) 2649 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2650} 2651 2652// ReturnStudentSubmissionRequest: Request to return a student 2653// submission. 2654type ReturnStudentSubmissionRequest struct { 2655} 2656 2657// SharedDriveFile: Drive file that is used as material for course work. 2658type SharedDriveFile struct { 2659 // DriveFile: Drive file details. 2660 DriveFile *DriveFile `json:"driveFile,omitempty"` 2661 2662 // ShareMode: Mechanism by which students access the Drive item. 2663 // 2664 // Possible values: 2665 // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never 2666 // be returned. 2667 // "VIEW" - Students can view the shared file. 2668 // "EDIT" - Students can edit the shared file. 2669 // "STUDENT_COPY" - Students have a personal copy of the shared file. 2670 ShareMode string `json:"shareMode,omitempty"` 2671 2672 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2673 // unconditionally include in API requests. By default, fields with 2674 // empty values are omitted from API requests. However, any non-pointer, 2675 // non-interface field appearing in ForceSendFields will be sent to the 2676 // server regardless of whether the field is empty or not. This may be 2677 // used to include empty fields in Patch requests. 2678 ForceSendFields []string `json:"-"` 2679 2680 // NullFields is a list of field names (e.g. "DriveFile") to include in 2681 // API requests with the JSON null value. By default, fields with empty 2682 // values are omitted from API requests. However, any field with an 2683 // empty value appearing in NullFields will be sent to the server as 2684 // null. It is an error if a field in this list has a non-empty value. 2685 // This may be used to include null fields in Patch requests. 2686 NullFields []string `json:"-"` 2687} 2688 2689func (s *SharedDriveFile) MarshalJSON() ([]byte, error) { 2690 type NoMethod SharedDriveFile 2691 raw := NoMethod(*s) 2692 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2693} 2694 2695// ShortAnswerSubmission: Student work for a short answer question. 2696type ShortAnswerSubmission struct { 2697 // Answer: Student response to a short-answer question. 2698 Answer string `json:"answer,omitempty"` 2699 2700 // ForceSendFields is a list of field names (e.g. "Answer") to 2701 // unconditionally include in API requests. By default, fields with 2702 // empty values are omitted from API requests. However, any non-pointer, 2703 // non-interface field appearing in ForceSendFields will be sent to the 2704 // server regardless of whether the field is empty or not. This may be 2705 // used to include empty fields in Patch requests. 2706 ForceSendFields []string `json:"-"` 2707 2708 // NullFields is a list of field names (e.g. "Answer") to include in API 2709 // requests with the JSON null value. By default, fields with empty 2710 // values are omitted from API requests. However, any field with an 2711 // empty value appearing in NullFields will be sent to the server as 2712 // null. It is an error if a field in this list has a non-empty value. 2713 // This may be used to include null fields in Patch requests. 2714 NullFields []string `json:"-"` 2715} 2716 2717func (s *ShortAnswerSubmission) MarshalJSON() ([]byte, error) { 2718 type NoMethod ShortAnswerSubmission 2719 raw := NoMethod(*s) 2720 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2721} 2722 2723// StateHistory: The history of each state this submission has been in. 2724type StateHistory struct { 2725 // ActorUserId: The teacher or student who made the change 2726 ActorUserId string `json:"actorUserId,omitempty"` 2727 2728 // State: The workflow pipeline stage. 2729 // 2730 // Possible values: 2731 // "STATE_UNSPECIFIED" - No state specified. This should never be 2732 // returned. 2733 // "CREATED" - The Submission has been created. 2734 // "TURNED_IN" - The student has turned in an assigned document, which 2735 // may or may not be 2736 // a template. 2737 // "RETURNED" - The teacher has returned the assigned document to the 2738 // student. 2739 // "RECLAIMED_BY_STUDENT" - The student turned in the assigned 2740 // document, and then chose to 2741 // "unsubmit" the assignment, giving the student control again as 2742 // the 2743 // owner. 2744 // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their 2745 // submission after turning it in. Currently, 2746 // only used by Questions, when the student edits their answer. 2747 State string `json:"state,omitempty"` 2748 2749 // StateTimestamp: When the submission entered this state. 2750 StateTimestamp string `json:"stateTimestamp,omitempty"` 2751 2752 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 2753 // unconditionally include in API requests. By default, fields with 2754 // empty values are omitted from API requests. However, any non-pointer, 2755 // non-interface field appearing in ForceSendFields will be sent to the 2756 // server regardless of whether the field is empty or not. This may be 2757 // used to include empty fields in Patch requests. 2758 ForceSendFields []string `json:"-"` 2759 2760 // NullFields is a list of field names (e.g. "ActorUserId") to include 2761 // in API requests with the JSON null value. By default, fields with 2762 // empty values are omitted from API requests. However, any field with 2763 // an empty value appearing in NullFields will be sent to the server as 2764 // null. It is an error if a field in this list has a non-empty value. 2765 // This may be used to include null fields in Patch requests. 2766 NullFields []string `json:"-"` 2767} 2768 2769func (s *StateHistory) MarshalJSON() ([]byte, error) { 2770 type NoMethod StateHistory 2771 raw := NoMethod(*s) 2772 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2773} 2774 2775// Student: Student in a course. 2776type Student struct { 2777 // CourseId: Identifier of the course. 2778 // 2779 // Read-only. 2780 CourseId string `json:"courseId,omitempty"` 2781 2782 // Profile: Global user information for the student. 2783 // 2784 // Read-only. 2785 Profile *UserProfile `json:"profile,omitempty"` 2786 2787 // StudentWorkFolder: Information about a Drive Folder for this 2788 // student's work in this course. 2789 // Only visible to the student and domain administrators. 2790 // 2791 // Read-only. 2792 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 2793 2794 // UserId: Identifier of the user. 2795 // 2796 // When specified as a parameter of a request, this identifier can be 2797 // one of 2798 // the following: 2799 // 2800 // * the numeric identifier for the user 2801 // * the email address of the user 2802 // * the string literal "me", indicating the requesting user 2803 UserId string `json:"userId,omitempty"` 2804 2805 // ServerResponse contains the HTTP response code and headers from the 2806 // server. 2807 googleapi.ServerResponse `json:"-"` 2808 2809 // ForceSendFields is a list of field names (e.g. "CourseId") to 2810 // unconditionally include in API requests. By default, fields with 2811 // empty values are omitted from API requests. However, any non-pointer, 2812 // non-interface field appearing in ForceSendFields will be sent to the 2813 // server regardless of whether the field is empty or not. This may be 2814 // used to include empty fields in Patch requests. 2815 ForceSendFields []string `json:"-"` 2816 2817 // NullFields is a list of field names (e.g. "CourseId") to include in 2818 // API requests with the JSON null value. By default, fields with empty 2819 // values are omitted from API requests. However, any field with an 2820 // empty value appearing in NullFields will be sent to the server as 2821 // null. It is an error if a field in this list has a non-empty value. 2822 // This may be used to include null fields in Patch requests. 2823 NullFields []string `json:"-"` 2824} 2825 2826func (s *Student) MarshalJSON() ([]byte, error) { 2827 type NoMethod Student 2828 raw := NoMethod(*s) 2829 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2830} 2831 2832// StudentSubmission: Student submission for course 2833// work. 2834// 2835// StudentSubmission items are generated when a CourseWork item is 2836// created. 2837// 2838// StudentSubmissions that have never been accessed (i.e. with `state` = 2839// NEW) 2840// may not have a creation time or update time. 2841type StudentSubmission struct { 2842 // AlternateLink: Absolute link to the submission in the Classroom web 2843 // UI. 2844 // 2845 // Read-only. 2846 AlternateLink string `json:"alternateLink,omitempty"` 2847 2848 // AssignedGrade: Optional grade. If unset, no grade was set. 2849 // This value must be non-negative. Decimal (i.e. non-integer) values 2850 // are 2851 // allowed, but will be rounded to two decimal places. 2852 // 2853 // This may be modified only by course teachers. 2854 AssignedGrade float64 `json:"assignedGrade,omitempty"` 2855 2856 // AssignmentSubmission: Submission content when course_work_type is 2857 // ASSIGNMENT. 2858 // 2859 // Students can modify this content 2860 // using 2861 // google.classroom.Work.ModifyAttachments. 2862 AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"` 2863 2864 // AssociatedWithDeveloper: Whether this student submission is 2865 // associated with the Developer Console 2866 // project making the request. 2867 // 2868 // See google.classroom.Work.CreateCourseWork for 2869 // more 2870 // details. 2871 // 2872 // Read-only. 2873 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 2874 2875 // CourseId: Identifier of the course. 2876 // 2877 // Read-only. 2878 CourseId string `json:"courseId,omitempty"` 2879 2880 // CourseWorkId: Identifier for the course work this corresponds 2881 // to. 2882 // 2883 // Read-only. 2884 CourseWorkId string `json:"courseWorkId,omitempty"` 2885 2886 // CourseWorkType: Type of course work this submission is 2887 // for. 2888 // 2889 // Read-only. 2890 // 2891 // Possible values: 2892 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 2893 // never returned. 2894 // "ASSIGNMENT" - An assignment. 2895 // "SHORT_ANSWER_QUESTION" - A short answer question. 2896 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 2897 CourseWorkType string `json:"courseWorkType,omitempty"` 2898 2899 // CreationTime: Creation time of this submission. 2900 // This may be unset if the student has not accessed this 2901 // item. 2902 // 2903 // Read-only. 2904 CreationTime string `json:"creationTime,omitempty"` 2905 2906 // DraftGrade: Optional pending grade. If unset, no grade was set. 2907 // This value must be non-negative. Decimal (i.e. non-integer) values 2908 // are 2909 // allowed, but will be rounded to two decimal places. 2910 // 2911 // This is only visible to and modifiable by course teachers. 2912 DraftGrade float64 `json:"draftGrade,omitempty"` 2913 2914 // Id: Classroom-assigned Identifier for the student submission. 2915 // This is unique among submissions for the relevant course 2916 // work. 2917 // 2918 // Read-only. 2919 Id string `json:"id,omitempty"` 2920 2921 // Late: Whether this submission is late. 2922 // 2923 // Read-only. 2924 Late bool `json:"late,omitempty"` 2925 2926 // MultipleChoiceSubmission: Submission content when course_work_type is 2927 // MULTIPLE_CHOICE_QUESTION. 2928 MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"` 2929 2930 // ShortAnswerSubmission: Submission content when course_work_type is 2931 // SHORT_ANSWER_QUESTION. 2932 ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"` 2933 2934 // State: State of this submission. 2935 // 2936 // Read-only. 2937 // 2938 // Possible values: 2939 // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 2940 // never be returned. 2941 // "NEW" - The student has never accessed this submission. Attachments 2942 // are not 2943 // returned and timestamps is not set. 2944 // "CREATED" - Has been created. 2945 // "TURNED_IN" - Has been turned in to the teacher. 2946 // "RETURNED" - Has been returned to the student. 2947 // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 2948 // assignment. 2949 State string `json:"state,omitempty"` 2950 2951 // SubmissionHistory: The history of the submission (includes state and 2952 // grade histories). 2953 // 2954 // Read-only. 2955 SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"` 2956 2957 // UpdateTime: Last update time of this submission. 2958 // This may be unset if the student has not accessed this 2959 // item. 2960 // 2961 // Read-only. 2962 UpdateTime string `json:"updateTime,omitempty"` 2963 2964 // UserId: Identifier for the student that owns this 2965 // submission. 2966 // 2967 // Read-only. 2968 UserId string `json:"userId,omitempty"` 2969 2970 // ServerResponse contains the HTTP response code and headers from the 2971 // server. 2972 googleapi.ServerResponse `json:"-"` 2973 2974 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 2975 // unconditionally include in API requests. By default, fields with 2976 // empty values are omitted from API requests. However, any non-pointer, 2977 // non-interface field appearing in ForceSendFields will be sent to the 2978 // server regardless of whether the field is empty or not. This may be 2979 // used to include empty fields in Patch requests. 2980 ForceSendFields []string `json:"-"` 2981 2982 // NullFields is a list of field names (e.g. "AlternateLink") to include 2983 // in API requests with the JSON null value. By default, fields with 2984 // empty values are omitted from API requests. However, any field with 2985 // an empty value appearing in NullFields will be sent to the server as 2986 // null. It is an error if a field in this list has a non-empty value. 2987 // This may be used to include null fields in Patch requests. 2988 NullFields []string `json:"-"` 2989} 2990 2991func (s *StudentSubmission) MarshalJSON() ([]byte, error) { 2992 type NoMethod StudentSubmission 2993 raw := NoMethod(*s) 2994 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2995} 2996 2997func (s *StudentSubmission) UnmarshalJSON(data []byte) error { 2998 type NoMethod StudentSubmission 2999 var s1 struct { 3000 AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"` 3001 DraftGrade gensupport.JSONFloat64 `json:"draftGrade"` 3002 *NoMethod 3003 } 3004 s1.NoMethod = (*NoMethod)(s) 3005 if err := json.Unmarshal(data, &s1); err != nil { 3006 return err 3007 } 3008 s.AssignedGrade = float64(s1.AssignedGrade) 3009 s.DraftGrade = float64(s1.DraftGrade) 3010 return nil 3011} 3012 3013// SubmissionHistory: The history of the submission. This currently 3014// includes state and grade 3015// histories. 3016type SubmissionHistory struct { 3017 // GradeHistory: The grade history information of the submission, if 3018 // present. 3019 GradeHistory *GradeHistory `json:"gradeHistory,omitempty"` 3020 3021 // StateHistory: The state history information of the submission, if 3022 // present. 3023 StateHistory *StateHistory `json:"stateHistory,omitempty"` 3024 3025 // ForceSendFields is a list of field names (e.g. "GradeHistory") to 3026 // unconditionally include in API requests. By default, fields with 3027 // empty values are omitted from API requests. However, any non-pointer, 3028 // non-interface field appearing in ForceSendFields will be sent to the 3029 // server regardless of whether the field is empty or not. This may be 3030 // used to include empty fields in Patch requests. 3031 ForceSendFields []string `json:"-"` 3032 3033 // NullFields is a list of field names (e.g. "GradeHistory") to include 3034 // in API requests with the JSON null value. By default, fields with 3035 // empty values are omitted from API requests. However, any field with 3036 // an empty value appearing in NullFields will be sent to the server as 3037 // null. It is an error if a field in this list has a non-empty value. 3038 // This may be used to include null fields in Patch requests. 3039 NullFields []string `json:"-"` 3040} 3041 3042func (s *SubmissionHistory) MarshalJSON() ([]byte, error) { 3043 type NoMethod SubmissionHistory 3044 raw := NoMethod(*s) 3045 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3046} 3047 3048// Teacher: Teacher of a course. 3049type Teacher struct { 3050 // CourseId: Identifier of the course. 3051 // 3052 // Read-only. 3053 CourseId string `json:"courseId,omitempty"` 3054 3055 // Profile: Global user information for the teacher. 3056 // 3057 // Read-only. 3058 Profile *UserProfile `json:"profile,omitempty"` 3059 3060 // UserId: Identifier of the user. 3061 // 3062 // When specified as a parameter of a request, this identifier can be 3063 // one of 3064 // the following: 3065 // 3066 // * the numeric identifier for the user 3067 // * the email address of the user 3068 // * the string literal "me", indicating the requesting user 3069 UserId string `json:"userId,omitempty"` 3070 3071 // ServerResponse contains the HTTP response code and headers from the 3072 // server. 3073 googleapi.ServerResponse `json:"-"` 3074 3075 // ForceSendFields is a list of field names (e.g. "CourseId") to 3076 // unconditionally include in API requests. By default, fields with 3077 // empty values are omitted from API requests. However, any non-pointer, 3078 // non-interface field appearing in ForceSendFields will be sent to the 3079 // server regardless of whether the field is empty or not. This may be 3080 // used to include empty fields in Patch requests. 3081 ForceSendFields []string `json:"-"` 3082 3083 // NullFields is a list of field names (e.g. "CourseId") to include in 3084 // API requests with the JSON null value. By default, fields with empty 3085 // values are omitted from API requests. However, any field with an 3086 // empty value appearing in NullFields will be sent to the server as 3087 // null. It is an error if a field in this list has a non-empty value. 3088 // This may be used to include null fields in Patch requests. 3089 NullFields []string `json:"-"` 3090} 3091 3092func (s *Teacher) MarshalJSON() ([]byte, error) { 3093 type NoMethod Teacher 3094 raw := NoMethod(*s) 3095 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3096} 3097 3098// TimeOfDay: Represents a time of day. The date and time zone are 3099// either not significant 3100// or are specified elsewhere. An API may choose to allow leap seconds. 3101// Related 3102// types are google.type.Date and `google.protobuf.Timestamp`. 3103type TimeOfDay struct { 3104 // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API 3105 // may choose 3106 // to allow the value "24:00:00" for scenarios like business closing 3107 // time. 3108 Hours int64 `json:"hours,omitempty"` 3109 3110 // Minutes: Minutes of hour of day. Must be from 0 to 59. 3111 Minutes int64 `json:"minutes,omitempty"` 3112 3113 // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to 3114 // 999,999,999. 3115 Nanos int64 `json:"nanos,omitempty"` 3116 3117 // Seconds: Seconds of minutes of the time. Must normally be from 0 to 3118 // 59. An API may 3119 // allow the value 60 if it allows leap-seconds. 3120 Seconds int64 `json:"seconds,omitempty"` 3121 3122 // ForceSendFields is a list of field names (e.g. "Hours") to 3123 // unconditionally include in API requests. By default, fields with 3124 // empty values are omitted from API requests. However, any non-pointer, 3125 // non-interface field appearing in ForceSendFields will be sent to the 3126 // server regardless of whether the field is empty or not. This may be 3127 // used to include empty fields in Patch requests. 3128 ForceSendFields []string `json:"-"` 3129 3130 // NullFields is a list of field names (e.g. "Hours") to include in API 3131 // requests with the JSON null value. By default, fields with empty 3132 // values are omitted from API requests. However, any field with an 3133 // empty value appearing in NullFields will be sent to the server as 3134 // null. It is an error if a field in this list has a non-empty value. 3135 // This may be used to include null fields in Patch requests. 3136 NullFields []string `json:"-"` 3137} 3138 3139func (s *TimeOfDay) MarshalJSON() ([]byte, error) { 3140 type NoMethod TimeOfDay 3141 raw := NoMethod(*s) 3142 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3143} 3144 3145// Topic: Topic created by a teacher for the course 3146type Topic struct { 3147 // CourseId: Identifier of the course. 3148 // 3149 // Read-only. 3150 CourseId string `json:"courseId,omitempty"` 3151 3152 // Name: The name of the topic, generated by the user. 3153 // Leading and trailing whitespaces, if any, will be trimmed. Also, 3154 // multiple 3155 // consecutive whitespaces will be collapsed into one inside the name. 3156 // The 3157 // result must be a non-empty string. Topic names are case sensitive, 3158 // and must 3159 // be no longer than 100 characters. 3160 Name string `json:"name,omitempty"` 3161 3162 // TopicId: Unique identifier for the topic. 3163 // 3164 // Read-only. 3165 TopicId string `json:"topicId,omitempty"` 3166 3167 // UpdateTime: The time the topic was last updated by the 3168 // system. 3169 // 3170 // Read-only. 3171 UpdateTime string `json:"updateTime,omitempty"` 3172 3173 // ServerResponse contains the HTTP response code and headers from the 3174 // server. 3175 googleapi.ServerResponse `json:"-"` 3176 3177 // ForceSendFields is a list of field names (e.g. "CourseId") to 3178 // unconditionally include in API requests. By default, fields with 3179 // empty values are omitted from API requests. However, any non-pointer, 3180 // non-interface field appearing in ForceSendFields will be sent to the 3181 // server regardless of whether the field is empty or not. This may be 3182 // used to include empty fields in Patch requests. 3183 ForceSendFields []string `json:"-"` 3184 3185 // NullFields is a list of field names (e.g. "CourseId") to include in 3186 // API requests with the JSON null value. By default, fields with empty 3187 // values are omitted from API requests. However, any field with an 3188 // empty value appearing in NullFields will be sent to the server as 3189 // null. It is an error if a field in this list has a non-empty value. 3190 // This may be used to include null fields in Patch requests. 3191 NullFields []string `json:"-"` 3192} 3193 3194func (s *Topic) MarshalJSON() ([]byte, error) { 3195 type NoMethod Topic 3196 raw := NoMethod(*s) 3197 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3198} 3199 3200// TurnInStudentSubmissionRequest: Request to turn in a student 3201// submission. 3202type TurnInStudentSubmissionRequest struct { 3203} 3204 3205// UserProfile: Global information for a user. 3206type UserProfile struct { 3207 // EmailAddress: Email address of the user. 3208 // 3209 // Read-only. 3210 EmailAddress string `json:"emailAddress,omitempty"` 3211 3212 // Id: Identifier of the user. 3213 // 3214 // Read-only. 3215 Id string `json:"id,omitempty"` 3216 3217 // Name: Name of the user. 3218 // 3219 // Read-only. 3220 Name *Name `json:"name,omitempty"` 3221 3222 // Permissions: Global permissions of the user. 3223 // 3224 // Read-only. 3225 Permissions []*GlobalPermission `json:"permissions,omitempty"` 3226 3227 // PhotoUrl: URL of user's profile photo. 3228 // 3229 // Read-only. 3230 PhotoUrl string `json:"photoUrl,omitempty"` 3231 3232 // VerifiedTeacher: Represents whether a G Suite for Education user's 3233 // domain administrator has 3234 // explicitly verified them as being a teacher. If the user is not a 3235 // member of 3236 // a G Suite for Education domain, than this field will always be 3237 // false. 3238 // 3239 // Read-only 3240 VerifiedTeacher bool `json:"verifiedTeacher,omitempty"` 3241 3242 // ServerResponse contains the HTTP response code and headers from the 3243 // server. 3244 googleapi.ServerResponse `json:"-"` 3245 3246 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 3247 // unconditionally include in API requests. By default, fields with 3248 // empty values are omitted from API requests. However, any non-pointer, 3249 // non-interface field appearing in ForceSendFields will be sent to the 3250 // server regardless of whether the field is empty or not. This may be 3251 // used to include empty fields in Patch requests. 3252 ForceSendFields []string `json:"-"` 3253 3254 // NullFields is a list of field names (e.g. "EmailAddress") to include 3255 // in API requests with the JSON null value. By default, fields with 3256 // empty values are omitted from API requests. However, any field with 3257 // an empty value appearing in NullFields will be sent to the server as 3258 // null. It is an error if a field in this list has a non-empty value. 3259 // This may be used to include null fields in Patch requests. 3260 NullFields []string `json:"-"` 3261} 3262 3263func (s *UserProfile) MarshalJSON() ([]byte, error) { 3264 type NoMethod UserProfile 3265 raw := NoMethod(*s) 3266 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3267} 3268 3269// YouTubeVideo: YouTube video item. 3270type YouTubeVideo struct { 3271 // AlternateLink: URL that can be used to view the YouTube 3272 // video. 3273 // 3274 // Read-only. 3275 AlternateLink string `json:"alternateLink,omitempty"` 3276 3277 // Id: YouTube API resource ID. 3278 Id string `json:"id,omitempty"` 3279 3280 // ThumbnailUrl: URL of a thumbnail image of the YouTube 3281 // video. 3282 // 3283 // Read-only. 3284 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 3285 3286 // Title: Title of the YouTube video. 3287 // 3288 // Read-only. 3289 Title string `json:"title,omitempty"` 3290 3291 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 3292 // unconditionally include in API requests. By default, fields with 3293 // empty values are omitted from API requests. However, any non-pointer, 3294 // non-interface field appearing in ForceSendFields will be sent to the 3295 // server regardless of whether the field is empty or not. This may be 3296 // used to include empty fields in Patch requests. 3297 ForceSendFields []string `json:"-"` 3298 3299 // NullFields is a list of field names (e.g. "AlternateLink") to include 3300 // in API requests with the JSON null value. By default, fields with 3301 // empty values are omitted from API requests. However, any field with 3302 // an empty value appearing in NullFields will be sent to the server as 3303 // null. It is an error if a field in this list has a non-empty value. 3304 // This may be used to include null fields in Patch requests. 3305 NullFields []string `json:"-"` 3306} 3307 3308func (s *YouTubeVideo) MarshalJSON() ([]byte, error) { 3309 type NoMethod YouTubeVideo 3310 raw := NoMethod(*s) 3311 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3312} 3313 3314// method id "classroom.courses.create": 3315 3316type CoursesCreateCall struct { 3317 s *Service 3318 course *Course 3319 urlParams_ gensupport.URLParams 3320 ctx_ context.Context 3321 header_ http.Header 3322} 3323 3324// Create: Creates a course. 3325// 3326// The user specified in `ownerId` is the owner of the created 3327// course 3328// and added as a teacher. 3329// 3330// This method returns the following error codes: 3331// 3332// * `PERMISSION_DENIED` if the requesting user is not permitted to 3333// create 3334// courses or for access errors. 3335// * `NOT_FOUND` if the primary teacher is not a valid user. 3336// * `FAILED_PRECONDITION` if the course owner's account is disabled or 3337// for 3338// the following request errors: 3339// * UserGroupsMembershipLimitReached 3340// * `ALREADY_EXISTS` if an alias was specified in the `id` and 3341// already exists. 3342func (r *CoursesService) Create(course *Course) *CoursesCreateCall { 3343 c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3344 c.course = course 3345 return c 3346} 3347 3348// Fields allows partial responses to be retrieved. See 3349// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3350// for more information. 3351func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall { 3352 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3353 return c 3354} 3355 3356// Context sets the context to be used in this call's Do method. Any 3357// pending HTTP request will be aborted if the provided context is 3358// canceled. 3359func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall { 3360 c.ctx_ = ctx 3361 return c 3362} 3363 3364// Header returns an http.Header that can be modified by the caller to 3365// add HTTP headers to the request. 3366func (c *CoursesCreateCall) Header() http.Header { 3367 if c.header_ == nil { 3368 c.header_ = make(http.Header) 3369 } 3370 return c.header_ 3371} 3372 3373func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) { 3374 reqHeaders := make(http.Header) 3375 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3376 for k, v := range c.header_ { 3377 reqHeaders[k] = v 3378 } 3379 reqHeaders.Set("User-Agent", c.s.userAgent()) 3380 var body io.Reader = nil 3381 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3382 if err != nil { 3383 return nil, err 3384 } 3385 reqHeaders.Set("Content-Type", "application/json") 3386 c.urlParams_.Set("alt", alt) 3387 c.urlParams_.Set("prettyPrint", "false") 3388 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3389 urls += "?" + c.urlParams_.Encode() 3390 req, err := http.NewRequest("POST", urls, body) 3391 if err != nil { 3392 return nil, err 3393 } 3394 req.Header = reqHeaders 3395 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3396} 3397 3398// Do executes the "classroom.courses.create" call. 3399// Exactly one of *Course or error will be non-nil. Any non-2xx status 3400// code is an error. Response headers are in either 3401// *Course.ServerResponse.Header or (if a response was returned at all) 3402// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3403// check whether the returned error was because http.StatusNotModified 3404// was returned. 3405func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3406 gensupport.SetOptions(c.urlParams_, opts...) 3407 res, err := c.doRequest("json") 3408 if res != nil && res.StatusCode == http.StatusNotModified { 3409 if res.Body != nil { 3410 res.Body.Close() 3411 } 3412 return nil, &googleapi.Error{ 3413 Code: res.StatusCode, 3414 Header: res.Header, 3415 } 3416 } 3417 if err != nil { 3418 return nil, err 3419 } 3420 defer googleapi.CloseBody(res) 3421 if err := googleapi.CheckResponse(res); err != nil { 3422 return nil, err 3423 } 3424 ret := &Course{ 3425 ServerResponse: googleapi.ServerResponse{ 3426 Header: res.Header, 3427 HTTPStatusCode: res.StatusCode, 3428 }, 3429 } 3430 target := &ret 3431 if err := gensupport.DecodeResponse(target, res); err != nil { 3432 return nil, err 3433 } 3434 return ret, nil 3435 // { 3436 // "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.", 3437 // "flatPath": "v1/courses", 3438 // "httpMethod": "POST", 3439 // "id": "classroom.courses.create", 3440 // "parameterOrder": [], 3441 // "parameters": {}, 3442 // "path": "v1/courses", 3443 // "request": { 3444 // "$ref": "Course" 3445 // }, 3446 // "response": { 3447 // "$ref": "Course" 3448 // }, 3449 // "scopes": [ 3450 // "https://www.googleapis.com/auth/classroom.courses" 3451 // ] 3452 // } 3453 3454} 3455 3456// method id "classroom.courses.delete": 3457 3458type CoursesDeleteCall struct { 3459 s *Service 3460 id string 3461 urlParams_ gensupport.URLParams 3462 ctx_ context.Context 3463 header_ http.Header 3464} 3465 3466// Delete: Deletes a course. 3467// 3468// This method returns the following error codes: 3469// 3470// * `PERMISSION_DENIED` if the requesting user is not permitted to 3471// delete the 3472// requested course or for access errors. 3473// * `NOT_FOUND` if no course exists with the requested ID. 3474func (r *CoursesService) Delete(id string) *CoursesDeleteCall { 3475 c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3476 c.id = id 3477 return c 3478} 3479 3480// Fields allows partial responses to be retrieved. See 3481// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3482// for more information. 3483func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall { 3484 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3485 return c 3486} 3487 3488// Context sets the context to be used in this call's Do method. Any 3489// pending HTTP request will be aborted if the provided context is 3490// canceled. 3491func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall { 3492 c.ctx_ = ctx 3493 return c 3494} 3495 3496// Header returns an http.Header that can be modified by the caller to 3497// add HTTP headers to the request. 3498func (c *CoursesDeleteCall) Header() http.Header { 3499 if c.header_ == nil { 3500 c.header_ = make(http.Header) 3501 } 3502 return c.header_ 3503} 3504 3505func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) { 3506 reqHeaders := make(http.Header) 3507 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3508 for k, v := range c.header_ { 3509 reqHeaders[k] = v 3510 } 3511 reqHeaders.Set("User-Agent", c.s.userAgent()) 3512 var body io.Reader = nil 3513 c.urlParams_.Set("alt", alt) 3514 c.urlParams_.Set("prettyPrint", "false") 3515 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3516 urls += "?" + c.urlParams_.Encode() 3517 req, err := http.NewRequest("DELETE", urls, body) 3518 if err != nil { 3519 return nil, err 3520 } 3521 req.Header = reqHeaders 3522 googleapi.Expand(req.URL, map[string]string{ 3523 "id": c.id, 3524 }) 3525 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3526} 3527 3528// Do executes the "classroom.courses.delete" call. 3529// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3530// code is an error. Response headers are in either 3531// *Empty.ServerResponse.Header or (if a response was returned at all) 3532// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3533// check whether the returned error was because http.StatusNotModified 3534// was returned. 3535func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3536 gensupport.SetOptions(c.urlParams_, opts...) 3537 res, err := c.doRequest("json") 3538 if res != nil && res.StatusCode == http.StatusNotModified { 3539 if res.Body != nil { 3540 res.Body.Close() 3541 } 3542 return nil, &googleapi.Error{ 3543 Code: res.StatusCode, 3544 Header: res.Header, 3545 } 3546 } 3547 if err != nil { 3548 return nil, err 3549 } 3550 defer googleapi.CloseBody(res) 3551 if err := googleapi.CheckResponse(res); err != nil { 3552 return nil, err 3553 } 3554 ret := &Empty{ 3555 ServerResponse: googleapi.ServerResponse{ 3556 Header: res.Header, 3557 HTTPStatusCode: res.StatusCode, 3558 }, 3559 } 3560 target := &ret 3561 if err := gensupport.DecodeResponse(target, res); err != nil { 3562 return nil, err 3563 } 3564 return ret, nil 3565 // { 3566 // "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.", 3567 // "flatPath": "v1/courses/{id}", 3568 // "httpMethod": "DELETE", 3569 // "id": "classroom.courses.delete", 3570 // "parameterOrder": [ 3571 // "id" 3572 // ], 3573 // "parameters": { 3574 // "id": { 3575 // "description": "Identifier of the course to delete.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3576 // "location": "path", 3577 // "required": true, 3578 // "type": "string" 3579 // } 3580 // }, 3581 // "path": "v1/courses/{id}", 3582 // "response": { 3583 // "$ref": "Empty" 3584 // }, 3585 // "scopes": [ 3586 // "https://www.googleapis.com/auth/classroom.courses" 3587 // ] 3588 // } 3589 3590} 3591 3592// method id "classroom.courses.get": 3593 3594type CoursesGetCall struct { 3595 s *Service 3596 id string 3597 urlParams_ gensupport.URLParams 3598 ifNoneMatch_ string 3599 ctx_ context.Context 3600 header_ http.Header 3601} 3602 3603// Get: Returns a course. 3604// 3605// This method returns the following error codes: 3606// 3607// * `PERMISSION_DENIED` if the requesting user is not permitted to 3608// access the 3609// requested course or for access errors. 3610// * `NOT_FOUND` if no course exists with the requested ID. 3611func (r *CoursesService) Get(id string) *CoursesGetCall { 3612 c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3613 c.id = id 3614 return c 3615} 3616 3617// Fields allows partial responses to be retrieved. See 3618// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3619// for more information. 3620func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall { 3621 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3622 return c 3623} 3624 3625// IfNoneMatch sets the optional parameter which makes the operation 3626// fail if the object's ETag matches the given value. This is useful for 3627// getting updates only after the object has changed since the last 3628// request. Use googleapi.IsNotModified to check whether the response 3629// error from Do is the result of In-None-Match. 3630func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall { 3631 c.ifNoneMatch_ = entityTag 3632 return c 3633} 3634 3635// Context sets the context to be used in this call's Do method. Any 3636// pending HTTP request will be aborted if the provided context is 3637// canceled. 3638func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall { 3639 c.ctx_ = ctx 3640 return c 3641} 3642 3643// Header returns an http.Header that can be modified by the caller to 3644// add HTTP headers to the request. 3645func (c *CoursesGetCall) Header() http.Header { 3646 if c.header_ == nil { 3647 c.header_ = make(http.Header) 3648 } 3649 return c.header_ 3650} 3651 3652func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) { 3653 reqHeaders := make(http.Header) 3654 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3655 for k, v := range c.header_ { 3656 reqHeaders[k] = v 3657 } 3658 reqHeaders.Set("User-Agent", c.s.userAgent()) 3659 if c.ifNoneMatch_ != "" { 3660 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3661 } 3662 var body io.Reader = nil 3663 c.urlParams_.Set("alt", alt) 3664 c.urlParams_.Set("prettyPrint", "false") 3665 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3666 urls += "?" + c.urlParams_.Encode() 3667 req, err := http.NewRequest("GET", urls, body) 3668 if err != nil { 3669 return nil, err 3670 } 3671 req.Header = reqHeaders 3672 googleapi.Expand(req.URL, map[string]string{ 3673 "id": c.id, 3674 }) 3675 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3676} 3677 3678// Do executes the "classroom.courses.get" call. 3679// Exactly one of *Course or error will be non-nil. Any non-2xx status 3680// code is an error. Response headers are in either 3681// *Course.ServerResponse.Header or (if a response was returned at all) 3682// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3683// check whether the returned error was because http.StatusNotModified 3684// was returned. 3685func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3686 gensupport.SetOptions(c.urlParams_, opts...) 3687 res, err := c.doRequest("json") 3688 if res != nil && res.StatusCode == http.StatusNotModified { 3689 if res.Body != nil { 3690 res.Body.Close() 3691 } 3692 return nil, &googleapi.Error{ 3693 Code: res.StatusCode, 3694 Header: res.Header, 3695 } 3696 } 3697 if err != nil { 3698 return nil, err 3699 } 3700 defer googleapi.CloseBody(res) 3701 if err := googleapi.CheckResponse(res); err != nil { 3702 return nil, err 3703 } 3704 ret := &Course{ 3705 ServerResponse: googleapi.ServerResponse{ 3706 Header: res.Header, 3707 HTTPStatusCode: res.StatusCode, 3708 }, 3709 } 3710 target := &ret 3711 if err := gensupport.DecodeResponse(target, res); err != nil { 3712 return nil, err 3713 } 3714 return ret, nil 3715 // { 3716 // "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.", 3717 // "flatPath": "v1/courses/{id}", 3718 // "httpMethod": "GET", 3719 // "id": "classroom.courses.get", 3720 // "parameterOrder": [ 3721 // "id" 3722 // ], 3723 // "parameters": { 3724 // "id": { 3725 // "description": "Identifier of the course to return.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 3726 // "location": "path", 3727 // "required": true, 3728 // "type": "string" 3729 // } 3730 // }, 3731 // "path": "v1/courses/{id}", 3732 // "response": { 3733 // "$ref": "Course" 3734 // }, 3735 // "scopes": [ 3736 // "https://www.googleapis.com/auth/classroom.courses", 3737 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3738 // ] 3739 // } 3740 3741} 3742 3743// method id "classroom.courses.list": 3744 3745type CoursesListCall struct { 3746 s *Service 3747 urlParams_ gensupport.URLParams 3748 ifNoneMatch_ string 3749 ctx_ context.Context 3750 header_ http.Header 3751} 3752 3753// List: Returns a list of courses that the requesting user is permitted 3754// to view, 3755// restricted to those that match the request. Returned courses are 3756// ordered by 3757// creation time, with the most recently created coming first. 3758// 3759// This method returns the following error codes: 3760// 3761// * `PERMISSION_DENIED` for access errors. 3762// * `INVALID_ARGUMENT` if the query argument is malformed. 3763// * `NOT_FOUND` if any users specified in the query arguments do not 3764// exist. 3765func (r *CoursesService) List() *CoursesListCall { 3766 c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3767 return c 3768} 3769 3770// CourseStates sets the optional parameter "courseStates": Restricts 3771// returned courses to those in one of the specified states 3772// The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED. 3773// 3774// Possible values: 3775// "COURSE_STATE_UNSPECIFIED" 3776// "ACTIVE" 3777// "ARCHIVED" 3778// "PROVISIONED" 3779// "DECLINED" 3780// "SUSPENDED" 3781func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall { 3782 c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...)) 3783 return c 3784} 3785 3786// PageSize sets the optional parameter "pageSize": Maximum number of 3787// items to return. Zero or unspecified indicates that the 3788// server may assign a maximum. 3789// 3790// The server may return fewer than the specified number of results. 3791func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall { 3792 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3793 return c 3794} 3795 3796// PageToken sets the optional parameter "pageToken": 3797// nextPageToken 3798// value returned from a previous 3799// list call, 3800// indicating that the subsequent page of results should be 3801// returned. 3802// 3803// The list request must be 3804// otherwise identical to the one that resulted in this token. 3805func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall { 3806 c.urlParams_.Set("pageToken", pageToken) 3807 return c 3808} 3809 3810// StudentId sets the optional parameter "studentId": Restricts returned 3811// courses to those having a student with the specified 3812// identifier. The identifier can be one of the following: 3813// 3814// * the numeric identifier for the user 3815// * the email address of the user 3816// * the string literal "me", indicating the requesting user 3817func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall { 3818 c.urlParams_.Set("studentId", studentId) 3819 return c 3820} 3821 3822// TeacherId sets the optional parameter "teacherId": Restricts returned 3823// courses to those having a teacher with the specified 3824// identifier. The identifier can be one of the following: 3825// 3826// * the numeric identifier for the user 3827// * the email address of the user 3828// * the string literal "me", indicating the requesting user 3829func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall { 3830 c.urlParams_.Set("teacherId", teacherId) 3831 return c 3832} 3833 3834// Fields allows partial responses to be retrieved. See 3835// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3836// for more information. 3837func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall { 3838 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3839 return c 3840} 3841 3842// IfNoneMatch sets the optional parameter which makes the operation 3843// fail if the object's ETag matches the given value. This is useful for 3844// getting updates only after the object has changed since the last 3845// request. Use googleapi.IsNotModified to check whether the response 3846// error from Do is the result of In-None-Match. 3847func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall { 3848 c.ifNoneMatch_ = entityTag 3849 return c 3850} 3851 3852// Context sets the context to be used in this call's Do method. Any 3853// pending HTTP request will be aborted if the provided context is 3854// canceled. 3855func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall { 3856 c.ctx_ = ctx 3857 return c 3858} 3859 3860// Header returns an http.Header that can be modified by the caller to 3861// add HTTP headers to the request. 3862func (c *CoursesListCall) Header() http.Header { 3863 if c.header_ == nil { 3864 c.header_ = make(http.Header) 3865 } 3866 return c.header_ 3867} 3868 3869func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) { 3870 reqHeaders := make(http.Header) 3871 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3872 for k, v := range c.header_ { 3873 reqHeaders[k] = v 3874 } 3875 reqHeaders.Set("User-Agent", c.s.userAgent()) 3876 if c.ifNoneMatch_ != "" { 3877 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3878 } 3879 var body io.Reader = nil 3880 c.urlParams_.Set("alt", alt) 3881 c.urlParams_.Set("prettyPrint", "false") 3882 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3883 urls += "?" + c.urlParams_.Encode() 3884 req, err := http.NewRequest("GET", urls, body) 3885 if err != nil { 3886 return nil, err 3887 } 3888 req.Header = reqHeaders 3889 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3890} 3891 3892// Do executes the "classroom.courses.list" call. 3893// Exactly one of *ListCoursesResponse or error will be non-nil. Any 3894// non-2xx status code is an error. Response headers are in either 3895// *ListCoursesResponse.ServerResponse.Header or (if a response was 3896// returned at all) in error.(*googleapi.Error).Header. Use 3897// googleapi.IsNotModified to check whether the returned error was 3898// because http.StatusNotModified was returned. 3899func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) { 3900 gensupport.SetOptions(c.urlParams_, opts...) 3901 res, err := c.doRequest("json") 3902 if res != nil && res.StatusCode == http.StatusNotModified { 3903 if res.Body != nil { 3904 res.Body.Close() 3905 } 3906 return nil, &googleapi.Error{ 3907 Code: res.StatusCode, 3908 Header: res.Header, 3909 } 3910 } 3911 if err != nil { 3912 return nil, err 3913 } 3914 defer googleapi.CloseBody(res) 3915 if err := googleapi.CheckResponse(res); err != nil { 3916 return nil, err 3917 } 3918 ret := &ListCoursesResponse{ 3919 ServerResponse: googleapi.ServerResponse{ 3920 Header: res.Header, 3921 HTTPStatusCode: res.StatusCode, 3922 }, 3923 } 3924 target := &ret 3925 if err := gensupport.DecodeResponse(target, res); err != nil { 3926 return nil, err 3927 } 3928 return ret, nil 3929 // { 3930 // "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.", 3931 // "flatPath": "v1/courses", 3932 // "httpMethod": "GET", 3933 // "id": "classroom.courses.list", 3934 // "parameterOrder": [], 3935 // "parameters": { 3936 // "courseStates": { 3937 // "description": "Restricts returned courses to those in one of the specified states\nThe default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.", 3938 // "enum": [ 3939 // "COURSE_STATE_UNSPECIFIED", 3940 // "ACTIVE", 3941 // "ARCHIVED", 3942 // "PROVISIONED", 3943 // "DECLINED", 3944 // "SUSPENDED" 3945 // ], 3946 // "location": "query", 3947 // "repeated": true, 3948 // "type": "string" 3949 // }, 3950 // "pageSize": { 3951 // "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.", 3952 // "format": "int32", 3953 // "location": "query", 3954 // "type": "integer" 3955 // }, 3956 // "pageToken": { 3957 // "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.", 3958 // "location": "query", 3959 // "type": "string" 3960 // }, 3961 // "studentId": { 3962 // "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", 3963 // "location": "query", 3964 // "type": "string" 3965 // }, 3966 // "teacherId": { 3967 // "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", 3968 // "location": "query", 3969 // "type": "string" 3970 // } 3971 // }, 3972 // "path": "v1/courses", 3973 // "response": { 3974 // "$ref": "ListCoursesResponse" 3975 // }, 3976 // "scopes": [ 3977 // "https://www.googleapis.com/auth/classroom.courses", 3978 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3979 // ] 3980 // } 3981 3982} 3983 3984// Pages invokes f for each page of results. 3985// A non-nil error returned from f will halt the iteration. 3986// The provided context supersedes any context provided to the Context method. 3987func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error { 3988 c.ctx_ = ctx 3989 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3990 for { 3991 x, err := c.Do() 3992 if err != nil { 3993 return err 3994 } 3995 if err := f(x); err != nil { 3996 return err 3997 } 3998 if x.NextPageToken == "" { 3999 return nil 4000 } 4001 c.PageToken(x.NextPageToken) 4002 } 4003} 4004 4005// method id "classroom.courses.patch": 4006 4007type CoursesPatchCall struct { 4008 s *Service 4009 id string 4010 course *Course 4011 urlParams_ gensupport.URLParams 4012 ctx_ context.Context 4013 header_ http.Header 4014} 4015 4016// Patch: Updates one or more fields in a course. 4017// 4018// This method returns the following error codes: 4019// 4020// * `PERMISSION_DENIED` if the requesting user is not permitted to 4021// modify the 4022// requested course or for access errors. 4023// * `NOT_FOUND` if no course exists with the requested ID. 4024// * `INVALID_ARGUMENT` if invalid fields are specified in the update 4025// mask or 4026// if no update mask is supplied. 4027// * `FAILED_PRECONDITION` for the following request errors: 4028// * CourseNotModifiable 4029func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall { 4030 c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4031 c.id = id 4032 c.course = course 4033 return c 4034} 4035 4036// UpdateMask sets the optional parameter "updateMask": Mask that 4037// identifies which fields on the course to update. 4038// This field is required to do an update. The update will fail if 4039// invalid 4040// fields are specified. The following fields are valid: 4041// 4042// * `name` 4043// * `section` 4044// * `descriptionHeading` 4045// * `description` 4046// * `room` 4047// * `courseState` 4048// * `ownerId` 4049// 4050// Note: patches to ownerId are treated as being effective immediately, 4051// but in 4052// practice it may take some time for the ownership transfer of all 4053// affected 4054// resources to complete. 4055// 4056// When set in a query parameter, this field should be specified 4057// as 4058// 4059// `updateMask=<field1>,<field2>,...` 4060func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall { 4061 c.urlParams_.Set("updateMask", updateMask) 4062 return c 4063} 4064 4065// Fields allows partial responses to be retrieved. See 4066// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4067// for more information. 4068func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall { 4069 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4070 return c 4071} 4072 4073// Context sets the context to be used in this call's Do method. Any 4074// pending HTTP request will be aborted if the provided context is 4075// canceled. 4076func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall { 4077 c.ctx_ = ctx 4078 return c 4079} 4080 4081// Header returns an http.Header that can be modified by the caller to 4082// add HTTP headers to the request. 4083func (c *CoursesPatchCall) Header() http.Header { 4084 if c.header_ == nil { 4085 c.header_ = make(http.Header) 4086 } 4087 return c.header_ 4088} 4089 4090func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) { 4091 reqHeaders := make(http.Header) 4092 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4093 for k, v := range c.header_ { 4094 reqHeaders[k] = v 4095 } 4096 reqHeaders.Set("User-Agent", c.s.userAgent()) 4097 var body io.Reader = nil 4098 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4099 if err != nil { 4100 return nil, err 4101 } 4102 reqHeaders.Set("Content-Type", "application/json") 4103 c.urlParams_.Set("alt", alt) 4104 c.urlParams_.Set("prettyPrint", "false") 4105 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4106 urls += "?" + c.urlParams_.Encode() 4107 req, err := http.NewRequest("PATCH", urls, body) 4108 if err != nil { 4109 return nil, err 4110 } 4111 req.Header = reqHeaders 4112 googleapi.Expand(req.URL, map[string]string{ 4113 "id": c.id, 4114 }) 4115 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4116} 4117 4118// Do executes the "classroom.courses.patch" call. 4119// Exactly one of *Course or error will be non-nil. Any non-2xx status 4120// code is an error. Response headers are in either 4121// *Course.ServerResponse.Header or (if a response was returned at all) 4122// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4123// check whether the returned error was because http.StatusNotModified 4124// was returned. 4125func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4126 gensupport.SetOptions(c.urlParams_, opts...) 4127 res, err := c.doRequest("json") 4128 if res != nil && res.StatusCode == http.StatusNotModified { 4129 if res.Body != nil { 4130 res.Body.Close() 4131 } 4132 return nil, &googleapi.Error{ 4133 Code: res.StatusCode, 4134 Header: res.Header, 4135 } 4136 } 4137 if err != nil { 4138 return nil, err 4139 } 4140 defer googleapi.CloseBody(res) 4141 if err := googleapi.CheckResponse(res); err != nil { 4142 return nil, err 4143 } 4144 ret := &Course{ 4145 ServerResponse: googleapi.ServerResponse{ 4146 Header: res.Header, 4147 HTTPStatusCode: res.StatusCode, 4148 }, 4149 } 4150 target := &ret 4151 if err := gensupport.DecodeResponse(target, res); err != nil { 4152 return nil, err 4153 } 4154 return ret, nil 4155 // { 4156 // "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", 4157 // "flatPath": "v1/courses/{id}", 4158 // "httpMethod": "PATCH", 4159 // "id": "classroom.courses.patch", 4160 // "parameterOrder": [ 4161 // "id" 4162 // ], 4163 // "parameters": { 4164 // "id": { 4165 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4166 // "location": "path", 4167 // "required": true, 4168 // "type": "string" 4169 // }, 4170 // "updateMask": { 4171 // "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,...`", 4172 // "format": "google-fieldmask", 4173 // "location": "query", 4174 // "type": "string" 4175 // } 4176 // }, 4177 // "path": "v1/courses/{id}", 4178 // "request": { 4179 // "$ref": "Course" 4180 // }, 4181 // "response": { 4182 // "$ref": "Course" 4183 // }, 4184 // "scopes": [ 4185 // "https://www.googleapis.com/auth/classroom.courses" 4186 // ] 4187 // } 4188 4189} 4190 4191// method id "classroom.courses.update": 4192 4193type CoursesUpdateCall struct { 4194 s *Service 4195 id string 4196 course *Course 4197 urlParams_ gensupport.URLParams 4198 ctx_ context.Context 4199 header_ http.Header 4200} 4201 4202// Update: Updates a course. 4203// 4204// This method returns the following error codes: 4205// 4206// * `PERMISSION_DENIED` if the requesting user is not permitted to 4207// modify the 4208// requested course or for access errors. 4209// * `NOT_FOUND` if no course exists with the requested ID. 4210// * `FAILED_PRECONDITION` for the following request errors: 4211// * CourseNotModifiable 4212func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall { 4213 c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4214 c.id = id 4215 c.course = course 4216 return c 4217} 4218 4219// Fields allows partial responses to be retrieved. See 4220// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4221// for more information. 4222func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall { 4223 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4224 return c 4225} 4226 4227// Context sets the context to be used in this call's Do method. Any 4228// pending HTTP request will be aborted if the provided context is 4229// canceled. 4230func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall { 4231 c.ctx_ = ctx 4232 return c 4233} 4234 4235// Header returns an http.Header that can be modified by the caller to 4236// add HTTP headers to the request. 4237func (c *CoursesUpdateCall) Header() http.Header { 4238 if c.header_ == nil { 4239 c.header_ = make(http.Header) 4240 } 4241 return c.header_ 4242} 4243 4244func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) { 4245 reqHeaders := make(http.Header) 4246 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4247 for k, v := range c.header_ { 4248 reqHeaders[k] = v 4249 } 4250 reqHeaders.Set("User-Agent", c.s.userAgent()) 4251 var body io.Reader = nil 4252 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4253 if err != nil { 4254 return nil, err 4255 } 4256 reqHeaders.Set("Content-Type", "application/json") 4257 c.urlParams_.Set("alt", alt) 4258 c.urlParams_.Set("prettyPrint", "false") 4259 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4260 urls += "?" + c.urlParams_.Encode() 4261 req, err := http.NewRequest("PUT", urls, body) 4262 if err != nil { 4263 return nil, err 4264 } 4265 req.Header = reqHeaders 4266 googleapi.Expand(req.URL, map[string]string{ 4267 "id": c.id, 4268 }) 4269 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4270} 4271 4272// Do executes the "classroom.courses.update" call. 4273// Exactly one of *Course or error will be non-nil. Any non-2xx status 4274// code is an error. Response headers are in either 4275// *Course.ServerResponse.Header or (if a response was returned at all) 4276// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4277// check whether the returned error was because http.StatusNotModified 4278// was returned. 4279func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4280 gensupport.SetOptions(c.urlParams_, opts...) 4281 res, err := c.doRequest("json") 4282 if res != nil && res.StatusCode == http.StatusNotModified { 4283 if res.Body != nil { 4284 res.Body.Close() 4285 } 4286 return nil, &googleapi.Error{ 4287 Code: res.StatusCode, 4288 Header: res.Header, 4289 } 4290 } 4291 if err != nil { 4292 return nil, err 4293 } 4294 defer googleapi.CloseBody(res) 4295 if err := googleapi.CheckResponse(res); err != nil { 4296 return nil, err 4297 } 4298 ret := &Course{ 4299 ServerResponse: googleapi.ServerResponse{ 4300 Header: res.Header, 4301 HTTPStatusCode: res.StatusCode, 4302 }, 4303 } 4304 target := &ret 4305 if err := gensupport.DecodeResponse(target, res); err != nil { 4306 return nil, err 4307 } 4308 return ret, nil 4309 // { 4310 // "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", 4311 // "flatPath": "v1/courses/{id}", 4312 // "httpMethod": "PUT", 4313 // "id": "classroom.courses.update", 4314 // "parameterOrder": [ 4315 // "id" 4316 // ], 4317 // "parameters": { 4318 // "id": { 4319 // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4320 // "location": "path", 4321 // "required": true, 4322 // "type": "string" 4323 // } 4324 // }, 4325 // "path": "v1/courses/{id}", 4326 // "request": { 4327 // "$ref": "Course" 4328 // }, 4329 // "response": { 4330 // "$ref": "Course" 4331 // }, 4332 // "scopes": [ 4333 // "https://www.googleapis.com/auth/classroom.courses" 4334 // ] 4335 // } 4336 4337} 4338 4339// method id "classroom.courses.aliases.create": 4340 4341type CoursesAliasesCreateCall struct { 4342 s *Service 4343 courseId string 4344 coursealias *CourseAlias 4345 urlParams_ gensupport.URLParams 4346 ctx_ context.Context 4347 header_ http.Header 4348} 4349 4350// Create: Creates an alias for a course. 4351// 4352// This method returns the following error codes: 4353// 4354// * `PERMISSION_DENIED` if the requesting user is not permitted to 4355// create the 4356// alias or for access errors. 4357// * `NOT_FOUND` if the course does not exist. 4358// * `ALREADY_EXISTS` if the alias already exists. 4359// * `FAILED_PRECONDITION` if the alias requested does not make sense 4360// for the 4361// requesting user or course (for example, if a user not in a domain 4362// attempts to access a domain-scoped alias). 4363func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall { 4364 c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4365 c.courseId = courseId 4366 c.coursealias = coursealias 4367 return c 4368} 4369 4370// Fields allows partial responses to be retrieved. See 4371// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4372// for more information. 4373func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall { 4374 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4375 return c 4376} 4377 4378// Context sets the context to be used in this call's Do method. Any 4379// pending HTTP request will be aborted if the provided context is 4380// canceled. 4381func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall { 4382 c.ctx_ = ctx 4383 return c 4384} 4385 4386// Header returns an http.Header that can be modified by the caller to 4387// add HTTP headers to the request. 4388func (c *CoursesAliasesCreateCall) Header() http.Header { 4389 if c.header_ == nil { 4390 c.header_ = make(http.Header) 4391 } 4392 return c.header_ 4393} 4394 4395func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) { 4396 reqHeaders := make(http.Header) 4397 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4398 for k, v := range c.header_ { 4399 reqHeaders[k] = v 4400 } 4401 reqHeaders.Set("User-Agent", c.s.userAgent()) 4402 var body io.Reader = nil 4403 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias) 4404 if err != nil { 4405 return nil, err 4406 } 4407 reqHeaders.Set("Content-Type", "application/json") 4408 c.urlParams_.Set("alt", alt) 4409 c.urlParams_.Set("prettyPrint", "false") 4410 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4411 urls += "?" + c.urlParams_.Encode() 4412 req, err := http.NewRequest("POST", urls, body) 4413 if err != nil { 4414 return nil, err 4415 } 4416 req.Header = reqHeaders 4417 googleapi.Expand(req.URL, map[string]string{ 4418 "courseId": c.courseId, 4419 }) 4420 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4421} 4422 4423// Do executes the "classroom.courses.aliases.create" call. 4424// Exactly one of *CourseAlias or error will be non-nil. Any non-2xx 4425// status code is an error. Response headers are in either 4426// *CourseAlias.ServerResponse.Header or (if a response was returned at 4427// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4428// to check whether the returned error was because 4429// http.StatusNotModified was returned. 4430func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) { 4431 gensupport.SetOptions(c.urlParams_, opts...) 4432 res, err := c.doRequest("json") 4433 if res != nil && res.StatusCode == http.StatusNotModified { 4434 if res.Body != nil { 4435 res.Body.Close() 4436 } 4437 return nil, &googleapi.Error{ 4438 Code: res.StatusCode, 4439 Header: res.Header, 4440 } 4441 } 4442 if err != nil { 4443 return nil, err 4444 } 4445 defer googleapi.CloseBody(res) 4446 if err := googleapi.CheckResponse(res); err != nil { 4447 return nil, err 4448 } 4449 ret := &CourseAlias{ 4450 ServerResponse: googleapi.ServerResponse{ 4451 Header: res.Header, 4452 HTTPStatusCode: res.StatusCode, 4453 }, 4454 } 4455 target := &ret 4456 if err := gensupport.DecodeResponse(target, res); err != nil { 4457 return nil, err 4458 } 4459 return ret, nil 4460 // { 4461 // "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).", 4462 // "flatPath": "v1/courses/{courseId}/aliases", 4463 // "httpMethod": "POST", 4464 // "id": "classroom.courses.aliases.create", 4465 // "parameterOrder": [ 4466 // "courseId" 4467 // ], 4468 // "parameters": { 4469 // "courseId": { 4470 // "description": "Identifier of the course to alias.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4471 // "location": "path", 4472 // "required": true, 4473 // "type": "string" 4474 // } 4475 // }, 4476 // "path": "v1/courses/{courseId}/aliases", 4477 // "request": { 4478 // "$ref": "CourseAlias" 4479 // }, 4480 // "response": { 4481 // "$ref": "CourseAlias" 4482 // }, 4483 // "scopes": [ 4484 // "https://www.googleapis.com/auth/classroom.courses" 4485 // ] 4486 // } 4487 4488} 4489 4490// method id "classroom.courses.aliases.delete": 4491 4492type CoursesAliasesDeleteCall struct { 4493 s *Service 4494 courseId string 4495 aliasid string 4496 urlParams_ gensupport.URLParams 4497 ctx_ context.Context 4498 header_ http.Header 4499} 4500 4501// Delete: Deletes an alias of a course. 4502// 4503// This method returns the following error codes: 4504// 4505// * `PERMISSION_DENIED` if the requesting user is not permitted to 4506// remove the 4507// alias or for access errors. 4508// * `NOT_FOUND` if the alias does not exist. 4509// * `FAILED_PRECONDITION` if the alias requested does not make sense 4510// for the 4511// requesting user or course (for example, if a user not in a domain 4512// attempts to delete a domain-scoped alias). 4513func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall { 4514 c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4515 c.courseId = courseId 4516 c.aliasid = aliasid 4517 return c 4518} 4519 4520// Fields allows partial responses to be retrieved. See 4521// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4522// for more information. 4523func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall { 4524 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4525 return c 4526} 4527 4528// Context sets the context to be used in this call's Do method. Any 4529// pending HTTP request will be aborted if the provided context is 4530// canceled. 4531func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall { 4532 c.ctx_ = ctx 4533 return c 4534} 4535 4536// Header returns an http.Header that can be modified by the caller to 4537// add HTTP headers to the request. 4538func (c *CoursesAliasesDeleteCall) Header() http.Header { 4539 if c.header_ == nil { 4540 c.header_ = make(http.Header) 4541 } 4542 return c.header_ 4543} 4544 4545func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) { 4546 reqHeaders := make(http.Header) 4547 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4548 for k, v := range c.header_ { 4549 reqHeaders[k] = v 4550 } 4551 reqHeaders.Set("User-Agent", c.s.userAgent()) 4552 var body io.Reader = nil 4553 c.urlParams_.Set("alt", alt) 4554 c.urlParams_.Set("prettyPrint", "false") 4555 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}") 4556 urls += "?" + c.urlParams_.Encode() 4557 req, err := http.NewRequest("DELETE", urls, body) 4558 if err != nil { 4559 return nil, err 4560 } 4561 req.Header = reqHeaders 4562 googleapi.Expand(req.URL, map[string]string{ 4563 "courseId": c.courseId, 4564 "alias": c.aliasid, 4565 }) 4566 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4567} 4568 4569// Do executes the "classroom.courses.aliases.delete" call. 4570// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4571// code is an error. Response headers are in either 4572// *Empty.ServerResponse.Header or (if a response was returned at all) 4573// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4574// check whether the returned error was because http.StatusNotModified 4575// was returned. 4576func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4577 gensupport.SetOptions(c.urlParams_, opts...) 4578 res, err := c.doRequest("json") 4579 if res != nil && res.StatusCode == http.StatusNotModified { 4580 if res.Body != nil { 4581 res.Body.Close() 4582 } 4583 return nil, &googleapi.Error{ 4584 Code: res.StatusCode, 4585 Header: res.Header, 4586 } 4587 } 4588 if err != nil { 4589 return nil, err 4590 } 4591 defer googleapi.CloseBody(res) 4592 if err := googleapi.CheckResponse(res); err != nil { 4593 return nil, err 4594 } 4595 ret := &Empty{ 4596 ServerResponse: googleapi.ServerResponse{ 4597 Header: res.Header, 4598 HTTPStatusCode: res.StatusCode, 4599 }, 4600 } 4601 target := &ret 4602 if err := gensupport.DecodeResponse(target, res); err != nil { 4603 return nil, err 4604 } 4605 return ret, nil 4606 // { 4607 // "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).", 4608 // "flatPath": "v1/courses/{courseId}/aliases/{alias}", 4609 // "httpMethod": "DELETE", 4610 // "id": "classroom.courses.aliases.delete", 4611 // "parameterOrder": [ 4612 // "courseId", 4613 // "alias" 4614 // ], 4615 // "parameters": { 4616 // "alias": { 4617 // "description": "Alias to delete.\nThis may not be the Classroom-assigned identifier.", 4618 // "location": "path", 4619 // "required": true, 4620 // "type": "string" 4621 // }, 4622 // "courseId": { 4623 // "description": "Identifier of the course whose alias should be deleted.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4624 // "location": "path", 4625 // "required": true, 4626 // "type": "string" 4627 // } 4628 // }, 4629 // "path": "v1/courses/{courseId}/aliases/{alias}", 4630 // "response": { 4631 // "$ref": "Empty" 4632 // }, 4633 // "scopes": [ 4634 // "https://www.googleapis.com/auth/classroom.courses" 4635 // ] 4636 // } 4637 4638} 4639 4640// method id "classroom.courses.aliases.list": 4641 4642type CoursesAliasesListCall struct { 4643 s *Service 4644 courseId string 4645 urlParams_ gensupport.URLParams 4646 ifNoneMatch_ string 4647 ctx_ context.Context 4648 header_ http.Header 4649} 4650 4651// List: Returns a list of aliases for a course. 4652// 4653// This method returns the following error codes: 4654// 4655// * `PERMISSION_DENIED` if the requesting user is not permitted to 4656// access the 4657// course or for access errors. 4658// * `NOT_FOUND` if the course does not exist. 4659func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall { 4660 c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4661 c.courseId = courseId 4662 return c 4663} 4664 4665// PageSize sets the optional parameter "pageSize": Maximum number of 4666// items to return. Zero or unspecified indicates that the 4667// server may assign a maximum. 4668// 4669// The server may return fewer than the specified number of results. 4670func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall { 4671 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4672 return c 4673} 4674 4675// PageToken sets the optional parameter "pageToken": 4676// nextPageToken 4677// value returned from a previous 4678// list call, 4679// indicating that the subsequent page of results should be 4680// returned. 4681// 4682// The list request 4683// must be otherwise identical to the one that resulted in this token. 4684func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall { 4685 c.urlParams_.Set("pageToken", pageToken) 4686 return c 4687} 4688 4689// Fields allows partial responses to be retrieved. See 4690// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4691// for more information. 4692func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall { 4693 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4694 return c 4695} 4696 4697// IfNoneMatch sets the optional parameter which makes the operation 4698// fail if the object's ETag matches the given value. This is useful for 4699// getting updates only after the object has changed since the last 4700// request. Use googleapi.IsNotModified to check whether the response 4701// error from Do is the result of In-None-Match. 4702func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall { 4703 c.ifNoneMatch_ = entityTag 4704 return c 4705} 4706 4707// Context sets the context to be used in this call's Do method. Any 4708// pending HTTP request will be aborted if the provided context is 4709// canceled. 4710func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall { 4711 c.ctx_ = ctx 4712 return c 4713} 4714 4715// Header returns an http.Header that can be modified by the caller to 4716// add HTTP headers to the request. 4717func (c *CoursesAliasesListCall) Header() http.Header { 4718 if c.header_ == nil { 4719 c.header_ = make(http.Header) 4720 } 4721 return c.header_ 4722} 4723 4724func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) { 4725 reqHeaders := make(http.Header) 4726 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4727 for k, v := range c.header_ { 4728 reqHeaders[k] = v 4729 } 4730 reqHeaders.Set("User-Agent", c.s.userAgent()) 4731 if c.ifNoneMatch_ != "" { 4732 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4733 } 4734 var body io.Reader = nil 4735 c.urlParams_.Set("alt", alt) 4736 c.urlParams_.Set("prettyPrint", "false") 4737 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4738 urls += "?" + c.urlParams_.Encode() 4739 req, err := http.NewRequest("GET", urls, body) 4740 if err != nil { 4741 return nil, err 4742 } 4743 req.Header = reqHeaders 4744 googleapi.Expand(req.URL, map[string]string{ 4745 "courseId": c.courseId, 4746 }) 4747 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4748} 4749 4750// Do executes the "classroom.courses.aliases.list" call. 4751// Exactly one of *ListCourseAliasesResponse or error will be non-nil. 4752// Any non-2xx status code is an error. Response headers are in either 4753// *ListCourseAliasesResponse.ServerResponse.Header or (if a response 4754// was returned at all) in error.(*googleapi.Error).Header. Use 4755// googleapi.IsNotModified to check whether the returned error was 4756// because http.StatusNotModified was returned. 4757func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) { 4758 gensupport.SetOptions(c.urlParams_, opts...) 4759 res, err := c.doRequest("json") 4760 if res != nil && res.StatusCode == http.StatusNotModified { 4761 if res.Body != nil { 4762 res.Body.Close() 4763 } 4764 return nil, &googleapi.Error{ 4765 Code: res.StatusCode, 4766 Header: res.Header, 4767 } 4768 } 4769 if err != nil { 4770 return nil, err 4771 } 4772 defer googleapi.CloseBody(res) 4773 if err := googleapi.CheckResponse(res); err != nil { 4774 return nil, err 4775 } 4776 ret := &ListCourseAliasesResponse{ 4777 ServerResponse: googleapi.ServerResponse{ 4778 Header: res.Header, 4779 HTTPStatusCode: res.StatusCode, 4780 }, 4781 } 4782 target := &ret 4783 if err := gensupport.DecodeResponse(target, res); err != nil { 4784 return nil, err 4785 } 4786 return ret, nil 4787 // { 4788 // "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.", 4789 // "flatPath": "v1/courses/{courseId}/aliases", 4790 // "httpMethod": "GET", 4791 // "id": "classroom.courses.aliases.list", 4792 // "parameterOrder": [ 4793 // "courseId" 4794 // ], 4795 // "parameters": { 4796 // "courseId": { 4797 // "description": "The identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4798 // "location": "path", 4799 // "required": true, 4800 // "type": "string" 4801 // }, 4802 // "pageSize": { 4803 // "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.", 4804 // "format": "int32", 4805 // "location": "query", 4806 // "type": "integer" 4807 // }, 4808 // "pageToken": { 4809 // "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.", 4810 // "location": "query", 4811 // "type": "string" 4812 // } 4813 // }, 4814 // "path": "v1/courses/{courseId}/aliases", 4815 // "response": { 4816 // "$ref": "ListCourseAliasesResponse" 4817 // }, 4818 // "scopes": [ 4819 // "https://www.googleapis.com/auth/classroom.courses", 4820 // "https://www.googleapis.com/auth/classroom.courses.readonly" 4821 // ] 4822 // } 4823 4824} 4825 4826// Pages invokes f for each page of results. 4827// A non-nil error returned from f will halt the iteration. 4828// The provided context supersedes any context provided to the Context method. 4829func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error { 4830 c.ctx_ = ctx 4831 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4832 for { 4833 x, err := c.Do() 4834 if err != nil { 4835 return err 4836 } 4837 if err := f(x); err != nil { 4838 return err 4839 } 4840 if x.NextPageToken == "" { 4841 return nil 4842 } 4843 c.PageToken(x.NextPageToken) 4844 } 4845} 4846 4847// method id "classroom.courses.announcements.create": 4848 4849type CoursesAnnouncementsCreateCall struct { 4850 s *Service 4851 courseId string 4852 announcement *Announcement 4853 urlParams_ gensupport.URLParams 4854 ctx_ context.Context 4855 header_ http.Header 4856} 4857 4858// Create: Creates an announcement. 4859// 4860// This method returns the following error codes: 4861// 4862// * `PERMISSION_DENIED` if the requesting user is not permitted to 4863// access the 4864// requested course, create announcements in the requested course, share 4865// a 4866// Drive attachment, or for access errors. 4867// * `INVALID_ARGUMENT` if the request is malformed. 4868// * `NOT_FOUND` if the requested course does not exist. 4869// * `FAILED_PRECONDITION` for the following request error: 4870// * AttachmentNotVisible 4871func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall { 4872 c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4873 c.courseId = courseId 4874 c.announcement = announcement 4875 return c 4876} 4877 4878// Fields allows partial responses to be retrieved. See 4879// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4880// for more information. 4881func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall { 4882 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4883 return c 4884} 4885 4886// Context sets the context to be used in this call's Do method. Any 4887// pending HTTP request will be aborted if the provided context is 4888// canceled. 4889func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall { 4890 c.ctx_ = ctx 4891 return c 4892} 4893 4894// Header returns an http.Header that can be modified by the caller to 4895// add HTTP headers to the request. 4896func (c *CoursesAnnouncementsCreateCall) Header() http.Header { 4897 if c.header_ == nil { 4898 c.header_ = make(http.Header) 4899 } 4900 return c.header_ 4901} 4902 4903func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) { 4904 reqHeaders := make(http.Header) 4905 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4906 for k, v := range c.header_ { 4907 reqHeaders[k] = v 4908 } 4909 reqHeaders.Set("User-Agent", c.s.userAgent()) 4910 var body io.Reader = nil 4911 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 4912 if err != nil { 4913 return nil, err 4914 } 4915 reqHeaders.Set("Content-Type", "application/json") 4916 c.urlParams_.Set("alt", alt) 4917 c.urlParams_.Set("prettyPrint", "false") 4918 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 4919 urls += "?" + c.urlParams_.Encode() 4920 req, err := http.NewRequest("POST", urls, body) 4921 if err != nil { 4922 return nil, err 4923 } 4924 req.Header = reqHeaders 4925 googleapi.Expand(req.URL, map[string]string{ 4926 "courseId": c.courseId, 4927 }) 4928 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4929} 4930 4931// Do executes the "classroom.courses.announcements.create" call. 4932// Exactly one of *Announcement or error will be non-nil. Any non-2xx 4933// status code is an error. Response headers are in either 4934// *Announcement.ServerResponse.Header or (if a response was returned at 4935// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4936// to check whether the returned error was because 4937// http.StatusNotModified was returned. 4938func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 4939 gensupport.SetOptions(c.urlParams_, opts...) 4940 res, err := c.doRequest("json") 4941 if res != nil && res.StatusCode == http.StatusNotModified { 4942 if res.Body != nil { 4943 res.Body.Close() 4944 } 4945 return nil, &googleapi.Error{ 4946 Code: res.StatusCode, 4947 Header: res.Header, 4948 } 4949 } 4950 if err != nil { 4951 return nil, err 4952 } 4953 defer googleapi.CloseBody(res) 4954 if err := googleapi.CheckResponse(res); err != nil { 4955 return nil, err 4956 } 4957 ret := &Announcement{ 4958 ServerResponse: googleapi.ServerResponse{ 4959 Header: res.Header, 4960 HTTPStatusCode: res.StatusCode, 4961 }, 4962 } 4963 target := &ret 4964 if err := gensupport.DecodeResponse(target, res); err != nil { 4965 return nil, err 4966 } 4967 return ret, nil 4968 // { 4969 // "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", 4970 // "flatPath": "v1/courses/{courseId}/announcements", 4971 // "httpMethod": "POST", 4972 // "id": "classroom.courses.announcements.create", 4973 // "parameterOrder": [ 4974 // "courseId" 4975 // ], 4976 // "parameters": { 4977 // "courseId": { 4978 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 4979 // "location": "path", 4980 // "required": true, 4981 // "type": "string" 4982 // } 4983 // }, 4984 // "path": "v1/courses/{courseId}/announcements", 4985 // "request": { 4986 // "$ref": "Announcement" 4987 // }, 4988 // "response": { 4989 // "$ref": "Announcement" 4990 // }, 4991 // "scopes": [ 4992 // "https://www.googleapis.com/auth/classroom.announcements" 4993 // ] 4994 // } 4995 4996} 4997 4998// method id "classroom.courses.announcements.delete": 4999 5000type CoursesAnnouncementsDeleteCall struct { 5001 s *Service 5002 courseId string 5003 id string 5004 urlParams_ gensupport.URLParams 5005 ctx_ context.Context 5006 header_ http.Header 5007} 5008 5009// Delete: Deletes an announcement. 5010// 5011// This request must be made by the Developer Console project of 5012// the 5013// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5014// used to 5015// create the corresponding announcement item. 5016// 5017// This method returns the following error codes: 5018// 5019// * `PERMISSION_DENIED` if the requesting developer project did not 5020// create 5021// the corresponding announcement, if the requesting user is not 5022// permitted 5023// to delete the requested course or for access errors. 5024// * `FAILED_PRECONDITION` if the requested announcement has already 5025// been 5026// deleted. 5027// * `NOT_FOUND` if no course exists with the requested ID. 5028func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall { 5029 c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5030 c.courseId = courseId 5031 c.id = id 5032 return c 5033} 5034 5035// Fields allows partial responses to be retrieved. See 5036// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5037// for more information. 5038func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall { 5039 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5040 return c 5041} 5042 5043// Context sets the context to be used in this call's Do method. Any 5044// pending HTTP request will be aborted if the provided context is 5045// canceled. 5046func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall { 5047 c.ctx_ = ctx 5048 return c 5049} 5050 5051// Header returns an http.Header that can be modified by the caller to 5052// add HTTP headers to the request. 5053func (c *CoursesAnnouncementsDeleteCall) Header() http.Header { 5054 if c.header_ == nil { 5055 c.header_ = make(http.Header) 5056 } 5057 return c.header_ 5058} 5059 5060func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) { 5061 reqHeaders := make(http.Header) 5062 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 5063 for k, v := range c.header_ { 5064 reqHeaders[k] = v 5065 } 5066 reqHeaders.Set("User-Agent", c.s.userAgent()) 5067 var body io.Reader = nil 5068 c.urlParams_.Set("alt", alt) 5069 c.urlParams_.Set("prettyPrint", "false") 5070 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5071 urls += "?" + c.urlParams_.Encode() 5072 req, err := http.NewRequest("DELETE", urls, body) 5073 if err != nil { 5074 return nil, err 5075 } 5076 req.Header = reqHeaders 5077 googleapi.Expand(req.URL, map[string]string{ 5078 "courseId": c.courseId, 5079 "id": c.id, 5080 }) 5081 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5082} 5083 5084// Do executes the "classroom.courses.announcements.delete" call. 5085// Exactly one of *Empty or error will be non-nil. Any non-2xx status 5086// code is an error. Response headers are in either 5087// *Empty.ServerResponse.Header or (if a response was returned at all) 5088// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5089// check whether the returned error was because http.StatusNotModified 5090// was returned. 5091func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 5092 gensupport.SetOptions(c.urlParams_, opts...) 5093 res, err := c.doRequest("json") 5094 if res != nil && res.StatusCode == http.StatusNotModified { 5095 if res.Body != nil { 5096 res.Body.Close() 5097 } 5098 return nil, &googleapi.Error{ 5099 Code: res.StatusCode, 5100 Header: res.Header, 5101 } 5102 } 5103 if err != nil { 5104 return nil, err 5105 } 5106 defer googleapi.CloseBody(res) 5107 if err := googleapi.CheckResponse(res); err != nil { 5108 return nil, err 5109 } 5110 ret := &Empty{ 5111 ServerResponse: googleapi.ServerResponse{ 5112 Header: res.Header, 5113 HTTPStatusCode: res.StatusCode, 5114 }, 5115 } 5116 target := &ret 5117 if err := gensupport.DecodeResponse(target, res); err != nil { 5118 return nil, err 5119 } 5120 return ret, nil 5121 // { 5122 // "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.", 5123 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5124 // "httpMethod": "DELETE", 5125 // "id": "classroom.courses.announcements.delete", 5126 // "parameterOrder": [ 5127 // "courseId", 5128 // "id" 5129 // ], 5130 // "parameters": { 5131 // "courseId": { 5132 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5133 // "location": "path", 5134 // "required": true, 5135 // "type": "string" 5136 // }, 5137 // "id": { 5138 // "description": "Identifier of the announcement to delete.\nThis identifier is a Classroom-assigned identifier.", 5139 // "location": "path", 5140 // "required": true, 5141 // "type": "string" 5142 // } 5143 // }, 5144 // "path": "v1/courses/{courseId}/announcements/{id}", 5145 // "response": { 5146 // "$ref": "Empty" 5147 // }, 5148 // "scopes": [ 5149 // "https://www.googleapis.com/auth/classroom.announcements" 5150 // ] 5151 // } 5152 5153} 5154 5155// method id "classroom.courses.announcements.get": 5156 5157type CoursesAnnouncementsGetCall struct { 5158 s *Service 5159 courseId string 5160 id string 5161 urlParams_ gensupport.URLParams 5162 ifNoneMatch_ string 5163 ctx_ context.Context 5164 header_ http.Header 5165} 5166 5167// Get: Returns an announcement. 5168// 5169// This method returns the following error codes: 5170// 5171// * `PERMISSION_DENIED` if the requesting user is not permitted to 5172// access the 5173// requested course or announcement, or for access errors. 5174// * `INVALID_ARGUMENT` if the request is malformed. 5175// * `NOT_FOUND` if the requested course or announcement does not exist. 5176func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall { 5177 c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5178 c.courseId = courseId 5179 c.id = id 5180 return c 5181} 5182 5183// Fields allows partial responses to be retrieved. See 5184// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5185// for more information. 5186func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall { 5187 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5188 return c 5189} 5190 5191// IfNoneMatch sets the optional parameter which makes the operation 5192// fail if the object's ETag matches the given value. This is useful for 5193// getting updates only after the object has changed since the last 5194// request. Use googleapi.IsNotModified to check whether the response 5195// error from Do is the result of In-None-Match. 5196func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall { 5197 c.ifNoneMatch_ = entityTag 5198 return c 5199} 5200 5201// Context sets the context to be used in this call's Do method. Any 5202// pending HTTP request will be aborted if the provided context is 5203// canceled. 5204func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall { 5205 c.ctx_ = ctx 5206 return c 5207} 5208 5209// Header returns an http.Header that can be modified by the caller to 5210// add HTTP headers to the request. 5211func (c *CoursesAnnouncementsGetCall) Header() http.Header { 5212 if c.header_ == nil { 5213 c.header_ = make(http.Header) 5214 } 5215 return c.header_ 5216} 5217 5218func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) { 5219 reqHeaders := make(http.Header) 5220 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 5221 for k, v := range c.header_ { 5222 reqHeaders[k] = v 5223 } 5224 reqHeaders.Set("User-Agent", c.s.userAgent()) 5225 if c.ifNoneMatch_ != "" { 5226 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5227 } 5228 var body io.Reader = nil 5229 c.urlParams_.Set("alt", alt) 5230 c.urlParams_.Set("prettyPrint", "false") 5231 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5232 urls += "?" + c.urlParams_.Encode() 5233 req, err := http.NewRequest("GET", urls, body) 5234 if err != nil { 5235 return nil, err 5236 } 5237 req.Header = reqHeaders 5238 googleapi.Expand(req.URL, map[string]string{ 5239 "courseId": c.courseId, 5240 "id": c.id, 5241 }) 5242 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5243} 5244 5245// Do executes the "classroom.courses.announcements.get" call. 5246// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5247// status code is an error. Response headers are in either 5248// *Announcement.ServerResponse.Header or (if a response was returned at 5249// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5250// to check whether the returned error was because 5251// http.StatusNotModified was returned. 5252func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5253 gensupport.SetOptions(c.urlParams_, opts...) 5254 res, err := c.doRequest("json") 5255 if res != nil && res.StatusCode == http.StatusNotModified { 5256 if res.Body != nil { 5257 res.Body.Close() 5258 } 5259 return nil, &googleapi.Error{ 5260 Code: res.StatusCode, 5261 Header: res.Header, 5262 } 5263 } 5264 if err != nil { 5265 return nil, err 5266 } 5267 defer googleapi.CloseBody(res) 5268 if err := googleapi.CheckResponse(res); err != nil { 5269 return nil, err 5270 } 5271 ret := &Announcement{ 5272 ServerResponse: googleapi.ServerResponse{ 5273 Header: res.Header, 5274 HTTPStatusCode: res.StatusCode, 5275 }, 5276 } 5277 target := &ret 5278 if err := gensupport.DecodeResponse(target, res); err != nil { 5279 return nil, err 5280 } 5281 return ret, nil 5282 // { 5283 // "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.", 5284 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5285 // "httpMethod": "GET", 5286 // "id": "classroom.courses.announcements.get", 5287 // "parameterOrder": [ 5288 // "courseId", 5289 // "id" 5290 // ], 5291 // "parameters": { 5292 // "courseId": { 5293 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5294 // "location": "path", 5295 // "required": true, 5296 // "type": "string" 5297 // }, 5298 // "id": { 5299 // "description": "Identifier of the announcement.", 5300 // "location": "path", 5301 // "required": true, 5302 // "type": "string" 5303 // } 5304 // }, 5305 // "path": "v1/courses/{courseId}/announcements/{id}", 5306 // "response": { 5307 // "$ref": "Announcement" 5308 // }, 5309 // "scopes": [ 5310 // "https://www.googleapis.com/auth/classroom.announcements", 5311 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5312 // ] 5313 // } 5314 5315} 5316 5317// method id "classroom.courses.announcements.list": 5318 5319type CoursesAnnouncementsListCall struct { 5320 s *Service 5321 courseId string 5322 urlParams_ gensupport.URLParams 5323 ifNoneMatch_ string 5324 ctx_ context.Context 5325 header_ http.Header 5326} 5327 5328// List: Returns a list of announcements that the requester is permitted 5329// to view. 5330// 5331// Course students may only view `PUBLISHED` announcements. Course 5332// teachers 5333// and domain administrators may view all announcements. 5334// 5335// This method returns the following error codes: 5336// 5337// * `PERMISSION_DENIED` if the requesting user is not permitted to 5338// access 5339// the requested course or for access errors. 5340// * `INVALID_ARGUMENT` if the request is malformed. 5341// * `NOT_FOUND` if the requested course does not exist. 5342func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall { 5343 c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5344 c.courseId = courseId 5345 return c 5346} 5347 5348// AnnouncementStates sets the optional parameter "announcementStates": 5349// Restriction on the `state` of announcements returned. 5350// If this argument is left unspecified, the default value is 5351// `PUBLISHED`. 5352// 5353// Possible values: 5354// "ANNOUNCEMENT_STATE_UNSPECIFIED" 5355// "PUBLISHED" 5356// "DRAFT" 5357// "DELETED" 5358func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall { 5359 c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...)) 5360 return c 5361} 5362 5363// OrderBy sets the optional parameter "orderBy": Optional sort ordering 5364// for results. A comma-separated list of fields with 5365// an optional sort direction keyword. Supported field is 5366// `updateTime`. 5367// Supported direction keywords are `asc` and `desc`. 5368// If not specified, `updateTime desc` is the default 5369// behavior. 5370// Examples: `updateTime asc`, `updateTime` 5371func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall { 5372 c.urlParams_.Set("orderBy", orderBy) 5373 return c 5374} 5375 5376// PageSize sets the optional parameter "pageSize": Maximum number of 5377// items to return. Zero or unspecified indicates that the 5378// server may assign a maximum. 5379// 5380// The server may return fewer than the specified number of results. 5381func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall { 5382 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5383 return c 5384} 5385 5386// PageToken sets the optional parameter "pageToken": 5387// nextPageToken 5388// value returned from a previous 5389// list call, 5390// indicating that the subsequent page of results should be 5391// returned. 5392// 5393// The list request 5394// must be otherwise identical to the one that resulted in this token. 5395func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall { 5396 c.urlParams_.Set("pageToken", pageToken) 5397 return c 5398} 5399 5400// Fields allows partial responses to be retrieved. See 5401// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5402// for more information. 5403func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall { 5404 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5405 return c 5406} 5407 5408// IfNoneMatch sets the optional parameter which makes the operation 5409// fail if the object's ETag matches the given value. This is useful for 5410// getting updates only after the object has changed since the last 5411// request. Use googleapi.IsNotModified to check whether the response 5412// error from Do is the result of In-None-Match. 5413func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall { 5414 c.ifNoneMatch_ = entityTag 5415 return c 5416} 5417 5418// Context sets the context to be used in this call's Do method. Any 5419// pending HTTP request will be aborted if the provided context is 5420// canceled. 5421func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall { 5422 c.ctx_ = ctx 5423 return c 5424} 5425 5426// Header returns an http.Header that can be modified by the caller to 5427// add HTTP headers to the request. 5428func (c *CoursesAnnouncementsListCall) Header() http.Header { 5429 if c.header_ == nil { 5430 c.header_ = make(http.Header) 5431 } 5432 return c.header_ 5433} 5434 5435func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) { 5436 reqHeaders := make(http.Header) 5437 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 5438 for k, v := range c.header_ { 5439 reqHeaders[k] = v 5440 } 5441 reqHeaders.Set("User-Agent", c.s.userAgent()) 5442 if c.ifNoneMatch_ != "" { 5443 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5444 } 5445 var body io.Reader = nil 5446 c.urlParams_.Set("alt", alt) 5447 c.urlParams_.Set("prettyPrint", "false") 5448 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 5449 urls += "?" + c.urlParams_.Encode() 5450 req, err := http.NewRequest("GET", urls, body) 5451 if err != nil { 5452 return nil, err 5453 } 5454 req.Header = reqHeaders 5455 googleapi.Expand(req.URL, map[string]string{ 5456 "courseId": c.courseId, 5457 }) 5458 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5459} 5460 5461// Do executes the "classroom.courses.announcements.list" call. 5462// Exactly one of *ListAnnouncementsResponse or error will be non-nil. 5463// Any non-2xx status code is an error. Response headers are in either 5464// *ListAnnouncementsResponse.ServerResponse.Header or (if a response 5465// was returned at all) in error.(*googleapi.Error).Header. Use 5466// googleapi.IsNotModified to check whether the returned error was 5467// because http.StatusNotModified was returned. 5468func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) { 5469 gensupport.SetOptions(c.urlParams_, opts...) 5470 res, err := c.doRequest("json") 5471 if res != nil && res.StatusCode == http.StatusNotModified { 5472 if res.Body != nil { 5473 res.Body.Close() 5474 } 5475 return nil, &googleapi.Error{ 5476 Code: res.StatusCode, 5477 Header: res.Header, 5478 } 5479 } 5480 if err != nil { 5481 return nil, err 5482 } 5483 defer googleapi.CloseBody(res) 5484 if err := googleapi.CheckResponse(res); err != nil { 5485 return nil, err 5486 } 5487 ret := &ListAnnouncementsResponse{ 5488 ServerResponse: googleapi.ServerResponse{ 5489 Header: res.Header, 5490 HTTPStatusCode: res.StatusCode, 5491 }, 5492 } 5493 target := &ret 5494 if err := gensupport.DecodeResponse(target, res); err != nil { 5495 return nil, err 5496 } 5497 return ret, nil 5498 // { 5499 // "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.", 5500 // "flatPath": "v1/courses/{courseId}/announcements", 5501 // "httpMethod": "GET", 5502 // "id": "classroom.courses.announcements.list", 5503 // "parameterOrder": [ 5504 // "courseId" 5505 // ], 5506 // "parameters": { 5507 // "announcementStates": { 5508 // "description": "Restriction on the `state` of announcements returned.\nIf this argument is left unspecified, the default value is `PUBLISHED`.", 5509 // "enum": [ 5510 // "ANNOUNCEMENT_STATE_UNSPECIFIED", 5511 // "PUBLISHED", 5512 // "DRAFT", 5513 // "DELETED" 5514 // ], 5515 // "location": "query", 5516 // "repeated": true, 5517 // "type": "string" 5518 // }, 5519 // "courseId": { 5520 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5521 // "location": "path", 5522 // "required": true, 5523 // "type": "string" 5524 // }, 5525 // "orderBy": { 5526 // "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`", 5527 // "location": "query", 5528 // "type": "string" 5529 // }, 5530 // "pageSize": { 5531 // "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.", 5532 // "format": "int32", 5533 // "location": "query", 5534 // "type": "integer" 5535 // }, 5536 // "pageToken": { 5537 // "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.", 5538 // "location": "query", 5539 // "type": "string" 5540 // } 5541 // }, 5542 // "path": "v1/courses/{courseId}/announcements", 5543 // "response": { 5544 // "$ref": "ListAnnouncementsResponse" 5545 // }, 5546 // "scopes": [ 5547 // "https://www.googleapis.com/auth/classroom.announcements", 5548 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5549 // ] 5550 // } 5551 5552} 5553 5554// Pages invokes f for each page of results. 5555// A non-nil error returned from f will halt the iteration. 5556// The provided context supersedes any context provided to the Context method. 5557func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error { 5558 c.ctx_ = ctx 5559 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5560 for { 5561 x, err := c.Do() 5562 if err != nil { 5563 return err 5564 } 5565 if err := f(x); err != nil { 5566 return err 5567 } 5568 if x.NextPageToken == "" { 5569 return nil 5570 } 5571 c.PageToken(x.NextPageToken) 5572 } 5573} 5574 5575// method id "classroom.courses.announcements.modifyAssignees": 5576 5577type CoursesAnnouncementsModifyAssigneesCall struct { 5578 s *Service 5579 courseId string 5580 id string 5581 modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest 5582 urlParams_ gensupport.URLParams 5583 ctx_ context.Context 5584 header_ http.Header 5585} 5586 5587// ModifyAssignees: Modifies assignee mode and options of an 5588// announcement. 5589// 5590// Only a teacher of the course that contains the announcement may 5591// call this method. 5592// 5593// This method returns the following error codes: 5594// 5595// * `PERMISSION_DENIED` if the requesting user is not permitted to 5596// access the 5597// requested course or course work or for access errors. 5598// * `INVALID_ARGUMENT` if the request is malformed. 5599// * `NOT_FOUND` if the requested course or course work does not exist. 5600func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall { 5601 c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5602 c.courseId = courseId 5603 c.id = id 5604 c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest 5605 return c 5606} 5607 5608// Fields allows partial responses to be retrieved. See 5609// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5610// for more information. 5611func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall { 5612 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5613 return c 5614} 5615 5616// Context sets the context to be used in this call's Do method. Any 5617// pending HTTP request will be aborted if the provided context is 5618// canceled. 5619func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall { 5620 c.ctx_ = ctx 5621 return c 5622} 5623 5624// Header returns an http.Header that can be modified by the caller to 5625// add HTTP headers to the request. 5626func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header { 5627 if c.header_ == nil { 5628 c.header_ = make(http.Header) 5629 } 5630 return c.header_ 5631} 5632 5633func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 5634 reqHeaders := make(http.Header) 5635 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 5636 for k, v := range c.header_ { 5637 reqHeaders[k] = v 5638 } 5639 reqHeaders.Set("User-Agent", c.s.userAgent()) 5640 var body io.Reader = nil 5641 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest) 5642 if err != nil { 5643 return nil, err 5644 } 5645 reqHeaders.Set("Content-Type", "application/json") 5646 c.urlParams_.Set("alt", alt) 5647 c.urlParams_.Set("prettyPrint", "false") 5648 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees") 5649 urls += "?" + c.urlParams_.Encode() 5650 req, err := http.NewRequest("POST", urls, body) 5651 if err != nil { 5652 return nil, err 5653 } 5654 req.Header = reqHeaders 5655 googleapi.Expand(req.URL, map[string]string{ 5656 "courseId": c.courseId, 5657 "id": c.id, 5658 }) 5659 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5660} 5661 5662// Do executes the "classroom.courses.announcements.modifyAssignees" call. 5663// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5664// status code is an error. Response headers are in either 5665// *Announcement.ServerResponse.Header or (if a response was returned at 5666// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5667// to check whether the returned error was because 5668// http.StatusNotModified was returned. 5669func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5670 gensupport.SetOptions(c.urlParams_, opts...) 5671 res, err := c.doRequest("json") 5672 if res != nil && res.StatusCode == http.StatusNotModified { 5673 if res.Body != nil { 5674 res.Body.Close() 5675 } 5676 return nil, &googleapi.Error{ 5677 Code: res.StatusCode, 5678 Header: res.Header, 5679 } 5680 } 5681 if err != nil { 5682 return nil, err 5683 } 5684 defer googleapi.CloseBody(res) 5685 if err := googleapi.CheckResponse(res); err != nil { 5686 return nil, err 5687 } 5688 ret := &Announcement{ 5689 ServerResponse: googleapi.ServerResponse{ 5690 Header: res.Header, 5691 HTTPStatusCode: res.StatusCode, 5692 }, 5693 } 5694 target := &ret 5695 if err := gensupport.DecodeResponse(target, res); err != nil { 5696 return nil, err 5697 } 5698 return ret, nil 5699 // { 5700 // "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.", 5701 // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5702 // "httpMethod": "POST", 5703 // "id": "classroom.courses.announcements.modifyAssignees", 5704 // "parameterOrder": [ 5705 // "courseId", 5706 // "id" 5707 // ], 5708 // "parameters": { 5709 // "courseId": { 5710 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5711 // "location": "path", 5712 // "required": true, 5713 // "type": "string" 5714 // }, 5715 // "id": { 5716 // "description": "Identifier of the announcement.", 5717 // "location": "path", 5718 // "required": true, 5719 // "type": "string" 5720 // } 5721 // }, 5722 // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5723 // "request": { 5724 // "$ref": "ModifyAnnouncementAssigneesRequest" 5725 // }, 5726 // "response": { 5727 // "$ref": "Announcement" 5728 // }, 5729 // "scopes": [ 5730 // "https://www.googleapis.com/auth/classroom.announcements" 5731 // ] 5732 // } 5733 5734} 5735 5736// method id "classroom.courses.announcements.patch": 5737 5738type CoursesAnnouncementsPatchCall struct { 5739 s *Service 5740 courseId string 5741 id string 5742 announcement *Announcement 5743 urlParams_ gensupport.URLParams 5744 ctx_ context.Context 5745 header_ http.Header 5746} 5747 5748// Patch: Updates one or more fields of an announcement. 5749// 5750// This method returns the following error codes: 5751// 5752// * `PERMISSION_DENIED` if the requesting developer project did not 5753// create 5754// the corresponding announcement or for access errors. 5755// * `INVALID_ARGUMENT` if the request is malformed. 5756// * `FAILED_PRECONDITION` if the requested announcement has already 5757// been 5758// deleted. 5759// * `NOT_FOUND` if the requested course or announcement does not exist 5760func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall { 5761 c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5762 c.courseId = courseId 5763 c.id = id 5764 c.announcement = announcement 5765 return c 5766} 5767 5768// UpdateMask sets the optional parameter "updateMask": Mask that 5769// identifies which fields on the announcement to update. 5770// This field is required to do an update. The update fails if 5771// invalid 5772// fields are specified. If a field supports empty values, it can be 5773// cleared 5774// by specifying it in the update mask and not in the Announcement 5775// object. If 5776// a field that does not support empty values is included in the update 5777// mask 5778// and not set in the Announcement object, an `INVALID_ARGUMENT` error 5779// will be 5780// returned. 5781// 5782// The following fields may be specified by teachers: 5783// 5784// * `text` 5785// * `state` 5786// * `scheduled_time` 5787func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall { 5788 c.urlParams_.Set("updateMask", updateMask) 5789 return c 5790} 5791 5792// Fields allows partial responses to be retrieved. See 5793// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5794// for more information. 5795func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall { 5796 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5797 return c 5798} 5799 5800// Context sets the context to be used in this call's Do method. Any 5801// pending HTTP request will be aborted if the provided context is 5802// canceled. 5803func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall { 5804 c.ctx_ = ctx 5805 return c 5806} 5807 5808// Header returns an http.Header that can be modified by the caller to 5809// add HTTP headers to the request. 5810func (c *CoursesAnnouncementsPatchCall) Header() http.Header { 5811 if c.header_ == nil { 5812 c.header_ = make(http.Header) 5813 } 5814 return c.header_ 5815} 5816 5817func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) { 5818 reqHeaders := make(http.Header) 5819 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 5820 for k, v := range c.header_ { 5821 reqHeaders[k] = v 5822 } 5823 reqHeaders.Set("User-Agent", c.s.userAgent()) 5824 var body io.Reader = nil 5825 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 5826 if err != nil { 5827 return nil, err 5828 } 5829 reqHeaders.Set("Content-Type", "application/json") 5830 c.urlParams_.Set("alt", alt) 5831 c.urlParams_.Set("prettyPrint", "false") 5832 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5833 urls += "?" + c.urlParams_.Encode() 5834 req, err := http.NewRequest("PATCH", urls, body) 5835 if err != nil { 5836 return nil, err 5837 } 5838 req.Header = reqHeaders 5839 googleapi.Expand(req.URL, map[string]string{ 5840 "courseId": c.courseId, 5841 "id": c.id, 5842 }) 5843 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5844} 5845 5846// Do executes the "classroom.courses.announcements.patch" call. 5847// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5848// status code is an error. Response headers are in either 5849// *Announcement.ServerResponse.Header or (if a response was returned at 5850// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5851// to check whether the returned error was because 5852// http.StatusNotModified was returned. 5853func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5854 gensupport.SetOptions(c.urlParams_, opts...) 5855 res, err := c.doRequest("json") 5856 if res != nil && res.StatusCode == http.StatusNotModified { 5857 if res.Body != nil { 5858 res.Body.Close() 5859 } 5860 return nil, &googleapi.Error{ 5861 Code: res.StatusCode, 5862 Header: res.Header, 5863 } 5864 } 5865 if err != nil { 5866 return nil, err 5867 } 5868 defer googleapi.CloseBody(res) 5869 if err := googleapi.CheckResponse(res); err != nil { 5870 return nil, err 5871 } 5872 ret := &Announcement{ 5873 ServerResponse: googleapi.ServerResponse{ 5874 Header: res.Header, 5875 HTTPStatusCode: res.StatusCode, 5876 }, 5877 } 5878 target := &ret 5879 if err := gensupport.DecodeResponse(target, res); err != nil { 5880 return nil, err 5881 } 5882 return ret, nil 5883 // { 5884 // "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", 5885 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5886 // "httpMethod": "PATCH", 5887 // "id": "classroom.courses.announcements.patch", 5888 // "parameterOrder": [ 5889 // "courseId", 5890 // "id" 5891 // ], 5892 // "parameters": { 5893 // "courseId": { 5894 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 5895 // "location": "path", 5896 // "required": true, 5897 // "type": "string" 5898 // }, 5899 // "id": { 5900 // "description": "Identifier of the announcement.", 5901 // "location": "path", 5902 // "required": true, 5903 // "type": "string" 5904 // }, 5905 // "updateMask": { 5906 // "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`", 5907 // "format": "google-fieldmask", 5908 // "location": "query", 5909 // "type": "string" 5910 // } 5911 // }, 5912 // "path": "v1/courses/{courseId}/announcements/{id}", 5913 // "request": { 5914 // "$ref": "Announcement" 5915 // }, 5916 // "response": { 5917 // "$ref": "Announcement" 5918 // }, 5919 // "scopes": [ 5920 // "https://www.googleapis.com/auth/classroom.announcements" 5921 // ] 5922 // } 5923 5924} 5925 5926// method id "classroom.courses.courseWork.create": 5927 5928type CoursesCourseWorkCreateCall struct { 5929 s *Service 5930 courseId string 5931 coursework *CourseWork 5932 urlParams_ gensupport.URLParams 5933 ctx_ context.Context 5934 header_ http.Header 5935} 5936 5937// Create: Creates course work. 5938// 5939// The resulting course work (and corresponding student submissions) 5940// are 5941// associated with the Developer Console project of the 5942// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 5943// used to 5944// make the request. Classroom API requests to modify course work and 5945// student 5946// submissions must be made with an OAuth client ID from the 5947// associated 5948// Developer Console project. 5949// 5950// This method returns the following error codes: 5951// 5952// * `PERMISSION_DENIED` if the requesting user is not permitted to 5953// access the 5954// requested course, create course work in the requested course, share 5955// a 5956// Drive attachment, or for access errors. 5957// * `INVALID_ARGUMENT` if the request is malformed. 5958// * `NOT_FOUND` if the requested course does not exist. 5959// * `FAILED_PRECONDITION` for the following request error: 5960// * AttachmentNotVisible 5961func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall { 5962 c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5963 c.courseId = courseId 5964 c.coursework = coursework 5965 return c 5966} 5967 5968// Fields allows partial responses to be retrieved. See 5969// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5970// for more information. 5971func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall { 5972 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5973 return c 5974} 5975 5976// Context sets the context to be used in this call's Do method. Any 5977// pending HTTP request will be aborted if the provided context is 5978// canceled. 5979func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall { 5980 c.ctx_ = ctx 5981 return c 5982} 5983 5984// Header returns an http.Header that can be modified by the caller to 5985// add HTTP headers to the request. 5986func (c *CoursesCourseWorkCreateCall) Header() http.Header { 5987 if c.header_ == nil { 5988 c.header_ = make(http.Header) 5989 } 5990 return c.header_ 5991} 5992 5993func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) { 5994 reqHeaders := make(http.Header) 5995 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 5996 for k, v := range c.header_ { 5997 reqHeaders[k] = v 5998 } 5999 reqHeaders.Set("User-Agent", c.s.userAgent()) 6000 var body io.Reader = nil 6001 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6002 if err != nil { 6003 return nil, err 6004 } 6005 reqHeaders.Set("Content-Type", "application/json") 6006 c.urlParams_.Set("alt", alt) 6007 c.urlParams_.Set("prettyPrint", "false") 6008 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6009 urls += "?" + c.urlParams_.Encode() 6010 req, err := http.NewRequest("POST", urls, body) 6011 if err != nil { 6012 return nil, err 6013 } 6014 req.Header = reqHeaders 6015 googleapi.Expand(req.URL, map[string]string{ 6016 "courseId": c.courseId, 6017 }) 6018 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6019} 6020 6021// Do executes the "classroom.courses.courseWork.create" call. 6022// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6023// status code is an error. Response headers are in either 6024// *CourseWork.ServerResponse.Header or (if a response was returned at 6025// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6026// to check whether the returned error was because 6027// http.StatusNotModified was returned. 6028func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6029 gensupport.SetOptions(c.urlParams_, opts...) 6030 res, err := c.doRequest("json") 6031 if res != nil && res.StatusCode == http.StatusNotModified { 6032 if res.Body != nil { 6033 res.Body.Close() 6034 } 6035 return nil, &googleapi.Error{ 6036 Code: res.StatusCode, 6037 Header: res.Header, 6038 } 6039 } 6040 if err != nil { 6041 return nil, err 6042 } 6043 defer googleapi.CloseBody(res) 6044 if err := googleapi.CheckResponse(res); err != nil { 6045 return nil, err 6046 } 6047 ret := &CourseWork{ 6048 ServerResponse: googleapi.ServerResponse{ 6049 Header: res.Header, 6050 HTTPStatusCode: res.StatusCode, 6051 }, 6052 } 6053 target := &ret 6054 if err := gensupport.DecodeResponse(target, res); err != nil { 6055 return nil, err 6056 } 6057 return ret, nil 6058 // { 6059 // "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", 6060 // "flatPath": "v1/courses/{courseId}/courseWork", 6061 // "httpMethod": "POST", 6062 // "id": "classroom.courses.courseWork.create", 6063 // "parameterOrder": [ 6064 // "courseId" 6065 // ], 6066 // "parameters": { 6067 // "courseId": { 6068 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6069 // "location": "path", 6070 // "required": true, 6071 // "type": "string" 6072 // } 6073 // }, 6074 // "path": "v1/courses/{courseId}/courseWork", 6075 // "request": { 6076 // "$ref": "CourseWork" 6077 // }, 6078 // "response": { 6079 // "$ref": "CourseWork" 6080 // }, 6081 // "scopes": [ 6082 // "https://www.googleapis.com/auth/classroom.coursework.students" 6083 // ] 6084 // } 6085 6086} 6087 6088// method id "classroom.courses.courseWork.delete": 6089 6090type CoursesCourseWorkDeleteCall struct { 6091 s *Service 6092 courseId string 6093 id string 6094 urlParams_ gensupport.URLParams 6095 ctx_ context.Context 6096 header_ http.Header 6097} 6098 6099// Delete: Deletes a course work. 6100// 6101// This request must be made by the Developer Console project of 6102// the 6103// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6104// used to 6105// create the corresponding course work item. 6106// 6107// This method returns the following error codes: 6108// 6109// * `PERMISSION_DENIED` if the requesting developer project did not 6110// create 6111// the corresponding course work, if the requesting user is not 6112// permitted 6113// to delete the requested course or for access errors. 6114// * `FAILED_PRECONDITION` if the requested course work has already 6115// been 6116// deleted. 6117// * `NOT_FOUND` if no course exists with the requested ID. 6118func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall { 6119 c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6120 c.courseId = courseId 6121 c.id = id 6122 return c 6123} 6124 6125// Fields allows partial responses to be retrieved. See 6126// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6127// for more information. 6128func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall { 6129 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6130 return c 6131} 6132 6133// Context sets the context to be used in this call's Do method. Any 6134// pending HTTP request will be aborted if the provided context is 6135// canceled. 6136func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall { 6137 c.ctx_ = ctx 6138 return c 6139} 6140 6141// Header returns an http.Header that can be modified by the caller to 6142// add HTTP headers to the request. 6143func (c *CoursesCourseWorkDeleteCall) Header() http.Header { 6144 if c.header_ == nil { 6145 c.header_ = make(http.Header) 6146 } 6147 return c.header_ 6148} 6149 6150func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) { 6151 reqHeaders := make(http.Header) 6152 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 6153 for k, v := range c.header_ { 6154 reqHeaders[k] = v 6155 } 6156 reqHeaders.Set("User-Agent", c.s.userAgent()) 6157 var body io.Reader = nil 6158 c.urlParams_.Set("alt", alt) 6159 c.urlParams_.Set("prettyPrint", "false") 6160 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6161 urls += "?" + c.urlParams_.Encode() 6162 req, err := http.NewRequest("DELETE", urls, body) 6163 if err != nil { 6164 return nil, err 6165 } 6166 req.Header = reqHeaders 6167 googleapi.Expand(req.URL, map[string]string{ 6168 "courseId": c.courseId, 6169 "id": c.id, 6170 }) 6171 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6172} 6173 6174// Do executes the "classroom.courses.courseWork.delete" call. 6175// Exactly one of *Empty or error will be non-nil. Any non-2xx status 6176// code is an error. Response headers are in either 6177// *Empty.ServerResponse.Header or (if a response was returned at all) 6178// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6179// check whether the returned error was because http.StatusNotModified 6180// was returned. 6181func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 6182 gensupport.SetOptions(c.urlParams_, opts...) 6183 res, err := c.doRequest("json") 6184 if res != nil && res.StatusCode == http.StatusNotModified { 6185 if res.Body != nil { 6186 res.Body.Close() 6187 } 6188 return nil, &googleapi.Error{ 6189 Code: res.StatusCode, 6190 Header: res.Header, 6191 } 6192 } 6193 if err != nil { 6194 return nil, err 6195 } 6196 defer googleapi.CloseBody(res) 6197 if err := googleapi.CheckResponse(res); err != nil { 6198 return nil, err 6199 } 6200 ret := &Empty{ 6201 ServerResponse: googleapi.ServerResponse{ 6202 Header: res.Header, 6203 HTTPStatusCode: res.StatusCode, 6204 }, 6205 } 6206 target := &ret 6207 if err := gensupport.DecodeResponse(target, res); err != nil { 6208 return nil, err 6209 } 6210 return ret, nil 6211 // { 6212 // "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.", 6213 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6214 // "httpMethod": "DELETE", 6215 // "id": "classroom.courses.courseWork.delete", 6216 // "parameterOrder": [ 6217 // "courseId", 6218 // "id" 6219 // ], 6220 // "parameters": { 6221 // "courseId": { 6222 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6223 // "location": "path", 6224 // "required": true, 6225 // "type": "string" 6226 // }, 6227 // "id": { 6228 // "description": "Identifier of the course work to delete.\nThis identifier is a Classroom-assigned identifier.", 6229 // "location": "path", 6230 // "required": true, 6231 // "type": "string" 6232 // } 6233 // }, 6234 // "path": "v1/courses/{courseId}/courseWork/{id}", 6235 // "response": { 6236 // "$ref": "Empty" 6237 // }, 6238 // "scopes": [ 6239 // "https://www.googleapis.com/auth/classroom.coursework.students" 6240 // ] 6241 // } 6242 6243} 6244 6245// method id "classroom.courses.courseWork.get": 6246 6247type CoursesCourseWorkGetCall struct { 6248 s *Service 6249 courseId string 6250 id string 6251 urlParams_ gensupport.URLParams 6252 ifNoneMatch_ string 6253 ctx_ context.Context 6254 header_ http.Header 6255} 6256 6257// Get: Returns course work. 6258// 6259// This method returns the following error codes: 6260// 6261// * `PERMISSION_DENIED` if the requesting user is not permitted to 6262// access the 6263// requested course or course work, or for access errors. 6264// * `INVALID_ARGUMENT` if the request is malformed. 6265// * `NOT_FOUND` if the requested course or course work does not exist. 6266func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall { 6267 c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6268 c.courseId = courseId 6269 c.id = id 6270 return c 6271} 6272 6273// Fields allows partial responses to be retrieved. See 6274// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6275// for more information. 6276func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall { 6277 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6278 return c 6279} 6280 6281// IfNoneMatch sets the optional parameter which makes the operation 6282// fail if the object's ETag matches the given value. This is useful for 6283// getting updates only after the object has changed since the last 6284// request. Use googleapi.IsNotModified to check whether the response 6285// error from Do is the result of In-None-Match. 6286func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall { 6287 c.ifNoneMatch_ = entityTag 6288 return c 6289} 6290 6291// Context sets the context to be used in this call's Do method. Any 6292// pending HTTP request will be aborted if the provided context is 6293// canceled. 6294func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall { 6295 c.ctx_ = ctx 6296 return c 6297} 6298 6299// Header returns an http.Header that can be modified by the caller to 6300// add HTTP headers to the request. 6301func (c *CoursesCourseWorkGetCall) Header() http.Header { 6302 if c.header_ == nil { 6303 c.header_ = make(http.Header) 6304 } 6305 return c.header_ 6306} 6307 6308func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) { 6309 reqHeaders := make(http.Header) 6310 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 6311 for k, v := range c.header_ { 6312 reqHeaders[k] = v 6313 } 6314 reqHeaders.Set("User-Agent", c.s.userAgent()) 6315 if c.ifNoneMatch_ != "" { 6316 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6317 } 6318 var body io.Reader = nil 6319 c.urlParams_.Set("alt", alt) 6320 c.urlParams_.Set("prettyPrint", "false") 6321 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6322 urls += "?" + c.urlParams_.Encode() 6323 req, err := http.NewRequest("GET", urls, body) 6324 if err != nil { 6325 return nil, err 6326 } 6327 req.Header = reqHeaders 6328 googleapi.Expand(req.URL, map[string]string{ 6329 "courseId": c.courseId, 6330 "id": c.id, 6331 }) 6332 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6333} 6334 6335// Do executes the "classroom.courses.courseWork.get" call. 6336// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6337// status code is an error. Response headers are in either 6338// *CourseWork.ServerResponse.Header or (if a response was returned at 6339// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6340// to check whether the returned error was because 6341// http.StatusNotModified was returned. 6342func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6343 gensupport.SetOptions(c.urlParams_, opts...) 6344 res, err := c.doRequest("json") 6345 if res != nil && res.StatusCode == http.StatusNotModified { 6346 if res.Body != nil { 6347 res.Body.Close() 6348 } 6349 return nil, &googleapi.Error{ 6350 Code: res.StatusCode, 6351 Header: res.Header, 6352 } 6353 } 6354 if err != nil { 6355 return nil, err 6356 } 6357 defer googleapi.CloseBody(res) 6358 if err := googleapi.CheckResponse(res); err != nil { 6359 return nil, err 6360 } 6361 ret := &CourseWork{ 6362 ServerResponse: googleapi.ServerResponse{ 6363 Header: res.Header, 6364 HTTPStatusCode: res.StatusCode, 6365 }, 6366 } 6367 target := &ret 6368 if err := gensupport.DecodeResponse(target, res); err != nil { 6369 return nil, err 6370 } 6371 return ret, nil 6372 // { 6373 // "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.", 6374 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6375 // "httpMethod": "GET", 6376 // "id": "classroom.courses.courseWork.get", 6377 // "parameterOrder": [ 6378 // "courseId", 6379 // "id" 6380 // ], 6381 // "parameters": { 6382 // "courseId": { 6383 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6384 // "location": "path", 6385 // "required": true, 6386 // "type": "string" 6387 // }, 6388 // "id": { 6389 // "description": "Identifier of the course work.", 6390 // "location": "path", 6391 // "required": true, 6392 // "type": "string" 6393 // } 6394 // }, 6395 // "path": "v1/courses/{courseId}/courseWork/{id}", 6396 // "response": { 6397 // "$ref": "CourseWork" 6398 // }, 6399 // "scopes": [ 6400 // "https://www.googleapis.com/auth/classroom.coursework.me", 6401 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6402 // "https://www.googleapis.com/auth/classroom.coursework.students", 6403 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6404 // ] 6405 // } 6406 6407} 6408 6409// method id "classroom.courses.courseWork.list": 6410 6411type CoursesCourseWorkListCall struct { 6412 s *Service 6413 courseId string 6414 urlParams_ gensupport.URLParams 6415 ifNoneMatch_ string 6416 ctx_ context.Context 6417 header_ http.Header 6418} 6419 6420// List: Returns a list of course work that the requester is permitted 6421// to view. 6422// 6423// Course students may only view `PUBLISHED` course work. Course 6424// teachers 6425// and domain administrators may view all course work. 6426// 6427// This method returns the following error codes: 6428// 6429// * `PERMISSION_DENIED` if the requesting user is not permitted to 6430// access 6431// the requested course or for access errors. 6432// * `INVALID_ARGUMENT` if the request is malformed. 6433// * `NOT_FOUND` if the requested course does not exist. 6434func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall { 6435 c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6436 c.courseId = courseId 6437 return c 6438} 6439 6440// CourseWorkStates sets the optional parameter "courseWorkStates": 6441// Restriction on the work status to return. Only courseWork that 6442// matches 6443// is returned. If unspecified, items with a work status of 6444// `PUBLISHED` 6445// is returned. 6446// 6447// Possible values: 6448// "COURSE_WORK_STATE_UNSPECIFIED" 6449// "PUBLISHED" 6450// "DRAFT" 6451// "DELETED" 6452func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall { 6453 c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...)) 6454 return c 6455} 6456 6457// OrderBy sets the optional parameter "orderBy": Optional sort ordering 6458// for results. A comma-separated list of fields with 6459// an optional sort direction keyword. Supported fields are 6460// `updateTime` 6461// and `dueDate`. Supported direction keywords are `asc` and `desc`. 6462// If not specified, `updateTime desc` is the default 6463// behavior. 6464// Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc` 6465func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall { 6466 c.urlParams_.Set("orderBy", orderBy) 6467 return c 6468} 6469 6470// PageSize sets the optional parameter "pageSize": Maximum number of 6471// items to return. Zero or unspecified indicates that the 6472// server may assign a maximum. 6473// 6474// The server may return fewer than the specified number of results. 6475func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall { 6476 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6477 return c 6478} 6479 6480// PageToken sets the optional parameter "pageToken": 6481// nextPageToken 6482// value returned from a previous 6483// list call, 6484// indicating that the subsequent page of results should be 6485// returned. 6486// 6487// The list request 6488// must be otherwise identical to the one that resulted in this token. 6489func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall { 6490 c.urlParams_.Set("pageToken", pageToken) 6491 return c 6492} 6493 6494// Fields allows partial responses to be retrieved. See 6495// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6496// for more information. 6497func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall { 6498 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6499 return c 6500} 6501 6502// IfNoneMatch sets the optional parameter which makes the operation 6503// fail if the object's ETag matches the given value. This is useful for 6504// getting updates only after the object has changed since the last 6505// request. Use googleapi.IsNotModified to check whether the response 6506// error from Do is the result of In-None-Match. 6507func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall { 6508 c.ifNoneMatch_ = entityTag 6509 return c 6510} 6511 6512// Context sets the context to be used in this call's Do method. Any 6513// pending HTTP request will be aborted if the provided context is 6514// canceled. 6515func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall { 6516 c.ctx_ = ctx 6517 return c 6518} 6519 6520// Header returns an http.Header that can be modified by the caller to 6521// add HTTP headers to the request. 6522func (c *CoursesCourseWorkListCall) Header() http.Header { 6523 if c.header_ == nil { 6524 c.header_ = make(http.Header) 6525 } 6526 return c.header_ 6527} 6528 6529func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) { 6530 reqHeaders := make(http.Header) 6531 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 6532 for k, v := range c.header_ { 6533 reqHeaders[k] = v 6534 } 6535 reqHeaders.Set("User-Agent", c.s.userAgent()) 6536 if c.ifNoneMatch_ != "" { 6537 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6538 } 6539 var body io.Reader = nil 6540 c.urlParams_.Set("alt", alt) 6541 c.urlParams_.Set("prettyPrint", "false") 6542 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6543 urls += "?" + c.urlParams_.Encode() 6544 req, err := http.NewRequest("GET", urls, body) 6545 if err != nil { 6546 return nil, err 6547 } 6548 req.Header = reqHeaders 6549 googleapi.Expand(req.URL, map[string]string{ 6550 "courseId": c.courseId, 6551 }) 6552 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6553} 6554 6555// Do executes the "classroom.courses.courseWork.list" call. 6556// Exactly one of *ListCourseWorkResponse or error will be non-nil. Any 6557// non-2xx status code is an error. Response headers are in either 6558// *ListCourseWorkResponse.ServerResponse.Header or (if a response was 6559// returned at all) in error.(*googleapi.Error).Header. Use 6560// googleapi.IsNotModified to check whether the returned error was 6561// because http.StatusNotModified was returned. 6562func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) { 6563 gensupport.SetOptions(c.urlParams_, opts...) 6564 res, err := c.doRequest("json") 6565 if res != nil && res.StatusCode == http.StatusNotModified { 6566 if res.Body != nil { 6567 res.Body.Close() 6568 } 6569 return nil, &googleapi.Error{ 6570 Code: res.StatusCode, 6571 Header: res.Header, 6572 } 6573 } 6574 if err != nil { 6575 return nil, err 6576 } 6577 defer googleapi.CloseBody(res) 6578 if err := googleapi.CheckResponse(res); err != nil { 6579 return nil, err 6580 } 6581 ret := &ListCourseWorkResponse{ 6582 ServerResponse: googleapi.ServerResponse{ 6583 Header: res.Header, 6584 HTTPStatusCode: res.StatusCode, 6585 }, 6586 } 6587 target := &ret 6588 if err := gensupport.DecodeResponse(target, res); err != nil { 6589 return nil, err 6590 } 6591 return ret, nil 6592 // { 6593 // "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.", 6594 // "flatPath": "v1/courses/{courseId}/courseWork", 6595 // "httpMethod": "GET", 6596 // "id": "classroom.courses.courseWork.list", 6597 // "parameterOrder": [ 6598 // "courseId" 6599 // ], 6600 // "parameters": { 6601 // "courseId": { 6602 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6603 // "location": "path", 6604 // "required": true, 6605 // "type": "string" 6606 // }, 6607 // "courseWorkStates": { 6608 // "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.", 6609 // "enum": [ 6610 // "COURSE_WORK_STATE_UNSPECIFIED", 6611 // "PUBLISHED", 6612 // "DRAFT", 6613 // "DELETED" 6614 // ], 6615 // "location": "query", 6616 // "repeated": true, 6617 // "type": "string" 6618 // }, 6619 // "orderBy": { 6620 // "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`", 6621 // "location": "query", 6622 // "type": "string" 6623 // }, 6624 // "pageSize": { 6625 // "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.", 6626 // "format": "int32", 6627 // "location": "query", 6628 // "type": "integer" 6629 // }, 6630 // "pageToken": { 6631 // "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.", 6632 // "location": "query", 6633 // "type": "string" 6634 // } 6635 // }, 6636 // "path": "v1/courses/{courseId}/courseWork", 6637 // "response": { 6638 // "$ref": "ListCourseWorkResponse" 6639 // }, 6640 // "scopes": [ 6641 // "https://www.googleapis.com/auth/classroom.coursework.me", 6642 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6643 // "https://www.googleapis.com/auth/classroom.coursework.students", 6644 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6645 // ] 6646 // } 6647 6648} 6649 6650// Pages invokes f for each page of results. 6651// A non-nil error returned from f will halt the iteration. 6652// The provided context supersedes any context provided to the Context method. 6653func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error { 6654 c.ctx_ = ctx 6655 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6656 for { 6657 x, err := c.Do() 6658 if err != nil { 6659 return err 6660 } 6661 if err := f(x); err != nil { 6662 return err 6663 } 6664 if x.NextPageToken == "" { 6665 return nil 6666 } 6667 c.PageToken(x.NextPageToken) 6668 } 6669} 6670 6671// method id "classroom.courses.courseWork.modifyAssignees": 6672 6673type CoursesCourseWorkModifyAssigneesCall struct { 6674 s *Service 6675 courseId string 6676 id string 6677 modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest 6678 urlParams_ gensupport.URLParams 6679 ctx_ context.Context 6680 header_ http.Header 6681} 6682 6683// ModifyAssignees: Modifies assignee mode and options of a 6684// coursework. 6685// 6686// Only a teacher of the course that contains the coursework may 6687// call this method. 6688// 6689// This method returns the following error codes: 6690// 6691// * `PERMISSION_DENIED` if the requesting user is not permitted to 6692// access the 6693// requested course or course work or for access errors. 6694// * `INVALID_ARGUMENT` if the request is malformed. 6695// * `NOT_FOUND` if the requested course or course work does not exist. 6696func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall { 6697 c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6698 c.courseId = courseId 6699 c.id = id 6700 c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest 6701 return c 6702} 6703 6704// Fields allows partial responses to be retrieved. See 6705// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6706// for more information. 6707func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall { 6708 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6709 return c 6710} 6711 6712// Context sets the context to be used in this call's Do method. Any 6713// pending HTTP request will be aborted if the provided context is 6714// canceled. 6715func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall { 6716 c.ctx_ = ctx 6717 return c 6718} 6719 6720// Header returns an http.Header that can be modified by the caller to 6721// add HTTP headers to the request. 6722func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header { 6723 if c.header_ == nil { 6724 c.header_ = make(http.Header) 6725 } 6726 return c.header_ 6727} 6728 6729func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 6730 reqHeaders := make(http.Header) 6731 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 6732 for k, v := range c.header_ { 6733 reqHeaders[k] = v 6734 } 6735 reqHeaders.Set("User-Agent", c.s.userAgent()) 6736 var body io.Reader = nil 6737 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest) 6738 if err != nil { 6739 return nil, err 6740 } 6741 reqHeaders.Set("Content-Type", "application/json") 6742 c.urlParams_.Set("alt", alt) 6743 c.urlParams_.Set("prettyPrint", "false") 6744 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees") 6745 urls += "?" + c.urlParams_.Encode() 6746 req, err := http.NewRequest("POST", urls, body) 6747 if err != nil { 6748 return nil, err 6749 } 6750 req.Header = reqHeaders 6751 googleapi.Expand(req.URL, map[string]string{ 6752 "courseId": c.courseId, 6753 "id": c.id, 6754 }) 6755 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6756} 6757 6758// Do executes the "classroom.courses.courseWork.modifyAssignees" call. 6759// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6760// status code is an error. Response headers are in either 6761// *CourseWork.ServerResponse.Header or (if a response was returned at 6762// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6763// to check whether the returned error was because 6764// http.StatusNotModified was returned. 6765func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6766 gensupport.SetOptions(c.urlParams_, opts...) 6767 res, err := c.doRequest("json") 6768 if res != nil && res.StatusCode == http.StatusNotModified { 6769 if res.Body != nil { 6770 res.Body.Close() 6771 } 6772 return nil, &googleapi.Error{ 6773 Code: res.StatusCode, 6774 Header: res.Header, 6775 } 6776 } 6777 if err != nil { 6778 return nil, err 6779 } 6780 defer googleapi.CloseBody(res) 6781 if err := googleapi.CheckResponse(res); err != nil { 6782 return nil, err 6783 } 6784 ret := &CourseWork{ 6785 ServerResponse: googleapi.ServerResponse{ 6786 Header: res.Header, 6787 HTTPStatusCode: res.StatusCode, 6788 }, 6789 } 6790 target := &ret 6791 if err := gensupport.DecodeResponse(target, res); err != nil { 6792 return nil, err 6793 } 6794 return ret, nil 6795 // { 6796 // "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.", 6797 // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6798 // "httpMethod": "POST", 6799 // "id": "classroom.courses.courseWork.modifyAssignees", 6800 // "parameterOrder": [ 6801 // "courseId", 6802 // "id" 6803 // ], 6804 // "parameters": { 6805 // "courseId": { 6806 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 6807 // "location": "path", 6808 // "required": true, 6809 // "type": "string" 6810 // }, 6811 // "id": { 6812 // "description": "Identifier of the coursework.", 6813 // "location": "path", 6814 // "required": true, 6815 // "type": "string" 6816 // } 6817 // }, 6818 // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6819 // "request": { 6820 // "$ref": "ModifyCourseWorkAssigneesRequest" 6821 // }, 6822 // "response": { 6823 // "$ref": "CourseWork" 6824 // }, 6825 // "scopes": [ 6826 // "https://www.googleapis.com/auth/classroom.coursework.students" 6827 // ] 6828 // } 6829 6830} 6831 6832// method id "classroom.courses.courseWork.patch": 6833 6834type CoursesCourseWorkPatchCall struct { 6835 s *Service 6836 courseId string 6837 id string 6838 coursework *CourseWork 6839 urlParams_ gensupport.URLParams 6840 ctx_ context.Context 6841 header_ http.Header 6842} 6843 6844// Patch: Updates one or more fields of a course work. 6845// 6846// See google.classroom.v1.CourseWork for details 6847// of which fields may be updated and who may change them. 6848// 6849// This request must be made by the Developer Console project of 6850// the 6851// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 6852// used to 6853// create the corresponding course work item. 6854// 6855// This method returns the following error codes: 6856// 6857// * `PERMISSION_DENIED` if the requesting developer project did not 6858// create 6859// the corresponding course work, if the user is not permitted to make 6860// the 6861// requested modification to the student submission, or for 6862// access errors. 6863// * `INVALID_ARGUMENT` if the request is malformed. 6864// * `FAILED_PRECONDITION` if the requested course work has already 6865// been 6866// deleted. 6867// * `NOT_FOUND` if the requested course, course work, or student 6868// submission 6869// does not exist. 6870func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall { 6871 c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6872 c.courseId = courseId 6873 c.id = id 6874 c.coursework = coursework 6875 return c 6876} 6877 6878// UpdateMask sets the optional parameter "updateMask": Mask that 6879// identifies which fields on the course work to update. 6880// This field is required to do an update. The update fails if 6881// invalid 6882// fields are specified. If a field supports empty values, it can be 6883// cleared 6884// by specifying it in the update mask and not in the CourseWork object. 6885// If a 6886// field that does not support empty values is included in the update 6887// mask and 6888// not set in the CourseWork object, an `INVALID_ARGUMENT` error will 6889// be 6890// returned. 6891// 6892// The following fields may be specified by teachers: 6893// 6894// * `title` 6895// * `description` 6896// * `state` 6897// * `due_date` 6898// * `due_time` 6899// * `max_points` 6900// * `scheduled_time` 6901// * `submission_modification_mode` 6902// * `topic_id` 6903func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall { 6904 c.urlParams_.Set("updateMask", updateMask) 6905 return c 6906} 6907 6908// Fields allows partial responses to be retrieved. See 6909// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6910// for more information. 6911func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall { 6912 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6913 return c 6914} 6915 6916// Context sets the context to be used in this call's Do method. Any 6917// pending HTTP request will be aborted if the provided context is 6918// canceled. 6919func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall { 6920 c.ctx_ = ctx 6921 return c 6922} 6923 6924// Header returns an http.Header that can be modified by the caller to 6925// add HTTP headers to the request. 6926func (c *CoursesCourseWorkPatchCall) Header() http.Header { 6927 if c.header_ == nil { 6928 c.header_ = make(http.Header) 6929 } 6930 return c.header_ 6931} 6932 6933func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) { 6934 reqHeaders := make(http.Header) 6935 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 6936 for k, v := range c.header_ { 6937 reqHeaders[k] = v 6938 } 6939 reqHeaders.Set("User-Agent", c.s.userAgent()) 6940 var body io.Reader = nil 6941 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6942 if err != nil { 6943 return nil, err 6944 } 6945 reqHeaders.Set("Content-Type", "application/json") 6946 c.urlParams_.Set("alt", alt) 6947 c.urlParams_.Set("prettyPrint", "false") 6948 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6949 urls += "?" + c.urlParams_.Encode() 6950 req, err := http.NewRequest("PATCH", urls, body) 6951 if err != nil { 6952 return nil, err 6953 } 6954 req.Header = reqHeaders 6955 googleapi.Expand(req.URL, map[string]string{ 6956 "courseId": c.courseId, 6957 "id": c.id, 6958 }) 6959 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6960} 6961 6962// Do executes the "classroom.courses.courseWork.patch" call. 6963// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6964// status code is an error. Response headers are in either 6965// *CourseWork.ServerResponse.Header or (if a response was returned at 6966// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6967// to check whether the returned error was because 6968// http.StatusNotModified was returned. 6969func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6970 gensupport.SetOptions(c.urlParams_, opts...) 6971 res, err := c.doRequest("json") 6972 if res != nil && res.StatusCode == http.StatusNotModified { 6973 if res.Body != nil { 6974 res.Body.Close() 6975 } 6976 return nil, &googleapi.Error{ 6977 Code: res.StatusCode, 6978 Header: res.Header, 6979 } 6980 } 6981 if err != nil { 6982 return nil, err 6983 } 6984 defer googleapi.CloseBody(res) 6985 if err := googleapi.CheckResponse(res); err != nil { 6986 return nil, err 6987 } 6988 ret := &CourseWork{ 6989 ServerResponse: googleapi.ServerResponse{ 6990 Header: res.Header, 6991 HTTPStatusCode: res.StatusCode, 6992 }, 6993 } 6994 target := &ret 6995 if err := gensupport.DecodeResponse(target, res); err != nil { 6996 return nil, err 6997 } 6998 return ret, nil 6999 // { 7000 // "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.", 7001 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 7002 // "httpMethod": "PATCH", 7003 // "id": "classroom.courses.courseWork.patch", 7004 // "parameterOrder": [ 7005 // "courseId", 7006 // "id" 7007 // ], 7008 // "parameters": { 7009 // "courseId": { 7010 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7011 // "location": "path", 7012 // "required": true, 7013 // "type": "string" 7014 // }, 7015 // "id": { 7016 // "description": "Identifier of the course work.", 7017 // "location": "path", 7018 // "required": true, 7019 // "type": "string" 7020 // }, 7021 // "updateMask": { 7022 // "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`", 7023 // "format": "google-fieldmask", 7024 // "location": "query", 7025 // "type": "string" 7026 // } 7027 // }, 7028 // "path": "v1/courses/{courseId}/courseWork/{id}", 7029 // "request": { 7030 // "$ref": "CourseWork" 7031 // }, 7032 // "response": { 7033 // "$ref": "CourseWork" 7034 // }, 7035 // "scopes": [ 7036 // "https://www.googleapis.com/auth/classroom.coursework.students" 7037 // ] 7038 // } 7039 7040} 7041 7042// method id "classroom.courses.courseWork.studentSubmissions.get": 7043 7044type CoursesCourseWorkStudentSubmissionsGetCall struct { 7045 s *Service 7046 courseId string 7047 courseWorkId string 7048 id string 7049 urlParams_ gensupport.URLParams 7050 ifNoneMatch_ string 7051 ctx_ context.Context 7052 header_ http.Header 7053} 7054 7055// Get: Returns a student submission. 7056// 7057// * `PERMISSION_DENIED` if the requesting user is not permitted to 7058// access the 7059// requested course, course work, or student submission or for 7060// access errors. 7061// * `INVALID_ARGUMENT` if the request is malformed. 7062// * `NOT_FOUND` if the requested course, course work, or student 7063// submission 7064// does not exist. 7065func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall { 7066 c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7067 c.courseId = courseId 7068 c.courseWorkId = courseWorkId 7069 c.id = id 7070 return c 7071} 7072 7073// Fields allows partial responses to be retrieved. See 7074// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7075// for more information. 7076func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall { 7077 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7078 return c 7079} 7080 7081// IfNoneMatch sets the optional parameter which makes the operation 7082// fail if the object's ETag matches the given value. This is useful for 7083// getting updates only after the object has changed since the last 7084// request. Use googleapi.IsNotModified to check whether the response 7085// error from Do is the result of In-None-Match. 7086func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall { 7087 c.ifNoneMatch_ = entityTag 7088 return c 7089} 7090 7091// Context sets the context to be used in this call's Do method. Any 7092// pending HTTP request will be aborted if the provided context is 7093// canceled. 7094func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall { 7095 c.ctx_ = ctx 7096 return c 7097} 7098 7099// Header returns an http.Header that can be modified by the caller to 7100// add HTTP headers to the request. 7101func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header { 7102 if c.header_ == nil { 7103 c.header_ = make(http.Header) 7104 } 7105 return c.header_ 7106} 7107 7108func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) { 7109 reqHeaders := make(http.Header) 7110 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 7111 for k, v := range c.header_ { 7112 reqHeaders[k] = v 7113 } 7114 reqHeaders.Set("User-Agent", c.s.userAgent()) 7115 if c.ifNoneMatch_ != "" { 7116 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7117 } 7118 var body io.Reader = nil 7119 c.urlParams_.Set("alt", alt) 7120 c.urlParams_.Set("prettyPrint", "false") 7121 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7122 urls += "?" + c.urlParams_.Encode() 7123 req, err := http.NewRequest("GET", urls, body) 7124 if err != nil { 7125 return nil, err 7126 } 7127 req.Header = reqHeaders 7128 googleapi.Expand(req.URL, map[string]string{ 7129 "courseId": c.courseId, 7130 "courseWorkId": c.courseWorkId, 7131 "id": c.id, 7132 }) 7133 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7134} 7135 7136// Do executes the "classroom.courses.courseWork.studentSubmissions.get" call. 7137// Exactly one of *StudentSubmission or error will be non-nil. Any 7138// non-2xx status code is an error. Response headers are in either 7139// *StudentSubmission.ServerResponse.Header or (if a response was 7140// returned at all) in error.(*googleapi.Error).Header. Use 7141// googleapi.IsNotModified to check whether the returned error was 7142// because http.StatusNotModified was returned. 7143func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7144 gensupport.SetOptions(c.urlParams_, opts...) 7145 res, err := c.doRequest("json") 7146 if res != nil && res.StatusCode == http.StatusNotModified { 7147 if res.Body != nil { 7148 res.Body.Close() 7149 } 7150 return nil, &googleapi.Error{ 7151 Code: res.StatusCode, 7152 Header: res.Header, 7153 } 7154 } 7155 if err != nil { 7156 return nil, err 7157 } 7158 defer googleapi.CloseBody(res) 7159 if err := googleapi.CheckResponse(res); err != nil { 7160 return nil, err 7161 } 7162 ret := &StudentSubmission{ 7163 ServerResponse: googleapi.ServerResponse{ 7164 Header: res.Header, 7165 HTTPStatusCode: res.StatusCode, 7166 }, 7167 } 7168 target := &ret 7169 if err := gensupport.DecodeResponse(target, res); err != nil { 7170 return nil, err 7171 } 7172 return ret, nil 7173 // { 7174 // "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.", 7175 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7176 // "httpMethod": "GET", 7177 // "id": "classroom.courses.courseWork.studentSubmissions.get", 7178 // "parameterOrder": [ 7179 // "courseId", 7180 // "courseWorkId", 7181 // "id" 7182 // ], 7183 // "parameters": { 7184 // "courseId": { 7185 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7186 // "location": "path", 7187 // "required": true, 7188 // "type": "string" 7189 // }, 7190 // "courseWorkId": { 7191 // "description": "Identifier of the course work.", 7192 // "location": "path", 7193 // "required": true, 7194 // "type": "string" 7195 // }, 7196 // "id": { 7197 // "description": "Identifier of the student submission.", 7198 // "location": "path", 7199 // "required": true, 7200 // "type": "string" 7201 // } 7202 // }, 7203 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7204 // "response": { 7205 // "$ref": "StudentSubmission" 7206 // }, 7207 // "scopes": [ 7208 // "https://www.googleapis.com/auth/classroom.coursework.me", 7209 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7210 // "https://www.googleapis.com/auth/classroom.coursework.students", 7211 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7212 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7213 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7214 // ] 7215 // } 7216 7217} 7218 7219// method id "classroom.courses.courseWork.studentSubmissions.list": 7220 7221type CoursesCourseWorkStudentSubmissionsListCall struct { 7222 s *Service 7223 courseId string 7224 courseWorkId string 7225 urlParams_ gensupport.URLParams 7226 ifNoneMatch_ string 7227 ctx_ context.Context 7228 header_ http.Header 7229} 7230 7231// List: Returns a list of student submissions that the requester is 7232// permitted to 7233// view, factoring in the OAuth scopes of the request. 7234// `-` may be specified as the `course_work_id` to include 7235// student 7236// submissions for multiple course work items. 7237// 7238// Course students may only view their own work. Course teachers 7239// and domain administrators may view all student submissions. 7240// 7241// This method returns the following error codes: 7242// 7243// * `PERMISSION_DENIED` if the requesting user is not permitted to 7244// access the 7245// requested course or course work, or for access errors. 7246// * `INVALID_ARGUMENT` if the request is malformed. 7247// * `NOT_FOUND` if the requested course does not exist. 7248func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall { 7249 c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7250 c.courseId = courseId 7251 c.courseWorkId = courseWorkId 7252 return c 7253} 7254 7255// Late sets the optional parameter "late": Requested lateness value. If 7256// specified, returned student submissions are 7257// restricted by the requested value. 7258// If unspecified, submissions are returned regardless of `late` value. 7259// 7260// Possible values: 7261// "LATE_VALUES_UNSPECIFIED" 7262// "LATE_ONLY" 7263// "NOT_LATE_ONLY" 7264func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall { 7265 c.urlParams_.Set("late", late) 7266 return c 7267} 7268 7269// PageSize sets the optional parameter "pageSize": Maximum number of 7270// items to return. Zero or unspecified indicates that the 7271// server may assign a maximum. 7272// 7273// The server may return fewer than the specified number of results. 7274func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall { 7275 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 7276 return c 7277} 7278 7279// PageToken sets the optional parameter "pageToken": 7280// nextPageToken 7281// value returned from a previous 7282// list call, 7283// indicating that the subsequent page of results should be 7284// returned. 7285// 7286// The list request 7287// must be otherwise identical to the one that resulted in this token. 7288func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall { 7289 c.urlParams_.Set("pageToken", pageToken) 7290 return c 7291} 7292 7293// States sets the optional parameter "states": Requested submission 7294// states. If specified, returned student submissions 7295// match one of the specified submission states. 7296// 7297// Possible values: 7298// "SUBMISSION_STATE_UNSPECIFIED" 7299// "NEW" 7300// "CREATED" 7301// "TURNED_IN" 7302// "RETURNED" 7303// "RECLAIMED_BY_STUDENT" 7304func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall { 7305 c.urlParams_.SetMulti("states", append([]string{}, states...)) 7306 return c 7307} 7308 7309// UserId sets the optional parameter "userId": Optional argument to 7310// restrict returned student work to those owned by the 7311// student with the specified identifier. The identifier can be one of 7312// the 7313// following: 7314// 7315// * the numeric identifier for the user 7316// * the email address of the user 7317// * the string literal "me", indicating the requesting user 7318func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall { 7319 c.urlParams_.Set("userId", userId) 7320 return c 7321} 7322 7323// Fields allows partial responses to be retrieved. See 7324// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7325// for more information. 7326func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall { 7327 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7328 return c 7329} 7330 7331// IfNoneMatch sets the optional parameter which makes the operation 7332// fail if the object's ETag matches the given value. This is useful for 7333// getting updates only after the object has changed since the last 7334// request. Use googleapi.IsNotModified to check whether the response 7335// error from Do is the result of In-None-Match. 7336func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall { 7337 c.ifNoneMatch_ = entityTag 7338 return c 7339} 7340 7341// Context sets the context to be used in this call's Do method. Any 7342// pending HTTP request will be aborted if the provided context is 7343// canceled. 7344func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall { 7345 c.ctx_ = ctx 7346 return c 7347} 7348 7349// Header returns an http.Header that can be modified by the caller to 7350// add HTTP headers to the request. 7351func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header { 7352 if c.header_ == nil { 7353 c.header_ = make(http.Header) 7354 } 7355 return c.header_ 7356} 7357 7358func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) { 7359 reqHeaders := make(http.Header) 7360 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 7361 for k, v := range c.header_ { 7362 reqHeaders[k] = v 7363 } 7364 reqHeaders.Set("User-Agent", c.s.userAgent()) 7365 if c.ifNoneMatch_ != "" { 7366 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7367 } 7368 var body io.Reader = nil 7369 c.urlParams_.Set("alt", alt) 7370 c.urlParams_.Set("prettyPrint", "false") 7371 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions") 7372 urls += "?" + c.urlParams_.Encode() 7373 req, err := http.NewRequest("GET", urls, body) 7374 if err != nil { 7375 return nil, err 7376 } 7377 req.Header = reqHeaders 7378 googleapi.Expand(req.URL, map[string]string{ 7379 "courseId": c.courseId, 7380 "courseWorkId": c.courseWorkId, 7381 }) 7382 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7383} 7384 7385// Do executes the "classroom.courses.courseWork.studentSubmissions.list" call. 7386// Exactly one of *ListStudentSubmissionsResponse or error will be 7387// non-nil. Any non-2xx status code is an error. Response headers are in 7388// either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a 7389// response was returned at all) in error.(*googleapi.Error).Header. Use 7390// googleapi.IsNotModified to check whether the returned error was 7391// because http.StatusNotModified was returned. 7392func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) { 7393 gensupport.SetOptions(c.urlParams_, opts...) 7394 res, err := c.doRequest("json") 7395 if res != nil && res.StatusCode == http.StatusNotModified { 7396 if res.Body != nil { 7397 res.Body.Close() 7398 } 7399 return nil, &googleapi.Error{ 7400 Code: res.StatusCode, 7401 Header: res.Header, 7402 } 7403 } 7404 if err != nil { 7405 return nil, err 7406 } 7407 defer googleapi.CloseBody(res) 7408 if err := googleapi.CheckResponse(res); err != nil { 7409 return nil, err 7410 } 7411 ret := &ListStudentSubmissionsResponse{ 7412 ServerResponse: googleapi.ServerResponse{ 7413 Header: res.Header, 7414 HTTPStatusCode: res.StatusCode, 7415 }, 7416 } 7417 target := &ret 7418 if err := gensupport.DecodeResponse(target, res); err != nil { 7419 return nil, err 7420 } 7421 return ret, nil 7422 // { 7423 // "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.", 7424 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7425 // "httpMethod": "GET", 7426 // "id": "classroom.courses.courseWork.studentSubmissions.list", 7427 // "parameterOrder": [ 7428 // "courseId", 7429 // "courseWorkId" 7430 // ], 7431 // "parameters": { 7432 // "courseId": { 7433 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7434 // "location": "path", 7435 // "required": true, 7436 // "type": "string" 7437 // }, 7438 // "courseWorkId": { 7439 // "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.", 7440 // "location": "path", 7441 // "required": true, 7442 // "type": "string" 7443 // }, 7444 // "late": { 7445 // "description": "Requested lateness value. If specified, returned student submissions are\nrestricted by the requested value.\nIf unspecified, submissions are returned regardless of `late` value.", 7446 // "enum": [ 7447 // "LATE_VALUES_UNSPECIFIED", 7448 // "LATE_ONLY", 7449 // "NOT_LATE_ONLY" 7450 // ], 7451 // "location": "query", 7452 // "type": "string" 7453 // }, 7454 // "pageSize": { 7455 // "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.", 7456 // "format": "int32", 7457 // "location": "query", 7458 // "type": "integer" 7459 // }, 7460 // "pageToken": { 7461 // "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.", 7462 // "location": "query", 7463 // "type": "string" 7464 // }, 7465 // "states": { 7466 // "description": "Requested submission states. If specified, returned student submissions\nmatch one of the specified submission states.", 7467 // "enum": [ 7468 // "SUBMISSION_STATE_UNSPECIFIED", 7469 // "NEW", 7470 // "CREATED", 7471 // "TURNED_IN", 7472 // "RETURNED", 7473 // "RECLAIMED_BY_STUDENT" 7474 // ], 7475 // "location": "query", 7476 // "repeated": true, 7477 // "type": "string" 7478 // }, 7479 // "userId": { 7480 // "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", 7481 // "location": "query", 7482 // "type": "string" 7483 // } 7484 // }, 7485 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7486 // "response": { 7487 // "$ref": "ListStudentSubmissionsResponse" 7488 // }, 7489 // "scopes": [ 7490 // "https://www.googleapis.com/auth/classroom.coursework.me", 7491 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7492 // "https://www.googleapis.com/auth/classroom.coursework.students", 7493 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7494 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7495 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7496 // ] 7497 // } 7498 7499} 7500 7501// Pages invokes f for each page of results. 7502// A non-nil error returned from f will halt the iteration. 7503// The provided context supersedes any context provided to the Context method. 7504func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error { 7505 c.ctx_ = ctx 7506 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7507 for { 7508 x, err := c.Do() 7509 if err != nil { 7510 return err 7511 } 7512 if err := f(x); err != nil { 7513 return err 7514 } 7515 if x.NextPageToken == "" { 7516 return nil 7517 } 7518 c.PageToken(x.NextPageToken) 7519 } 7520} 7521 7522// method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments": 7523 7524type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct { 7525 s *Service 7526 courseId string 7527 courseWorkId string 7528 id string 7529 modifyattachmentsrequest *ModifyAttachmentsRequest 7530 urlParams_ gensupport.URLParams 7531 ctx_ context.Context 7532 header_ http.Header 7533} 7534 7535// ModifyAttachments: Modifies attachments of student 7536// submission. 7537// 7538// Attachments may only be added to student submissions belonging to 7539// course 7540// work objects with a `workType` of `ASSIGNMENT`. 7541// 7542// This request must be made by the Developer Console project of 7543// the 7544// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7545// used to 7546// create the corresponding course work item. 7547// 7548// This method returns the following error codes: 7549// 7550// * `PERMISSION_DENIED` if the requesting user is not permitted to 7551// access the 7552// requested course or course work, if the user is not permitted to 7553// modify 7554// attachments on the requested student submission, or for 7555// access errors. 7556// * `INVALID_ARGUMENT` if the request is malformed. 7557// * `NOT_FOUND` if the requested course, course work, or student 7558// submission 7559// does not exist. 7560func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7561 c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7562 c.courseId = courseId 7563 c.courseWorkId = courseWorkId 7564 c.id = id 7565 c.modifyattachmentsrequest = modifyattachmentsrequest 7566 return c 7567} 7568 7569// Fields allows partial responses to be retrieved. See 7570// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7571// for more information. 7572func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7573 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7574 return c 7575} 7576 7577// Context sets the context to be used in this call's Do method. Any 7578// pending HTTP request will be aborted if the provided context is 7579// canceled. 7580func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7581 c.ctx_ = ctx 7582 return c 7583} 7584 7585// Header returns an http.Header that can be modified by the caller to 7586// add HTTP headers to the request. 7587func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header { 7588 if c.header_ == nil { 7589 c.header_ = make(http.Header) 7590 } 7591 return c.header_ 7592} 7593 7594func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) { 7595 reqHeaders := make(http.Header) 7596 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 7597 for k, v := range c.header_ { 7598 reqHeaders[k] = v 7599 } 7600 reqHeaders.Set("User-Agent", c.s.userAgent()) 7601 var body io.Reader = nil 7602 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest) 7603 if err != nil { 7604 return nil, err 7605 } 7606 reqHeaders.Set("Content-Type", "application/json") 7607 c.urlParams_.Set("alt", alt) 7608 c.urlParams_.Set("prettyPrint", "false") 7609 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments") 7610 urls += "?" + c.urlParams_.Encode() 7611 req, err := http.NewRequest("POST", urls, body) 7612 if err != nil { 7613 return nil, err 7614 } 7615 req.Header = reqHeaders 7616 googleapi.Expand(req.URL, map[string]string{ 7617 "courseId": c.courseId, 7618 "courseWorkId": c.courseWorkId, 7619 "id": c.id, 7620 }) 7621 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7622} 7623 7624// Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call. 7625// Exactly one of *StudentSubmission or error will be non-nil. Any 7626// non-2xx status code is an error. Response headers are in either 7627// *StudentSubmission.ServerResponse.Header or (if a response was 7628// returned at all) in error.(*googleapi.Error).Header. Use 7629// googleapi.IsNotModified to check whether the returned error was 7630// because http.StatusNotModified was returned. 7631func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7632 gensupport.SetOptions(c.urlParams_, opts...) 7633 res, err := c.doRequest("json") 7634 if res != nil && res.StatusCode == http.StatusNotModified { 7635 if res.Body != nil { 7636 res.Body.Close() 7637 } 7638 return nil, &googleapi.Error{ 7639 Code: res.StatusCode, 7640 Header: res.Header, 7641 } 7642 } 7643 if err != nil { 7644 return nil, err 7645 } 7646 defer googleapi.CloseBody(res) 7647 if err := googleapi.CheckResponse(res); err != nil { 7648 return nil, err 7649 } 7650 ret := &StudentSubmission{ 7651 ServerResponse: googleapi.ServerResponse{ 7652 Header: res.Header, 7653 HTTPStatusCode: res.StatusCode, 7654 }, 7655 } 7656 target := &ret 7657 if err := gensupport.DecodeResponse(target, res); err != nil { 7658 return nil, err 7659 } 7660 return ret, nil 7661 // { 7662 // "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.", 7663 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7664 // "httpMethod": "POST", 7665 // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments", 7666 // "parameterOrder": [ 7667 // "courseId", 7668 // "courseWorkId", 7669 // "id" 7670 // ], 7671 // "parameters": { 7672 // "courseId": { 7673 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7674 // "location": "path", 7675 // "required": true, 7676 // "type": "string" 7677 // }, 7678 // "courseWorkId": { 7679 // "description": "Identifier of the course work.", 7680 // "location": "path", 7681 // "required": true, 7682 // "type": "string" 7683 // }, 7684 // "id": { 7685 // "description": "Identifier of the student submission.", 7686 // "location": "path", 7687 // "required": true, 7688 // "type": "string" 7689 // } 7690 // }, 7691 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7692 // "request": { 7693 // "$ref": "ModifyAttachmentsRequest" 7694 // }, 7695 // "response": { 7696 // "$ref": "StudentSubmission" 7697 // }, 7698 // "scopes": [ 7699 // "https://www.googleapis.com/auth/classroom.coursework.me", 7700 // "https://www.googleapis.com/auth/classroom.coursework.students" 7701 // ] 7702 // } 7703 7704} 7705 7706// method id "classroom.courses.courseWork.studentSubmissions.patch": 7707 7708type CoursesCourseWorkStudentSubmissionsPatchCall struct { 7709 s *Service 7710 courseId string 7711 courseWorkId string 7712 id string 7713 studentsubmission *StudentSubmission 7714 urlParams_ gensupport.URLParams 7715 ctx_ context.Context 7716 header_ http.Header 7717} 7718 7719// Patch: Updates one or more fields of a student submission. 7720// 7721// See google.classroom.v1.StudentSubmission for details 7722// of which fields may be updated and who may change them. 7723// 7724// This request must be made by the Developer Console project of 7725// the 7726// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7727// used to 7728// create the corresponding course work item. 7729// 7730// This method returns the following error codes: 7731// 7732// * `PERMISSION_DENIED` if the requesting developer project did not 7733// create 7734// the corresponding course work, if the user is not permitted to make 7735// the 7736// requested modification to the student submission, or for 7737// access errors. 7738// * `INVALID_ARGUMENT` if the request is malformed. 7739// * `NOT_FOUND` if the requested course, course work, or student 7740// submission 7741// does not exist. 7742func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall { 7743 c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7744 c.courseId = courseId 7745 c.courseWorkId = courseWorkId 7746 c.id = id 7747 c.studentsubmission = studentsubmission 7748 return c 7749} 7750 7751// UpdateMask sets the optional parameter "updateMask": Mask that 7752// identifies which fields on the student submission to update. 7753// This field is required to do an update. The update fails if 7754// invalid 7755// fields are specified. 7756// 7757// The following fields may be specified by teachers: 7758// 7759// * `draft_grade` 7760// * `assigned_grade` 7761func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall { 7762 c.urlParams_.Set("updateMask", updateMask) 7763 return c 7764} 7765 7766// Fields allows partial responses to be retrieved. See 7767// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7768// for more information. 7769func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall { 7770 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7771 return c 7772} 7773 7774// Context sets the context to be used in this call's Do method. Any 7775// pending HTTP request will be aborted if the provided context is 7776// canceled. 7777func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall { 7778 c.ctx_ = ctx 7779 return c 7780} 7781 7782// Header returns an http.Header that can be modified by the caller to 7783// add HTTP headers to the request. 7784func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header { 7785 if c.header_ == nil { 7786 c.header_ = make(http.Header) 7787 } 7788 return c.header_ 7789} 7790 7791func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) { 7792 reqHeaders := make(http.Header) 7793 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 7794 for k, v := range c.header_ { 7795 reqHeaders[k] = v 7796 } 7797 reqHeaders.Set("User-Agent", c.s.userAgent()) 7798 var body io.Reader = nil 7799 body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission) 7800 if err != nil { 7801 return nil, err 7802 } 7803 reqHeaders.Set("Content-Type", "application/json") 7804 c.urlParams_.Set("alt", alt) 7805 c.urlParams_.Set("prettyPrint", "false") 7806 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7807 urls += "?" + c.urlParams_.Encode() 7808 req, err := http.NewRequest("PATCH", urls, body) 7809 if err != nil { 7810 return nil, err 7811 } 7812 req.Header = reqHeaders 7813 googleapi.Expand(req.URL, map[string]string{ 7814 "courseId": c.courseId, 7815 "courseWorkId": c.courseWorkId, 7816 "id": c.id, 7817 }) 7818 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7819} 7820 7821// Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call. 7822// Exactly one of *StudentSubmission or error will be non-nil. Any 7823// non-2xx status code is an error. Response headers are in either 7824// *StudentSubmission.ServerResponse.Header or (if a response was 7825// returned at all) in error.(*googleapi.Error).Header. Use 7826// googleapi.IsNotModified to check whether the returned error was 7827// because http.StatusNotModified was returned. 7828func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7829 gensupport.SetOptions(c.urlParams_, opts...) 7830 res, err := c.doRequest("json") 7831 if res != nil && res.StatusCode == http.StatusNotModified { 7832 if res.Body != nil { 7833 res.Body.Close() 7834 } 7835 return nil, &googleapi.Error{ 7836 Code: res.StatusCode, 7837 Header: res.Header, 7838 } 7839 } 7840 if err != nil { 7841 return nil, err 7842 } 7843 defer googleapi.CloseBody(res) 7844 if err := googleapi.CheckResponse(res); err != nil { 7845 return nil, err 7846 } 7847 ret := &StudentSubmission{ 7848 ServerResponse: googleapi.ServerResponse{ 7849 Header: res.Header, 7850 HTTPStatusCode: res.StatusCode, 7851 }, 7852 } 7853 target := &ret 7854 if err := gensupport.DecodeResponse(target, res); err != nil { 7855 return nil, err 7856 } 7857 return ret, nil 7858 // { 7859 // "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.", 7860 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7861 // "httpMethod": "PATCH", 7862 // "id": "classroom.courses.courseWork.studentSubmissions.patch", 7863 // "parameterOrder": [ 7864 // "courseId", 7865 // "courseWorkId", 7866 // "id" 7867 // ], 7868 // "parameters": { 7869 // "courseId": { 7870 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 7871 // "location": "path", 7872 // "required": true, 7873 // "type": "string" 7874 // }, 7875 // "courseWorkId": { 7876 // "description": "Identifier of the course work.", 7877 // "location": "path", 7878 // "required": true, 7879 // "type": "string" 7880 // }, 7881 // "id": { 7882 // "description": "Identifier of the student submission.", 7883 // "location": "path", 7884 // "required": true, 7885 // "type": "string" 7886 // }, 7887 // "updateMask": { 7888 // "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`", 7889 // "format": "google-fieldmask", 7890 // "location": "query", 7891 // "type": "string" 7892 // } 7893 // }, 7894 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7895 // "request": { 7896 // "$ref": "StudentSubmission" 7897 // }, 7898 // "response": { 7899 // "$ref": "StudentSubmission" 7900 // }, 7901 // "scopes": [ 7902 // "https://www.googleapis.com/auth/classroom.coursework.me", 7903 // "https://www.googleapis.com/auth/classroom.coursework.students" 7904 // ] 7905 // } 7906 7907} 7908 7909// method id "classroom.courses.courseWork.studentSubmissions.reclaim": 7910 7911type CoursesCourseWorkStudentSubmissionsReclaimCall struct { 7912 s *Service 7913 courseId string 7914 courseWorkId string 7915 id string 7916 reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest 7917 urlParams_ gensupport.URLParams 7918 ctx_ context.Context 7919 header_ http.Header 7920} 7921 7922// Reclaim: Reclaims a student submission on behalf of the student that 7923// owns it. 7924// 7925// Reclaiming a student submission transfers ownership of attached 7926// Drive 7927// files to the student and updates the submission state. 7928// 7929// Only the student that owns the requested student submission may call 7930// this 7931// method, and only for a student submission that has been turned 7932// in. 7933// 7934// This request must be made by the Developer Console project of 7935// the 7936// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 7937// used to 7938// create the corresponding course work item. 7939// 7940// This method returns the following error codes: 7941// 7942// * `PERMISSION_DENIED` if the requesting user is not permitted to 7943// access the 7944// requested course or course work, unsubmit the requested student 7945// submission, 7946// or for access errors. 7947// * `FAILED_PRECONDITION` if the student submission has not been turned 7948// in. 7949// * `INVALID_ARGUMENT` if the request is malformed. 7950// * `NOT_FOUND` if the requested course, course work, or student 7951// submission 7952// does not exist. 7953func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7954 c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7955 c.courseId = courseId 7956 c.courseWorkId = courseWorkId 7957 c.id = id 7958 c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest 7959 return c 7960} 7961 7962// Fields allows partial responses to be retrieved. See 7963// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7964// for more information. 7965func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7966 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7967 return c 7968} 7969 7970// Context sets the context to be used in this call's Do method. Any 7971// pending HTTP request will be aborted if the provided context is 7972// canceled. 7973func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7974 c.ctx_ = ctx 7975 return c 7976} 7977 7978// Header returns an http.Header that can be modified by the caller to 7979// add HTTP headers to the request. 7980func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header { 7981 if c.header_ == nil { 7982 c.header_ = make(http.Header) 7983 } 7984 return c.header_ 7985} 7986 7987func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) { 7988 reqHeaders := make(http.Header) 7989 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 7990 for k, v := range c.header_ { 7991 reqHeaders[k] = v 7992 } 7993 reqHeaders.Set("User-Agent", c.s.userAgent()) 7994 var body io.Reader = nil 7995 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest) 7996 if err != nil { 7997 return nil, err 7998 } 7999 reqHeaders.Set("Content-Type", "application/json") 8000 c.urlParams_.Set("alt", alt) 8001 c.urlParams_.Set("prettyPrint", "false") 8002 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim") 8003 urls += "?" + c.urlParams_.Encode() 8004 req, err := http.NewRequest("POST", urls, body) 8005 if err != nil { 8006 return nil, err 8007 } 8008 req.Header = reqHeaders 8009 googleapi.Expand(req.URL, map[string]string{ 8010 "courseId": c.courseId, 8011 "courseWorkId": c.courseWorkId, 8012 "id": c.id, 8013 }) 8014 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8015} 8016 8017// Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call. 8018// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8019// code is an error. Response headers are in either 8020// *Empty.ServerResponse.Header or (if a response was returned at all) 8021// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8022// check whether the returned error was because http.StatusNotModified 8023// was returned. 8024func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8025 gensupport.SetOptions(c.urlParams_, opts...) 8026 res, err := c.doRequest("json") 8027 if res != nil && res.StatusCode == http.StatusNotModified { 8028 if res.Body != nil { 8029 res.Body.Close() 8030 } 8031 return nil, &googleapi.Error{ 8032 Code: res.StatusCode, 8033 Header: res.Header, 8034 } 8035 } 8036 if err != nil { 8037 return nil, err 8038 } 8039 defer googleapi.CloseBody(res) 8040 if err := googleapi.CheckResponse(res); err != nil { 8041 return nil, err 8042 } 8043 ret := &Empty{ 8044 ServerResponse: googleapi.ServerResponse{ 8045 Header: res.Header, 8046 HTTPStatusCode: res.StatusCode, 8047 }, 8048 } 8049 target := &ret 8050 if err := gensupport.DecodeResponse(target, res); err != nil { 8051 return nil, err 8052 } 8053 return ret, nil 8054 // { 8055 // "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.", 8056 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8057 // "httpMethod": "POST", 8058 // "id": "classroom.courses.courseWork.studentSubmissions.reclaim", 8059 // "parameterOrder": [ 8060 // "courseId", 8061 // "courseWorkId", 8062 // "id" 8063 // ], 8064 // "parameters": { 8065 // "courseId": { 8066 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8067 // "location": "path", 8068 // "required": true, 8069 // "type": "string" 8070 // }, 8071 // "courseWorkId": { 8072 // "description": "Identifier of the course work.", 8073 // "location": "path", 8074 // "required": true, 8075 // "type": "string" 8076 // }, 8077 // "id": { 8078 // "description": "Identifier of the student submission.", 8079 // "location": "path", 8080 // "required": true, 8081 // "type": "string" 8082 // } 8083 // }, 8084 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 8085 // "request": { 8086 // "$ref": "ReclaimStudentSubmissionRequest" 8087 // }, 8088 // "response": { 8089 // "$ref": "Empty" 8090 // }, 8091 // "scopes": [ 8092 // "https://www.googleapis.com/auth/classroom.coursework.me" 8093 // ] 8094 // } 8095 8096} 8097 8098// method id "classroom.courses.courseWork.studentSubmissions.return": 8099 8100type CoursesCourseWorkStudentSubmissionsReturnCall struct { 8101 s *Service 8102 courseId string 8103 courseWorkId string 8104 id string 8105 returnstudentsubmissionrequest *ReturnStudentSubmissionRequest 8106 urlParams_ gensupport.URLParams 8107 ctx_ context.Context 8108 header_ http.Header 8109} 8110 8111// Return: Returns a student submission. 8112// 8113// Returning a student submission transfers ownership of attached 8114// Drive 8115// files to the student and may also update the submission state. 8116// Unlike the Classroom application, returning a student submission does 8117// not 8118// set assignedGrade to the draftGrade value. 8119// 8120// Only a teacher of the course that contains the requested student 8121// submission 8122// may call this method. 8123// 8124// This request must be made by the Developer Console project of 8125// the 8126// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8127// used to 8128// create the corresponding course work item. 8129// 8130// This method returns the following error codes: 8131// 8132// * `PERMISSION_DENIED` if the requesting user is not permitted to 8133// access the 8134// requested course or course work, return the requested student 8135// submission, 8136// or for access errors. 8137// * `INVALID_ARGUMENT` if the request is malformed. 8138// * `NOT_FOUND` if the requested course, course work, or student 8139// submission 8140// does not exist. 8141func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall { 8142 c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8143 c.courseId = courseId 8144 c.courseWorkId = courseWorkId 8145 c.id = id 8146 c.returnstudentsubmissionrequest = returnstudentsubmissionrequest 8147 return c 8148} 8149 8150// Fields allows partial responses to be retrieved. See 8151// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8152// for more information. 8153func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall { 8154 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8155 return c 8156} 8157 8158// Context sets the context to be used in this call's Do method. Any 8159// pending HTTP request will be aborted if the provided context is 8160// canceled. 8161func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall { 8162 c.ctx_ = ctx 8163 return c 8164} 8165 8166// Header returns an http.Header that can be modified by the caller to 8167// add HTTP headers to the request. 8168func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header { 8169 if c.header_ == nil { 8170 c.header_ = make(http.Header) 8171 } 8172 return c.header_ 8173} 8174 8175func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) { 8176 reqHeaders := make(http.Header) 8177 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 8178 for k, v := range c.header_ { 8179 reqHeaders[k] = v 8180 } 8181 reqHeaders.Set("User-Agent", c.s.userAgent()) 8182 var body io.Reader = nil 8183 body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest) 8184 if err != nil { 8185 return nil, err 8186 } 8187 reqHeaders.Set("Content-Type", "application/json") 8188 c.urlParams_.Set("alt", alt) 8189 c.urlParams_.Set("prettyPrint", "false") 8190 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return") 8191 urls += "?" + c.urlParams_.Encode() 8192 req, err := http.NewRequest("POST", urls, body) 8193 if err != nil { 8194 return nil, err 8195 } 8196 req.Header = reqHeaders 8197 googleapi.Expand(req.URL, map[string]string{ 8198 "courseId": c.courseId, 8199 "courseWorkId": c.courseWorkId, 8200 "id": c.id, 8201 }) 8202 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8203} 8204 8205// Do executes the "classroom.courses.courseWork.studentSubmissions.return" call. 8206// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8207// code is an error. Response headers are in either 8208// *Empty.ServerResponse.Header or (if a response was returned at all) 8209// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8210// check whether the returned error was because http.StatusNotModified 8211// was returned. 8212func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8213 gensupport.SetOptions(c.urlParams_, opts...) 8214 res, err := c.doRequest("json") 8215 if res != nil && res.StatusCode == http.StatusNotModified { 8216 if res.Body != nil { 8217 res.Body.Close() 8218 } 8219 return nil, &googleapi.Error{ 8220 Code: res.StatusCode, 8221 Header: res.Header, 8222 } 8223 } 8224 if err != nil { 8225 return nil, err 8226 } 8227 defer googleapi.CloseBody(res) 8228 if err := googleapi.CheckResponse(res); err != nil { 8229 return nil, err 8230 } 8231 ret := &Empty{ 8232 ServerResponse: googleapi.ServerResponse{ 8233 Header: res.Header, 8234 HTTPStatusCode: res.StatusCode, 8235 }, 8236 } 8237 target := &ret 8238 if err := gensupport.DecodeResponse(target, res); err != nil { 8239 return nil, err 8240 } 8241 return ret, nil 8242 // { 8243 // "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.", 8244 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8245 // "httpMethod": "POST", 8246 // "id": "classroom.courses.courseWork.studentSubmissions.return", 8247 // "parameterOrder": [ 8248 // "courseId", 8249 // "courseWorkId", 8250 // "id" 8251 // ], 8252 // "parameters": { 8253 // "courseId": { 8254 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8255 // "location": "path", 8256 // "required": true, 8257 // "type": "string" 8258 // }, 8259 // "courseWorkId": { 8260 // "description": "Identifier of the course work.", 8261 // "location": "path", 8262 // "required": true, 8263 // "type": "string" 8264 // }, 8265 // "id": { 8266 // "description": "Identifier of the student submission.", 8267 // "location": "path", 8268 // "required": true, 8269 // "type": "string" 8270 // } 8271 // }, 8272 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 8273 // "request": { 8274 // "$ref": "ReturnStudentSubmissionRequest" 8275 // }, 8276 // "response": { 8277 // "$ref": "Empty" 8278 // }, 8279 // "scopes": [ 8280 // "https://www.googleapis.com/auth/classroom.coursework.students" 8281 // ] 8282 // } 8283 8284} 8285 8286// method id "classroom.courses.courseWork.studentSubmissions.turnIn": 8287 8288type CoursesCourseWorkStudentSubmissionsTurnInCall struct { 8289 s *Service 8290 courseId string 8291 courseWorkId string 8292 id string 8293 turninstudentsubmissionrequest *TurnInStudentSubmissionRequest 8294 urlParams_ gensupport.URLParams 8295 ctx_ context.Context 8296 header_ http.Header 8297} 8298 8299// TurnIn: Turns in a student submission. 8300// 8301// Turning in a student submission transfers ownership of attached 8302// Drive 8303// files to the teacher and may also update the submission state. 8304// 8305// This may only be called by the student that owns the specified 8306// student 8307// submission. 8308// 8309// This request must be made by the Developer Console project of 8310// the 8311// [OAuth client ID](https://support.google.com/cloud/answer/6158849) 8312// used to 8313// create the corresponding course work item. 8314// 8315// This method returns the following error codes: 8316// 8317// * `PERMISSION_DENIED` if the requesting user is not permitted to 8318// access the 8319// requested course or course work, turn in the requested student 8320// submission, 8321// or for access errors. 8322// * `INVALID_ARGUMENT` if the request is malformed. 8323// * `NOT_FOUND` if the requested course, course work, or student 8324// submission 8325// does not exist. 8326func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8327 c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8328 c.courseId = courseId 8329 c.courseWorkId = courseWorkId 8330 c.id = id 8331 c.turninstudentsubmissionrequest = turninstudentsubmissionrequest 8332 return c 8333} 8334 8335// Fields allows partial responses to be retrieved. See 8336// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8337// for more information. 8338func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8339 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8340 return c 8341} 8342 8343// Context sets the context to be used in this call's Do method. Any 8344// pending HTTP request will be aborted if the provided context is 8345// canceled. 8346func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8347 c.ctx_ = ctx 8348 return c 8349} 8350 8351// Header returns an http.Header that can be modified by the caller to 8352// add HTTP headers to the request. 8353func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header { 8354 if c.header_ == nil { 8355 c.header_ = make(http.Header) 8356 } 8357 return c.header_ 8358} 8359 8360func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) { 8361 reqHeaders := make(http.Header) 8362 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 8363 for k, v := range c.header_ { 8364 reqHeaders[k] = v 8365 } 8366 reqHeaders.Set("User-Agent", c.s.userAgent()) 8367 var body io.Reader = nil 8368 body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest) 8369 if err != nil { 8370 return nil, err 8371 } 8372 reqHeaders.Set("Content-Type", "application/json") 8373 c.urlParams_.Set("alt", alt) 8374 c.urlParams_.Set("prettyPrint", "false") 8375 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn") 8376 urls += "?" + c.urlParams_.Encode() 8377 req, err := http.NewRequest("POST", urls, body) 8378 if err != nil { 8379 return nil, err 8380 } 8381 req.Header = reqHeaders 8382 googleapi.Expand(req.URL, map[string]string{ 8383 "courseId": c.courseId, 8384 "courseWorkId": c.courseWorkId, 8385 "id": c.id, 8386 }) 8387 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8388} 8389 8390// Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call. 8391// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8392// code is an error. Response headers are in either 8393// *Empty.ServerResponse.Header or (if a response was returned at all) 8394// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8395// check whether the returned error was because http.StatusNotModified 8396// was returned. 8397func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8398 gensupport.SetOptions(c.urlParams_, opts...) 8399 res, err := c.doRequest("json") 8400 if res != nil && res.StatusCode == http.StatusNotModified { 8401 if res.Body != nil { 8402 res.Body.Close() 8403 } 8404 return nil, &googleapi.Error{ 8405 Code: res.StatusCode, 8406 Header: res.Header, 8407 } 8408 } 8409 if err != nil { 8410 return nil, err 8411 } 8412 defer googleapi.CloseBody(res) 8413 if err := googleapi.CheckResponse(res); err != nil { 8414 return nil, err 8415 } 8416 ret := &Empty{ 8417 ServerResponse: googleapi.ServerResponse{ 8418 Header: res.Header, 8419 HTTPStatusCode: res.StatusCode, 8420 }, 8421 } 8422 target := &ret 8423 if err := gensupport.DecodeResponse(target, res); err != nil { 8424 return nil, err 8425 } 8426 return ret, nil 8427 // { 8428 // "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.", 8429 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8430 // "httpMethod": "POST", 8431 // "id": "classroom.courses.courseWork.studentSubmissions.turnIn", 8432 // "parameterOrder": [ 8433 // "courseId", 8434 // "courseWorkId", 8435 // "id" 8436 // ], 8437 // "parameters": { 8438 // "courseId": { 8439 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8440 // "location": "path", 8441 // "required": true, 8442 // "type": "string" 8443 // }, 8444 // "courseWorkId": { 8445 // "description": "Identifier of the course work.", 8446 // "location": "path", 8447 // "required": true, 8448 // "type": "string" 8449 // }, 8450 // "id": { 8451 // "description": "Identifier of the student submission.", 8452 // "location": "path", 8453 // "required": true, 8454 // "type": "string" 8455 // } 8456 // }, 8457 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8458 // "request": { 8459 // "$ref": "TurnInStudentSubmissionRequest" 8460 // }, 8461 // "response": { 8462 // "$ref": "Empty" 8463 // }, 8464 // "scopes": [ 8465 // "https://www.googleapis.com/auth/classroom.coursework.me" 8466 // ] 8467 // } 8468 8469} 8470 8471// method id "classroom.courses.students.create": 8472 8473type CoursesStudentsCreateCall struct { 8474 s *Service 8475 courseId string 8476 student *Student 8477 urlParams_ gensupport.URLParams 8478 ctx_ context.Context 8479 header_ http.Header 8480} 8481 8482// Create: Adds a user as a student of a course. 8483// 8484// This method returns the following error codes: 8485// 8486// * `PERMISSION_DENIED` if the requesting user is not permitted to 8487// create 8488// students in this course or for access errors. 8489// * `NOT_FOUND` if the requested course ID does not exist. 8490// * `FAILED_PRECONDITION` if the requested user's account is 8491// disabled, 8492// for the following request errors: 8493// * CourseMemberLimitReached 8494// * CourseNotModifiable 8495// * UserGroupsMembershipLimitReached 8496// * `ALREADY_EXISTS` if the user is already a student or teacher in 8497// the 8498// course. 8499func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall { 8500 c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8501 c.courseId = courseId 8502 c.student = student 8503 return c 8504} 8505 8506// EnrollmentCode sets the optional parameter "enrollmentCode": 8507// Enrollment code of the course to create the student in. 8508// This code is required if userId 8509// corresponds to the requesting user; it may be omitted if the 8510// requesting 8511// user has administrative permissions to create students for any user. 8512func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall { 8513 c.urlParams_.Set("enrollmentCode", enrollmentCode) 8514 return c 8515} 8516 8517// Fields allows partial responses to be retrieved. See 8518// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8519// for more information. 8520func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall { 8521 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8522 return c 8523} 8524 8525// Context sets the context to be used in this call's Do method. Any 8526// pending HTTP request will be aborted if the provided context is 8527// canceled. 8528func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall { 8529 c.ctx_ = ctx 8530 return c 8531} 8532 8533// Header returns an http.Header that can be modified by the caller to 8534// add HTTP headers to the request. 8535func (c *CoursesStudentsCreateCall) Header() http.Header { 8536 if c.header_ == nil { 8537 c.header_ = make(http.Header) 8538 } 8539 return c.header_ 8540} 8541 8542func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) { 8543 reqHeaders := make(http.Header) 8544 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 8545 for k, v := range c.header_ { 8546 reqHeaders[k] = v 8547 } 8548 reqHeaders.Set("User-Agent", c.s.userAgent()) 8549 var body io.Reader = nil 8550 body, err := googleapi.WithoutDataWrapper.JSONReader(c.student) 8551 if err != nil { 8552 return nil, err 8553 } 8554 reqHeaders.Set("Content-Type", "application/json") 8555 c.urlParams_.Set("alt", alt) 8556 c.urlParams_.Set("prettyPrint", "false") 8557 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 8558 urls += "?" + c.urlParams_.Encode() 8559 req, err := http.NewRequest("POST", urls, body) 8560 if err != nil { 8561 return nil, err 8562 } 8563 req.Header = reqHeaders 8564 googleapi.Expand(req.URL, map[string]string{ 8565 "courseId": c.courseId, 8566 }) 8567 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8568} 8569 8570// Do executes the "classroom.courses.students.create" call. 8571// Exactly one of *Student or error will be non-nil. Any non-2xx status 8572// code is an error. Response headers are in either 8573// *Student.ServerResponse.Header or (if a response was returned at all) 8574// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8575// check whether the returned error was because http.StatusNotModified 8576// was returned. 8577func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8578 gensupport.SetOptions(c.urlParams_, opts...) 8579 res, err := c.doRequest("json") 8580 if res != nil && res.StatusCode == http.StatusNotModified { 8581 if res.Body != nil { 8582 res.Body.Close() 8583 } 8584 return nil, &googleapi.Error{ 8585 Code: res.StatusCode, 8586 Header: res.Header, 8587 } 8588 } 8589 if err != nil { 8590 return nil, err 8591 } 8592 defer googleapi.CloseBody(res) 8593 if err := googleapi.CheckResponse(res); err != nil { 8594 return nil, err 8595 } 8596 ret := &Student{ 8597 ServerResponse: googleapi.ServerResponse{ 8598 Header: res.Header, 8599 HTTPStatusCode: res.StatusCode, 8600 }, 8601 } 8602 target := &ret 8603 if err := gensupport.DecodeResponse(target, res); err != nil { 8604 return nil, err 8605 } 8606 return ret, nil 8607 // { 8608 // "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.", 8609 // "flatPath": "v1/courses/{courseId}/students", 8610 // "httpMethod": "POST", 8611 // "id": "classroom.courses.students.create", 8612 // "parameterOrder": [ 8613 // "courseId" 8614 // ], 8615 // "parameters": { 8616 // "courseId": { 8617 // "description": "Identifier of the course to create the student in.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8618 // "location": "path", 8619 // "required": true, 8620 // "type": "string" 8621 // }, 8622 // "enrollmentCode": { 8623 // "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.", 8624 // "location": "query", 8625 // "type": "string" 8626 // } 8627 // }, 8628 // "path": "v1/courses/{courseId}/students", 8629 // "request": { 8630 // "$ref": "Student" 8631 // }, 8632 // "response": { 8633 // "$ref": "Student" 8634 // }, 8635 // "scopes": [ 8636 // "https://www.googleapis.com/auth/classroom.profile.emails", 8637 // "https://www.googleapis.com/auth/classroom.profile.photos", 8638 // "https://www.googleapis.com/auth/classroom.rosters" 8639 // ] 8640 // } 8641 8642} 8643 8644// method id "classroom.courses.students.delete": 8645 8646type CoursesStudentsDeleteCall struct { 8647 s *Service 8648 courseId string 8649 userId string 8650 urlParams_ gensupport.URLParams 8651 ctx_ context.Context 8652 header_ http.Header 8653} 8654 8655// Delete: Deletes a student of a course. 8656// 8657// This method returns the following error codes: 8658// 8659// * `PERMISSION_DENIED` if the requesting user is not permitted to 8660// delete 8661// students of this course or for access errors. 8662// * `NOT_FOUND` if no student of this course has the requested ID or if 8663// the 8664// course does not exist. 8665func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall { 8666 c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8667 c.courseId = courseId 8668 c.userId = userId 8669 return c 8670} 8671 8672// Fields allows partial responses to be retrieved. See 8673// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8674// for more information. 8675func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall { 8676 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8677 return c 8678} 8679 8680// Context sets the context to be used in this call's Do method. Any 8681// pending HTTP request will be aborted if the provided context is 8682// canceled. 8683func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall { 8684 c.ctx_ = ctx 8685 return c 8686} 8687 8688// Header returns an http.Header that can be modified by the caller to 8689// add HTTP headers to the request. 8690func (c *CoursesStudentsDeleteCall) Header() http.Header { 8691 if c.header_ == nil { 8692 c.header_ = make(http.Header) 8693 } 8694 return c.header_ 8695} 8696 8697func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) { 8698 reqHeaders := make(http.Header) 8699 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 8700 for k, v := range c.header_ { 8701 reqHeaders[k] = v 8702 } 8703 reqHeaders.Set("User-Agent", c.s.userAgent()) 8704 var body io.Reader = nil 8705 c.urlParams_.Set("alt", alt) 8706 c.urlParams_.Set("prettyPrint", "false") 8707 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8708 urls += "?" + c.urlParams_.Encode() 8709 req, err := http.NewRequest("DELETE", urls, body) 8710 if err != nil { 8711 return nil, err 8712 } 8713 req.Header = reqHeaders 8714 googleapi.Expand(req.URL, map[string]string{ 8715 "courseId": c.courseId, 8716 "userId": c.userId, 8717 }) 8718 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8719} 8720 8721// Do executes the "classroom.courses.students.delete" call. 8722// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8723// code is an error. Response headers are in either 8724// *Empty.ServerResponse.Header or (if a response was returned at all) 8725// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8726// check whether the returned error was because http.StatusNotModified 8727// was returned. 8728func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8729 gensupport.SetOptions(c.urlParams_, opts...) 8730 res, err := c.doRequest("json") 8731 if res != nil && res.StatusCode == http.StatusNotModified { 8732 if res.Body != nil { 8733 res.Body.Close() 8734 } 8735 return nil, &googleapi.Error{ 8736 Code: res.StatusCode, 8737 Header: res.Header, 8738 } 8739 } 8740 if err != nil { 8741 return nil, err 8742 } 8743 defer googleapi.CloseBody(res) 8744 if err := googleapi.CheckResponse(res); err != nil { 8745 return nil, err 8746 } 8747 ret := &Empty{ 8748 ServerResponse: googleapi.ServerResponse{ 8749 Header: res.Header, 8750 HTTPStatusCode: res.StatusCode, 8751 }, 8752 } 8753 target := &ret 8754 if err := gensupport.DecodeResponse(target, res); err != nil { 8755 return nil, err 8756 } 8757 return ret, nil 8758 // { 8759 // "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.", 8760 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8761 // "httpMethod": "DELETE", 8762 // "id": "classroom.courses.students.delete", 8763 // "parameterOrder": [ 8764 // "courseId", 8765 // "userId" 8766 // ], 8767 // "parameters": { 8768 // "courseId": { 8769 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8770 // "location": "path", 8771 // "required": true, 8772 // "type": "string" 8773 // }, 8774 // "userId": { 8775 // "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", 8776 // "location": "path", 8777 // "required": true, 8778 // "type": "string" 8779 // } 8780 // }, 8781 // "path": "v1/courses/{courseId}/students/{userId}", 8782 // "response": { 8783 // "$ref": "Empty" 8784 // }, 8785 // "scopes": [ 8786 // "https://www.googleapis.com/auth/classroom.rosters" 8787 // ] 8788 // } 8789 8790} 8791 8792// method id "classroom.courses.students.get": 8793 8794type CoursesStudentsGetCall struct { 8795 s *Service 8796 courseId string 8797 userId string 8798 urlParams_ gensupport.URLParams 8799 ifNoneMatch_ string 8800 ctx_ context.Context 8801 header_ http.Header 8802} 8803 8804// Get: Returns a student of a course. 8805// 8806// This method returns the following error codes: 8807// 8808// * `PERMISSION_DENIED` if the requesting user is not permitted to 8809// view 8810// students of this course or for access errors. 8811// * `NOT_FOUND` if no student of this course has the requested ID or if 8812// the 8813// course does not exist. 8814func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall { 8815 c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8816 c.courseId = courseId 8817 c.userId = userId 8818 return c 8819} 8820 8821// Fields allows partial responses to be retrieved. See 8822// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8823// for more information. 8824func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall { 8825 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8826 return c 8827} 8828 8829// IfNoneMatch sets the optional parameter which makes the operation 8830// fail if the object's ETag matches the given value. This is useful for 8831// getting updates only after the object has changed since the last 8832// request. Use googleapi.IsNotModified to check whether the response 8833// error from Do is the result of In-None-Match. 8834func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall { 8835 c.ifNoneMatch_ = entityTag 8836 return c 8837} 8838 8839// Context sets the context to be used in this call's Do method. Any 8840// pending HTTP request will be aborted if the provided context is 8841// canceled. 8842func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall { 8843 c.ctx_ = ctx 8844 return c 8845} 8846 8847// Header returns an http.Header that can be modified by the caller to 8848// add HTTP headers to the request. 8849func (c *CoursesStudentsGetCall) Header() http.Header { 8850 if c.header_ == nil { 8851 c.header_ = make(http.Header) 8852 } 8853 return c.header_ 8854} 8855 8856func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) { 8857 reqHeaders := make(http.Header) 8858 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 8859 for k, v := range c.header_ { 8860 reqHeaders[k] = v 8861 } 8862 reqHeaders.Set("User-Agent", c.s.userAgent()) 8863 if c.ifNoneMatch_ != "" { 8864 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8865 } 8866 var body io.Reader = nil 8867 c.urlParams_.Set("alt", alt) 8868 c.urlParams_.Set("prettyPrint", "false") 8869 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 8870 urls += "?" + c.urlParams_.Encode() 8871 req, err := http.NewRequest("GET", urls, body) 8872 if err != nil { 8873 return nil, err 8874 } 8875 req.Header = reqHeaders 8876 googleapi.Expand(req.URL, map[string]string{ 8877 "courseId": c.courseId, 8878 "userId": c.userId, 8879 }) 8880 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8881} 8882 8883// Do executes the "classroom.courses.students.get" call. 8884// Exactly one of *Student or error will be non-nil. Any non-2xx status 8885// code is an error. Response headers are in either 8886// *Student.ServerResponse.Header or (if a response was returned at all) 8887// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8888// check whether the returned error was because http.StatusNotModified 8889// was returned. 8890func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) { 8891 gensupport.SetOptions(c.urlParams_, opts...) 8892 res, err := c.doRequest("json") 8893 if res != nil && res.StatusCode == http.StatusNotModified { 8894 if res.Body != nil { 8895 res.Body.Close() 8896 } 8897 return nil, &googleapi.Error{ 8898 Code: res.StatusCode, 8899 Header: res.Header, 8900 } 8901 } 8902 if err != nil { 8903 return nil, err 8904 } 8905 defer googleapi.CloseBody(res) 8906 if err := googleapi.CheckResponse(res); err != nil { 8907 return nil, err 8908 } 8909 ret := &Student{ 8910 ServerResponse: googleapi.ServerResponse{ 8911 Header: res.Header, 8912 HTTPStatusCode: res.StatusCode, 8913 }, 8914 } 8915 target := &ret 8916 if err := gensupport.DecodeResponse(target, res); err != nil { 8917 return nil, err 8918 } 8919 return ret, nil 8920 // { 8921 // "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.", 8922 // "flatPath": "v1/courses/{courseId}/students/{userId}", 8923 // "httpMethod": "GET", 8924 // "id": "classroom.courses.students.get", 8925 // "parameterOrder": [ 8926 // "courseId", 8927 // "userId" 8928 // ], 8929 // "parameters": { 8930 // "courseId": { 8931 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 8932 // "location": "path", 8933 // "required": true, 8934 // "type": "string" 8935 // }, 8936 // "userId": { 8937 // "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", 8938 // "location": "path", 8939 // "required": true, 8940 // "type": "string" 8941 // } 8942 // }, 8943 // "path": "v1/courses/{courseId}/students/{userId}", 8944 // "response": { 8945 // "$ref": "Student" 8946 // }, 8947 // "scopes": [ 8948 // "https://www.googleapis.com/auth/classroom.profile.emails", 8949 // "https://www.googleapis.com/auth/classroom.profile.photos", 8950 // "https://www.googleapis.com/auth/classroom.rosters", 8951 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 8952 // ] 8953 // } 8954 8955} 8956 8957// method id "classroom.courses.students.list": 8958 8959type CoursesStudentsListCall struct { 8960 s *Service 8961 courseId string 8962 urlParams_ gensupport.URLParams 8963 ifNoneMatch_ string 8964 ctx_ context.Context 8965 header_ http.Header 8966} 8967 8968// List: Returns a list of students of this course that the requester 8969// is permitted to view. 8970// 8971// This method returns the following error codes: 8972// 8973// * `NOT_FOUND` if the course does not exist. 8974// * `PERMISSION_DENIED` for access errors. 8975func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall { 8976 c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8977 c.courseId = courseId 8978 return c 8979} 8980 8981// PageSize sets the optional parameter "pageSize": Maximum number of 8982// items to return. Zero means no maximum. 8983// 8984// The server may return fewer than the specified number of results. 8985func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall { 8986 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8987 return c 8988} 8989 8990// PageToken sets the optional parameter "pageToken": 8991// nextPageToken 8992// value returned from a previous 8993// list call, indicating that 8994// the subsequent page of results should be returned. 8995// 8996// The list request must be 8997// otherwise identical to the one that resulted in this token. 8998func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall { 8999 c.urlParams_.Set("pageToken", pageToken) 9000 return c 9001} 9002 9003// Fields allows partial responses to be retrieved. See 9004// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9005// for more information. 9006func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall { 9007 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9008 return c 9009} 9010 9011// IfNoneMatch sets the optional parameter which makes the operation 9012// fail if the object's ETag matches the given value. This is useful for 9013// getting updates only after the object has changed since the last 9014// request. Use googleapi.IsNotModified to check whether the response 9015// error from Do is the result of In-None-Match. 9016func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall { 9017 c.ifNoneMatch_ = entityTag 9018 return c 9019} 9020 9021// Context sets the context to be used in this call's Do method. Any 9022// pending HTTP request will be aborted if the provided context is 9023// canceled. 9024func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall { 9025 c.ctx_ = ctx 9026 return c 9027} 9028 9029// Header returns an http.Header that can be modified by the caller to 9030// add HTTP headers to the request. 9031func (c *CoursesStudentsListCall) Header() http.Header { 9032 if c.header_ == nil { 9033 c.header_ = make(http.Header) 9034 } 9035 return c.header_ 9036} 9037 9038func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) { 9039 reqHeaders := make(http.Header) 9040 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 9041 for k, v := range c.header_ { 9042 reqHeaders[k] = v 9043 } 9044 reqHeaders.Set("User-Agent", c.s.userAgent()) 9045 if c.ifNoneMatch_ != "" { 9046 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9047 } 9048 var body io.Reader = nil 9049 c.urlParams_.Set("alt", alt) 9050 c.urlParams_.Set("prettyPrint", "false") 9051 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9052 urls += "?" + c.urlParams_.Encode() 9053 req, err := http.NewRequest("GET", urls, body) 9054 if err != nil { 9055 return nil, err 9056 } 9057 req.Header = reqHeaders 9058 googleapi.Expand(req.URL, map[string]string{ 9059 "courseId": c.courseId, 9060 }) 9061 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9062} 9063 9064// Do executes the "classroom.courses.students.list" call. 9065// Exactly one of *ListStudentsResponse or error will be non-nil. Any 9066// non-2xx status code is an error. Response headers are in either 9067// *ListStudentsResponse.ServerResponse.Header or (if a response was 9068// returned at all) in error.(*googleapi.Error).Header. Use 9069// googleapi.IsNotModified to check whether the returned error was 9070// because http.StatusNotModified was returned. 9071func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) { 9072 gensupport.SetOptions(c.urlParams_, opts...) 9073 res, err := c.doRequest("json") 9074 if res != nil && res.StatusCode == http.StatusNotModified { 9075 if res.Body != nil { 9076 res.Body.Close() 9077 } 9078 return nil, &googleapi.Error{ 9079 Code: res.StatusCode, 9080 Header: res.Header, 9081 } 9082 } 9083 if err != nil { 9084 return nil, err 9085 } 9086 defer googleapi.CloseBody(res) 9087 if err := googleapi.CheckResponse(res); err != nil { 9088 return nil, err 9089 } 9090 ret := &ListStudentsResponse{ 9091 ServerResponse: googleapi.ServerResponse{ 9092 Header: res.Header, 9093 HTTPStatusCode: res.StatusCode, 9094 }, 9095 } 9096 target := &ret 9097 if err := gensupport.DecodeResponse(target, res); err != nil { 9098 return nil, err 9099 } 9100 return ret, nil 9101 // { 9102 // "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.", 9103 // "flatPath": "v1/courses/{courseId}/students", 9104 // "httpMethod": "GET", 9105 // "id": "classroom.courses.students.list", 9106 // "parameterOrder": [ 9107 // "courseId" 9108 // ], 9109 // "parameters": { 9110 // "courseId": { 9111 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9112 // "location": "path", 9113 // "required": true, 9114 // "type": "string" 9115 // }, 9116 // "pageSize": { 9117 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9118 // "format": "int32", 9119 // "location": "query", 9120 // "type": "integer" 9121 // }, 9122 // "pageToken": { 9123 // "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.", 9124 // "location": "query", 9125 // "type": "string" 9126 // } 9127 // }, 9128 // "path": "v1/courses/{courseId}/students", 9129 // "response": { 9130 // "$ref": "ListStudentsResponse" 9131 // }, 9132 // "scopes": [ 9133 // "https://www.googleapis.com/auth/classroom.profile.emails", 9134 // "https://www.googleapis.com/auth/classroom.profile.photos", 9135 // "https://www.googleapis.com/auth/classroom.rosters", 9136 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9137 // ] 9138 // } 9139 9140} 9141 9142// Pages invokes f for each page of results. 9143// A non-nil error returned from f will halt the iteration. 9144// The provided context supersedes any context provided to the Context method. 9145func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error { 9146 c.ctx_ = ctx 9147 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9148 for { 9149 x, err := c.Do() 9150 if err != nil { 9151 return err 9152 } 9153 if err := f(x); err != nil { 9154 return err 9155 } 9156 if x.NextPageToken == "" { 9157 return nil 9158 } 9159 c.PageToken(x.NextPageToken) 9160 } 9161} 9162 9163// method id "classroom.courses.teachers.create": 9164 9165type CoursesTeachersCreateCall struct { 9166 s *Service 9167 courseId string 9168 teacher *Teacher 9169 urlParams_ gensupport.URLParams 9170 ctx_ context.Context 9171 header_ http.Header 9172} 9173 9174// Create: Creates a teacher of a course. 9175// 9176// This method returns the following error codes: 9177// 9178// * `PERMISSION_DENIED` if the requesting user is not permitted to 9179// create 9180// teachers in this course or for access errors. 9181// * `NOT_FOUND` if the requested course ID does not exist. 9182// * `FAILED_PRECONDITION` if the requested user's account is 9183// disabled, 9184// for the following request errors: 9185// * CourseMemberLimitReached 9186// * CourseNotModifiable 9187// * CourseTeacherLimitReached 9188// * UserGroupsMembershipLimitReached 9189// * `ALREADY_EXISTS` if the user is already a teacher or student in 9190// the 9191// course. 9192func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall { 9193 c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9194 c.courseId = courseId 9195 c.teacher = teacher 9196 return c 9197} 9198 9199// Fields allows partial responses to be retrieved. See 9200// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9201// for more information. 9202func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall { 9203 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9204 return c 9205} 9206 9207// Context sets the context to be used in this call's Do method. Any 9208// pending HTTP request will be aborted if the provided context is 9209// canceled. 9210func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall { 9211 c.ctx_ = ctx 9212 return c 9213} 9214 9215// Header returns an http.Header that can be modified by the caller to 9216// add HTTP headers to the request. 9217func (c *CoursesTeachersCreateCall) Header() http.Header { 9218 if c.header_ == nil { 9219 c.header_ = make(http.Header) 9220 } 9221 return c.header_ 9222} 9223 9224func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) { 9225 reqHeaders := make(http.Header) 9226 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 9227 for k, v := range c.header_ { 9228 reqHeaders[k] = v 9229 } 9230 reqHeaders.Set("User-Agent", c.s.userAgent()) 9231 var body io.Reader = nil 9232 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher) 9233 if err != nil { 9234 return nil, err 9235 } 9236 reqHeaders.Set("Content-Type", "application/json") 9237 c.urlParams_.Set("alt", alt) 9238 c.urlParams_.Set("prettyPrint", "false") 9239 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9240 urls += "?" + c.urlParams_.Encode() 9241 req, err := http.NewRequest("POST", urls, body) 9242 if err != nil { 9243 return nil, err 9244 } 9245 req.Header = reqHeaders 9246 googleapi.Expand(req.URL, map[string]string{ 9247 "courseId": c.courseId, 9248 }) 9249 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9250} 9251 9252// Do executes the "classroom.courses.teachers.create" call. 9253// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9254// code is an error. Response headers are in either 9255// *Teacher.ServerResponse.Header or (if a response was returned at all) 9256// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9257// check whether the returned error was because http.StatusNotModified 9258// was returned. 9259func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9260 gensupport.SetOptions(c.urlParams_, opts...) 9261 res, err := c.doRequest("json") 9262 if res != nil && res.StatusCode == http.StatusNotModified { 9263 if res.Body != nil { 9264 res.Body.Close() 9265 } 9266 return nil, &googleapi.Error{ 9267 Code: res.StatusCode, 9268 Header: res.Header, 9269 } 9270 } 9271 if err != nil { 9272 return nil, err 9273 } 9274 defer googleapi.CloseBody(res) 9275 if err := googleapi.CheckResponse(res); err != nil { 9276 return nil, err 9277 } 9278 ret := &Teacher{ 9279 ServerResponse: googleapi.ServerResponse{ 9280 Header: res.Header, 9281 HTTPStatusCode: res.StatusCode, 9282 }, 9283 } 9284 target := &ret 9285 if err := gensupport.DecodeResponse(target, res); err != nil { 9286 return nil, err 9287 } 9288 return ret, nil 9289 // { 9290 // "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.", 9291 // "flatPath": "v1/courses/{courseId}/teachers", 9292 // "httpMethod": "POST", 9293 // "id": "classroom.courses.teachers.create", 9294 // "parameterOrder": [ 9295 // "courseId" 9296 // ], 9297 // "parameters": { 9298 // "courseId": { 9299 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9300 // "location": "path", 9301 // "required": true, 9302 // "type": "string" 9303 // } 9304 // }, 9305 // "path": "v1/courses/{courseId}/teachers", 9306 // "request": { 9307 // "$ref": "Teacher" 9308 // }, 9309 // "response": { 9310 // "$ref": "Teacher" 9311 // }, 9312 // "scopes": [ 9313 // "https://www.googleapis.com/auth/classroom.profile.emails", 9314 // "https://www.googleapis.com/auth/classroom.profile.photos", 9315 // "https://www.googleapis.com/auth/classroom.rosters" 9316 // ] 9317 // } 9318 9319} 9320 9321// method id "classroom.courses.teachers.delete": 9322 9323type CoursesTeachersDeleteCall struct { 9324 s *Service 9325 courseId string 9326 userId string 9327 urlParams_ gensupport.URLParams 9328 ctx_ context.Context 9329 header_ http.Header 9330} 9331 9332// Delete: Deletes a teacher of a course. 9333// 9334// This method returns the following error codes: 9335// 9336// * `PERMISSION_DENIED` if the requesting user is not permitted to 9337// delete 9338// teachers of this course or for access errors. 9339// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9340// the 9341// course does not exist. 9342// * `FAILED_PRECONDITION` if the requested ID belongs to the primary 9343// teacher 9344// of this course. 9345func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall { 9346 c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9347 c.courseId = courseId 9348 c.userId = userId 9349 return c 9350} 9351 9352// Fields allows partial responses to be retrieved. See 9353// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9354// for more information. 9355func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall { 9356 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9357 return c 9358} 9359 9360// Context sets the context to be used in this call's Do method. Any 9361// pending HTTP request will be aborted if the provided context is 9362// canceled. 9363func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall { 9364 c.ctx_ = ctx 9365 return c 9366} 9367 9368// Header returns an http.Header that can be modified by the caller to 9369// add HTTP headers to the request. 9370func (c *CoursesTeachersDeleteCall) Header() http.Header { 9371 if c.header_ == nil { 9372 c.header_ = make(http.Header) 9373 } 9374 return c.header_ 9375} 9376 9377func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) { 9378 reqHeaders := make(http.Header) 9379 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 9380 for k, v := range c.header_ { 9381 reqHeaders[k] = v 9382 } 9383 reqHeaders.Set("User-Agent", c.s.userAgent()) 9384 var body io.Reader = nil 9385 c.urlParams_.Set("alt", alt) 9386 c.urlParams_.Set("prettyPrint", "false") 9387 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9388 urls += "?" + c.urlParams_.Encode() 9389 req, err := http.NewRequest("DELETE", urls, body) 9390 if err != nil { 9391 return nil, err 9392 } 9393 req.Header = reqHeaders 9394 googleapi.Expand(req.URL, map[string]string{ 9395 "courseId": c.courseId, 9396 "userId": c.userId, 9397 }) 9398 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9399} 9400 9401// Do executes the "classroom.courses.teachers.delete" call. 9402// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9403// code is an error. Response headers are in either 9404// *Empty.ServerResponse.Header or (if a response was returned at all) 9405// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9406// check whether the returned error was because http.StatusNotModified 9407// was returned. 9408func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9409 gensupport.SetOptions(c.urlParams_, opts...) 9410 res, err := c.doRequest("json") 9411 if res != nil && res.StatusCode == http.StatusNotModified { 9412 if res.Body != nil { 9413 res.Body.Close() 9414 } 9415 return nil, &googleapi.Error{ 9416 Code: res.StatusCode, 9417 Header: res.Header, 9418 } 9419 } 9420 if err != nil { 9421 return nil, err 9422 } 9423 defer googleapi.CloseBody(res) 9424 if err := googleapi.CheckResponse(res); err != nil { 9425 return nil, err 9426 } 9427 ret := &Empty{ 9428 ServerResponse: googleapi.ServerResponse{ 9429 Header: res.Header, 9430 HTTPStatusCode: res.StatusCode, 9431 }, 9432 } 9433 target := &ret 9434 if err := gensupport.DecodeResponse(target, res); err != nil { 9435 return nil, err 9436 } 9437 return ret, nil 9438 // { 9439 // "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.", 9440 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9441 // "httpMethod": "DELETE", 9442 // "id": "classroom.courses.teachers.delete", 9443 // "parameterOrder": [ 9444 // "courseId", 9445 // "userId" 9446 // ], 9447 // "parameters": { 9448 // "courseId": { 9449 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9450 // "location": "path", 9451 // "required": true, 9452 // "type": "string" 9453 // }, 9454 // "userId": { 9455 // "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", 9456 // "location": "path", 9457 // "required": true, 9458 // "type": "string" 9459 // } 9460 // }, 9461 // "path": "v1/courses/{courseId}/teachers/{userId}", 9462 // "response": { 9463 // "$ref": "Empty" 9464 // }, 9465 // "scopes": [ 9466 // "https://www.googleapis.com/auth/classroom.rosters" 9467 // ] 9468 // } 9469 9470} 9471 9472// method id "classroom.courses.teachers.get": 9473 9474type CoursesTeachersGetCall struct { 9475 s *Service 9476 courseId string 9477 userId string 9478 urlParams_ gensupport.URLParams 9479 ifNoneMatch_ string 9480 ctx_ context.Context 9481 header_ http.Header 9482} 9483 9484// Get: Returns a teacher of a course. 9485// 9486// This method returns the following error codes: 9487// 9488// * `PERMISSION_DENIED` if the requesting user is not permitted to 9489// view 9490// teachers of this course or for access errors. 9491// * `NOT_FOUND` if no teacher of this course has the requested ID or if 9492// the 9493// course does not exist. 9494func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall { 9495 c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9496 c.courseId = courseId 9497 c.userId = userId 9498 return c 9499} 9500 9501// Fields allows partial responses to be retrieved. See 9502// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9503// for more information. 9504func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall { 9505 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9506 return c 9507} 9508 9509// IfNoneMatch sets the optional parameter which makes the operation 9510// fail if the object's ETag matches the given value. This is useful for 9511// getting updates only after the object has changed since the last 9512// request. Use googleapi.IsNotModified to check whether the response 9513// error from Do is the result of In-None-Match. 9514func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall { 9515 c.ifNoneMatch_ = entityTag 9516 return c 9517} 9518 9519// Context sets the context to be used in this call's Do method. Any 9520// pending HTTP request will be aborted if the provided context is 9521// canceled. 9522func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall { 9523 c.ctx_ = ctx 9524 return c 9525} 9526 9527// Header returns an http.Header that can be modified by the caller to 9528// add HTTP headers to the request. 9529func (c *CoursesTeachersGetCall) Header() http.Header { 9530 if c.header_ == nil { 9531 c.header_ = make(http.Header) 9532 } 9533 return c.header_ 9534} 9535 9536func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) { 9537 reqHeaders := make(http.Header) 9538 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 9539 for k, v := range c.header_ { 9540 reqHeaders[k] = v 9541 } 9542 reqHeaders.Set("User-Agent", c.s.userAgent()) 9543 if c.ifNoneMatch_ != "" { 9544 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9545 } 9546 var body io.Reader = nil 9547 c.urlParams_.Set("alt", alt) 9548 c.urlParams_.Set("prettyPrint", "false") 9549 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9550 urls += "?" + c.urlParams_.Encode() 9551 req, err := http.NewRequest("GET", urls, body) 9552 if err != nil { 9553 return nil, err 9554 } 9555 req.Header = reqHeaders 9556 googleapi.Expand(req.URL, map[string]string{ 9557 "courseId": c.courseId, 9558 "userId": c.userId, 9559 }) 9560 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9561} 9562 9563// Do executes the "classroom.courses.teachers.get" call. 9564// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9565// code is an error. Response headers are in either 9566// *Teacher.ServerResponse.Header or (if a response was returned at all) 9567// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9568// check whether the returned error was because http.StatusNotModified 9569// was returned. 9570func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9571 gensupport.SetOptions(c.urlParams_, opts...) 9572 res, err := c.doRequest("json") 9573 if res != nil && res.StatusCode == http.StatusNotModified { 9574 if res.Body != nil { 9575 res.Body.Close() 9576 } 9577 return nil, &googleapi.Error{ 9578 Code: res.StatusCode, 9579 Header: res.Header, 9580 } 9581 } 9582 if err != nil { 9583 return nil, err 9584 } 9585 defer googleapi.CloseBody(res) 9586 if err := googleapi.CheckResponse(res); err != nil { 9587 return nil, err 9588 } 9589 ret := &Teacher{ 9590 ServerResponse: googleapi.ServerResponse{ 9591 Header: res.Header, 9592 HTTPStatusCode: res.StatusCode, 9593 }, 9594 } 9595 target := &ret 9596 if err := gensupport.DecodeResponse(target, res); err != nil { 9597 return nil, err 9598 } 9599 return ret, nil 9600 // { 9601 // "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.", 9602 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 9603 // "httpMethod": "GET", 9604 // "id": "classroom.courses.teachers.get", 9605 // "parameterOrder": [ 9606 // "courseId", 9607 // "userId" 9608 // ], 9609 // "parameters": { 9610 // "courseId": { 9611 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9612 // "location": "path", 9613 // "required": true, 9614 // "type": "string" 9615 // }, 9616 // "userId": { 9617 // "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", 9618 // "location": "path", 9619 // "required": true, 9620 // "type": "string" 9621 // } 9622 // }, 9623 // "path": "v1/courses/{courseId}/teachers/{userId}", 9624 // "response": { 9625 // "$ref": "Teacher" 9626 // }, 9627 // "scopes": [ 9628 // "https://www.googleapis.com/auth/classroom.profile.emails", 9629 // "https://www.googleapis.com/auth/classroom.profile.photos", 9630 // "https://www.googleapis.com/auth/classroom.rosters", 9631 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9632 // ] 9633 // } 9634 9635} 9636 9637// method id "classroom.courses.teachers.list": 9638 9639type CoursesTeachersListCall struct { 9640 s *Service 9641 courseId string 9642 urlParams_ gensupport.URLParams 9643 ifNoneMatch_ string 9644 ctx_ context.Context 9645 header_ http.Header 9646} 9647 9648// List: Returns a list of teachers of this course that the requester 9649// is permitted to view. 9650// 9651// This method returns the following error codes: 9652// 9653// * `NOT_FOUND` if the course does not exist. 9654// * `PERMISSION_DENIED` for access errors. 9655func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall { 9656 c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9657 c.courseId = courseId 9658 return c 9659} 9660 9661// PageSize sets the optional parameter "pageSize": Maximum number of 9662// items to return. Zero means no maximum. 9663// 9664// The server may return fewer than the specified number of results. 9665func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall { 9666 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9667 return c 9668} 9669 9670// PageToken sets the optional parameter "pageToken": 9671// nextPageToken 9672// value returned from a previous 9673// list call, indicating that 9674// the subsequent page of results should be returned. 9675// 9676// The list request must be 9677// otherwise identical to the one that resulted in this token. 9678func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall { 9679 c.urlParams_.Set("pageToken", pageToken) 9680 return c 9681} 9682 9683// Fields allows partial responses to be retrieved. See 9684// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9685// for more information. 9686func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall { 9687 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9688 return c 9689} 9690 9691// IfNoneMatch sets the optional parameter which makes the operation 9692// fail if the object's ETag matches the given value. This is useful for 9693// getting updates only after the object has changed since the last 9694// request. Use googleapi.IsNotModified to check whether the response 9695// error from Do is the result of In-None-Match. 9696func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall { 9697 c.ifNoneMatch_ = entityTag 9698 return c 9699} 9700 9701// Context sets the context to be used in this call's Do method. Any 9702// pending HTTP request will be aborted if the provided context is 9703// canceled. 9704func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall { 9705 c.ctx_ = ctx 9706 return c 9707} 9708 9709// Header returns an http.Header that can be modified by the caller to 9710// add HTTP headers to the request. 9711func (c *CoursesTeachersListCall) Header() http.Header { 9712 if c.header_ == nil { 9713 c.header_ = make(http.Header) 9714 } 9715 return c.header_ 9716} 9717 9718func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) { 9719 reqHeaders := make(http.Header) 9720 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 9721 for k, v := range c.header_ { 9722 reqHeaders[k] = v 9723 } 9724 reqHeaders.Set("User-Agent", c.s.userAgent()) 9725 if c.ifNoneMatch_ != "" { 9726 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9727 } 9728 var body io.Reader = nil 9729 c.urlParams_.Set("alt", alt) 9730 c.urlParams_.Set("prettyPrint", "false") 9731 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9732 urls += "?" + c.urlParams_.Encode() 9733 req, err := http.NewRequest("GET", urls, body) 9734 if err != nil { 9735 return nil, err 9736 } 9737 req.Header = reqHeaders 9738 googleapi.Expand(req.URL, map[string]string{ 9739 "courseId": c.courseId, 9740 }) 9741 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9742} 9743 9744// Do executes the "classroom.courses.teachers.list" call. 9745// Exactly one of *ListTeachersResponse or error will be non-nil. Any 9746// non-2xx status code is an error. Response headers are in either 9747// *ListTeachersResponse.ServerResponse.Header or (if a response was 9748// returned at all) in error.(*googleapi.Error).Header. Use 9749// googleapi.IsNotModified to check whether the returned error was 9750// because http.StatusNotModified was returned. 9751func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) { 9752 gensupport.SetOptions(c.urlParams_, opts...) 9753 res, err := c.doRequest("json") 9754 if res != nil && res.StatusCode == http.StatusNotModified { 9755 if res.Body != nil { 9756 res.Body.Close() 9757 } 9758 return nil, &googleapi.Error{ 9759 Code: res.StatusCode, 9760 Header: res.Header, 9761 } 9762 } 9763 if err != nil { 9764 return nil, err 9765 } 9766 defer googleapi.CloseBody(res) 9767 if err := googleapi.CheckResponse(res); err != nil { 9768 return nil, err 9769 } 9770 ret := &ListTeachersResponse{ 9771 ServerResponse: googleapi.ServerResponse{ 9772 Header: res.Header, 9773 HTTPStatusCode: res.StatusCode, 9774 }, 9775 } 9776 target := &ret 9777 if err := gensupport.DecodeResponse(target, res); err != nil { 9778 return nil, err 9779 } 9780 return ret, nil 9781 // { 9782 // "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.", 9783 // "flatPath": "v1/courses/{courseId}/teachers", 9784 // "httpMethod": "GET", 9785 // "id": "classroom.courses.teachers.list", 9786 // "parameterOrder": [ 9787 // "courseId" 9788 // ], 9789 // "parameters": { 9790 // "courseId": { 9791 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9792 // "location": "path", 9793 // "required": true, 9794 // "type": "string" 9795 // }, 9796 // "pageSize": { 9797 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 9798 // "format": "int32", 9799 // "location": "query", 9800 // "type": "integer" 9801 // }, 9802 // "pageToken": { 9803 // "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.", 9804 // "location": "query", 9805 // "type": "string" 9806 // } 9807 // }, 9808 // "path": "v1/courses/{courseId}/teachers", 9809 // "response": { 9810 // "$ref": "ListTeachersResponse" 9811 // }, 9812 // "scopes": [ 9813 // "https://www.googleapis.com/auth/classroom.profile.emails", 9814 // "https://www.googleapis.com/auth/classroom.profile.photos", 9815 // "https://www.googleapis.com/auth/classroom.rosters", 9816 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9817 // ] 9818 // } 9819 9820} 9821 9822// Pages invokes f for each page of results. 9823// A non-nil error returned from f will halt the iteration. 9824// The provided context supersedes any context provided to the Context method. 9825func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error { 9826 c.ctx_ = ctx 9827 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9828 for { 9829 x, err := c.Do() 9830 if err != nil { 9831 return err 9832 } 9833 if err := f(x); err != nil { 9834 return err 9835 } 9836 if x.NextPageToken == "" { 9837 return nil 9838 } 9839 c.PageToken(x.NextPageToken) 9840 } 9841} 9842 9843// method id "classroom.courses.topics.create": 9844 9845type CoursesTopicsCreateCall struct { 9846 s *Service 9847 courseId string 9848 topic *Topic 9849 urlParams_ gensupport.URLParams 9850 ctx_ context.Context 9851 header_ http.Header 9852} 9853 9854// Create: Creates a topic. 9855// 9856// This method returns the following error codes: 9857// 9858// * `PERMISSION_DENIED` if the requesting user is not permitted to 9859// access the 9860// requested course, create a topic in the requested course, 9861// or for access errors. 9862// * `INVALID_ARGUMENT` if the request is malformed. 9863// * `NOT_FOUND` if the requested course does not exist. 9864func (r *CoursesTopicsService) Create(courseId string, topic *Topic) *CoursesTopicsCreateCall { 9865 c := &CoursesTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9866 c.courseId = courseId 9867 c.topic = topic 9868 return c 9869} 9870 9871// Fields allows partial responses to be retrieved. See 9872// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9873// for more information. 9874func (c *CoursesTopicsCreateCall) Fields(s ...googleapi.Field) *CoursesTopicsCreateCall { 9875 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9876 return c 9877} 9878 9879// Context sets the context to be used in this call's Do method. Any 9880// pending HTTP request will be aborted if the provided context is 9881// canceled. 9882func (c *CoursesTopicsCreateCall) Context(ctx context.Context) *CoursesTopicsCreateCall { 9883 c.ctx_ = ctx 9884 return c 9885} 9886 9887// Header returns an http.Header that can be modified by the caller to 9888// add HTTP headers to the request. 9889func (c *CoursesTopicsCreateCall) Header() http.Header { 9890 if c.header_ == nil { 9891 c.header_ = make(http.Header) 9892 } 9893 return c.header_ 9894} 9895 9896func (c *CoursesTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 9897 reqHeaders := make(http.Header) 9898 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 9899 for k, v := range c.header_ { 9900 reqHeaders[k] = v 9901 } 9902 reqHeaders.Set("User-Agent", c.s.userAgent()) 9903 var body io.Reader = nil 9904 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 9905 if err != nil { 9906 return nil, err 9907 } 9908 reqHeaders.Set("Content-Type", "application/json") 9909 c.urlParams_.Set("alt", alt) 9910 c.urlParams_.Set("prettyPrint", "false") 9911 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 9912 urls += "?" + c.urlParams_.Encode() 9913 req, err := http.NewRequest("POST", urls, body) 9914 if err != nil { 9915 return nil, err 9916 } 9917 req.Header = reqHeaders 9918 googleapi.Expand(req.URL, map[string]string{ 9919 "courseId": c.courseId, 9920 }) 9921 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9922} 9923 9924// Do executes the "classroom.courses.topics.create" call. 9925// Exactly one of *Topic or error will be non-nil. Any non-2xx status 9926// code is an error. Response headers are in either 9927// *Topic.ServerResponse.Header or (if a response was returned at all) 9928// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9929// check whether the returned error was because http.StatusNotModified 9930// was returned. 9931func (c *CoursesTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 9932 gensupport.SetOptions(c.urlParams_, opts...) 9933 res, err := c.doRequest("json") 9934 if res != nil && res.StatusCode == http.StatusNotModified { 9935 if res.Body != nil { 9936 res.Body.Close() 9937 } 9938 return nil, &googleapi.Error{ 9939 Code: res.StatusCode, 9940 Header: res.Header, 9941 } 9942 } 9943 if err != nil { 9944 return nil, err 9945 } 9946 defer googleapi.CloseBody(res) 9947 if err := googleapi.CheckResponse(res); err != nil { 9948 return nil, err 9949 } 9950 ret := &Topic{ 9951 ServerResponse: googleapi.ServerResponse{ 9952 Header: res.Header, 9953 HTTPStatusCode: res.StatusCode, 9954 }, 9955 } 9956 target := &ret 9957 if err := gensupport.DecodeResponse(target, res); err != nil { 9958 return nil, err 9959 } 9960 return ret, nil 9961 // { 9962 // "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.", 9963 // "flatPath": "v1/courses/{courseId}/topics", 9964 // "httpMethod": "POST", 9965 // "id": "classroom.courses.topics.create", 9966 // "parameterOrder": [ 9967 // "courseId" 9968 // ], 9969 // "parameters": { 9970 // "courseId": { 9971 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 9972 // "location": "path", 9973 // "required": true, 9974 // "type": "string" 9975 // } 9976 // }, 9977 // "path": "v1/courses/{courseId}/topics", 9978 // "request": { 9979 // "$ref": "Topic" 9980 // }, 9981 // "response": { 9982 // "$ref": "Topic" 9983 // }, 9984 // "scopes": [ 9985 // "https://www.googleapis.com/auth/classroom.topics" 9986 // ] 9987 // } 9988 9989} 9990 9991// method id "classroom.courses.topics.delete": 9992 9993type CoursesTopicsDeleteCall struct { 9994 s *Service 9995 courseId string 9996 id string 9997 urlParams_ gensupport.URLParams 9998 ctx_ context.Context 9999 header_ http.Header 10000} 10001 10002// Delete: Deletes a topic. 10003// 10004// This method returns the following error codes: 10005// 10006// * `PERMISSION_DENIED` if the requesting user is not allowed to delete 10007// the 10008// requested topic or for access errors. 10009// * `FAILED_PRECONDITION` if the requested topic has already 10010// been 10011// deleted. 10012// * `NOT_FOUND` if no course or topic exists with the requested ID. 10013func (r *CoursesTopicsService) Delete(courseId string, id string) *CoursesTopicsDeleteCall { 10014 c := &CoursesTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10015 c.courseId = courseId 10016 c.id = id 10017 return c 10018} 10019 10020// Fields allows partial responses to be retrieved. See 10021// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10022// for more information. 10023func (c *CoursesTopicsDeleteCall) Fields(s ...googleapi.Field) *CoursesTopicsDeleteCall { 10024 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10025 return c 10026} 10027 10028// Context sets the context to be used in this call's Do method. Any 10029// pending HTTP request will be aborted if the provided context is 10030// canceled. 10031func (c *CoursesTopicsDeleteCall) Context(ctx context.Context) *CoursesTopicsDeleteCall { 10032 c.ctx_ = ctx 10033 return c 10034} 10035 10036// Header returns an http.Header that can be modified by the caller to 10037// add HTTP headers to the request. 10038func (c *CoursesTopicsDeleteCall) Header() http.Header { 10039 if c.header_ == nil { 10040 c.header_ = make(http.Header) 10041 } 10042 return c.header_ 10043} 10044 10045func (c *CoursesTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 10046 reqHeaders := make(http.Header) 10047 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 10048 for k, v := range c.header_ { 10049 reqHeaders[k] = v 10050 } 10051 reqHeaders.Set("User-Agent", c.s.userAgent()) 10052 var body io.Reader = nil 10053 c.urlParams_.Set("alt", alt) 10054 c.urlParams_.Set("prettyPrint", "false") 10055 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10056 urls += "?" + c.urlParams_.Encode() 10057 req, err := http.NewRequest("DELETE", urls, body) 10058 if err != nil { 10059 return nil, err 10060 } 10061 req.Header = reqHeaders 10062 googleapi.Expand(req.URL, map[string]string{ 10063 "courseId": c.courseId, 10064 "id": c.id, 10065 }) 10066 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10067} 10068 10069// Do executes the "classroom.courses.topics.delete" call. 10070// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10071// code is an error. Response headers are in either 10072// *Empty.ServerResponse.Header or (if a response was returned at all) 10073// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10074// check whether the returned error was because http.StatusNotModified 10075// was returned. 10076func (c *CoursesTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10077 gensupport.SetOptions(c.urlParams_, opts...) 10078 res, err := c.doRequest("json") 10079 if res != nil && res.StatusCode == http.StatusNotModified { 10080 if res.Body != nil { 10081 res.Body.Close() 10082 } 10083 return nil, &googleapi.Error{ 10084 Code: res.StatusCode, 10085 Header: res.Header, 10086 } 10087 } 10088 if err != nil { 10089 return nil, err 10090 } 10091 defer googleapi.CloseBody(res) 10092 if err := googleapi.CheckResponse(res); err != nil { 10093 return nil, err 10094 } 10095 ret := &Empty{ 10096 ServerResponse: googleapi.ServerResponse{ 10097 Header: res.Header, 10098 HTTPStatusCode: res.StatusCode, 10099 }, 10100 } 10101 target := &ret 10102 if err := gensupport.DecodeResponse(target, res); err != nil { 10103 return nil, err 10104 } 10105 return ret, nil 10106 // { 10107 // "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.", 10108 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10109 // "httpMethod": "DELETE", 10110 // "id": "classroom.courses.topics.delete", 10111 // "parameterOrder": [ 10112 // "courseId", 10113 // "id" 10114 // ], 10115 // "parameters": { 10116 // "courseId": { 10117 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10118 // "location": "path", 10119 // "required": true, 10120 // "type": "string" 10121 // }, 10122 // "id": { 10123 // "description": "Identifier of the topic to delete.", 10124 // "location": "path", 10125 // "required": true, 10126 // "type": "string" 10127 // } 10128 // }, 10129 // "path": "v1/courses/{courseId}/topics/{id}", 10130 // "response": { 10131 // "$ref": "Empty" 10132 // }, 10133 // "scopes": [ 10134 // "https://www.googleapis.com/auth/classroom.topics" 10135 // ] 10136 // } 10137 10138} 10139 10140// method id "classroom.courses.topics.get": 10141 10142type CoursesTopicsGetCall struct { 10143 s *Service 10144 courseId string 10145 id string 10146 urlParams_ gensupport.URLParams 10147 ifNoneMatch_ string 10148 ctx_ context.Context 10149 header_ http.Header 10150} 10151 10152// Get: Returns a topic. 10153// 10154// This method returns the following error codes: 10155// 10156// * `PERMISSION_DENIED` if the requesting user is not permitted to 10157// access the 10158// requested course or topic, or for access errors. 10159// * `INVALID_ARGUMENT` if the request is malformed. 10160// * `NOT_FOUND` if the requested course or topic does not exist. 10161func (r *CoursesTopicsService) Get(courseId string, id string) *CoursesTopicsGetCall { 10162 c := &CoursesTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10163 c.courseId = courseId 10164 c.id = id 10165 return c 10166} 10167 10168// Fields allows partial responses to be retrieved. See 10169// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10170// for more information. 10171func (c *CoursesTopicsGetCall) Fields(s ...googleapi.Field) *CoursesTopicsGetCall { 10172 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10173 return c 10174} 10175 10176// IfNoneMatch sets the optional parameter which makes the operation 10177// fail if the object's ETag matches the given value. This is useful for 10178// getting updates only after the object has changed since the last 10179// request. Use googleapi.IsNotModified to check whether the response 10180// error from Do is the result of In-None-Match. 10181func (c *CoursesTopicsGetCall) IfNoneMatch(entityTag string) *CoursesTopicsGetCall { 10182 c.ifNoneMatch_ = entityTag 10183 return c 10184} 10185 10186// Context sets the context to be used in this call's Do method. Any 10187// pending HTTP request will be aborted if the provided context is 10188// canceled. 10189func (c *CoursesTopicsGetCall) Context(ctx context.Context) *CoursesTopicsGetCall { 10190 c.ctx_ = ctx 10191 return c 10192} 10193 10194// Header returns an http.Header that can be modified by the caller to 10195// add HTTP headers to the request. 10196func (c *CoursesTopicsGetCall) Header() http.Header { 10197 if c.header_ == nil { 10198 c.header_ = make(http.Header) 10199 } 10200 return c.header_ 10201} 10202 10203func (c *CoursesTopicsGetCall) doRequest(alt string) (*http.Response, error) { 10204 reqHeaders := make(http.Header) 10205 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 10206 for k, v := range c.header_ { 10207 reqHeaders[k] = v 10208 } 10209 reqHeaders.Set("User-Agent", c.s.userAgent()) 10210 if c.ifNoneMatch_ != "" { 10211 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10212 } 10213 var body io.Reader = nil 10214 c.urlParams_.Set("alt", alt) 10215 c.urlParams_.Set("prettyPrint", "false") 10216 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10217 urls += "?" + c.urlParams_.Encode() 10218 req, err := http.NewRequest("GET", urls, body) 10219 if err != nil { 10220 return nil, err 10221 } 10222 req.Header = reqHeaders 10223 googleapi.Expand(req.URL, map[string]string{ 10224 "courseId": c.courseId, 10225 "id": c.id, 10226 }) 10227 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10228} 10229 10230// Do executes the "classroom.courses.topics.get" call. 10231// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10232// code is an error. Response headers are in either 10233// *Topic.ServerResponse.Header or (if a response was returned at all) 10234// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10235// check whether the returned error was because http.StatusNotModified 10236// was returned. 10237func (c *CoursesTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10238 gensupport.SetOptions(c.urlParams_, opts...) 10239 res, err := c.doRequest("json") 10240 if res != nil && res.StatusCode == http.StatusNotModified { 10241 if res.Body != nil { 10242 res.Body.Close() 10243 } 10244 return nil, &googleapi.Error{ 10245 Code: res.StatusCode, 10246 Header: res.Header, 10247 } 10248 } 10249 if err != nil { 10250 return nil, err 10251 } 10252 defer googleapi.CloseBody(res) 10253 if err := googleapi.CheckResponse(res); err != nil { 10254 return nil, err 10255 } 10256 ret := &Topic{ 10257 ServerResponse: googleapi.ServerResponse{ 10258 Header: res.Header, 10259 HTTPStatusCode: res.StatusCode, 10260 }, 10261 } 10262 target := &ret 10263 if err := gensupport.DecodeResponse(target, res); err != nil { 10264 return nil, err 10265 } 10266 return ret, nil 10267 // { 10268 // "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.", 10269 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10270 // "httpMethod": "GET", 10271 // "id": "classroom.courses.topics.get", 10272 // "parameterOrder": [ 10273 // "courseId", 10274 // "id" 10275 // ], 10276 // "parameters": { 10277 // "courseId": { 10278 // "description": "Identifier of the course.", 10279 // "location": "path", 10280 // "required": true, 10281 // "type": "string" 10282 // }, 10283 // "id": { 10284 // "description": "Identifier of the topic.", 10285 // "location": "path", 10286 // "required": true, 10287 // "type": "string" 10288 // } 10289 // }, 10290 // "path": "v1/courses/{courseId}/topics/{id}", 10291 // "response": { 10292 // "$ref": "Topic" 10293 // }, 10294 // "scopes": [ 10295 // "https://www.googleapis.com/auth/classroom.topics", 10296 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10297 // ] 10298 // } 10299 10300} 10301 10302// method id "classroom.courses.topics.list": 10303 10304type CoursesTopicsListCall struct { 10305 s *Service 10306 courseId string 10307 urlParams_ gensupport.URLParams 10308 ifNoneMatch_ string 10309 ctx_ context.Context 10310 header_ http.Header 10311} 10312 10313// List: Returns the list of topics that the requester is permitted to 10314// view. 10315// 10316// This method returns the following error codes: 10317// 10318// * `PERMISSION_DENIED` if the requesting user is not permitted to 10319// access 10320// the requested course or for access errors. 10321// * `INVALID_ARGUMENT` if the request is malformed. 10322// * `NOT_FOUND` if the requested course does not exist. 10323func (r *CoursesTopicsService) List(courseId string) *CoursesTopicsListCall { 10324 c := &CoursesTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10325 c.courseId = courseId 10326 return c 10327} 10328 10329// PageSize sets the optional parameter "pageSize": Maximum number of 10330// items to return. Zero or unspecified indicates that the 10331// server may assign a maximum. 10332// 10333// The server may return fewer than the specified number of results. 10334func (c *CoursesTopicsListCall) PageSize(pageSize int64) *CoursesTopicsListCall { 10335 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10336 return c 10337} 10338 10339// PageToken sets the optional parameter "pageToken": 10340// nextPageToken 10341// value returned from a previous 10342// list call, 10343// indicating that the subsequent page of results should be 10344// returned. 10345// 10346// The list request 10347// must be otherwise identical to the one that resulted in this token. 10348func (c *CoursesTopicsListCall) PageToken(pageToken string) *CoursesTopicsListCall { 10349 c.urlParams_.Set("pageToken", pageToken) 10350 return c 10351} 10352 10353// Fields allows partial responses to be retrieved. See 10354// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10355// for more information. 10356func (c *CoursesTopicsListCall) Fields(s ...googleapi.Field) *CoursesTopicsListCall { 10357 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10358 return c 10359} 10360 10361// IfNoneMatch sets the optional parameter which makes the operation 10362// fail if the object's ETag matches the given value. This is useful for 10363// getting updates only after the object has changed since the last 10364// request. Use googleapi.IsNotModified to check whether the response 10365// error from Do is the result of In-None-Match. 10366func (c *CoursesTopicsListCall) IfNoneMatch(entityTag string) *CoursesTopicsListCall { 10367 c.ifNoneMatch_ = entityTag 10368 return c 10369} 10370 10371// Context sets the context to be used in this call's Do method. Any 10372// pending HTTP request will be aborted if the provided context is 10373// canceled. 10374func (c *CoursesTopicsListCall) Context(ctx context.Context) *CoursesTopicsListCall { 10375 c.ctx_ = ctx 10376 return c 10377} 10378 10379// Header returns an http.Header that can be modified by the caller to 10380// add HTTP headers to the request. 10381func (c *CoursesTopicsListCall) Header() http.Header { 10382 if c.header_ == nil { 10383 c.header_ = make(http.Header) 10384 } 10385 return c.header_ 10386} 10387 10388func (c *CoursesTopicsListCall) doRequest(alt string) (*http.Response, error) { 10389 reqHeaders := make(http.Header) 10390 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 10391 for k, v := range c.header_ { 10392 reqHeaders[k] = v 10393 } 10394 reqHeaders.Set("User-Agent", c.s.userAgent()) 10395 if c.ifNoneMatch_ != "" { 10396 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10397 } 10398 var body io.Reader = nil 10399 c.urlParams_.Set("alt", alt) 10400 c.urlParams_.Set("prettyPrint", "false") 10401 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10402 urls += "?" + c.urlParams_.Encode() 10403 req, err := http.NewRequest("GET", urls, body) 10404 if err != nil { 10405 return nil, err 10406 } 10407 req.Header = reqHeaders 10408 googleapi.Expand(req.URL, map[string]string{ 10409 "courseId": c.courseId, 10410 }) 10411 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10412} 10413 10414// Do executes the "classroom.courses.topics.list" call. 10415// Exactly one of *ListTopicResponse or error will be non-nil. Any 10416// non-2xx status code is an error. Response headers are in either 10417// *ListTopicResponse.ServerResponse.Header or (if a response was 10418// returned at all) in error.(*googleapi.Error).Header. Use 10419// googleapi.IsNotModified to check whether the returned error was 10420// because http.StatusNotModified was returned. 10421func (c *CoursesTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicResponse, error) { 10422 gensupport.SetOptions(c.urlParams_, opts...) 10423 res, err := c.doRequest("json") 10424 if res != nil && res.StatusCode == http.StatusNotModified { 10425 if res.Body != nil { 10426 res.Body.Close() 10427 } 10428 return nil, &googleapi.Error{ 10429 Code: res.StatusCode, 10430 Header: res.Header, 10431 } 10432 } 10433 if err != nil { 10434 return nil, err 10435 } 10436 defer googleapi.CloseBody(res) 10437 if err := googleapi.CheckResponse(res); err != nil { 10438 return nil, err 10439 } 10440 ret := &ListTopicResponse{ 10441 ServerResponse: googleapi.ServerResponse{ 10442 Header: res.Header, 10443 HTTPStatusCode: res.StatusCode, 10444 }, 10445 } 10446 target := &ret 10447 if err := gensupport.DecodeResponse(target, res); err != nil { 10448 return nil, err 10449 } 10450 return ret, nil 10451 // { 10452 // "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.", 10453 // "flatPath": "v1/courses/{courseId}/topics", 10454 // "httpMethod": "GET", 10455 // "id": "classroom.courses.topics.list", 10456 // "parameterOrder": [ 10457 // "courseId" 10458 // ], 10459 // "parameters": { 10460 // "courseId": { 10461 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10462 // "location": "path", 10463 // "required": true, 10464 // "type": "string" 10465 // }, 10466 // "pageSize": { 10467 // "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.", 10468 // "format": "int32", 10469 // "location": "query", 10470 // "type": "integer" 10471 // }, 10472 // "pageToken": { 10473 // "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.", 10474 // "location": "query", 10475 // "type": "string" 10476 // } 10477 // }, 10478 // "path": "v1/courses/{courseId}/topics", 10479 // "response": { 10480 // "$ref": "ListTopicResponse" 10481 // }, 10482 // "scopes": [ 10483 // "https://www.googleapis.com/auth/classroom.topics", 10484 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10485 // ] 10486 // } 10487 10488} 10489 10490// Pages invokes f for each page of results. 10491// A non-nil error returned from f will halt the iteration. 10492// The provided context supersedes any context provided to the Context method. 10493func (c *CoursesTopicsListCall) Pages(ctx context.Context, f func(*ListTopicResponse) error) error { 10494 c.ctx_ = ctx 10495 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10496 for { 10497 x, err := c.Do() 10498 if err != nil { 10499 return err 10500 } 10501 if err := f(x); err != nil { 10502 return err 10503 } 10504 if x.NextPageToken == "" { 10505 return nil 10506 } 10507 c.PageToken(x.NextPageToken) 10508 } 10509} 10510 10511// method id "classroom.courses.topics.patch": 10512 10513type CoursesTopicsPatchCall struct { 10514 s *Service 10515 courseId string 10516 id string 10517 topic *Topic 10518 urlParams_ gensupport.URLParams 10519 ctx_ context.Context 10520 header_ http.Header 10521} 10522 10523// Patch: Updates one or more fields of a topic. 10524// 10525// This method returns the following error codes: 10526// 10527// * `PERMISSION_DENIED` if the requesting developer project did not 10528// create 10529// the corresponding topic or for access errors. 10530// * `INVALID_ARGUMENT` if the request is malformed. 10531// * `NOT_FOUND` if the requested course or topic does not exist 10532func (r *CoursesTopicsService) Patch(courseId string, id string, topic *Topic) *CoursesTopicsPatchCall { 10533 c := &CoursesTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10534 c.courseId = courseId 10535 c.id = id 10536 c.topic = topic 10537 return c 10538} 10539 10540// UpdateMask sets the optional parameter "updateMask": Mask that 10541// identifies which fields on the topic to update. 10542// This field is required to do an update. The update fails if 10543// invalid 10544// fields are specified. If a field supports empty values, it can be 10545// cleared 10546// by specifying it in the update mask and not in the Topic object. If 10547// a 10548// field that does not support empty values is included in the update 10549// mask and 10550// not set in the Topic object, an `INVALID_ARGUMENT` error will 10551// be 10552// returned. 10553// 10554// The following fields may be specified: 10555// 10556// * `name` 10557func (c *CoursesTopicsPatchCall) UpdateMask(updateMask string) *CoursesTopicsPatchCall { 10558 c.urlParams_.Set("updateMask", updateMask) 10559 return c 10560} 10561 10562// Fields allows partial responses to be retrieved. See 10563// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10564// for more information. 10565func (c *CoursesTopicsPatchCall) Fields(s ...googleapi.Field) *CoursesTopicsPatchCall { 10566 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10567 return c 10568} 10569 10570// Context sets the context to be used in this call's Do method. Any 10571// pending HTTP request will be aborted if the provided context is 10572// canceled. 10573func (c *CoursesTopicsPatchCall) Context(ctx context.Context) *CoursesTopicsPatchCall { 10574 c.ctx_ = ctx 10575 return c 10576} 10577 10578// Header returns an http.Header that can be modified by the caller to 10579// add HTTP headers to the request. 10580func (c *CoursesTopicsPatchCall) Header() http.Header { 10581 if c.header_ == nil { 10582 c.header_ = make(http.Header) 10583 } 10584 return c.header_ 10585} 10586 10587func (c *CoursesTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 10588 reqHeaders := make(http.Header) 10589 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 10590 for k, v := range c.header_ { 10591 reqHeaders[k] = v 10592 } 10593 reqHeaders.Set("User-Agent", c.s.userAgent()) 10594 var body io.Reader = nil 10595 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 10596 if err != nil { 10597 return nil, err 10598 } 10599 reqHeaders.Set("Content-Type", "application/json") 10600 c.urlParams_.Set("alt", alt) 10601 c.urlParams_.Set("prettyPrint", "false") 10602 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10603 urls += "?" + c.urlParams_.Encode() 10604 req, err := http.NewRequest("PATCH", urls, body) 10605 if err != nil { 10606 return nil, err 10607 } 10608 req.Header = reqHeaders 10609 googleapi.Expand(req.URL, map[string]string{ 10610 "courseId": c.courseId, 10611 "id": c.id, 10612 }) 10613 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10614} 10615 10616// Do executes the "classroom.courses.topics.patch" call. 10617// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10618// code is an error. Response headers are in either 10619// *Topic.ServerResponse.Header or (if a response was returned at all) 10620// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10621// check whether the returned error was because http.StatusNotModified 10622// was returned. 10623func (c *CoursesTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10624 gensupport.SetOptions(c.urlParams_, opts...) 10625 res, err := c.doRequest("json") 10626 if res != nil && res.StatusCode == http.StatusNotModified { 10627 if res.Body != nil { 10628 res.Body.Close() 10629 } 10630 return nil, &googleapi.Error{ 10631 Code: res.StatusCode, 10632 Header: res.Header, 10633 } 10634 } 10635 if err != nil { 10636 return nil, err 10637 } 10638 defer googleapi.CloseBody(res) 10639 if err := googleapi.CheckResponse(res); err != nil { 10640 return nil, err 10641 } 10642 ret := &Topic{ 10643 ServerResponse: googleapi.ServerResponse{ 10644 Header: res.Header, 10645 HTTPStatusCode: res.StatusCode, 10646 }, 10647 } 10648 target := &ret 10649 if err := gensupport.DecodeResponse(target, res); err != nil { 10650 return nil, err 10651 } 10652 return ret, nil 10653 // { 10654 // "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", 10655 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10656 // "httpMethod": "PATCH", 10657 // "id": "classroom.courses.topics.patch", 10658 // "parameterOrder": [ 10659 // "courseId", 10660 // "id" 10661 // ], 10662 // "parameters": { 10663 // "courseId": { 10664 // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.", 10665 // "location": "path", 10666 // "required": true, 10667 // "type": "string" 10668 // }, 10669 // "id": { 10670 // "description": "Identifier of the topic.", 10671 // "location": "path", 10672 // "required": true, 10673 // "type": "string" 10674 // }, 10675 // "updateMask": { 10676 // "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`", 10677 // "format": "google-fieldmask", 10678 // "location": "query", 10679 // "type": "string" 10680 // } 10681 // }, 10682 // "path": "v1/courses/{courseId}/topics/{id}", 10683 // "request": { 10684 // "$ref": "Topic" 10685 // }, 10686 // "response": { 10687 // "$ref": "Topic" 10688 // }, 10689 // "scopes": [ 10690 // "https://www.googleapis.com/auth/classroom.topics" 10691 // ] 10692 // } 10693 10694} 10695 10696// method id "classroom.invitations.accept": 10697 10698type InvitationsAcceptCall struct { 10699 s *Service 10700 id string 10701 urlParams_ gensupport.URLParams 10702 ctx_ context.Context 10703 header_ http.Header 10704} 10705 10706// Accept: Accepts an invitation, removing it and adding the invited 10707// user to the 10708// teachers or students (as appropriate) of the specified course. Only 10709// the 10710// invited user may accept an invitation. 10711// 10712// This method returns the following error codes: 10713// 10714// * `PERMISSION_DENIED` if the requesting user is not permitted to 10715// accept the 10716// requested invitation or for access errors. 10717// * `FAILED_PRECONDITION` for the following request errors: 10718// * CourseMemberLimitReached 10719// * CourseNotModifiable 10720// * CourseTeacherLimitReached 10721// * UserGroupsMembershipLimitReached 10722// * `NOT_FOUND` if no invitation exists with the requested ID. 10723func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall { 10724 c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10725 c.id = id 10726 return c 10727} 10728 10729// Fields allows partial responses to be retrieved. See 10730// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10731// for more information. 10732func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall { 10733 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10734 return c 10735} 10736 10737// Context sets the context to be used in this call's Do method. Any 10738// pending HTTP request will be aborted if the provided context is 10739// canceled. 10740func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall { 10741 c.ctx_ = ctx 10742 return c 10743} 10744 10745// Header returns an http.Header that can be modified by the caller to 10746// add HTTP headers to the request. 10747func (c *InvitationsAcceptCall) Header() http.Header { 10748 if c.header_ == nil { 10749 c.header_ = make(http.Header) 10750 } 10751 return c.header_ 10752} 10753 10754func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) { 10755 reqHeaders := make(http.Header) 10756 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 10757 for k, v := range c.header_ { 10758 reqHeaders[k] = v 10759 } 10760 reqHeaders.Set("User-Agent", c.s.userAgent()) 10761 var body io.Reader = nil 10762 c.urlParams_.Set("alt", alt) 10763 c.urlParams_.Set("prettyPrint", "false") 10764 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept") 10765 urls += "?" + c.urlParams_.Encode() 10766 req, err := http.NewRequest("POST", urls, body) 10767 if err != nil { 10768 return nil, err 10769 } 10770 req.Header = reqHeaders 10771 googleapi.Expand(req.URL, map[string]string{ 10772 "id": c.id, 10773 }) 10774 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10775} 10776 10777// Do executes the "classroom.invitations.accept" call. 10778// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10779// code is an error. Response headers are in either 10780// *Empty.ServerResponse.Header or (if a response was returned at all) 10781// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10782// check whether the returned error was because http.StatusNotModified 10783// was returned. 10784func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10785 gensupport.SetOptions(c.urlParams_, opts...) 10786 res, err := c.doRequest("json") 10787 if res != nil && res.StatusCode == http.StatusNotModified { 10788 if res.Body != nil { 10789 res.Body.Close() 10790 } 10791 return nil, &googleapi.Error{ 10792 Code: res.StatusCode, 10793 Header: res.Header, 10794 } 10795 } 10796 if err != nil { 10797 return nil, err 10798 } 10799 defer googleapi.CloseBody(res) 10800 if err := googleapi.CheckResponse(res); err != nil { 10801 return nil, err 10802 } 10803 ret := &Empty{ 10804 ServerResponse: googleapi.ServerResponse{ 10805 Header: res.Header, 10806 HTTPStatusCode: res.StatusCode, 10807 }, 10808 } 10809 target := &ret 10810 if err := gensupport.DecodeResponse(target, res); err != nil { 10811 return nil, err 10812 } 10813 return ret, nil 10814 // { 10815 // "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.", 10816 // "flatPath": "v1/invitations/{id}:accept", 10817 // "httpMethod": "POST", 10818 // "id": "classroom.invitations.accept", 10819 // "parameterOrder": [ 10820 // "id" 10821 // ], 10822 // "parameters": { 10823 // "id": { 10824 // "description": "Identifier of the invitation to accept.", 10825 // "location": "path", 10826 // "required": true, 10827 // "type": "string" 10828 // } 10829 // }, 10830 // "path": "v1/invitations/{id}:accept", 10831 // "response": { 10832 // "$ref": "Empty" 10833 // }, 10834 // "scopes": [ 10835 // "https://www.googleapis.com/auth/classroom.rosters" 10836 // ] 10837 // } 10838 10839} 10840 10841// method id "classroom.invitations.create": 10842 10843type InvitationsCreateCall struct { 10844 s *Service 10845 invitation *Invitation 10846 urlParams_ gensupport.URLParams 10847 ctx_ context.Context 10848 header_ http.Header 10849} 10850 10851// Create: Creates an invitation. Only one invitation for a user and 10852// course may exist 10853// at a time. Delete and re-create an invitation to make changes. 10854// 10855// This method returns the following error codes: 10856// 10857// * `PERMISSION_DENIED` if the requesting user is not permitted to 10858// create 10859// invitations for this course or for access errors. 10860// * `NOT_FOUND` if the course or the user does not exist. 10861// * `FAILED_PRECONDITION` if the requested user's account is disabled 10862// or if 10863// the user already has this role or a role with greater permissions. 10864// * `ALREADY_EXISTS` if an invitation for the specified user and 10865// course 10866// already exists. 10867func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall { 10868 c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10869 c.invitation = invitation 10870 return c 10871} 10872 10873// Fields allows partial responses to be retrieved. See 10874// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10875// for more information. 10876func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall { 10877 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10878 return c 10879} 10880 10881// Context sets the context to be used in this call's Do method. Any 10882// pending HTTP request will be aborted if the provided context is 10883// canceled. 10884func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall { 10885 c.ctx_ = ctx 10886 return c 10887} 10888 10889// Header returns an http.Header that can be modified by the caller to 10890// add HTTP headers to the request. 10891func (c *InvitationsCreateCall) Header() http.Header { 10892 if c.header_ == nil { 10893 c.header_ = make(http.Header) 10894 } 10895 return c.header_ 10896} 10897 10898func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 10899 reqHeaders := make(http.Header) 10900 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 10901 for k, v := range c.header_ { 10902 reqHeaders[k] = v 10903 } 10904 reqHeaders.Set("User-Agent", c.s.userAgent()) 10905 var body io.Reader = nil 10906 body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation) 10907 if err != nil { 10908 return nil, err 10909 } 10910 reqHeaders.Set("Content-Type", "application/json") 10911 c.urlParams_.Set("alt", alt) 10912 c.urlParams_.Set("prettyPrint", "false") 10913 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 10914 urls += "?" + c.urlParams_.Encode() 10915 req, err := http.NewRequest("POST", urls, body) 10916 if err != nil { 10917 return nil, err 10918 } 10919 req.Header = reqHeaders 10920 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10921} 10922 10923// Do executes the "classroom.invitations.create" call. 10924// Exactly one of *Invitation or error will be non-nil. Any non-2xx 10925// status code is an error. Response headers are in either 10926// *Invitation.ServerResponse.Header or (if a response was returned at 10927// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10928// to check whether the returned error was because 10929// http.StatusNotModified was returned. 10930func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 10931 gensupport.SetOptions(c.urlParams_, opts...) 10932 res, err := c.doRequest("json") 10933 if res != nil && res.StatusCode == http.StatusNotModified { 10934 if res.Body != nil { 10935 res.Body.Close() 10936 } 10937 return nil, &googleapi.Error{ 10938 Code: res.StatusCode, 10939 Header: res.Header, 10940 } 10941 } 10942 if err != nil { 10943 return nil, err 10944 } 10945 defer googleapi.CloseBody(res) 10946 if err := googleapi.CheckResponse(res); err != nil { 10947 return nil, err 10948 } 10949 ret := &Invitation{ 10950 ServerResponse: googleapi.ServerResponse{ 10951 Header: res.Header, 10952 HTTPStatusCode: res.StatusCode, 10953 }, 10954 } 10955 target := &ret 10956 if err := gensupport.DecodeResponse(target, res); err != nil { 10957 return nil, err 10958 } 10959 return ret, nil 10960 // { 10961 // "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.", 10962 // "flatPath": "v1/invitations", 10963 // "httpMethod": "POST", 10964 // "id": "classroom.invitations.create", 10965 // "parameterOrder": [], 10966 // "parameters": {}, 10967 // "path": "v1/invitations", 10968 // "request": { 10969 // "$ref": "Invitation" 10970 // }, 10971 // "response": { 10972 // "$ref": "Invitation" 10973 // }, 10974 // "scopes": [ 10975 // "https://www.googleapis.com/auth/classroom.rosters" 10976 // ] 10977 // } 10978 10979} 10980 10981// method id "classroom.invitations.delete": 10982 10983type InvitationsDeleteCall struct { 10984 s *Service 10985 id string 10986 urlParams_ gensupport.URLParams 10987 ctx_ context.Context 10988 header_ http.Header 10989} 10990 10991// Delete: Deletes an invitation. 10992// 10993// This method returns the following error codes: 10994// 10995// * `PERMISSION_DENIED` if the requesting user is not permitted to 10996// delete the 10997// requested invitation or for access errors. 10998// * `NOT_FOUND` if no invitation exists with the requested ID. 10999func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall { 11000 c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11001 c.id = id 11002 return c 11003} 11004 11005// Fields allows partial responses to be retrieved. See 11006// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11007// for more information. 11008func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall { 11009 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11010 return c 11011} 11012 11013// Context sets the context to be used in this call's Do method. Any 11014// pending HTTP request will be aborted if the provided context is 11015// canceled. 11016func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall { 11017 c.ctx_ = ctx 11018 return c 11019} 11020 11021// Header returns an http.Header that can be modified by the caller to 11022// add HTTP headers to the request. 11023func (c *InvitationsDeleteCall) Header() http.Header { 11024 if c.header_ == nil { 11025 c.header_ = make(http.Header) 11026 } 11027 return c.header_ 11028} 11029 11030func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11031 reqHeaders := make(http.Header) 11032 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 11033 for k, v := range c.header_ { 11034 reqHeaders[k] = v 11035 } 11036 reqHeaders.Set("User-Agent", c.s.userAgent()) 11037 var body io.Reader = nil 11038 c.urlParams_.Set("alt", alt) 11039 c.urlParams_.Set("prettyPrint", "false") 11040 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11041 urls += "?" + c.urlParams_.Encode() 11042 req, err := http.NewRequest("DELETE", urls, body) 11043 if err != nil { 11044 return nil, err 11045 } 11046 req.Header = reqHeaders 11047 googleapi.Expand(req.URL, map[string]string{ 11048 "id": c.id, 11049 }) 11050 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11051} 11052 11053// Do executes the "classroom.invitations.delete" call. 11054// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11055// code is an error. Response headers are in either 11056// *Empty.ServerResponse.Header or (if a response was returned at all) 11057// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11058// check whether the returned error was because http.StatusNotModified 11059// was returned. 11060func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11061 gensupport.SetOptions(c.urlParams_, opts...) 11062 res, err := c.doRequest("json") 11063 if res != nil && res.StatusCode == http.StatusNotModified { 11064 if res.Body != nil { 11065 res.Body.Close() 11066 } 11067 return nil, &googleapi.Error{ 11068 Code: res.StatusCode, 11069 Header: res.Header, 11070 } 11071 } 11072 if err != nil { 11073 return nil, err 11074 } 11075 defer googleapi.CloseBody(res) 11076 if err := googleapi.CheckResponse(res); err != nil { 11077 return nil, err 11078 } 11079 ret := &Empty{ 11080 ServerResponse: googleapi.ServerResponse{ 11081 Header: res.Header, 11082 HTTPStatusCode: res.StatusCode, 11083 }, 11084 } 11085 target := &ret 11086 if err := gensupport.DecodeResponse(target, res); err != nil { 11087 return nil, err 11088 } 11089 return ret, nil 11090 // { 11091 // "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.", 11092 // "flatPath": "v1/invitations/{id}", 11093 // "httpMethod": "DELETE", 11094 // "id": "classroom.invitations.delete", 11095 // "parameterOrder": [ 11096 // "id" 11097 // ], 11098 // "parameters": { 11099 // "id": { 11100 // "description": "Identifier of the invitation to delete.", 11101 // "location": "path", 11102 // "required": true, 11103 // "type": "string" 11104 // } 11105 // }, 11106 // "path": "v1/invitations/{id}", 11107 // "response": { 11108 // "$ref": "Empty" 11109 // }, 11110 // "scopes": [ 11111 // "https://www.googleapis.com/auth/classroom.rosters" 11112 // ] 11113 // } 11114 11115} 11116 11117// method id "classroom.invitations.get": 11118 11119type InvitationsGetCall struct { 11120 s *Service 11121 id string 11122 urlParams_ gensupport.URLParams 11123 ifNoneMatch_ string 11124 ctx_ context.Context 11125 header_ http.Header 11126} 11127 11128// Get: Returns an invitation. 11129// 11130// This method returns the following error codes: 11131// 11132// * `PERMISSION_DENIED` if the requesting user is not permitted to view 11133// the 11134// requested invitation or for access errors. 11135// * `NOT_FOUND` if no invitation exists with the requested ID. 11136func (r *InvitationsService) Get(id string) *InvitationsGetCall { 11137 c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11138 c.id = id 11139 return c 11140} 11141 11142// Fields allows partial responses to be retrieved. See 11143// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11144// for more information. 11145func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall { 11146 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11147 return c 11148} 11149 11150// IfNoneMatch sets the optional parameter which makes the operation 11151// fail if the object's ETag matches the given value. This is useful for 11152// getting updates only after the object has changed since the last 11153// request. Use googleapi.IsNotModified to check whether the response 11154// error from Do is the result of In-None-Match. 11155func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall { 11156 c.ifNoneMatch_ = entityTag 11157 return c 11158} 11159 11160// Context sets the context to be used in this call's Do method. Any 11161// pending HTTP request will be aborted if the provided context is 11162// canceled. 11163func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall { 11164 c.ctx_ = ctx 11165 return c 11166} 11167 11168// Header returns an http.Header that can be modified by the caller to 11169// add HTTP headers to the request. 11170func (c *InvitationsGetCall) Header() http.Header { 11171 if c.header_ == nil { 11172 c.header_ = make(http.Header) 11173 } 11174 return c.header_ 11175} 11176 11177func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) { 11178 reqHeaders := make(http.Header) 11179 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 11180 for k, v := range c.header_ { 11181 reqHeaders[k] = v 11182 } 11183 reqHeaders.Set("User-Agent", c.s.userAgent()) 11184 if c.ifNoneMatch_ != "" { 11185 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11186 } 11187 var body io.Reader = nil 11188 c.urlParams_.Set("alt", alt) 11189 c.urlParams_.Set("prettyPrint", "false") 11190 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11191 urls += "?" + c.urlParams_.Encode() 11192 req, err := http.NewRequest("GET", urls, body) 11193 if err != nil { 11194 return nil, err 11195 } 11196 req.Header = reqHeaders 11197 googleapi.Expand(req.URL, map[string]string{ 11198 "id": c.id, 11199 }) 11200 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11201} 11202 11203// Do executes the "classroom.invitations.get" call. 11204// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11205// status code is an error. Response headers are in either 11206// *Invitation.ServerResponse.Header or (if a response was returned at 11207// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11208// to check whether the returned error was because 11209// http.StatusNotModified was returned. 11210func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11211 gensupport.SetOptions(c.urlParams_, opts...) 11212 res, err := c.doRequest("json") 11213 if res != nil && res.StatusCode == http.StatusNotModified { 11214 if res.Body != nil { 11215 res.Body.Close() 11216 } 11217 return nil, &googleapi.Error{ 11218 Code: res.StatusCode, 11219 Header: res.Header, 11220 } 11221 } 11222 if err != nil { 11223 return nil, err 11224 } 11225 defer googleapi.CloseBody(res) 11226 if err := googleapi.CheckResponse(res); err != nil { 11227 return nil, err 11228 } 11229 ret := &Invitation{ 11230 ServerResponse: googleapi.ServerResponse{ 11231 Header: res.Header, 11232 HTTPStatusCode: res.StatusCode, 11233 }, 11234 } 11235 target := &ret 11236 if err := gensupport.DecodeResponse(target, res); err != nil { 11237 return nil, err 11238 } 11239 return ret, nil 11240 // { 11241 // "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.", 11242 // "flatPath": "v1/invitations/{id}", 11243 // "httpMethod": "GET", 11244 // "id": "classroom.invitations.get", 11245 // "parameterOrder": [ 11246 // "id" 11247 // ], 11248 // "parameters": { 11249 // "id": { 11250 // "description": "Identifier of the invitation to return.", 11251 // "location": "path", 11252 // "required": true, 11253 // "type": "string" 11254 // } 11255 // }, 11256 // "path": "v1/invitations/{id}", 11257 // "response": { 11258 // "$ref": "Invitation" 11259 // }, 11260 // "scopes": [ 11261 // "https://www.googleapis.com/auth/classroom.rosters", 11262 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11263 // ] 11264 // } 11265 11266} 11267 11268// method id "classroom.invitations.list": 11269 11270type InvitationsListCall struct { 11271 s *Service 11272 urlParams_ gensupport.URLParams 11273 ifNoneMatch_ string 11274 ctx_ context.Context 11275 header_ http.Header 11276} 11277 11278// List: Returns a list of invitations that the requesting user is 11279// permitted to 11280// view, restricted to those that match the list request. 11281// 11282// *Note:* At least one of `user_id` or `course_id` must be supplied. 11283// Both 11284// fields can be supplied. 11285// 11286// This method returns the following error codes: 11287// 11288// * `PERMISSION_DENIED` for access errors. 11289func (r *InvitationsService) List() *InvitationsListCall { 11290 c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11291 return c 11292} 11293 11294// CourseId sets the optional parameter "courseId": Restricts returned 11295// invitations to those for a course with the specified 11296// identifier. 11297func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall { 11298 c.urlParams_.Set("courseId", courseId) 11299 return c 11300} 11301 11302// PageSize sets the optional parameter "pageSize": Maximum number of 11303// items to return. Zero means no maximum. 11304// 11305// The server may return fewer than the specified number of results. 11306func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall { 11307 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 11308 return c 11309} 11310 11311// PageToken sets the optional parameter "pageToken": 11312// nextPageToken 11313// value returned from a previous 11314// list call, indicating 11315// that the subsequent page of results should be returned. 11316// 11317// The list request must be 11318// otherwise identical to the one that resulted in this token. 11319func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall { 11320 c.urlParams_.Set("pageToken", pageToken) 11321 return c 11322} 11323 11324// UserId sets the optional parameter "userId": Restricts returned 11325// invitations to those for a specific user. The identifier 11326// can be one of the following: 11327// 11328// * the numeric identifier for the user 11329// * the email address of the user 11330// * the string literal "me", indicating the requesting user 11331func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall { 11332 c.urlParams_.Set("userId", userId) 11333 return c 11334} 11335 11336// Fields allows partial responses to be retrieved. See 11337// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11338// for more information. 11339func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall { 11340 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11341 return c 11342} 11343 11344// IfNoneMatch sets the optional parameter which makes the operation 11345// fail if the object's ETag matches the given value. This is useful for 11346// getting updates only after the object has changed since the last 11347// request. Use googleapi.IsNotModified to check whether the response 11348// error from Do is the result of In-None-Match. 11349func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall { 11350 c.ifNoneMatch_ = entityTag 11351 return c 11352} 11353 11354// Context sets the context to be used in this call's Do method. Any 11355// pending HTTP request will be aborted if the provided context is 11356// canceled. 11357func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall { 11358 c.ctx_ = ctx 11359 return c 11360} 11361 11362// Header returns an http.Header that can be modified by the caller to 11363// add HTTP headers to the request. 11364func (c *InvitationsListCall) Header() http.Header { 11365 if c.header_ == nil { 11366 c.header_ = make(http.Header) 11367 } 11368 return c.header_ 11369} 11370 11371func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) { 11372 reqHeaders := make(http.Header) 11373 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 11374 for k, v := range c.header_ { 11375 reqHeaders[k] = v 11376 } 11377 reqHeaders.Set("User-Agent", c.s.userAgent()) 11378 if c.ifNoneMatch_ != "" { 11379 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11380 } 11381 var body io.Reader = nil 11382 c.urlParams_.Set("alt", alt) 11383 c.urlParams_.Set("prettyPrint", "false") 11384 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11385 urls += "?" + c.urlParams_.Encode() 11386 req, err := http.NewRequest("GET", urls, body) 11387 if err != nil { 11388 return nil, err 11389 } 11390 req.Header = reqHeaders 11391 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11392} 11393 11394// Do executes the "classroom.invitations.list" call. 11395// Exactly one of *ListInvitationsResponse or error will be non-nil. Any 11396// non-2xx status code is an error. Response headers are in either 11397// *ListInvitationsResponse.ServerResponse.Header or (if a response was 11398// returned at all) in error.(*googleapi.Error).Header. Use 11399// googleapi.IsNotModified to check whether the returned error was 11400// because http.StatusNotModified was returned. 11401func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) { 11402 gensupport.SetOptions(c.urlParams_, opts...) 11403 res, err := c.doRequest("json") 11404 if res != nil && res.StatusCode == http.StatusNotModified { 11405 if res.Body != nil { 11406 res.Body.Close() 11407 } 11408 return nil, &googleapi.Error{ 11409 Code: res.StatusCode, 11410 Header: res.Header, 11411 } 11412 } 11413 if err != nil { 11414 return nil, err 11415 } 11416 defer googleapi.CloseBody(res) 11417 if err := googleapi.CheckResponse(res); err != nil { 11418 return nil, err 11419 } 11420 ret := &ListInvitationsResponse{ 11421 ServerResponse: googleapi.ServerResponse{ 11422 Header: res.Header, 11423 HTTPStatusCode: res.StatusCode, 11424 }, 11425 } 11426 target := &ret 11427 if err := gensupport.DecodeResponse(target, res); err != nil { 11428 return nil, err 11429 } 11430 return ret, nil 11431 // { 11432 // "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.", 11433 // "flatPath": "v1/invitations", 11434 // "httpMethod": "GET", 11435 // "id": "classroom.invitations.list", 11436 // "parameterOrder": [], 11437 // "parameters": { 11438 // "courseId": { 11439 // "description": "Restricts returned invitations to those for a course with the specified\nidentifier.", 11440 // "location": "query", 11441 // "type": "string" 11442 // }, 11443 // "pageSize": { 11444 // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.", 11445 // "format": "int32", 11446 // "location": "query", 11447 // "type": "integer" 11448 // }, 11449 // "pageToken": { 11450 // "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.", 11451 // "location": "query", 11452 // "type": "string" 11453 // }, 11454 // "userId": { 11455 // "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", 11456 // "location": "query", 11457 // "type": "string" 11458 // } 11459 // }, 11460 // "path": "v1/invitations", 11461 // "response": { 11462 // "$ref": "ListInvitationsResponse" 11463 // }, 11464 // "scopes": [ 11465 // "https://www.googleapis.com/auth/classroom.rosters", 11466 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11467 // ] 11468 // } 11469 11470} 11471 11472// Pages invokes f for each page of results. 11473// A non-nil error returned from f will halt the iteration. 11474// The provided context supersedes any context provided to the Context method. 11475func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error { 11476 c.ctx_ = ctx 11477 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 11478 for { 11479 x, err := c.Do() 11480 if err != nil { 11481 return err 11482 } 11483 if err := f(x); err != nil { 11484 return err 11485 } 11486 if x.NextPageToken == "" { 11487 return nil 11488 } 11489 c.PageToken(x.NextPageToken) 11490 } 11491} 11492 11493// method id "classroom.registrations.create": 11494 11495type RegistrationsCreateCall struct { 11496 s *Service 11497 registration *Registration 11498 urlParams_ gensupport.URLParams 11499 ctx_ context.Context 11500 header_ http.Header 11501} 11502 11503// Create: Creates a `Registration`, causing Classroom to start sending 11504// notifications 11505// from the provided `feed` to the destination provided in 11506// `cloudPubSubTopic`. 11507// 11508// Returns the created `Registration`. Currently, this will be the same 11509// as 11510// the argument, but with server-assigned fields such as `expiry_time` 11511// and 11512// `id` filled in. 11513// 11514// Note that any value specified for the `expiry_time` or `id` fields 11515// will be 11516// ignored. 11517// 11518// While Classroom may validate the `cloudPubSubTopic` and return errors 11519// on a 11520// best effort basis, it is the caller's responsibility to ensure that 11521// it 11522// exists and that Classroom has permission to publish to it. 11523// 11524// This method may return the following error codes: 11525// 11526// * `PERMISSION_DENIED` if: 11527// * the authenticated user does not have permission to receive 11528// notifications from the requested field; or 11529// * the credential provided does not include the appropriate scope 11530// for 11531// the requested feed. 11532// * another access error is encountered. 11533// * `INVALID_ARGUMENT` if: 11534// * no `cloudPubsubTopic` is specified, or the specified 11535// `cloudPubsubTopic` is not valid; or 11536// * no `feed` is specified, or the specified `feed` is not valid. 11537// * `NOT_FOUND` if: 11538// * the specified `feed` cannot be located, or the requesting user 11539// does 11540// not have permission to determine whether or not it exists; or 11541// * the specified `cloudPubsubTopic` cannot be located, or 11542// Classroom has 11543// not been granted permission to publish to it. 11544func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall { 11545 c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11546 c.registration = registration 11547 return c 11548} 11549 11550// Fields allows partial responses to be retrieved. See 11551// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11552// for more information. 11553func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall { 11554 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11555 return c 11556} 11557 11558// Context sets the context to be used in this call's Do method. Any 11559// pending HTTP request will be aborted if the provided context is 11560// canceled. 11561func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall { 11562 c.ctx_ = ctx 11563 return c 11564} 11565 11566// Header returns an http.Header that can be modified by the caller to 11567// add HTTP headers to the request. 11568func (c *RegistrationsCreateCall) Header() http.Header { 11569 if c.header_ == nil { 11570 c.header_ = make(http.Header) 11571 } 11572 return c.header_ 11573} 11574 11575func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) { 11576 reqHeaders := make(http.Header) 11577 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 11578 for k, v := range c.header_ { 11579 reqHeaders[k] = v 11580 } 11581 reqHeaders.Set("User-Agent", c.s.userAgent()) 11582 var body io.Reader = nil 11583 body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration) 11584 if err != nil { 11585 return nil, err 11586 } 11587 reqHeaders.Set("Content-Type", "application/json") 11588 c.urlParams_.Set("alt", alt) 11589 c.urlParams_.Set("prettyPrint", "false") 11590 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations") 11591 urls += "?" + c.urlParams_.Encode() 11592 req, err := http.NewRequest("POST", urls, body) 11593 if err != nil { 11594 return nil, err 11595 } 11596 req.Header = reqHeaders 11597 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11598} 11599 11600// Do executes the "classroom.registrations.create" call. 11601// Exactly one of *Registration or error will be non-nil. Any non-2xx 11602// status code is an error. Response headers are in either 11603// *Registration.ServerResponse.Header or (if a response was returned at 11604// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11605// to check whether the returned error was because 11606// http.StatusNotModified was returned. 11607func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) { 11608 gensupport.SetOptions(c.urlParams_, opts...) 11609 res, err := c.doRequest("json") 11610 if res != nil && res.StatusCode == http.StatusNotModified { 11611 if res.Body != nil { 11612 res.Body.Close() 11613 } 11614 return nil, &googleapi.Error{ 11615 Code: res.StatusCode, 11616 Header: res.Header, 11617 } 11618 } 11619 if err != nil { 11620 return nil, err 11621 } 11622 defer googleapi.CloseBody(res) 11623 if err := googleapi.CheckResponse(res); err != nil { 11624 return nil, err 11625 } 11626 ret := &Registration{ 11627 ServerResponse: googleapi.ServerResponse{ 11628 Header: res.Header, 11629 HTTPStatusCode: res.StatusCode, 11630 }, 11631 } 11632 target := &ret 11633 if err := gensupport.DecodeResponse(target, res); err != nil { 11634 return nil, err 11635 } 11636 return ret, nil 11637 // { 11638 // "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.", 11639 // "flatPath": "v1/registrations", 11640 // "httpMethod": "POST", 11641 // "id": "classroom.registrations.create", 11642 // "parameterOrder": [], 11643 // "parameters": {}, 11644 // "path": "v1/registrations", 11645 // "request": { 11646 // "$ref": "Registration" 11647 // }, 11648 // "response": { 11649 // "$ref": "Registration" 11650 // }, 11651 // "scopes": [ 11652 // "https://www.googleapis.com/auth/classroom.push-notifications" 11653 // ] 11654 // } 11655 11656} 11657 11658// method id "classroom.registrations.delete": 11659 11660type RegistrationsDeleteCall struct { 11661 s *Service 11662 registrationId string 11663 urlParams_ gensupport.URLParams 11664 ctx_ context.Context 11665 header_ http.Header 11666} 11667 11668// Delete: Deletes a `Registration`, causing Classroom to stop sending 11669// notifications 11670// for that `Registration`. 11671func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall { 11672 c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11673 c.registrationId = registrationId 11674 return c 11675} 11676 11677// Fields allows partial responses to be retrieved. See 11678// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11679// for more information. 11680func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall { 11681 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11682 return c 11683} 11684 11685// Context sets the context to be used in this call's Do method. Any 11686// pending HTTP request will be aborted if the provided context is 11687// canceled. 11688func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall { 11689 c.ctx_ = ctx 11690 return c 11691} 11692 11693// Header returns an http.Header that can be modified by the caller to 11694// add HTTP headers to the request. 11695func (c *RegistrationsDeleteCall) Header() http.Header { 11696 if c.header_ == nil { 11697 c.header_ = make(http.Header) 11698 } 11699 return c.header_ 11700} 11701 11702func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11703 reqHeaders := make(http.Header) 11704 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 11705 for k, v := range c.header_ { 11706 reqHeaders[k] = v 11707 } 11708 reqHeaders.Set("User-Agent", c.s.userAgent()) 11709 var body io.Reader = nil 11710 c.urlParams_.Set("alt", alt) 11711 c.urlParams_.Set("prettyPrint", "false") 11712 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}") 11713 urls += "?" + c.urlParams_.Encode() 11714 req, err := http.NewRequest("DELETE", urls, body) 11715 if err != nil { 11716 return nil, err 11717 } 11718 req.Header = reqHeaders 11719 googleapi.Expand(req.URL, map[string]string{ 11720 "registrationId": c.registrationId, 11721 }) 11722 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11723} 11724 11725// Do executes the "classroom.registrations.delete" call. 11726// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11727// code is an error. Response headers are in either 11728// *Empty.ServerResponse.Header or (if a response was returned at all) 11729// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11730// check whether the returned error was because http.StatusNotModified 11731// was returned. 11732func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11733 gensupport.SetOptions(c.urlParams_, opts...) 11734 res, err := c.doRequest("json") 11735 if res != nil && res.StatusCode == http.StatusNotModified { 11736 if res.Body != nil { 11737 res.Body.Close() 11738 } 11739 return nil, &googleapi.Error{ 11740 Code: res.StatusCode, 11741 Header: res.Header, 11742 } 11743 } 11744 if err != nil { 11745 return nil, err 11746 } 11747 defer googleapi.CloseBody(res) 11748 if err := googleapi.CheckResponse(res); err != nil { 11749 return nil, err 11750 } 11751 ret := &Empty{ 11752 ServerResponse: googleapi.ServerResponse{ 11753 Header: res.Header, 11754 HTTPStatusCode: res.StatusCode, 11755 }, 11756 } 11757 target := &ret 11758 if err := gensupport.DecodeResponse(target, res); err != nil { 11759 return nil, err 11760 } 11761 return ret, nil 11762 // { 11763 // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications\nfor that `Registration`.", 11764 // "flatPath": "v1/registrations/{registrationId}", 11765 // "httpMethod": "DELETE", 11766 // "id": "classroom.registrations.delete", 11767 // "parameterOrder": [ 11768 // "registrationId" 11769 // ], 11770 // "parameters": { 11771 // "registrationId": { 11772 // "description": "The `registration_id` of the `Registration` to be deleted.", 11773 // "location": "path", 11774 // "required": true, 11775 // "type": "string" 11776 // } 11777 // }, 11778 // "path": "v1/registrations/{registrationId}", 11779 // "response": { 11780 // "$ref": "Empty" 11781 // }, 11782 // "scopes": [ 11783 // "https://www.googleapis.com/auth/classroom.push-notifications" 11784 // ] 11785 // } 11786 11787} 11788 11789// method id "classroom.userProfiles.get": 11790 11791type UserProfilesGetCall struct { 11792 s *Service 11793 userId string 11794 urlParams_ gensupport.URLParams 11795 ifNoneMatch_ string 11796 ctx_ context.Context 11797 header_ http.Header 11798} 11799 11800// Get: Returns a user profile. 11801// 11802// This method returns the following error codes: 11803// 11804// * `PERMISSION_DENIED` if the requesting user is not permitted to 11805// access 11806// this user profile, if no profile exists with the requested ID, or 11807// for 11808// access errors. 11809func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall { 11810 c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11811 c.userId = userId 11812 return c 11813} 11814 11815// Fields allows partial responses to be retrieved. See 11816// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11817// for more information. 11818func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall { 11819 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11820 return c 11821} 11822 11823// IfNoneMatch sets the optional parameter which makes the operation 11824// fail if the object's ETag matches the given value. This is useful for 11825// getting updates only after the object has changed since the last 11826// request. Use googleapi.IsNotModified to check whether the response 11827// error from Do is the result of In-None-Match. 11828func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall { 11829 c.ifNoneMatch_ = entityTag 11830 return c 11831} 11832 11833// Context sets the context to be used in this call's Do method. Any 11834// pending HTTP request will be aborted if the provided context is 11835// canceled. 11836func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall { 11837 c.ctx_ = ctx 11838 return c 11839} 11840 11841// Header returns an http.Header that can be modified by the caller to 11842// add HTTP headers to the request. 11843func (c *UserProfilesGetCall) Header() http.Header { 11844 if c.header_ == nil { 11845 c.header_ = make(http.Header) 11846 } 11847 return c.header_ 11848} 11849 11850func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) { 11851 reqHeaders := make(http.Header) 11852 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 11853 for k, v := range c.header_ { 11854 reqHeaders[k] = v 11855 } 11856 reqHeaders.Set("User-Agent", c.s.userAgent()) 11857 if c.ifNoneMatch_ != "" { 11858 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11859 } 11860 var body io.Reader = nil 11861 c.urlParams_.Set("alt", alt) 11862 c.urlParams_.Set("prettyPrint", "false") 11863 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}") 11864 urls += "?" + c.urlParams_.Encode() 11865 req, err := http.NewRequest("GET", urls, body) 11866 if err != nil { 11867 return nil, err 11868 } 11869 req.Header = reqHeaders 11870 googleapi.Expand(req.URL, map[string]string{ 11871 "userId": c.userId, 11872 }) 11873 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11874} 11875 11876// Do executes the "classroom.userProfiles.get" call. 11877// Exactly one of *UserProfile or error will be non-nil. Any non-2xx 11878// status code is an error. Response headers are in either 11879// *UserProfile.ServerResponse.Header or (if a response was returned at 11880// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11881// to check whether the returned error was because 11882// http.StatusNotModified was returned. 11883func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) { 11884 gensupport.SetOptions(c.urlParams_, opts...) 11885 res, err := c.doRequest("json") 11886 if res != nil && res.StatusCode == http.StatusNotModified { 11887 if res.Body != nil { 11888 res.Body.Close() 11889 } 11890 return nil, &googleapi.Error{ 11891 Code: res.StatusCode, 11892 Header: res.Header, 11893 } 11894 } 11895 if err != nil { 11896 return nil, err 11897 } 11898 defer googleapi.CloseBody(res) 11899 if err := googleapi.CheckResponse(res); err != nil { 11900 return nil, err 11901 } 11902 ret := &UserProfile{ 11903 ServerResponse: googleapi.ServerResponse{ 11904 Header: res.Header, 11905 HTTPStatusCode: res.StatusCode, 11906 }, 11907 } 11908 target := &ret 11909 if err := gensupport.DecodeResponse(target, res); err != nil { 11910 return nil, err 11911 } 11912 return ret, nil 11913 // { 11914 // "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.", 11915 // "flatPath": "v1/userProfiles/{userId}", 11916 // "httpMethod": "GET", 11917 // "id": "classroom.userProfiles.get", 11918 // "parameterOrder": [ 11919 // "userId" 11920 // ], 11921 // "parameters": { 11922 // "userId": { 11923 // "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", 11924 // "location": "path", 11925 // "required": true, 11926 // "type": "string" 11927 // } 11928 // }, 11929 // "path": "v1/userProfiles/{userId}", 11930 // "response": { 11931 // "$ref": "UserProfile" 11932 // }, 11933 // "scopes": [ 11934 // "https://www.googleapis.com/auth/classroom.profile.emails", 11935 // "https://www.googleapis.com/auth/classroom.profile.photos", 11936 // "https://www.googleapis.com/auth/classroom.rosters", 11937 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11938 // ] 11939 // } 11940 11941} 11942 11943// method id "classroom.userProfiles.guardianInvitations.create": 11944 11945type UserProfilesGuardianInvitationsCreateCall struct { 11946 s *Service 11947 studentId string 11948 guardianinvitation *GuardianInvitation 11949 urlParams_ gensupport.URLParams 11950 ctx_ context.Context 11951 header_ http.Header 11952} 11953 11954// Create: Creates a guardian invitation, and sends an email to the 11955// guardian asking 11956// them to confirm that they are the student's guardian. 11957// 11958// Once the guardian accepts the invitation, their `state` will change 11959// to 11960// `COMPLETED` and they will start receiving guardian notifications. 11961// A 11962// `Guardian` resource will also be created to represent the active 11963// guardian. 11964// 11965// The request object must have the `student_id` 11966// and 11967// `invited_email_address` fields set. Failing to set these fields, 11968// or 11969// setting any other fields in the request, will result in an 11970// error. 11971// 11972// This method returns the following error codes: 11973// 11974// * `PERMISSION_DENIED` if the current user does not have permission 11975// to 11976// manage guardians, if the guardian in question has already rejected 11977// too many requests for that student, if guardians are not enabled 11978// for the 11979// domain in question, or for other access errors. 11980// * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the 11981// guardian 11982// link limit. 11983// * `INVALID_ARGUMENT` if the guardian email address is not valid (for 11984// example, if it is too long), or if the format of the student ID 11985// provided 11986// cannot be recognized (it is not an email address, nor a `user_id` 11987// from 11988// this API). This error will also be returned if read-only fields are 11989// set, 11990// or if the `state` field is set to to a value other than 11991// `PENDING`. 11992// * `NOT_FOUND` if the student ID provided is a valid student ID, but 11993// Classroom has no record of that student. 11994// * `ALREADY_EXISTS` if there is already a pending guardian invitation 11995// for 11996// the student and `invited_email_address` provided, or if the 11997// provided 11998// `invited_email_address` matches the Google account of an existing 11999// `Guardian` for this user. 12000func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall { 12001 c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12002 c.studentId = studentId 12003 c.guardianinvitation = guardianinvitation 12004 return c 12005} 12006 12007// Fields allows partial responses to be retrieved. See 12008// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12009// for more information. 12010func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall { 12011 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12012 return c 12013} 12014 12015// Context sets the context to be used in this call's Do method. Any 12016// pending HTTP request will be aborted if the provided context is 12017// canceled. 12018func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall { 12019 c.ctx_ = ctx 12020 return c 12021} 12022 12023// Header returns an http.Header that can be modified by the caller to 12024// add HTTP headers to the request. 12025func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header { 12026 if c.header_ == nil { 12027 c.header_ = make(http.Header) 12028 } 12029 return c.header_ 12030} 12031 12032func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 12033 reqHeaders := make(http.Header) 12034 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 12035 for k, v := range c.header_ { 12036 reqHeaders[k] = v 12037 } 12038 reqHeaders.Set("User-Agent", c.s.userAgent()) 12039 var body io.Reader = nil 12040 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12041 if err != nil { 12042 return nil, err 12043 } 12044 reqHeaders.Set("Content-Type", "application/json") 12045 c.urlParams_.Set("alt", alt) 12046 c.urlParams_.Set("prettyPrint", "false") 12047 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12048 urls += "?" + c.urlParams_.Encode() 12049 req, err := http.NewRequest("POST", urls, body) 12050 if err != nil { 12051 return nil, err 12052 } 12053 req.Header = reqHeaders 12054 googleapi.Expand(req.URL, map[string]string{ 12055 "studentId": c.studentId, 12056 }) 12057 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12058} 12059 12060// Do executes the "classroom.userProfiles.guardianInvitations.create" call. 12061// Exactly one of *GuardianInvitation or error will be non-nil. Any 12062// non-2xx status code is an error. Response headers are in either 12063// *GuardianInvitation.ServerResponse.Header or (if a response was 12064// returned at all) in error.(*googleapi.Error).Header. Use 12065// googleapi.IsNotModified to check whether the returned error was 12066// because http.StatusNotModified was returned. 12067func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12068 gensupport.SetOptions(c.urlParams_, opts...) 12069 res, err := c.doRequest("json") 12070 if res != nil && res.StatusCode == http.StatusNotModified { 12071 if res.Body != nil { 12072 res.Body.Close() 12073 } 12074 return nil, &googleapi.Error{ 12075 Code: res.StatusCode, 12076 Header: res.Header, 12077 } 12078 } 12079 if err != nil { 12080 return nil, err 12081 } 12082 defer googleapi.CloseBody(res) 12083 if err := googleapi.CheckResponse(res); err != nil { 12084 return nil, err 12085 } 12086 ret := &GuardianInvitation{ 12087 ServerResponse: googleapi.ServerResponse{ 12088 Header: res.Header, 12089 HTTPStatusCode: res.StatusCode, 12090 }, 12091 } 12092 target := &ret 12093 if err := gensupport.DecodeResponse(target, res); err != nil { 12094 return nil, err 12095 } 12096 return ret, nil 12097 // { 12098 // "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.", 12099 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12100 // "httpMethod": "POST", 12101 // "id": "classroom.userProfiles.guardianInvitations.create", 12102 // "parameterOrder": [ 12103 // "studentId" 12104 // ], 12105 // "parameters": { 12106 // "studentId": { 12107 // "description": "ID of the student (in standard format)", 12108 // "location": "path", 12109 // "required": true, 12110 // "type": "string" 12111 // } 12112 // }, 12113 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12114 // "request": { 12115 // "$ref": "GuardianInvitation" 12116 // }, 12117 // "response": { 12118 // "$ref": "GuardianInvitation" 12119 // }, 12120 // "scopes": [ 12121 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12122 // ] 12123 // } 12124 12125} 12126 12127// method id "classroom.userProfiles.guardianInvitations.get": 12128 12129type UserProfilesGuardianInvitationsGetCall struct { 12130 s *Service 12131 studentId string 12132 invitationId string 12133 urlParams_ gensupport.URLParams 12134 ifNoneMatch_ string 12135 ctx_ context.Context 12136 header_ http.Header 12137} 12138 12139// Get: Returns a specific guardian invitation. 12140// 12141// This method returns the following error codes: 12142// 12143// * `PERMISSION_DENIED` if the requesting user is not permitted to 12144// view 12145// guardian invitations for the student identified by the 12146// `student_id`, if 12147// guardians are not enabled for the domain in question, or for other 12148// access errors. 12149// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12150// cannot 12151// be recognized (it is not an email address, nor a `student_id` from 12152// the 12153// API, nor the literal string `me`). 12154// * `NOT_FOUND` if Classroom cannot find any record of the given 12155// student or 12156// `invitation_id`. May also be returned if the student exists, but 12157// the 12158// requesting user does not have access to see that student. 12159func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall { 12160 c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12161 c.studentId = studentId 12162 c.invitationId = invitationId 12163 return c 12164} 12165 12166// Fields allows partial responses to be retrieved. See 12167// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12168// for more information. 12169func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall { 12170 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12171 return c 12172} 12173 12174// IfNoneMatch sets the optional parameter which makes the operation 12175// fail if the object's ETag matches the given value. This is useful for 12176// getting updates only after the object has changed since the last 12177// request. Use googleapi.IsNotModified to check whether the response 12178// error from Do is the result of In-None-Match. 12179func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall { 12180 c.ifNoneMatch_ = entityTag 12181 return c 12182} 12183 12184// Context sets the context to be used in this call's Do method. Any 12185// pending HTTP request will be aborted if the provided context is 12186// canceled. 12187func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall { 12188 c.ctx_ = ctx 12189 return c 12190} 12191 12192// Header returns an http.Header that can be modified by the caller to 12193// add HTTP headers to the request. 12194func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header { 12195 if c.header_ == nil { 12196 c.header_ = make(http.Header) 12197 } 12198 return c.header_ 12199} 12200 12201func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) { 12202 reqHeaders := make(http.Header) 12203 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 12204 for k, v := range c.header_ { 12205 reqHeaders[k] = v 12206 } 12207 reqHeaders.Set("User-Agent", c.s.userAgent()) 12208 if c.ifNoneMatch_ != "" { 12209 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12210 } 12211 var body io.Reader = nil 12212 c.urlParams_.Set("alt", alt) 12213 c.urlParams_.Set("prettyPrint", "false") 12214 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12215 urls += "?" + c.urlParams_.Encode() 12216 req, err := http.NewRequest("GET", urls, body) 12217 if err != nil { 12218 return nil, err 12219 } 12220 req.Header = reqHeaders 12221 googleapi.Expand(req.URL, map[string]string{ 12222 "studentId": c.studentId, 12223 "invitationId": c.invitationId, 12224 }) 12225 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12226} 12227 12228// Do executes the "classroom.userProfiles.guardianInvitations.get" call. 12229// Exactly one of *GuardianInvitation or error will be non-nil. Any 12230// non-2xx status code is an error. Response headers are in either 12231// *GuardianInvitation.ServerResponse.Header or (if a response was 12232// returned at all) in error.(*googleapi.Error).Header. Use 12233// googleapi.IsNotModified to check whether the returned error was 12234// because http.StatusNotModified was returned. 12235func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12236 gensupport.SetOptions(c.urlParams_, opts...) 12237 res, err := c.doRequest("json") 12238 if res != nil && res.StatusCode == http.StatusNotModified { 12239 if res.Body != nil { 12240 res.Body.Close() 12241 } 12242 return nil, &googleapi.Error{ 12243 Code: res.StatusCode, 12244 Header: res.Header, 12245 } 12246 } 12247 if err != nil { 12248 return nil, err 12249 } 12250 defer googleapi.CloseBody(res) 12251 if err := googleapi.CheckResponse(res); err != nil { 12252 return nil, err 12253 } 12254 ret := &GuardianInvitation{ 12255 ServerResponse: googleapi.ServerResponse{ 12256 Header: res.Header, 12257 HTTPStatusCode: res.StatusCode, 12258 }, 12259 } 12260 target := &ret 12261 if err := gensupport.DecodeResponse(target, res); err != nil { 12262 return nil, err 12263 } 12264 return ret, nil 12265 // { 12266 // "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.", 12267 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12268 // "httpMethod": "GET", 12269 // "id": "classroom.userProfiles.guardianInvitations.get", 12270 // "parameterOrder": [ 12271 // "studentId", 12272 // "invitationId" 12273 // ], 12274 // "parameters": { 12275 // "invitationId": { 12276 // "description": "The `id` field of the `GuardianInvitation` being requested.", 12277 // "location": "path", 12278 // "required": true, 12279 // "type": "string" 12280 // }, 12281 // "studentId": { 12282 // "description": "The ID of the student whose guardian invitation is being requested.", 12283 // "location": "path", 12284 // "required": true, 12285 // "type": "string" 12286 // } 12287 // }, 12288 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12289 // "response": { 12290 // "$ref": "GuardianInvitation" 12291 // }, 12292 // "scopes": [ 12293 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12294 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12295 // ] 12296 // } 12297 12298} 12299 12300// method id "classroom.userProfiles.guardianInvitations.list": 12301 12302type UserProfilesGuardianInvitationsListCall struct { 12303 s *Service 12304 studentId string 12305 urlParams_ gensupport.URLParams 12306 ifNoneMatch_ string 12307 ctx_ context.Context 12308 header_ http.Header 12309} 12310 12311// List: Returns a list of guardian invitations that the requesting user 12312// is 12313// permitted to view, filtered by the parameters provided. 12314// 12315// This method returns the following error codes: 12316// 12317// * `PERMISSION_DENIED` if a `student_id` is specified, and the 12318// requesting 12319// user is not permitted to view guardian invitations for that 12320// student, if 12321// "-" is specified as the `student_id` and the user is not a 12322// domain 12323// administrator, if guardians are not enabled for the domain in 12324// question, 12325// or for other access errors. 12326// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12327// cannot 12328// be recognized (it is not an email address, nor a `student_id` from 12329// the 12330// API, nor the literal string `me`). May also be returned if an 12331// invalid 12332// `page_token` or `state` is provided. 12333// * `NOT_FOUND` if a `student_id` is specified, and its format can be 12334// recognized, but Classroom has no record of that student. 12335func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall { 12336 c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12337 c.studentId = studentId 12338 return c 12339} 12340 12341// InvitedEmailAddress sets the optional parameter 12342// "invitedEmailAddress": If specified, only results with the specified 12343// `invited_email_address` 12344// will be returned. 12345func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall { 12346 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 12347 return c 12348} 12349 12350// PageSize sets the optional parameter "pageSize": Maximum number of 12351// items to return. Zero or unspecified indicates that the 12352// server may assign a maximum. 12353// 12354// The server may return fewer than the specified number of results. 12355func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall { 12356 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 12357 return c 12358} 12359 12360// PageToken sets the optional parameter "pageToken": 12361// nextPageToken 12362// value returned from a previous 12363// list call, 12364// indicating that the subsequent page of results should be 12365// returned. 12366// 12367// The list request 12368// must be otherwise identical to the one that resulted in this token. 12369func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall { 12370 c.urlParams_.Set("pageToken", pageToken) 12371 return c 12372} 12373 12374// States sets the optional parameter "states": If specified, only 12375// results with the specified `state` values will be 12376// returned. Otherwise, results with a `state` of `PENDING` will be 12377// returned. 12378// 12379// Possible values: 12380// "GUARDIAN_INVITATION_STATE_UNSPECIFIED" 12381// "PENDING" 12382// "COMPLETE" 12383func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall { 12384 c.urlParams_.SetMulti("states", append([]string{}, states...)) 12385 return c 12386} 12387 12388// Fields allows partial responses to be retrieved. See 12389// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12390// for more information. 12391func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall { 12392 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12393 return c 12394} 12395 12396// IfNoneMatch sets the optional parameter which makes the operation 12397// fail if the object's ETag matches the given value. This is useful for 12398// getting updates only after the object has changed since the last 12399// request. Use googleapi.IsNotModified to check whether the response 12400// error from Do is the result of In-None-Match. 12401func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall { 12402 c.ifNoneMatch_ = entityTag 12403 return c 12404} 12405 12406// Context sets the context to be used in this call's Do method. Any 12407// pending HTTP request will be aborted if the provided context is 12408// canceled. 12409func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall { 12410 c.ctx_ = ctx 12411 return c 12412} 12413 12414// Header returns an http.Header that can be modified by the caller to 12415// add HTTP headers to the request. 12416func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header { 12417 if c.header_ == nil { 12418 c.header_ = make(http.Header) 12419 } 12420 return c.header_ 12421} 12422 12423func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) { 12424 reqHeaders := make(http.Header) 12425 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 12426 for k, v := range c.header_ { 12427 reqHeaders[k] = v 12428 } 12429 reqHeaders.Set("User-Agent", c.s.userAgent()) 12430 if c.ifNoneMatch_ != "" { 12431 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12432 } 12433 var body io.Reader = nil 12434 c.urlParams_.Set("alt", alt) 12435 c.urlParams_.Set("prettyPrint", "false") 12436 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12437 urls += "?" + c.urlParams_.Encode() 12438 req, err := http.NewRequest("GET", urls, body) 12439 if err != nil { 12440 return nil, err 12441 } 12442 req.Header = reqHeaders 12443 googleapi.Expand(req.URL, map[string]string{ 12444 "studentId": c.studentId, 12445 }) 12446 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12447} 12448 12449// Do executes the "classroom.userProfiles.guardianInvitations.list" call. 12450// Exactly one of *ListGuardianInvitationsResponse or error will be 12451// non-nil. Any non-2xx status code is an error. Response headers are in 12452// either *ListGuardianInvitationsResponse.ServerResponse.Header or (if 12453// a response was returned at all) in error.(*googleapi.Error).Header. 12454// Use googleapi.IsNotModified to check whether the returned error was 12455// because http.StatusNotModified was returned. 12456func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) { 12457 gensupport.SetOptions(c.urlParams_, opts...) 12458 res, err := c.doRequest("json") 12459 if res != nil && res.StatusCode == http.StatusNotModified { 12460 if res.Body != nil { 12461 res.Body.Close() 12462 } 12463 return nil, &googleapi.Error{ 12464 Code: res.StatusCode, 12465 Header: res.Header, 12466 } 12467 } 12468 if err != nil { 12469 return nil, err 12470 } 12471 defer googleapi.CloseBody(res) 12472 if err := googleapi.CheckResponse(res); err != nil { 12473 return nil, err 12474 } 12475 ret := &ListGuardianInvitationsResponse{ 12476 ServerResponse: googleapi.ServerResponse{ 12477 Header: res.Header, 12478 HTTPStatusCode: res.StatusCode, 12479 }, 12480 } 12481 target := &ret 12482 if err := gensupport.DecodeResponse(target, res); err != nil { 12483 return nil, err 12484 } 12485 return ret, nil 12486 // { 12487 // "description": "Returns a list of guardian invitations that the requesting user is\npermitted to view, filtered by the parameters provided.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if a `student_id` is specified, and the requesting\n user is not permitted to view guardian invitations for that student, if\n `\"-\"` is specified as the `student_id` and the user is not a domain\n administrator, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`). May also be returned if an invalid\n `page_token` or `state` is provided.\n* `NOT_FOUND` if a `student_id` is specified, and its format can be\n recognized, but Classroom has no record of that student.", 12488 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12489 // "httpMethod": "GET", 12490 // "id": "classroom.userProfiles.guardianInvitations.list", 12491 // "parameterOrder": [ 12492 // "studentId" 12493 // ], 12494 // "parameters": { 12495 // "invitedEmailAddress": { 12496 // "description": "If specified, only results with the specified `invited_email_address`\nwill be returned.", 12497 // "location": "query", 12498 // "type": "string" 12499 // }, 12500 // "pageSize": { 12501 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 12502 // "format": "int32", 12503 // "location": "query", 12504 // "type": "integer" 12505 // }, 12506 // "pageToken": { 12507 // "description": "nextPageToken\nvalue returned from a previous\nlist 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.", 12508 // "location": "query", 12509 // "type": "string" 12510 // }, 12511 // "states": { 12512 // "description": "If specified, only results with the specified `state` values will be\nreturned. Otherwise, results with a `state` of `PENDING` will be returned.", 12513 // "enum": [ 12514 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED", 12515 // "PENDING", 12516 // "COMPLETE" 12517 // ], 12518 // "location": "query", 12519 // "repeated": true, 12520 // "type": "string" 12521 // }, 12522 // "studentId": { 12523 // "description": "The ID of the student whose guardian invitations are to be returned.\nThe identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user\n* the string literal `\"-\"`, indicating that results should be returned for\n all students that the requesting user is permitted to view guardian\n invitations.", 12524 // "location": "path", 12525 // "required": true, 12526 // "type": "string" 12527 // } 12528 // }, 12529 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12530 // "response": { 12531 // "$ref": "ListGuardianInvitationsResponse" 12532 // }, 12533 // "scopes": [ 12534 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12535 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12536 // ] 12537 // } 12538 12539} 12540 12541// Pages invokes f for each page of results. 12542// A non-nil error returned from f will halt the iteration. 12543// The provided context supersedes any context provided to the Context method. 12544func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error { 12545 c.ctx_ = ctx 12546 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12547 for { 12548 x, err := c.Do() 12549 if err != nil { 12550 return err 12551 } 12552 if err := f(x); err != nil { 12553 return err 12554 } 12555 if x.NextPageToken == "" { 12556 return nil 12557 } 12558 c.PageToken(x.NextPageToken) 12559 } 12560} 12561 12562// method id "classroom.userProfiles.guardianInvitations.patch": 12563 12564type UserProfilesGuardianInvitationsPatchCall struct { 12565 s *Service 12566 studentId string 12567 invitationId string 12568 guardianinvitation *GuardianInvitation 12569 urlParams_ gensupport.URLParams 12570 ctx_ context.Context 12571 header_ http.Header 12572} 12573 12574// Patch: Modifies a guardian invitation. 12575// 12576// Currently, the only valid modification is to change the `state` 12577// from 12578// `PENDING` to `COMPLETE`. This has the effect of withdrawing the 12579// invitation. 12580// 12581// This method returns the following error codes: 12582// 12583// * `PERMISSION_DENIED` if the current user does not have permission 12584// to 12585// manage guardians, if guardians are not enabled for the domain in 12586// question 12587// or for other access errors. 12588// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` 12589// state. 12590// * `INVALID_ARGUMENT` if the format of the student ID provided 12591// cannot be recognized (it is not an email address, nor a `user_id` 12592// from 12593// this API), or if the passed `GuardianInvitation` has a `state` 12594// other than 12595// `COMPLETE`, or if it modifies fields other than `state`. 12596// * `NOT_FOUND` if the student ID provided is a valid student ID, but 12597// Classroom has no record of that student, or if the `id` field does 12598// not 12599// refer to a guardian invitation known to Classroom. 12600func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall { 12601 c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12602 c.studentId = studentId 12603 c.invitationId = invitationId 12604 c.guardianinvitation = guardianinvitation 12605 return c 12606} 12607 12608// UpdateMask sets the optional parameter "updateMask": Mask that 12609// identifies which fields on the course to update. 12610// This field is required to do an update. The update will fail if 12611// invalid 12612// fields are specified. The following fields are valid: 12613// 12614// * `state` 12615// 12616// When set in a query parameter, this field should be specified 12617// as 12618// 12619// `updateMask=<field1>,<field2>,...` 12620func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall { 12621 c.urlParams_.Set("updateMask", updateMask) 12622 return c 12623} 12624 12625// Fields allows partial responses to be retrieved. See 12626// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12627// for more information. 12628func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall { 12629 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12630 return c 12631} 12632 12633// Context sets the context to be used in this call's Do method. Any 12634// pending HTTP request will be aborted if the provided context is 12635// canceled. 12636func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall { 12637 c.ctx_ = ctx 12638 return c 12639} 12640 12641// Header returns an http.Header that can be modified by the caller to 12642// add HTTP headers to the request. 12643func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header { 12644 if c.header_ == nil { 12645 c.header_ = make(http.Header) 12646 } 12647 return c.header_ 12648} 12649 12650func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) { 12651 reqHeaders := make(http.Header) 12652 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 12653 for k, v := range c.header_ { 12654 reqHeaders[k] = v 12655 } 12656 reqHeaders.Set("User-Agent", c.s.userAgent()) 12657 var body io.Reader = nil 12658 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12659 if err != nil { 12660 return nil, err 12661 } 12662 reqHeaders.Set("Content-Type", "application/json") 12663 c.urlParams_.Set("alt", alt) 12664 c.urlParams_.Set("prettyPrint", "false") 12665 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12666 urls += "?" + c.urlParams_.Encode() 12667 req, err := http.NewRequest("PATCH", urls, body) 12668 if err != nil { 12669 return nil, err 12670 } 12671 req.Header = reqHeaders 12672 googleapi.Expand(req.URL, map[string]string{ 12673 "studentId": c.studentId, 12674 "invitationId": c.invitationId, 12675 }) 12676 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12677} 12678 12679// Do executes the "classroom.userProfiles.guardianInvitations.patch" call. 12680// Exactly one of *GuardianInvitation or error will be non-nil. Any 12681// non-2xx status code is an error. Response headers are in either 12682// *GuardianInvitation.ServerResponse.Header or (if a response was 12683// returned at all) in error.(*googleapi.Error).Header. Use 12684// googleapi.IsNotModified to check whether the returned error was 12685// because http.StatusNotModified was returned. 12686func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12687 gensupport.SetOptions(c.urlParams_, opts...) 12688 res, err := c.doRequest("json") 12689 if res != nil && res.StatusCode == http.StatusNotModified { 12690 if res.Body != nil { 12691 res.Body.Close() 12692 } 12693 return nil, &googleapi.Error{ 12694 Code: res.StatusCode, 12695 Header: res.Header, 12696 } 12697 } 12698 if err != nil { 12699 return nil, err 12700 } 12701 defer googleapi.CloseBody(res) 12702 if err := googleapi.CheckResponse(res); err != nil { 12703 return nil, err 12704 } 12705 ret := &GuardianInvitation{ 12706 ServerResponse: googleapi.ServerResponse{ 12707 Header: res.Header, 12708 HTTPStatusCode: res.StatusCode, 12709 }, 12710 } 12711 target := &ret 12712 if err := gensupport.DecodeResponse(target, res); err != nil { 12713 return nil, err 12714 } 12715 return ret, nil 12716 // { 12717 // "description": "Modifies a guardian invitation.\n\nCurrently, the only valid modification is to change the `state` from\n`PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the current user does not have permission to\n manage guardians, if guardians are not enabled for the domain in question\n or for other access errors.\n* `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state.\n* `INVALID_ARGUMENT` if the format of the student ID provided\n cannot be recognized (it is not an email address, nor a `user_id` from\n this API), or if the passed `GuardianInvitation` has a `state` other than\n `COMPLETE`, or if it modifies fields other than `state`.\n* `NOT_FOUND` if the student ID provided is a valid student ID, but\n Classroom has no record of that student, or if the `id` field does not\n refer to a guardian invitation known to Classroom.", 12718 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12719 // "httpMethod": "PATCH", 12720 // "id": "classroom.userProfiles.guardianInvitations.patch", 12721 // "parameterOrder": [ 12722 // "studentId", 12723 // "invitationId" 12724 // ], 12725 // "parameters": { 12726 // "invitationId": { 12727 // "description": "The `id` field of the `GuardianInvitation` to be modified.", 12728 // "location": "path", 12729 // "required": true, 12730 // "type": "string" 12731 // }, 12732 // "studentId": { 12733 // "description": "The ID of the student whose guardian invitation is to be modified.", 12734 // "location": "path", 12735 // "required": true, 12736 // "type": "string" 12737 // }, 12738 // "updateMask": { 12739 // "description": "Mask that identifies which fields on the course to update.\nThis field is required to do an update. The update 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,...`", 12740 // "format": "google-fieldmask", 12741 // "location": "query", 12742 // "type": "string" 12743 // } 12744 // }, 12745 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12746 // "request": { 12747 // "$ref": "GuardianInvitation" 12748 // }, 12749 // "response": { 12750 // "$ref": "GuardianInvitation" 12751 // }, 12752 // "scopes": [ 12753 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12754 // ] 12755 // } 12756 12757} 12758 12759// method id "classroom.userProfiles.guardians.delete": 12760 12761type UserProfilesGuardiansDeleteCall struct { 12762 s *Service 12763 studentId string 12764 guardianId string 12765 urlParams_ gensupport.URLParams 12766 ctx_ context.Context 12767 header_ http.Header 12768} 12769 12770// Delete: Deletes a guardian. 12771// 12772// The guardian will no longer receive guardian notifications and the 12773// guardian 12774// will no longer be accessible via the API. 12775// 12776// This method returns the following error codes: 12777// 12778// * `PERMISSION_DENIED` if no user that matches the provided 12779// `student_id` 12780// is visible to the requesting user, if the requesting user is not 12781// permitted to manage guardians for the student identified by the 12782// `student_id`, if guardians are not enabled for the domain in 12783// question, 12784// or for other access errors. 12785// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12786// cannot 12787// be recognized (it is not an email address, nor a `student_id` from 12788// the 12789// API). 12790// * `NOT_FOUND` if the requesting user is permitted to modify guardians 12791// for 12792// the requested `student_id`, but no `Guardian` record exists for 12793// that 12794// student with the provided `guardian_id`. 12795func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall { 12796 c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12797 c.studentId = studentId 12798 c.guardianId = guardianId 12799 return c 12800} 12801 12802// Fields allows partial responses to be retrieved. See 12803// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12804// for more information. 12805func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall { 12806 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12807 return c 12808} 12809 12810// Context sets the context to be used in this call's Do method. Any 12811// pending HTTP request will be aborted if the provided context is 12812// canceled. 12813func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall { 12814 c.ctx_ = ctx 12815 return c 12816} 12817 12818// Header returns an http.Header that can be modified by the caller to 12819// add HTTP headers to the request. 12820func (c *UserProfilesGuardiansDeleteCall) Header() http.Header { 12821 if c.header_ == nil { 12822 c.header_ = make(http.Header) 12823 } 12824 return c.header_ 12825} 12826 12827func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) { 12828 reqHeaders := make(http.Header) 12829 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 12830 for k, v := range c.header_ { 12831 reqHeaders[k] = v 12832 } 12833 reqHeaders.Set("User-Agent", c.s.userAgent()) 12834 var body io.Reader = nil 12835 c.urlParams_.Set("alt", alt) 12836 c.urlParams_.Set("prettyPrint", "false") 12837 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 12838 urls += "?" + c.urlParams_.Encode() 12839 req, err := http.NewRequest("DELETE", urls, body) 12840 if err != nil { 12841 return nil, err 12842 } 12843 req.Header = reqHeaders 12844 googleapi.Expand(req.URL, map[string]string{ 12845 "studentId": c.studentId, 12846 "guardianId": c.guardianId, 12847 }) 12848 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12849} 12850 12851// Do executes the "classroom.userProfiles.guardians.delete" call. 12852// Exactly one of *Empty or error will be non-nil. Any non-2xx status 12853// code is an error. Response headers are in either 12854// *Empty.ServerResponse.Header or (if a response was returned at all) 12855// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12856// check whether the returned error was because http.StatusNotModified 12857// was returned. 12858func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 12859 gensupport.SetOptions(c.urlParams_, opts...) 12860 res, err := c.doRequest("json") 12861 if res != nil && res.StatusCode == http.StatusNotModified { 12862 if res.Body != nil { 12863 res.Body.Close() 12864 } 12865 return nil, &googleapi.Error{ 12866 Code: res.StatusCode, 12867 Header: res.Header, 12868 } 12869 } 12870 if err != nil { 12871 return nil, err 12872 } 12873 defer googleapi.CloseBody(res) 12874 if err := googleapi.CheckResponse(res); err != nil { 12875 return nil, err 12876 } 12877 ret := &Empty{ 12878 ServerResponse: googleapi.ServerResponse{ 12879 Header: res.Header, 12880 HTTPStatusCode: res.StatusCode, 12881 }, 12882 } 12883 target := &ret 12884 if err := gensupport.DecodeResponse(target, res); err != nil { 12885 return nil, err 12886 } 12887 return ret, nil 12888 // { 12889 // "description": "Deletes a guardian.\n\nThe guardian will no longer receive guardian notifications and the guardian\nwill no longer be accessible via the API.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if no user that matches the provided `student_id`\n is visible to the requesting user, if the requesting user is not\n permitted to manage guardians for the student identified by the\n `student_id`, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API).\n* `NOT_FOUND` if the requesting user is permitted to modify guardians for\n the requested `student_id`, but no `Guardian` record exists for that\n student with the provided `guardian_id`.", 12890 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12891 // "httpMethod": "DELETE", 12892 // "id": "classroom.userProfiles.guardians.delete", 12893 // "parameterOrder": [ 12894 // "studentId", 12895 // "guardianId" 12896 // ], 12897 // "parameters": { 12898 // "guardianId": { 12899 // "description": "The `id` field from a `Guardian`.", 12900 // "location": "path", 12901 // "required": true, 12902 // "type": "string" 12903 // }, 12904 // "studentId": { 12905 // "description": "The student whose guardian is to be deleted. One of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 12906 // "location": "path", 12907 // "required": true, 12908 // "type": "string" 12909 // } 12910 // }, 12911 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 12912 // "response": { 12913 // "$ref": "Empty" 12914 // }, 12915 // "scopes": [ 12916 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12917 // ] 12918 // } 12919 12920} 12921 12922// method id "classroom.userProfiles.guardians.get": 12923 12924type UserProfilesGuardiansGetCall struct { 12925 s *Service 12926 studentId string 12927 guardianId string 12928 urlParams_ gensupport.URLParams 12929 ifNoneMatch_ string 12930 ctx_ context.Context 12931 header_ http.Header 12932} 12933 12934// Get: Returns a specific guardian. 12935// 12936// This method returns the following error codes: 12937// 12938// * `PERMISSION_DENIED` if no user that matches the provided 12939// `student_id` 12940// is visible to the requesting user, if the requesting user is not 12941// permitted to view guardian information for the student identified 12942// by the 12943// `student_id`, if guardians are not enabled for the domain in 12944// question, 12945// or for other access errors. 12946// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 12947// cannot 12948// be recognized (it is not an email address, nor a `student_id` from 12949// the 12950// API, nor the literal string `me`). 12951// * `NOT_FOUND` if the requesting user is permitted to view guardians 12952// for 12953// the requested `student_id`, but no `Guardian` record exists for 12954// that 12955// student that matches the provided `guardian_id`. 12956func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall { 12957 c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12958 c.studentId = studentId 12959 c.guardianId = guardianId 12960 return c 12961} 12962 12963// Fields allows partial responses to be retrieved. See 12964// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12965// for more information. 12966func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall { 12967 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12968 return c 12969} 12970 12971// IfNoneMatch sets the optional parameter which makes the operation 12972// fail if the object's ETag matches the given value. This is useful for 12973// getting updates only after the object has changed since the last 12974// request. Use googleapi.IsNotModified to check whether the response 12975// error from Do is the result of In-None-Match. 12976func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall { 12977 c.ifNoneMatch_ = entityTag 12978 return c 12979} 12980 12981// Context sets the context to be used in this call's Do method. Any 12982// pending HTTP request will be aborted if the provided context is 12983// canceled. 12984func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall { 12985 c.ctx_ = ctx 12986 return c 12987} 12988 12989// Header returns an http.Header that can be modified by the caller to 12990// add HTTP headers to the request. 12991func (c *UserProfilesGuardiansGetCall) Header() http.Header { 12992 if c.header_ == nil { 12993 c.header_ = make(http.Header) 12994 } 12995 return c.header_ 12996} 12997 12998func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) { 12999 reqHeaders := make(http.Header) 13000 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 13001 for k, v := range c.header_ { 13002 reqHeaders[k] = v 13003 } 13004 reqHeaders.Set("User-Agent", c.s.userAgent()) 13005 if c.ifNoneMatch_ != "" { 13006 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13007 } 13008 var body io.Reader = nil 13009 c.urlParams_.Set("alt", alt) 13010 c.urlParams_.Set("prettyPrint", "false") 13011 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13012 urls += "?" + c.urlParams_.Encode() 13013 req, err := http.NewRequest("GET", urls, body) 13014 if err != nil { 13015 return nil, err 13016 } 13017 req.Header = reqHeaders 13018 googleapi.Expand(req.URL, map[string]string{ 13019 "studentId": c.studentId, 13020 "guardianId": c.guardianId, 13021 }) 13022 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13023} 13024 13025// Do executes the "classroom.userProfiles.guardians.get" call. 13026// Exactly one of *Guardian or error will be non-nil. Any non-2xx status 13027// code is an error. Response headers are in either 13028// *Guardian.ServerResponse.Header or (if a response was returned at 13029// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13030// to check whether the returned error was because 13031// http.StatusNotModified was returned. 13032func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) { 13033 gensupport.SetOptions(c.urlParams_, opts...) 13034 res, err := c.doRequest("json") 13035 if res != nil && res.StatusCode == http.StatusNotModified { 13036 if res.Body != nil { 13037 res.Body.Close() 13038 } 13039 return nil, &googleapi.Error{ 13040 Code: res.StatusCode, 13041 Header: res.Header, 13042 } 13043 } 13044 if err != nil { 13045 return nil, err 13046 } 13047 defer googleapi.CloseBody(res) 13048 if err := googleapi.CheckResponse(res); err != nil { 13049 return nil, err 13050 } 13051 ret := &Guardian{ 13052 ServerResponse: googleapi.ServerResponse{ 13053 Header: res.Header, 13054 HTTPStatusCode: res.StatusCode, 13055 }, 13056 } 13057 target := &ret 13058 if err := gensupport.DecodeResponse(target, res); err != nil { 13059 return nil, err 13060 } 13061 return ret, nil 13062 // { 13063 // "description": "Returns a specific guardian.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if no user that matches the provided `student_id`\n is visible to the requesting user, if the requesting user is not\n permitted to view guardian information for the student identified by the\n `student_id`, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`).\n* `NOT_FOUND` if the requesting user is permitted to view guardians for\n the requested `student_id`, but no `Guardian` record exists for that\n student that matches the provided `guardian_id`.", 13064 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13065 // "httpMethod": "GET", 13066 // "id": "classroom.userProfiles.guardians.get", 13067 // "parameterOrder": [ 13068 // "studentId", 13069 // "guardianId" 13070 // ], 13071 // "parameters": { 13072 // "guardianId": { 13073 // "description": "The `id` field from a `Guardian`.", 13074 // "location": "path", 13075 // "required": true, 13076 // "type": "string" 13077 // }, 13078 // "studentId": { 13079 // "description": "The student whose guardian is being requested. One of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user", 13080 // "location": "path", 13081 // "required": true, 13082 // "type": "string" 13083 // } 13084 // }, 13085 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13086 // "response": { 13087 // "$ref": "Guardian" 13088 // }, 13089 // "scopes": [ 13090 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13091 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13092 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13093 // ] 13094 // } 13095 13096} 13097 13098// method id "classroom.userProfiles.guardians.list": 13099 13100type UserProfilesGuardiansListCall struct { 13101 s *Service 13102 studentId string 13103 urlParams_ gensupport.URLParams 13104 ifNoneMatch_ string 13105 ctx_ context.Context 13106 header_ http.Header 13107} 13108 13109// List: Returns a list of guardians that the requesting user is 13110// permitted to 13111// view, restricted to those that match the request. 13112// 13113// To list guardians for any student that the requesting user may 13114// view 13115// guardians for, use the literal character `-` for the student 13116// ID. 13117// 13118// This method returns the following error codes: 13119// 13120// * `PERMISSION_DENIED` if a `student_id` is specified, and the 13121// requesting 13122// user is not permitted to view guardian information for that 13123// student, if 13124// "-" is specified as the `student_id` and the user is not a 13125// domain 13126// administrator, if guardians are not enabled for the domain in 13127// question, 13128// if the `invited_email_address` filter is set by a user who is not 13129// a 13130// domain administrator, or for other access errors. 13131// * `INVALID_ARGUMENT` if a `student_id` is specified, but its format 13132// cannot 13133// be recognized (it is not an email address, nor a `student_id` from 13134// the 13135// API, nor the literal string `me`). May also be returned if an 13136// invalid 13137// `page_token` is provided. 13138// * `NOT_FOUND` if a `student_id` is specified, and its format can be 13139// recognized, but Classroom has no record of that student. 13140func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall { 13141 c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13142 c.studentId = studentId 13143 return c 13144} 13145 13146// InvitedEmailAddress sets the optional parameter 13147// "invitedEmailAddress": Filter results by the email address that the 13148// original invitation was sent 13149// to, resulting in this guardian link. 13150// This filter can only be used by domain administrators. 13151func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall { 13152 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 13153 return c 13154} 13155 13156// PageSize sets the optional parameter "pageSize": Maximum number of 13157// items to return. Zero or unspecified indicates that the 13158// server may assign a maximum. 13159// 13160// The server may return fewer than the specified number of results. 13161func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall { 13162 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 13163 return c 13164} 13165 13166// PageToken sets the optional parameter "pageToken": 13167// nextPageToken 13168// value returned from a previous 13169// list call, 13170// indicating that the subsequent page of results should be 13171// returned. 13172// 13173// The list request 13174// must be otherwise identical to the one that resulted in this token. 13175func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall { 13176 c.urlParams_.Set("pageToken", pageToken) 13177 return c 13178} 13179 13180// Fields allows partial responses to be retrieved. See 13181// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13182// for more information. 13183func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall { 13184 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13185 return c 13186} 13187 13188// IfNoneMatch sets the optional parameter which makes the operation 13189// fail if the object's ETag matches the given value. This is useful for 13190// getting updates only after the object has changed since the last 13191// request. Use googleapi.IsNotModified to check whether the response 13192// error from Do is the result of In-None-Match. 13193func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall { 13194 c.ifNoneMatch_ = entityTag 13195 return c 13196} 13197 13198// Context sets the context to be used in this call's Do method. Any 13199// pending HTTP request will be aborted if the provided context is 13200// canceled. 13201func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall { 13202 c.ctx_ = ctx 13203 return c 13204} 13205 13206// Header returns an http.Header that can be modified by the caller to 13207// add HTTP headers to the request. 13208func (c *UserProfilesGuardiansListCall) Header() http.Header { 13209 if c.header_ == nil { 13210 c.header_ = make(http.Header) 13211 } 13212 return c.header_ 13213} 13214 13215func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) { 13216 reqHeaders := make(http.Header) 13217 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 13218 for k, v := range c.header_ { 13219 reqHeaders[k] = v 13220 } 13221 reqHeaders.Set("User-Agent", c.s.userAgent()) 13222 if c.ifNoneMatch_ != "" { 13223 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13224 } 13225 var body io.Reader = nil 13226 c.urlParams_.Set("alt", alt) 13227 c.urlParams_.Set("prettyPrint", "false") 13228 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians") 13229 urls += "?" + c.urlParams_.Encode() 13230 req, err := http.NewRequest("GET", urls, body) 13231 if err != nil { 13232 return nil, err 13233 } 13234 req.Header = reqHeaders 13235 googleapi.Expand(req.URL, map[string]string{ 13236 "studentId": c.studentId, 13237 }) 13238 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13239} 13240 13241// Do executes the "classroom.userProfiles.guardians.list" call. 13242// Exactly one of *ListGuardiansResponse or error will be non-nil. Any 13243// non-2xx status code is an error. Response headers are in either 13244// *ListGuardiansResponse.ServerResponse.Header or (if a response was 13245// returned at all) in error.(*googleapi.Error).Header. Use 13246// googleapi.IsNotModified to check whether the returned error was 13247// because http.StatusNotModified was returned. 13248func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) { 13249 gensupport.SetOptions(c.urlParams_, opts...) 13250 res, err := c.doRequest("json") 13251 if res != nil && res.StatusCode == http.StatusNotModified { 13252 if res.Body != nil { 13253 res.Body.Close() 13254 } 13255 return nil, &googleapi.Error{ 13256 Code: res.StatusCode, 13257 Header: res.Header, 13258 } 13259 } 13260 if err != nil { 13261 return nil, err 13262 } 13263 defer googleapi.CloseBody(res) 13264 if err := googleapi.CheckResponse(res); err != nil { 13265 return nil, err 13266 } 13267 ret := &ListGuardiansResponse{ 13268 ServerResponse: googleapi.ServerResponse{ 13269 Header: res.Header, 13270 HTTPStatusCode: res.StatusCode, 13271 }, 13272 } 13273 target := &ret 13274 if err := gensupport.DecodeResponse(target, res); err != nil { 13275 return nil, err 13276 } 13277 return ret, nil 13278 // { 13279 // "description": "Returns a list of guardians that the requesting user is permitted to\nview, restricted to those that match the request.\n\nTo list guardians for any student that the requesting user may view\nguardians for, use the literal character `-` for the student ID.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if a `student_id` is specified, and the requesting\n user is not permitted to view guardian information for that student, if\n `\"-\"` is specified as the `student_id` and the user is not a domain\n administrator, if guardians are not enabled for the domain in question,\n if the `invited_email_address` filter is set by a user who is not a\n domain administrator, or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`). May also be returned if an invalid\n `page_token` is provided.\n* `NOT_FOUND` if a `student_id` is specified, and its format can be\n recognized, but Classroom has no record of that student.", 13280 // "flatPath": "v1/userProfiles/{studentId}/guardians", 13281 // "httpMethod": "GET", 13282 // "id": "classroom.userProfiles.guardians.list", 13283 // "parameterOrder": [ 13284 // "studentId" 13285 // ], 13286 // "parameters": { 13287 // "invitedEmailAddress": { 13288 // "description": "Filter results by the email address that the original invitation was sent\nto, resulting in this guardian link.\nThis filter can only be used by domain administrators.", 13289 // "location": "query", 13290 // "type": "string" 13291 // }, 13292 // "pageSize": { 13293 // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.", 13294 // "format": "int32", 13295 // "location": "query", 13296 // "type": "integer" 13297 // }, 13298 // "pageToken": { 13299 // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.", 13300 // "location": "query", 13301 // "type": "string" 13302 // }, 13303 // "studentId": { 13304 // "description": "Filter results by the student who the guardian is linked to.\nThe identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user\n* the string literal `\"-\"`, indicating that results should be returned for\n all students that the requesting user has access to view.", 13305 // "location": "path", 13306 // "required": true, 13307 // "type": "string" 13308 // } 13309 // }, 13310 // "path": "v1/userProfiles/{studentId}/guardians", 13311 // "response": { 13312 // "$ref": "ListGuardiansResponse" 13313 // }, 13314 // "scopes": [ 13315 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13316 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13317 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13318 // ] 13319 // } 13320 13321} 13322 13323// Pages invokes f for each page of results. 13324// A non-nil error returned from f will halt the iteration. 13325// The provided context supersedes any context provided to the Context method. 13326func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error { 13327 c.ctx_ = ctx 13328 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13329 for { 13330 x, err := c.Do() 13331 if err != nil { 13332 return err 13333 } 13334 if err := f(x); err != nil { 13335 return err 13336 } 13337 if x.NextPageToken == "" { 13338 return nil 13339 } 13340 c.PageToken(x.NextPageToken) 13341 } 13342} 13343