1// Copyright 2021 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package classroom provides access to the Google Classroom API. 8// 9// For product documentation, see: https://developers.google.com/classroom/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/classroom/v1" 16// ... 17// ctx := context.Background() 18// classroomService, err := classroom.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// classroomService, err := classroom.NewService(ctx, option.WithScopes(classroom.ClassroomTopicsReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// classroomService, err := classroom.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// classroomService, err := classroom.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package classroom // import "google.golang.org/api/classroom/v1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "classroom:v1" 79const apiName = "classroom" 80const apiVersion = "v1" 81const basePath = "https://classroom.googleapis.com/" 82const mtlsBasePath = "https://classroom.mtls.googleapis.com/" 83 84// OAuth2 scopes used by this API. 85const ( 86 // View and manage announcements in Google Classroom 87 ClassroomAnnouncementsScope = "https://www.googleapis.com/auth/classroom.announcements" 88 89 // View announcements in Google Classroom 90 ClassroomAnnouncementsReadonlyScope = "https://www.googleapis.com/auth/classroom.announcements.readonly" 91 92 // See, edit, create, and permanently delete your Google Classroom 93 // classes 94 ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses" 95 96 // View your Google Classroom classes 97 ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly" 98 99 // See, create and edit coursework items including assignments, 100 // questions, and grades 101 ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me" 102 103 // View your course work and grades in Google Classroom 104 ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly" 105 106 // Manage course work and grades for students in the Google Classroom 107 // classes you teach and view the course work and grades for classes you 108 // administer 109 ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students" 110 111 // View course work and grades for students in the Google Classroom 112 // classes you teach or administer 113 ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 114 115 // See, edit, and create classwork materials in Google Classroom 116 ClassroomCourseworkmaterialsScope = "https://www.googleapis.com/auth/classroom.courseworkmaterials" 117 118 // See all classwork materials for your Google Classroom classes 119 ClassroomCourseworkmaterialsReadonlyScope = "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly" 120 121 // View your Google Classroom guardians 122 ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly" 123 124 // View and manage guardians for students in your Google Classroom 125 // classes 126 ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students" 127 128 // View guardians for students in your Google Classroom classes 129 ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 130 131 // View the email addresses of people in your classes 132 ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails" 133 134 // View the profile photos of people in your classes 135 ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos" 136 137 // Receive notifications about your Google Classroom data 138 ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications" 139 140 // Manage your Google Classroom class rosters 141 ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters" 142 143 // View your Google Classroom class rosters 144 ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly" 145 146 // View your course work and grades in Google Classroom 147 ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly" 148 149 // View course work and grades for students in the Google Classroom 150 // classes you teach or administer 151 ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 152 153 // See, create, and edit topics in Google Classroom 154 ClassroomTopicsScope = "https://www.googleapis.com/auth/classroom.topics" 155 156 // View topics in Google Classroom 157 ClassroomTopicsReadonlyScope = "https://www.googleapis.com/auth/classroom.topics.readonly" 158) 159 160// NewService creates a new Service. 161func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 162 scopesOption := option.WithScopes( 163 "https://www.googleapis.com/auth/classroom.announcements", 164 "https://www.googleapis.com/auth/classroom.announcements.readonly", 165 "https://www.googleapis.com/auth/classroom.courses", 166 "https://www.googleapis.com/auth/classroom.courses.readonly", 167 "https://www.googleapis.com/auth/classroom.coursework.me", 168 "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 169 "https://www.googleapis.com/auth/classroom.coursework.students", 170 "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 171 "https://www.googleapis.com/auth/classroom.courseworkmaterials", 172 "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly", 173 "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 174 "https://www.googleapis.com/auth/classroom.guardianlinks.students", 175 "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly", 176 "https://www.googleapis.com/auth/classroom.profile.emails", 177 "https://www.googleapis.com/auth/classroom.profile.photos", 178 "https://www.googleapis.com/auth/classroom.push-notifications", 179 "https://www.googleapis.com/auth/classroom.rosters", 180 "https://www.googleapis.com/auth/classroom.rosters.readonly", 181 "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 182 "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly", 183 "https://www.googleapis.com/auth/classroom.topics", 184 "https://www.googleapis.com/auth/classroom.topics.readonly", 185 ) 186 // NOTE: prepend, so we don't override user-specified scopes. 187 opts = append([]option.ClientOption{scopesOption}, opts...) 188 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 189 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 190 client, endpoint, err := htransport.NewClient(ctx, opts...) 191 if err != nil { 192 return nil, err 193 } 194 s, err := New(client) 195 if err != nil { 196 return nil, err 197 } 198 if endpoint != "" { 199 s.BasePath = endpoint 200 } 201 return s, nil 202} 203 204// New creates a new Service. It uses the provided http.Client for requests. 205// 206// Deprecated: please use NewService instead. 207// To provide a custom HTTP client, use option.WithHTTPClient. 208// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 209func New(client *http.Client) (*Service, error) { 210 if client == nil { 211 return nil, errors.New("client is nil") 212 } 213 s := &Service{client: client, BasePath: basePath} 214 s.Courses = NewCoursesService(s) 215 s.Invitations = NewInvitationsService(s) 216 s.Registrations = NewRegistrationsService(s) 217 s.UserProfiles = NewUserProfilesService(s) 218 return s, nil 219} 220 221type Service struct { 222 client *http.Client 223 BasePath string // API endpoint base URL 224 UserAgent string // optional additional User-Agent fragment 225 226 Courses *CoursesService 227 228 Invitations *InvitationsService 229 230 Registrations *RegistrationsService 231 232 UserProfiles *UserProfilesService 233} 234 235func (s *Service) userAgent() string { 236 if s.UserAgent == "" { 237 return googleapi.UserAgent 238 } 239 return googleapi.UserAgent + " " + s.UserAgent 240} 241 242func NewCoursesService(s *Service) *CoursesService { 243 rs := &CoursesService{s: s} 244 rs.Aliases = NewCoursesAliasesService(s) 245 rs.Announcements = NewCoursesAnnouncementsService(s) 246 rs.CourseWork = NewCoursesCourseWorkService(s) 247 rs.CourseWorkMaterials = NewCoursesCourseWorkMaterialsService(s) 248 rs.Students = NewCoursesStudentsService(s) 249 rs.Teachers = NewCoursesTeachersService(s) 250 rs.Topics = NewCoursesTopicsService(s) 251 return rs 252} 253 254type CoursesService struct { 255 s *Service 256 257 Aliases *CoursesAliasesService 258 259 Announcements *CoursesAnnouncementsService 260 261 CourseWork *CoursesCourseWorkService 262 263 CourseWorkMaterials *CoursesCourseWorkMaterialsService 264 265 Students *CoursesStudentsService 266 267 Teachers *CoursesTeachersService 268 269 Topics *CoursesTopicsService 270} 271 272func NewCoursesAliasesService(s *Service) *CoursesAliasesService { 273 rs := &CoursesAliasesService{s: s} 274 return rs 275} 276 277type CoursesAliasesService struct { 278 s *Service 279} 280 281func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService { 282 rs := &CoursesAnnouncementsService{s: s} 283 return rs 284} 285 286type CoursesAnnouncementsService struct { 287 s *Service 288} 289 290func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService { 291 rs := &CoursesCourseWorkService{s: s} 292 rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s) 293 return rs 294} 295 296type CoursesCourseWorkService struct { 297 s *Service 298 299 StudentSubmissions *CoursesCourseWorkStudentSubmissionsService 300} 301 302func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService { 303 rs := &CoursesCourseWorkStudentSubmissionsService{s: s} 304 return rs 305} 306 307type CoursesCourseWorkStudentSubmissionsService struct { 308 s *Service 309} 310 311func NewCoursesCourseWorkMaterialsService(s *Service) *CoursesCourseWorkMaterialsService { 312 rs := &CoursesCourseWorkMaterialsService{s: s} 313 return rs 314} 315 316type CoursesCourseWorkMaterialsService struct { 317 s *Service 318} 319 320func NewCoursesStudentsService(s *Service) *CoursesStudentsService { 321 rs := &CoursesStudentsService{s: s} 322 return rs 323} 324 325type CoursesStudentsService struct { 326 s *Service 327} 328 329func NewCoursesTeachersService(s *Service) *CoursesTeachersService { 330 rs := &CoursesTeachersService{s: s} 331 return rs 332} 333 334type CoursesTeachersService struct { 335 s *Service 336} 337 338func NewCoursesTopicsService(s *Service) *CoursesTopicsService { 339 rs := &CoursesTopicsService{s: s} 340 return rs 341} 342 343type CoursesTopicsService struct { 344 s *Service 345} 346 347func NewInvitationsService(s *Service) *InvitationsService { 348 rs := &InvitationsService{s: s} 349 return rs 350} 351 352type InvitationsService struct { 353 s *Service 354} 355 356func NewRegistrationsService(s *Service) *RegistrationsService { 357 rs := &RegistrationsService{s: s} 358 return rs 359} 360 361type RegistrationsService struct { 362 s *Service 363} 364 365func NewUserProfilesService(s *Service) *UserProfilesService { 366 rs := &UserProfilesService{s: s} 367 rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s) 368 rs.Guardians = NewUserProfilesGuardiansService(s) 369 return rs 370} 371 372type UserProfilesService struct { 373 s *Service 374 375 GuardianInvitations *UserProfilesGuardianInvitationsService 376 377 Guardians *UserProfilesGuardiansService 378} 379 380func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService { 381 rs := &UserProfilesGuardianInvitationsService{s: s} 382 return rs 383} 384 385type UserProfilesGuardianInvitationsService struct { 386 s *Service 387} 388 389func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService { 390 rs := &UserProfilesGuardiansService{s: s} 391 return rs 392} 393 394type UserProfilesGuardiansService struct { 395 s *Service 396} 397 398// Announcement: Announcement created by a teacher for students of the 399// course 400type Announcement struct { 401 // AlternateLink: Absolute link to this announcement in the Classroom 402 // web UI. This is only populated if `state` is `PUBLISHED`. Read-only. 403 AlternateLink string `json:"alternateLink,omitempty"` 404 405 // AssigneeMode: Assignee mode of the announcement. If unspecified, the 406 // default value is `ALL_STUDENTS`. 407 // 408 // Possible values: 409 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 410 // returned. 411 // "ALL_STUDENTS" - All students can see the item. This is the default 412 // state. 413 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 414 AssigneeMode string `json:"assigneeMode,omitempty"` 415 416 // CourseId: Identifier of the course. Read-only. 417 CourseId string `json:"courseId,omitempty"` 418 419 // CreationTime: Timestamp when this announcement was created. 420 // Read-only. 421 CreationTime string `json:"creationTime,omitempty"` 422 423 // CreatorUserId: Identifier for the user that created the announcement. 424 // Read-only. 425 CreatorUserId string `json:"creatorUserId,omitempty"` 426 427 // Id: Classroom-assigned identifier of this announcement, unique per 428 // course. Read-only. 429 Id string `json:"id,omitempty"` 430 431 // IndividualStudentsOptions: Identifiers of students with access to the 432 // announcement. This field is set only if `assigneeMode` is 433 // `INDIVIDUAL_STUDENTS`. If the `assigneeMode` is 434 // `INDIVIDUAL_STUDENTS`, then only students specified in this field can 435 // see the announcement. 436 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 437 438 // Materials: Additional materials. Announcements must have no more than 439 // 20 material items. 440 Materials []*Material `json:"materials,omitempty"` 441 442 // ScheduledTime: Optional timestamp when this announcement is scheduled 443 // to be published. 444 ScheduledTime string `json:"scheduledTime,omitempty"` 445 446 // State: Status of this announcement. If unspecified, the default state 447 // is `DRAFT`. 448 // 449 // Possible values: 450 // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 451 // never returned. 452 // "PUBLISHED" - Status for announcement that has been published. This 453 // is the default state. 454 // "DRAFT" - Status for an announcement that is not yet published. 455 // Announcement in this state is visible only to course teachers and 456 // domain administrators. 457 // "DELETED" - Status for announcement that was published but is now 458 // deleted. Announcement in this state is visible only to course 459 // teachers and domain administrators. Announcement in this state is 460 // deleted after some time. 461 State string `json:"state,omitempty"` 462 463 // Text: Description of this announcement. The text must be a valid 464 // UTF-8 string containing no more than 30,000 characters. 465 Text string `json:"text,omitempty"` 466 467 // UpdateTime: Timestamp of the most recent change to this announcement. 468 // Read-only. 469 UpdateTime string `json:"updateTime,omitempty"` 470 471 // ServerResponse contains the HTTP response code and headers from the 472 // server. 473 googleapi.ServerResponse `json:"-"` 474 475 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 476 // unconditionally include in API requests. By default, fields with 477 // empty or default values are omitted from API requests. However, any 478 // non-pointer, non-interface field appearing in ForceSendFields will be 479 // sent to the server regardless of whether the field is empty or not. 480 // This may be used to include empty fields in Patch requests. 481 ForceSendFields []string `json:"-"` 482 483 // NullFields is a list of field names (e.g. "AlternateLink") to include 484 // in API requests with the JSON null value. By default, fields with 485 // empty values are omitted from API requests. However, any field with 486 // an empty value appearing in NullFields will be sent to the server as 487 // null. It is an error if a field in this list has a non-empty value. 488 // This may be used to include null fields in Patch requests. 489 NullFields []string `json:"-"` 490} 491 492func (s *Announcement) MarshalJSON() ([]byte, error) { 493 type NoMethod Announcement 494 raw := NoMethod(*s) 495 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 496} 497 498// Assignment: Additional details for assignments. 499type Assignment struct { 500 // StudentWorkFolder: Drive folder where attachments from student 501 // submissions are placed. This is only populated for course teachers 502 // and administrators. 503 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 504 505 // ForceSendFields is a list of field names (e.g. "StudentWorkFolder") 506 // to unconditionally include in API requests. By default, fields with 507 // empty or default values are omitted from API requests. However, any 508 // non-pointer, non-interface field appearing in ForceSendFields will be 509 // sent to the server regardless of whether the field is empty or not. 510 // This may be used to include empty fields in Patch requests. 511 ForceSendFields []string `json:"-"` 512 513 // NullFields is a list of field names (e.g. "StudentWorkFolder") to 514 // include in API requests with the JSON null value. By default, fields 515 // with empty values are omitted from API requests. However, any field 516 // with an empty value appearing in NullFields will be sent to the 517 // server as null. It is an error if a field in this list has a 518 // non-empty value. This may be used to include null fields in Patch 519 // requests. 520 NullFields []string `json:"-"` 521} 522 523func (s *Assignment) MarshalJSON() ([]byte, error) { 524 type NoMethod Assignment 525 raw := NoMethod(*s) 526 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 527} 528 529// AssignmentSubmission: Student work for an assignment. 530type AssignmentSubmission struct { 531 // Attachments: Attachments added by the student. Drive files that 532 // correspond to materials with a share mode of STUDENT_COPY may not 533 // exist yet if the student has not accessed the assignment in 534 // Classroom. Some attachment metadata is only populated if the 535 // requesting user has permission to access it. Identifier and 536 // alternate_link fields are always available, but others (for example, 537 // title) may not be. 538 Attachments []*Attachment `json:"attachments,omitempty"` 539 540 // ForceSendFields is a list of field names (e.g. "Attachments") to 541 // unconditionally include in API requests. By default, fields with 542 // empty or default values are omitted from API requests. However, any 543 // non-pointer, non-interface field appearing in ForceSendFields will be 544 // sent to the server regardless of whether the field is empty or not. 545 // This may be used to include empty fields in Patch requests. 546 ForceSendFields []string `json:"-"` 547 548 // NullFields is a list of field names (e.g. "Attachments") to include 549 // in API requests with the JSON null value. By default, fields with 550 // empty values are omitted from API requests. However, any field with 551 // an empty value appearing in NullFields will be sent to the server as 552 // null. It is an error if a field in this list has a non-empty value. 553 // This may be used to include null fields in Patch requests. 554 NullFields []string `json:"-"` 555} 556 557func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) { 558 type NoMethod AssignmentSubmission 559 raw := NoMethod(*s) 560 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 561} 562 563// Attachment: Attachment added to student assignment work. When 564// creating attachments, setting the `form` field is not supported. 565type Attachment struct { 566 // DriveFile: Google Drive file attachment. 567 DriveFile *DriveFile `json:"driveFile,omitempty"` 568 569 // Form: Google Forms attachment. 570 Form *Form `json:"form,omitempty"` 571 572 // Link: Link attachment. 573 Link *Link `json:"link,omitempty"` 574 575 // YouTubeVideo: Youtube video attachment. 576 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 577 578 // ForceSendFields is a list of field names (e.g. "DriveFile") to 579 // unconditionally include in API requests. By default, fields with 580 // empty or default values are omitted from API requests. However, any 581 // non-pointer, non-interface field appearing in ForceSendFields will be 582 // sent to the server regardless of whether the field is empty or not. 583 // This may be used to include empty fields in Patch requests. 584 ForceSendFields []string `json:"-"` 585 586 // NullFields is a list of field names (e.g. "DriveFile") to include in 587 // API requests with the JSON null value. By default, fields with empty 588 // values are omitted from API requests. However, any field with an 589 // empty value appearing in NullFields will be sent to the server as 590 // null. It is an error if a field in this list has a non-empty value. 591 // This may be used to include null fields in Patch requests. 592 NullFields []string `json:"-"` 593} 594 595func (s *Attachment) MarshalJSON() ([]byte, error) { 596 type NoMethod Attachment 597 raw := NoMethod(*s) 598 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 599} 600 601// CloudPubsubTopic: A reference to a Cloud Pub/Sub topic. To register 602// for notifications, the owner of the topic must grant 603// `classroom-notifications@system.gserviceaccount.com` the 604// `projects.topics.publish` permission. 605type CloudPubsubTopic struct { 606 // TopicName: The `name` field of a Cloud Pub/Sub Topic 607 // (https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#Topic). 608 TopicName string `json:"topicName,omitempty"` 609 610 // ForceSendFields is a list of field names (e.g. "TopicName") to 611 // unconditionally include in API requests. By default, fields with 612 // empty or default values are omitted from API requests. However, any 613 // non-pointer, non-interface field appearing in ForceSendFields will be 614 // sent to the server regardless of whether the field is empty or not. 615 // This may be used to include empty fields in Patch requests. 616 ForceSendFields []string `json:"-"` 617 618 // NullFields is a list of field names (e.g. "TopicName") to include in 619 // API requests with the JSON null value. By default, fields with empty 620 // values are omitted from API requests. However, any field with an 621 // empty value appearing in NullFields will be sent to the server as 622 // null. It is an error if a field in this list has a non-empty value. 623 // This may be used to include null fields in Patch requests. 624 NullFields []string `json:"-"` 625} 626 627func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) { 628 type NoMethod CloudPubsubTopic 629 raw := NoMethod(*s) 630 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 631} 632 633// Course: A Course in Classroom. 634type Course struct { 635 // AlternateLink: Absolute link to this course in the Classroom web UI. 636 // Read-only. 637 AlternateLink string `json:"alternateLink,omitempty"` 638 639 // CalendarId: The Calendar ID for a calendar that all course members 640 // can see, to which Classroom adds events for course work and 641 // announcements in the course. Read-only. 642 CalendarId string `json:"calendarId,omitempty"` 643 644 // CourseGroupEmail: The email address of a Google group containing all 645 // members of the course. This group does not accept email and can only 646 // be used for permissions. Read-only. 647 CourseGroupEmail string `json:"courseGroupEmail,omitempty"` 648 649 // CourseMaterialSets: Sets of materials that appear on the "about" page 650 // of this course. Read-only. 651 CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"` 652 653 // CourseState: State of the course. If unspecified, the default state 654 // is `PROVISIONED`. 655 // 656 // Possible values: 657 // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 658 // message will use this value. 659 // "ACTIVE" - The course is active. 660 // "ARCHIVED" - The course has been archived. You cannot modify it 661 // except to change it to a different state. 662 // "PROVISIONED" - The course has been created, but not yet activated. 663 // It is accessible by the primary teacher and domain administrators, 664 // who may modify it or change it to the `ACTIVE` or `DECLINED` states. 665 // A course may only be changed to `PROVISIONED` if it is in the 666 // `DECLINED` state. 667 // "DECLINED" - The course has been created, but declined. It is 668 // accessible by the course owner and domain administrators, though it 669 // will not be displayed in the web UI. You cannot modify the course 670 // except to change it to the `PROVISIONED` state. A course may only be 671 // changed to `DECLINED` if it is in the `PROVISIONED` state. 672 // "SUSPENDED" - The course has been suspended. You cannot modify the 673 // course, and only the user identified by the `owner_id` can view the 674 // course. A course may be placed in this state if it potentially 675 // violates the Terms of Service. 676 CourseState string `json:"courseState,omitempty"` 677 678 // CreationTime: Creation time of the course. Specifying this field in a 679 // course update mask results in an error. Read-only. 680 CreationTime string `json:"creationTime,omitempty"` 681 682 // Description: Optional description. For example, "We'll be learning 683 // about the structure of living creatures from a combination of 684 // textbooks, guest lectures, and lab work. Expect to be excited!" If 685 // set, this field must be a valid UTF-8 string and no longer than 686 // 30,000 characters. 687 Description string `json:"description,omitempty"` 688 689 // DescriptionHeading: Optional heading for the description. For 690 // example, "Welcome to 10th Grade Biology." If set, this field must be 691 // a valid UTF-8 string and no longer than 3600 characters. 692 DescriptionHeading string `json:"descriptionHeading,omitempty"` 693 694 // EnrollmentCode: Enrollment code to use when joining this course. 695 // Specifying this field in a course update mask results in an error. 696 // Read-only. 697 EnrollmentCode string `json:"enrollmentCode,omitempty"` 698 699 // GuardiansEnabled: Whether or not guardian notifications are enabled 700 // for this course. Read-only. 701 GuardiansEnabled bool `json:"guardiansEnabled,omitempty"` 702 703 // Id: Identifier for this course assigned by Classroom. When creating a 704 // course, you may optionally set this identifier to an alias string in 705 // the request to create a corresponding alias. The `id` is still 706 // assigned by Classroom and cannot be updated after the course is 707 // created. Specifying this field in a course update mask results in an 708 // error. 709 Id string `json:"id,omitempty"` 710 711 // Name: Name of the course. For example, "10th Grade Biology". The name 712 // is required. It must be between 1 and 750 characters and a valid 713 // UTF-8 string. 714 Name string `json:"name,omitempty"` 715 716 // OwnerId: The identifier of the owner of a course. When specified as a 717 // parameter of a create course request, this field is required. The 718 // identifier can be one of the following: * the numeric identifier for 719 // the user * the email address of the user * the string literal "me", 720 // indicating the requesting user This must be set in a create request. 721 // Admins can also specify this field in a patch course request to 722 // transfer ownership. In other contexts, it is read-only. 723 OwnerId string `json:"ownerId,omitempty"` 724 725 // Room: Optional room location. For example, "301". If set, this field 726 // must be a valid UTF-8 string and no longer than 650 characters. 727 Room string `json:"room,omitempty"` 728 729 // Section: Section of the course. For example, "Period 2". If set, this 730 // field must be a valid UTF-8 string and no longer than 2800 731 // characters. 732 Section string `json:"section,omitempty"` 733 734 // TeacherFolder: Information about a Drive Folder that is shared with 735 // all teachers of the course. This field will only be set for teachers 736 // of the course and domain administrators. Read-only. 737 TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"` 738 739 // TeacherGroupEmail: The email address of a Google group containing all 740 // teachers of the course. This group does not accept email and can only 741 // be used for permissions. Read-only. 742 TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"` 743 744 // UpdateTime: Time of the most recent update to this course. Specifying 745 // this field in a course update mask results in an error. Read-only. 746 UpdateTime string `json:"updateTime,omitempty"` 747 748 // ServerResponse contains the HTTP response code and headers from the 749 // server. 750 googleapi.ServerResponse `json:"-"` 751 752 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 753 // unconditionally include in API requests. By default, fields with 754 // empty or default values are omitted from API requests. However, any 755 // non-pointer, non-interface field appearing in ForceSendFields will be 756 // sent to the server regardless of whether the field is empty or not. 757 // This may be used to include empty fields in Patch requests. 758 ForceSendFields []string `json:"-"` 759 760 // NullFields is a list of field names (e.g. "AlternateLink") to include 761 // in API requests with the JSON null value. By default, fields with 762 // empty values are omitted from API requests. However, any field with 763 // an empty value appearing in NullFields will be sent to the server as 764 // null. It is an error if a field in this list has a non-empty value. 765 // This may be used to include null fields in Patch requests. 766 NullFields []string `json:"-"` 767} 768 769func (s *Course) MarshalJSON() ([]byte, error) { 770 type NoMethod Course 771 raw := NoMethod(*s) 772 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 773} 774 775// CourseAlias: Alternative identifier for a course. An alias uniquely 776// identifies a course. It must be unique within one of the following 777// scopes: * domain: A domain-scoped alias is visible to all users 778// within the alias creator's domain and can be created only by a domain 779// admin. A domain-scoped alias is often used when a course has an 780// identifier external to Classroom. * project: A project-scoped alias 781// is visible to any request from an application using the Developer 782// Console project ID that created the alias and can be created by any 783// project. A project-scoped alias is often used when an application has 784// alternative identifiers. A random value can also be used to avoid 785// duplicate courses in the event of transmission failures, as retrying 786// a request will return `ALREADY_EXISTS` if a previous one has 787// succeeded. 788type CourseAlias struct { 789 // Alias: Alias string. The format of the string indicates the desired 790 // alias scoping. * `d:` indicates a domain-scoped alias. Example: 791 // `d:math_101` * `p:` indicates a project-scoped alias. Example: 792 // `p:abc123` This field has a maximum length of 256 characters. 793 Alias string `json:"alias,omitempty"` 794 795 // ServerResponse contains the HTTP response code and headers from the 796 // server. 797 googleapi.ServerResponse `json:"-"` 798 799 // ForceSendFields is a list of field names (e.g. "Alias") to 800 // unconditionally include in API requests. By default, fields with 801 // empty or default values are omitted from API requests. However, any 802 // non-pointer, non-interface field appearing in ForceSendFields will be 803 // sent to the server regardless of whether the field is empty or not. 804 // This may be used to include empty fields in Patch requests. 805 ForceSendFields []string `json:"-"` 806 807 // NullFields is a list of field names (e.g. "Alias") to include in API 808 // requests with the JSON null value. By default, fields with empty 809 // values are omitted from API requests. However, any field with an 810 // empty value appearing in NullFields will be sent to the server as 811 // null. It is an error if a field in this list has a non-empty value. 812 // This may be used to include null fields in Patch requests. 813 NullFields []string `json:"-"` 814} 815 816func (s *CourseAlias) MarshalJSON() ([]byte, error) { 817 type NoMethod CourseAlias 818 raw := NoMethod(*s) 819 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 820} 821 822// CourseMaterial: A material attached to a course as part of a material 823// set. 824type CourseMaterial struct { 825 // DriveFile: Google Drive file attachment. 826 DriveFile *DriveFile `json:"driveFile,omitempty"` 827 828 // Form: Google Forms attachment. 829 Form *Form `json:"form,omitempty"` 830 831 // Link: Link atatchment. 832 Link *Link `json:"link,omitempty"` 833 834 // YouTubeVideo: Youtube video attachment. 835 YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"` 836 837 // ForceSendFields is a list of field names (e.g. "DriveFile") to 838 // unconditionally include in API requests. By default, fields with 839 // empty or default values are omitted from API requests. However, any 840 // non-pointer, non-interface field appearing in ForceSendFields will be 841 // sent to the server regardless of whether the field is empty or not. 842 // This may be used to include empty fields in Patch requests. 843 ForceSendFields []string `json:"-"` 844 845 // NullFields is a list of field names (e.g. "DriveFile") to include in 846 // API requests with the JSON null value. By default, fields with empty 847 // values are omitted from API requests. However, any field with an 848 // empty value appearing in NullFields will be sent to the server as 849 // null. It is an error if a field in this list has a non-empty value. 850 // This may be used to include null fields in Patch requests. 851 NullFields []string `json:"-"` 852} 853 854func (s *CourseMaterial) MarshalJSON() ([]byte, error) { 855 type NoMethod CourseMaterial 856 raw := NoMethod(*s) 857 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 858} 859 860// CourseMaterialSet: A set of materials that appears on the "About" 861// page of the course. These materials might include a syllabus, 862// schedule, or other background information relating to the course as a 863// whole. 864type CourseMaterialSet struct { 865 // Materials: Materials attached to this set. 866 Materials []*CourseMaterial `json:"materials,omitempty"` 867 868 // Title: Title for this set. 869 Title string `json:"title,omitempty"` 870 871 // ForceSendFields is a list of field names (e.g. "Materials") to 872 // unconditionally include in API requests. By default, fields with 873 // empty or default values are omitted from API requests. However, any 874 // non-pointer, non-interface field appearing in ForceSendFields will be 875 // sent to the server regardless of whether the field is empty or not. 876 // This may be used to include empty fields in Patch requests. 877 ForceSendFields []string `json:"-"` 878 879 // NullFields is a list of field names (e.g. "Materials") to include in 880 // API requests with the JSON null value. By default, fields with empty 881 // values are omitted from API requests. However, any field with an 882 // empty value appearing in NullFields will be sent to the server as 883 // null. It is an error if a field in this list has a non-empty value. 884 // This may be used to include null fields in Patch requests. 885 NullFields []string `json:"-"` 886} 887 888func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) { 889 type NoMethod CourseMaterialSet 890 raw := NoMethod(*s) 891 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 892} 893 894// CourseRosterChangesInfo: Information about a `Feed` with a 895// `feed_type` of `COURSE_ROSTER_CHANGES`. 896type CourseRosterChangesInfo struct { 897 // CourseId: The `course_id` of the course to subscribe to roster 898 // changes for. 899 CourseId string `json:"courseId,omitempty"` 900 901 // ForceSendFields is a list of field names (e.g. "CourseId") to 902 // unconditionally include in API requests. By default, fields with 903 // empty or default values are omitted from API requests. However, any 904 // non-pointer, non-interface field appearing in ForceSendFields will be 905 // sent to the server regardless of whether the field is empty or not. 906 // This may be used to include empty fields in Patch requests. 907 ForceSendFields []string `json:"-"` 908 909 // NullFields is a list of field names (e.g. "CourseId") to include in 910 // API requests with the JSON null value. By default, fields with empty 911 // values are omitted from API requests. However, any field with an 912 // empty value appearing in NullFields will be sent to the server as 913 // null. It is an error if a field in this list has a non-empty value. 914 // This may be used to include null fields in Patch requests. 915 NullFields []string `json:"-"` 916} 917 918func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) { 919 type NoMethod CourseRosterChangesInfo 920 raw := NoMethod(*s) 921 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 922} 923 924// CourseWork: Course work created by a teacher for students of the 925// course. 926type CourseWork struct { 927 // AlternateLink: Absolute link to this course work in the Classroom web 928 // UI. This is only populated if `state` is `PUBLISHED`. Read-only. 929 AlternateLink string `json:"alternateLink,omitempty"` 930 931 // AssigneeMode: Assignee mode of the coursework. If unspecified, the 932 // default value is `ALL_STUDENTS`. 933 // 934 // Possible values: 935 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 936 // returned. 937 // "ALL_STUDENTS" - All students can see the item. This is the default 938 // state. 939 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 940 AssigneeMode string `json:"assigneeMode,omitempty"` 941 942 // Assignment: Assignment details. This is populated only when 943 // `work_type` is `ASSIGNMENT`. Read-only. 944 Assignment *Assignment `json:"assignment,omitempty"` 945 946 // AssociatedWithDeveloper: Whether this course work item is associated 947 // with the Developer Console project making the request. See 948 // CreateCourseWork for more details. Read-only. 949 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 950 951 // CourseId: Identifier of the course. Read-only. 952 CourseId string `json:"courseId,omitempty"` 953 954 // CreationTime: Timestamp when this course work was created. Read-only. 955 CreationTime string `json:"creationTime,omitempty"` 956 957 // CreatorUserId: Identifier for the user that created the coursework. 958 // Read-only. 959 CreatorUserId string `json:"creatorUserId,omitempty"` 960 961 // Description: Optional description of this course work. If set, the 962 // description must be a valid UTF-8 string containing no more than 963 // 30,000 characters. 964 Description string `json:"description,omitempty"` 965 966 // DueDate: Optional date, in UTC, that submissions for this course work 967 // are due. This must be specified if `due_time` is specified. 968 DueDate *Date `json:"dueDate,omitempty"` 969 970 // DueTime: Optional time of day, in UTC, that submissions for this 971 // course work are due. This must be specified if `due_date` is 972 // specified. 973 DueTime *TimeOfDay `json:"dueTime,omitempty"` 974 975 // Id: Classroom-assigned identifier of this course work, unique per 976 // course. Read-only. 977 Id string `json:"id,omitempty"` 978 979 // IndividualStudentsOptions: Identifiers of students with access to the 980 // coursework. This field is set only if `assigneeMode` is 981 // `INDIVIDUAL_STUDENTS`. If the `assigneeMode` is 982 // `INDIVIDUAL_STUDENTS`, then only students specified in this field are 983 // assigned the coursework. 984 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 985 986 // Materials: Additional materials. CourseWork must have no more than 20 987 // material items. 988 Materials []*Material `json:"materials,omitempty"` 989 990 // MaxPoints: Maximum grade for this course work. If zero or 991 // unspecified, this assignment is considered ungraded. This must be a 992 // non-negative integer value. 993 MaxPoints float64 `json:"maxPoints,omitempty"` 994 995 // MultipleChoiceQuestion: Multiple choice question details. For read 996 // operations, this field is populated only when `work_type` is 997 // `MULTIPLE_CHOICE_QUESTION`. For write operations, this field must be 998 // specified when creating course work with a `work_type` of 999 // `MULTIPLE_CHOICE_QUESTION`, and it must not be set otherwise. 1000 MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"` 1001 1002 // ScheduledTime: Optional timestamp when this course work is scheduled 1003 // to be published. 1004 ScheduledTime string `json:"scheduledTime,omitempty"` 1005 1006 // State: Status of this course work. If unspecified, the default state 1007 // is `DRAFT`. 1008 // 1009 // Possible values: 1010 // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 1011 // returned. 1012 // "PUBLISHED" - Status for work that has been published. This is the 1013 // default state. 1014 // "DRAFT" - Status for work that is not yet published. Work in this 1015 // state is visible only to course teachers and domain administrators. 1016 // "DELETED" - Status for work that was published but is now deleted. 1017 // Work in this state is visible only to course teachers and domain 1018 // administrators. Work in this state is deleted after some time. 1019 State string `json:"state,omitempty"` 1020 1021 // SubmissionModificationMode: Setting to determine when students are 1022 // allowed to modify submissions. If unspecified, the default value is 1023 // `MODIFIABLE_UNTIL_TURNED_IN`. 1024 // 1025 // Possible values: 1026 // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode 1027 // specified. This is never returned. 1028 // "MODIFIABLE_UNTIL_TURNED_IN" - Submissions can be modified before 1029 // being turned in. 1030 // "MODIFIABLE" - Submissions can be modified at any time. 1031 SubmissionModificationMode string `json:"submissionModificationMode,omitempty"` 1032 1033 // Title: Title of this course work. The title must be a valid UTF-8 1034 // string containing between 1 and 3000 characters. 1035 Title string `json:"title,omitempty"` 1036 1037 // TopicId: Identifier for the topic that this coursework is associated 1038 // with. Must match an existing topic in the course. 1039 TopicId string `json:"topicId,omitempty"` 1040 1041 // UpdateTime: Timestamp of the most recent change to this course work. 1042 // Read-only. 1043 UpdateTime string `json:"updateTime,omitempty"` 1044 1045 // WorkType: Type of this course work. The type is set when the course 1046 // work is created and cannot be changed. 1047 // 1048 // Possible values: 1049 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 1050 // never returned. 1051 // "ASSIGNMENT" - An assignment. 1052 // "SHORT_ANSWER_QUESTION" - A short answer question. 1053 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 1054 WorkType string `json:"workType,omitempty"` 1055 1056 // ServerResponse contains the HTTP response code and headers from the 1057 // server. 1058 googleapi.ServerResponse `json:"-"` 1059 1060 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1061 // unconditionally include in API requests. By default, fields with 1062 // empty or default values are omitted from API requests. However, any 1063 // non-pointer, non-interface field appearing in ForceSendFields will be 1064 // sent to the server regardless of whether the field is empty or not. 1065 // This may be used to include empty fields in Patch requests. 1066 ForceSendFields []string `json:"-"` 1067 1068 // NullFields is a list of field names (e.g. "AlternateLink") to include 1069 // in API requests with the JSON null value. By default, fields with 1070 // empty values are omitted from API requests. However, any field with 1071 // an empty value appearing in NullFields will be sent to the server as 1072 // null. It is an error if a field in this list has a non-empty value. 1073 // This may be used to include null fields in Patch requests. 1074 NullFields []string `json:"-"` 1075} 1076 1077func (s *CourseWork) MarshalJSON() ([]byte, error) { 1078 type NoMethod CourseWork 1079 raw := NoMethod(*s) 1080 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1081} 1082 1083func (s *CourseWork) UnmarshalJSON(data []byte) error { 1084 type NoMethod CourseWork 1085 var s1 struct { 1086 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1087 *NoMethod 1088 } 1089 s1.NoMethod = (*NoMethod)(s) 1090 if err := json.Unmarshal(data, &s1); err != nil { 1091 return err 1092 } 1093 s.MaxPoints = float64(s1.MaxPoints) 1094 return nil 1095} 1096 1097// CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1098// of `COURSE_WORK_CHANGES`. 1099type CourseWorkChangesInfo struct { 1100 // CourseId: The `course_id` of the course to subscribe to work changes 1101 // for. 1102 CourseId string `json:"courseId,omitempty"` 1103 1104 // ForceSendFields is a list of field names (e.g. "CourseId") to 1105 // unconditionally include in API requests. By default, fields with 1106 // empty or default values are omitted from API requests. However, any 1107 // non-pointer, non-interface field appearing in ForceSendFields will be 1108 // sent to the server regardless of whether the field is empty or not. 1109 // This may be used to include empty fields in Patch requests. 1110 ForceSendFields []string `json:"-"` 1111 1112 // NullFields is a list of field names (e.g. "CourseId") to include in 1113 // API requests with the JSON null value. By default, fields with empty 1114 // values are omitted from API requests. However, any field with an 1115 // empty value appearing in NullFields will be sent to the server as 1116 // null. It is an error if a field in this list has a non-empty value. 1117 // This may be used to include null fields in Patch requests. 1118 NullFields []string `json:"-"` 1119} 1120 1121func (s *CourseWorkChangesInfo) MarshalJSON() ([]byte, error) { 1122 type NoMethod CourseWorkChangesInfo 1123 raw := NoMethod(*s) 1124 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1125} 1126 1127// CourseWorkMaterial: Course work material created by a teacher for 1128// students of the course 1129type CourseWorkMaterial struct { 1130 // AlternateLink: Absolute link to this course work material in the 1131 // Classroom web UI. This is only populated if `state` is `PUBLISHED`. 1132 // Read-only. 1133 AlternateLink string `json:"alternateLink,omitempty"` 1134 1135 // AssigneeMode: Assignee mode of the course work material. If 1136 // unspecified, the default value is `ALL_STUDENTS`. 1137 // 1138 // Possible values: 1139 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 1140 // returned. 1141 // "ALL_STUDENTS" - All students can see the item. This is the default 1142 // state. 1143 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 1144 AssigneeMode string `json:"assigneeMode,omitempty"` 1145 1146 // CourseId: Identifier of the course. Read-only. 1147 CourseId string `json:"courseId,omitempty"` 1148 1149 // CreationTime: Timestamp when this course work material was created. 1150 // Read-only. 1151 CreationTime string `json:"creationTime,omitempty"` 1152 1153 // CreatorUserId: Identifier for the user that created the course work 1154 // material. Read-only. 1155 CreatorUserId string `json:"creatorUserId,omitempty"` 1156 1157 // Description: Optional description of this course work material. The 1158 // text must be a valid UTF-8 string containing no more than 30,000 1159 // characters. 1160 Description string `json:"description,omitempty"` 1161 1162 // Id: Classroom-assigned identifier of this course work material, 1163 // unique per course. Read-only. 1164 Id string `json:"id,omitempty"` 1165 1166 // IndividualStudentsOptions: Identifiers of students with access to the 1167 // course work material. This field is set only if `assigneeMode` is 1168 // `INDIVIDUAL_STUDENTS`. If the `assigneeMode` is 1169 // `INDIVIDUAL_STUDENTS`, then only students specified in this field can 1170 // see the course work material. 1171 IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"` 1172 1173 // Materials: Additional materials. A course work material must have no 1174 // more than 20 material items. 1175 Materials []*Material `json:"materials,omitempty"` 1176 1177 // ScheduledTime: Optional timestamp when this course work material is 1178 // scheduled to be published. 1179 ScheduledTime string `json:"scheduledTime,omitempty"` 1180 1181 // State: Status of this course work material. If unspecified, the 1182 // default state is `DRAFT`. 1183 // 1184 // Possible values: 1185 // "COURSEWORK_MATERIAL_STATE_UNSPECIFIED" - No state specified. This 1186 // is never returned. 1187 // "PUBLISHED" - Status for course work material that has been 1188 // published. This is the default state. 1189 // "DRAFT" - Status for an course work material that is not yet 1190 // published. Course work material in this state is visible only to 1191 // course teachers and domain administrators. 1192 // "DELETED" - Status for course work material that was published but 1193 // is now deleted. Course work material in this state is visible only to 1194 // course teachers and domain administrators. Course work material in 1195 // this state is deleted after some time. 1196 State string `json:"state,omitempty"` 1197 1198 // Title: Title of this course work material. The title must be a valid 1199 // UTF-8 string containing between 1 and 3000 characters. 1200 Title string `json:"title,omitempty"` 1201 1202 // TopicId: Identifier for the topic that this course work material is 1203 // associated with. Must match an existing topic in the course. 1204 TopicId string `json:"topicId,omitempty"` 1205 1206 // UpdateTime: Timestamp of the most recent change to this course work 1207 // material. Read-only. 1208 UpdateTime string `json:"updateTime,omitempty"` 1209 1210 // ServerResponse contains the HTTP response code and headers from the 1211 // server. 1212 googleapi.ServerResponse `json:"-"` 1213 1214 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1215 // unconditionally include in API requests. By default, fields with 1216 // empty or default values are omitted from API requests. However, any 1217 // non-pointer, non-interface field appearing in ForceSendFields will be 1218 // sent to the server regardless of whether the field is empty or not. 1219 // This may be used to include empty fields in Patch requests. 1220 ForceSendFields []string `json:"-"` 1221 1222 // NullFields is a list of field names (e.g. "AlternateLink") to include 1223 // in API requests with the JSON null value. By default, fields with 1224 // empty values are omitted from API requests. However, any field with 1225 // an empty value appearing in NullFields will be sent to the server as 1226 // null. It is an error if a field in this list has a non-empty value. 1227 // This may be used to include null fields in Patch requests. 1228 NullFields []string `json:"-"` 1229} 1230 1231func (s *CourseWorkMaterial) MarshalJSON() ([]byte, error) { 1232 type NoMethod CourseWorkMaterial 1233 raw := NoMethod(*s) 1234 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1235} 1236 1237// Date: Represents a whole or partial calendar date, such as a 1238// birthday. The time of day and time zone are either specified 1239// elsewhere or are insignificant. The date is relative to the Gregorian 1240// Calendar. This can represent one of the following: * A full date, 1241// with non-zero year, month, and day values * A month and day value, 1242// with a zero year, such as an anniversary * A year on its own, with 1243// zero month and day values * A year and month value, with a zero day, 1244// such as a credit card expiration date Related types are 1245// google.type.TimeOfDay and `google.protobuf.Timestamp`. 1246type Date struct { 1247 // Day: Day of a month. Must be from 1 to 31 and valid for the year and 1248 // month, or 0 to specify a year by itself or a year and month where the 1249 // day isn't significant. 1250 Day int64 `json:"day,omitempty"` 1251 1252 // Month: Month of a year. Must be from 1 to 12, or 0 to specify a year 1253 // without a month and day. 1254 Month int64 `json:"month,omitempty"` 1255 1256 // Year: Year of the date. Must be from 1 to 9999, or 0 to specify a 1257 // date without a year. 1258 Year int64 `json:"year,omitempty"` 1259 1260 // ForceSendFields is a list of field names (e.g. "Day") to 1261 // unconditionally include in API requests. By default, fields with 1262 // empty or default values are omitted from API requests. However, any 1263 // non-pointer, non-interface field appearing in ForceSendFields will be 1264 // sent to the server regardless of whether the field is empty or not. 1265 // This may be used to include empty fields in Patch requests. 1266 ForceSendFields []string `json:"-"` 1267 1268 // NullFields is a list of field names (e.g. "Day") to include in API 1269 // requests with the JSON null value. By default, fields with empty 1270 // values are omitted from API requests. However, any field with an 1271 // empty value appearing in NullFields will be sent to the server as 1272 // null. It is an error if a field in this list has a non-empty value. 1273 // This may be used to include null fields in Patch requests. 1274 NullFields []string `json:"-"` 1275} 1276 1277func (s *Date) MarshalJSON() ([]byte, error) { 1278 type NoMethod Date 1279 raw := NoMethod(*s) 1280 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1281} 1282 1283// DriveFile: Representation of a Google Drive file. 1284type DriveFile struct { 1285 // AlternateLink: URL that can be used to access the Drive item. 1286 // Read-only. 1287 AlternateLink string `json:"alternateLink,omitempty"` 1288 1289 // Id: Drive API resource ID. 1290 Id string `json:"id,omitempty"` 1291 1292 // ThumbnailUrl: URL of a thumbnail image of the Drive item. Read-only. 1293 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1294 1295 // Title: Title of the Drive item. Read-only. 1296 Title string `json:"title,omitempty"` 1297 1298 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1299 // unconditionally include in API requests. By default, fields with 1300 // empty or default values are omitted from API requests. However, any 1301 // non-pointer, non-interface field appearing in ForceSendFields will be 1302 // sent to the server regardless of whether the field is empty or not. 1303 // This may be used to include empty fields in Patch requests. 1304 ForceSendFields []string `json:"-"` 1305 1306 // NullFields is a list of field names (e.g. "AlternateLink") to include 1307 // in API requests with the JSON null value. By default, fields with 1308 // empty values are omitted from API requests. However, any field with 1309 // an empty value appearing in NullFields will be sent to the server as 1310 // null. It is an error if a field in this list has a non-empty value. 1311 // This may be used to include null fields in Patch requests. 1312 NullFields []string `json:"-"` 1313} 1314 1315func (s *DriveFile) MarshalJSON() ([]byte, error) { 1316 type NoMethod DriveFile 1317 raw := NoMethod(*s) 1318 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1319} 1320 1321// DriveFolder: Representation of a Google Drive folder. 1322type DriveFolder struct { 1323 // AlternateLink: URL that can be used to access the Drive folder. 1324 // Read-only. 1325 AlternateLink string `json:"alternateLink,omitempty"` 1326 1327 // Id: Drive API resource ID. 1328 Id string `json:"id,omitempty"` 1329 1330 // Title: Title of the Drive folder. Read-only. 1331 Title string `json:"title,omitempty"` 1332 1333 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 1334 // unconditionally include in API requests. By default, fields with 1335 // empty or default values are omitted from API requests. However, any 1336 // non-pointer, non-interface field appearing in ForceSendFields will be 1337 // sent to the server regardless of whether the field is empty or not. 1338 // This may be used to include empty fields in Patch requests. 1339 ForceSendFields []string `json:"-"` 1340 1341 // NullFields is a list of field names (e.g. "AlternateLink") to include 1342 // in API requests with the JSON null value. By default, fields with 1343 // empty values are omitted from API requests. However, any field with 1344 // an empty value appearing in NullFields will be sent to the server as 1345 // null. It is an error if a field in this list has a non-empty value. 1346 // This may be used to include null fields in Patch requests. 1347 NullFields []string `json:"-"` 1348} 1349 1350func (s *DriveFolder) MarshalJSON() ([]byte, error) { 1351 type NoMethod DriveFolder 1352 raw := NoMethod(*s) 1353 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1354} 1355 1356// Empty: A generic empty message that you can re-use to avoid defining 1357// duplicated empty messages in your APIs. A typical example is to use 1358// it as the request or the response type of an API method. For 1359// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 1360// (google.protobuf.Empty); } The JSON representation for `Empty` is 1361// empty JSON object `{}`. 1362type Empty struct { 1363 // ServerResponse contains the HTTP response code and headers from the 1364 // server. 1365 googleapi.ServerResponse `json:"-"` 1366} 1367 1368// Feed: A class of notifications that an application can register to 1369// receive. For example: "all roster changes for a domain". 1370type Feed struct { 1371 // CourseRosterChangesInfo: Information about a `Feed` with a 1372 // `feed_type` of `COURSE_ROSTER_CHANGES`. This field must be specified 1373 // if `feed_type` is `COURSE_ROSTER_CHANGES`. 1374 CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"` 1375 1376 // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type` 1377 // of `COURSE_WORK_CHANGES`. This field must be specified if `feed_type` 1378 // is `COURSE_WORK_CHANGES`. 1379 CourseWorkChangesInfo *CourseWorkChangesInfo `json:"courseWorkChangesInfo,omitempty"` 1380 1381 // FeedType: The type of feed. 1382 // 1383 // Possible values: 1384 // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided. 1385 // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular 1386 // domain. Notifications will be generated whenever a user joins or 1387 // leaves a course. No notifications will be generated when an 1388 // invitation is created or deleted, but notifications will be generated 1389 // when a user joins a course by accepting an invitation. 1390 // "COURSE_ROSTER_CHANGES" - All roster changes for a particular 1391 // course. Notifications will be generated whenever a user joins or 1392 // leaves a course. No notifications will be generated when an 1393 // invitation is created or deleted, but notifications will be generated 1394 // when a user joins a course by accepting an invitation. 1395 // "COURSE_WORK_CHANGES" - All course work activity for a particular 1396 // course. Notifications will be generated when a CourseWork or 1397 // StudentSubmission object is created or modified. No notification will 1398 // be generated when a StudentSubmission object is created in connection 1399 // with the creation or modification of its parent CourseWork object 1400 // (but a notification will be generated for that CourseWork object's 1401 // creation or modification). 1402 FeedType string `json:"feedType,omitempty"` 1403 1404 // ForceSendFields is a list of field names (e.g. 1405 // "CourseRosterChangesInfo") to unconditionally include in API 1406 // requests. By default, fields with empty or default values are omitted 1407 // from API requests. However, any non-pointer, non-interface field 1408 // appearing in ForceSendFields will be sent to the server regardless of 1409 // whether the field is empty or not. This may be used to include empty 1410 // fields in Patch requests. 1411 ForceSendFields []string `json:"-"` 1412 1413 // NullFields is a list of field names (e.g. "CourseRosterChangesInfo") 1414 // to include in API requests with the JSON null value. By default, 1415 // fields with empty values are omitted from API requests. However, any 1416 // field with an empty value appearing in NullFields will be sent to the 1417 // server as null. It is an error if a field in this list has a 1418 // non-empty value. This may be used to include null fields in Patch 1419 // requests. 1420 NullFields []string `json:"-"` 1421} 1422 1423func (s *Feed) MarshalJSON() ([]byte, error) { 1424 type NoMethod Feed 1425 raw := NoMethod(*s) 1426 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1427} 1428 1429// Form: Google Forms item. 1430type Form struct { 1431 // FormUrl: URL of the form. 1432 FormUrl string `json:"formUrl,omitempty"` 1433 1434 // ResponseUrl: URL of the form responses document. Only set if 1435 // respsonses have been recorded and only when the requesting user is an 1436 // editor of the form. Read-only. 1437 ResponseUrl string `json:"responseUrl,omitempty"` 1438 1439 // ThumbnailUrl: URL of a thumbnail image of the Form. Read-only. 1440 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1441 1442 // Title: Title of the Form. Read-only. 1443 Title string `json:"title,omitempty"` 1444 1445 // ForceSendFields is a list of field names (e.g. "FormUrl") to 1446 // unconditionally include in API requests. By default, fields with 1447 // empty or default values are omitted from API requests. However, any 1448 // non-pointer, non-interface field appearing in ForceSendFields will be 1449 // sent to the server regardless of whether the field is empty or not. 1450 // This may be used to include empty fields in Patch requests. 1451 ForceSendFields []string `json:"-"` 1452 1453 // NullFields is a list of field names (e.g. "FormUrl") to include in 1454 // API requests with the JSON null value. By default, fields with empty 1455 // values are omitted from API requests. However, any field with an 1456 // empty value appearing in NullFields will be sent to the server as 1457 // null. It is an error if a field in this list has a non-empty value. 1458 // This may be used to include null fields in Patch requests. 1459 NullFields []string `json:"-"` 1460} 1461 1462func (s *Form) MarshalJSON() ([]byte, error) { 1463 type NoMethod Form 1464 raw := NoMethod(*s) 1465 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1466} 1467 1468// GlobalPermission: Global user permission description. 1469type GlobalPermission struct { 1470 // Permission: Permission value. 1471 // 1472 // Possible values: 1473 // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not 1474 // returned and is not a valid value. 1475 // "CREATE_COURSE" - User is permitted to create a course. 1476 Permission string `json:"permission,omitempty"` 1477 1478 // ForceSendFields is a list of field names (e.g. "Permission") to 1479 // unconditionally include in API requests. By default, fields with 1480 // empty or default values are omitted from API requests. However, any 1481 // non-pointer, non-interface field appearing in ForceSendFields will be 1482 // sent to the server regardless of whether the field is empty or not. 1483 // This may be used to include empty fields in Patch requests. 1484 ForceSendFields []string `json:"-"` 1485 1486 // NullFields is a list of field names (e.g. "Permission") to include in 1487 // API requests with the JSON null value. By default, fields with empty 1488 // values are omitted from API requests. However, any field with an 1489 // empty value appearing in NullFields will be sent to the server as 1490 // null. It is an error if a field in this list has a non-empty value. 1491 // This may be used to include null fields in Patch requests. 1492 NullFields []string `json:"-"` 1493} 1494 1495func (s *GlobalPermission) MarshalJSON() ([]byte, error) { 1496 type NoMethod GlobalPermission 1497 raw := NoMethod(*s) 1498 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1499} 1500 1501// GradeHistory: The history of each grade on this submission. 1502type GradeHistory struct { 1503 // ActorUserId: The teacher who made the grade change. 1504 ActorUserId string `json:"actorUserId,omitempty"` 1505 1506 // GradeChangeType: The type of grade change at this time in the 1507 // submission grade history. 1508 // 1509 // Possible values: 1510 // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This 1511 // should never be returned. 1512 // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of 1513 // the draft grade. 1514 // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator 1515 // of the assigned grade. 1516 // "MAX_POINTS_CHANGE" - A change in the denominator of the grade. 1517 GradeChangeType string `json:"gradeChangeType,omitempty"` 1518 1519 // GradeTimestamp: When the grade of the submission was changed. 1520 GradeTimestamp string `json:"gradeTimestamp,omitempty"` 1521 1522 // MaxPoints: The denominator of the grade at this time in the 1523 // submission grade history. 1524 MaxPoints float64 `json:"maxPoints,omitempty"` 1525 1526 // PointsEarned: The numerator of the grade at this time in the 1527 // submission grade history. 1528 PointsEarned float64 `json:"pointsEarned,omitempty"` 1529 1530 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 1531 // unconditionally include in API requests. By default, fields with 1532 // empty or default values are omitted from API requests. However, any 1533 // non-pointer, non-interface field appearing in ForceSendFields will be 1534 // sent to the server regardless of whether the field is empty or not. 1535 // This may be used to include empty fields in Patch requests. 1536 ForceSendFields []string `json:"-"` 1537 1538 // NullFields is a list of field names (e.g. "ActorUserId") to include 1539 // in API requests with the JSON null value. By default, fields with 1540 // empty values are omitted from API requests. However, any field with 1541 // an empty value appearing in NullFields will be sent to the server as 1542 // null. It is an error if a field in this list has a non-empty value. 1543 // This may be used to include null fields in Patch requests. 1544 NullFields []string `json:"-"` 1545} 1546 1547func (s *GradeHistory) MarshalJSON() ([]byte, error) { 1548 type NoMethod GradeHistory 1549 raw := NoMethod(*s) 1550 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1551} 1552 1553func (s *GradeHistory) UnmarshalJSON(data []byte) error { 1554 type NoMethod GradeHistory 1555 var s1 struct { 1556 MaxPoints gensupport.JSONFloat64 `json:"maxPoints"` 1557 PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"` 1558 *NoMethod 1559 } 1560 s1.NoMethod = (*NoMethod)(s) 1561 if err := json.Unmarshal(data, &s1); err != nil { 1562 return err 1563 } 1564 s.MaxPoints = float64(s1.MaxPoints) 1565 s.PointsEarned = float64(s1.PointsEarned) 1566 return nil 1567} 1568 1569// Guardian: Association between a student and a guardian of that 1570// student. The guardian may receive information about the student's 1571// course work. 1572type Guardian struct { 1573 // GuardianId: Identifier for the guardian. 1574 GuardianId string `json:"guardianId,omitempty"` 1575 1576 // GuardianProfile: User profile for the guardian. 1577 GuardianProfile *UserProfile `json:"guardianProfile,omitempty"` 1578 1579 // InvitedEmailAddress: The email address to which the initial guardian 1580 // invitation was sent. This field is only visible to domain 1581 // administrators. 1582 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1583 1584 // StudentId: Identifier for the student to whom the guardian 1585 // relationship applies. 1586 StudentId string `json:"studentId,omitempty"` 1587 1588 // ServerResponse contains the HTTP response code and headers from the 1589 // server. 1590 googleapi.ServerResponse `json:"-"` 1591 1592 // ForceSendFields is a list of field names (e.g. "GuardianId") to 1593 // unconditionally include in API requests. By default, fields with 1594 // empty or default values are omitted from API requests. However, any 1595 // non-pointer, non-interface field appearing in ForceSendFields will be 1596 // sent to the server regardless of whether the field is empty or not. 1597 // This may be used to include empty fields in Patch requests. 1598 ForceSendFields []string `json:"-"` 1599 1600 // NullFields is a list of field names (e.g. "GuardianId") to include in 1601 // API requests with the JSON null value. By default, fields with empty 1602 // values are omitted from API requests. However, any field with an 1603 // empty value appearing in NullFields will be sent to the server as 1604 // null. It is an error if a field in this list has a non-empty value. 1605 // This may be used to include null fields in Patch requests. 1606 NullFields []string `json:"-"` 1607} 1608 1609func (s *Guardian) MarshalJSON() ([]byte, error) { 1610 type NoMethod Guardian 1611 raw := NoMethod(*s) 1612 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1613} 1614 1615// GuardianInvitation: An invitation to become the guardian of a 1616// specified user, sent to a specified email address. 1617type GuardianInvitation struct { 1618 // CreationTime: The time that this invitation was created. Read-only. 1619 CreationTime string `json:"creationTime,omitempty"` 1620 1621 // InvitationId: Unique identifier for this invitation. Read-only. 1622 InvitationId string `json:"invitationId,omitempty"` 1623 1624 // InvitedEmailAddress: Email address that the invitation was sent to. 1625 // This field is only visible to domain administrators. 1626 InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"` 1627 1628 // State: The state that this invitation is in. 1629 // 1630 // Possible values: 1631 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 1632 // "PENDING" - The invitation is active and awaiting a response. 1633 // "COMPLETE" - The invitation is no longer active. It may have been 1634 // accepted, declined, withdrawn or it may have expired. 1635 State string `json:"state,omitempty"` 1636 1637 // StudentId: ID of the student (in standard format) 1638 StudentId string `json:"studentId,omitempty"` 1639 1640 // ServerResponse contains the HTTP response code and headers from the 1641 // server. 1642 googleapi.ServerResponse `json:"-"` 1643 1644 // ForceSendFields is a list of field names (e.g. "CreationTime") to 1645 // unconditionally include in API requests. By default, fields with 1646 // empty or default values are omitted from API requests. However, any 1647 // non-pointer, non-interface field appearing in ForceSendFields will be 1648 // sent to the server regardless of whether the field is empty or not. 1649 // This may be used to include empty fields in Patch requests. 1650 ForceSendFields []string `json:"-"` 1651 1652 // NullFields is a list of field names (e.g. "CreationTime") to include 1653 // in API requests with the JSON null value. By default, fields with 1654 // empty values are omitted from API requests. However, any field with 1655 // an empty value appearing in NullFields will be sent to the server as 1656 // null. It is an error if a field in this list has a non-empty value. 1657 // This may be used to include null fields in Patch requests. 1658 NullFields []string `json:"-"` 1659} 1660 1661func (s *GuardianInvitation) MarshalJSON() ([]byte, error) { 1662 type NoMethod GuardianInvitation 1663 raw := NoMethod(*s) 1664 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1665} 1666 1667// IndividualStudentsOptions: Assignee details about a 1668// coursework/announcement. This field is set if and only if 1669// `assigneeMode` is `INDIVIDUAL_STUDENTS`. 1670type IndividualStudentsOptions struct { 1671 // StudentIds: Identifiers for the students that have access to the 1672 // coursework/announcement. 1673 StudentIds []string `json:"studentIds,omitempty"` 1674 1675 // ForceSendFields is a list of field names (e.g. "StudentIds") to 1676 // unconditionally include in API requests. By default, fields with 1677 // empty or default values are omitted from API requests. However, any 1678 // non-pointer, non-interface field appearing in ForceSendFields will be 1679 // sent to the server regardless of whether the field is empty or not. 1680 // This may be used to include empty fields in Patch requests. 1681 ForceSendFields []string `json:"-"` 1682 1683 // NullFields is a list of field names (e.g. "StudentIds") to include in 1684 // API requests with the JSON null value. By default, fields with empty 1685 // values are omitted from API requests. However, any field with an 1686 // empty value appearing in NullFields will be sent to the server as 1687 // null. It is an error if a field in this list has a non-empty value. 1688 // This may be used to include null fields in Patch requests. 1689 NullFields []string `json:"-"` 1690} 1691 1692func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) { 1693 type NoMethod IndividualStudentsOptions 1694 raw := NoMethod(*s) 1695 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1696} 1697 1698// Invitation: An invitation to join a course. 1699type Invitation struct { 1700 // CourseId: Identifier of the course to invite the user to. 1701 CourseId string `json:"courseId,omitempty"` 1702 1703 // Id: Identifier assigned by Classroom. Read-only. 1704 Id string `json:"id,omitempty"` 1705 1706 // Role: Role to invite the user to have. Must not be 1707 // `COURSE_ROLE_UNSPECIFIED`. 1708 // 1709 // Possible values: 1710 // "COURSE_ROLE_UNSPECIFIED" - No course role. 1711 // "STUDENT" - Student in the course. 1712 // "TEACHER" - Teacher of the course. 1713 // "OWNER" - Owner of the course. 1714 Role string `json:"role,omitempty"` 1715 1716 // UserId: Identifier of the invited user. When specified as a parameter 1717 // of a request, this identifier can be set to one of the following: * 1718 // the numeric identifier for the user * the email address of the user * 1719 // the string literal "me", indicating the requesting user 1720 UserId string `json:"userId,omitempty"` 1721 1722 // ServerResponse contains the HTTP response code and headers from the 1723 // server. 1724 googleapi.ServerResponse `json:"-"` 1725 1726 // ForceSendFields is a list of field names (e.g. "CourseId") to 1727 // unconditionally include in API requests. By default, fields with 1728 // empty or default values are omitted from API requests. However, any 1729 // non-pointer, non-interface field appearing in ForceSendFields will be 1730 // sent to the server regardless of whether the field is empty or not. 1731 // This may be used to include empty fields in Patch requests. 1732 ForceSendFields []string `json:"-"` 1733 1734 // NullFields is a list of field names (e.g. "CourseId") to include in 1735 // API requests with the JSON null value. By default, fields with empty 1736 // values are omitted from API requests. However, any field with an 1737 // empty value appearing in NullFields will be sent to the server as 1738 // null. It is an error if a field in this list has a non-empty value. 1739 // This may be used to include null fields in Patch requests. 1740 NullFields []string `json:"-"` 1741} 1742 1743func (s *Invitation) MarshalJSON() ([]byte, error) { 1744 type NoMethod Invitation 1745 raw := NoMethod(*s) 1746 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1747} 1748 1749// Link: URL item. 1750type Link struct { 1751 // ThumbnailUrl: URL of a thumbnail image of the target URL. Read-only. 1752 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 1753 1754 // Title: Title of the target of the URL. Read-only. 1755 Title string `json:"title,omitempty"` 1756 1757 // Url: URL to link to. This must be a valid UTF-8 string containing 1758 // between 1 and 2024 characters. 1759 Url string `json:"url,omitempty"` 1760 1761 // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to 1762 // unconditionally include in API requests. By default, fields with 1763 // empty or default values are omitted from API requests. However, any 1764 // non-pointer, non-interface field appearing in ForceSendFields will be 1765 // sent to the server regardless of whether the field is empty or not. 1766 // This may be used to include empty fields in Patch requests. 1767 ForceSendFields []string `json:"-"` 1768 1769 // NullFields is a list of field names (e.g. "ThumbnailUrl") to include 1770 // in API requests with the JSON null value. By default, fields with 1771 // empty values are omitted from API requests. However, any field with 1772 // an empty value appearing in NullFields will be sent to the server as 1773 // null. It is an error if a field in this list has a non-empty value. 1774 // This may be used to include null fields in Patch requests. 1775 NullFields []string `json:"-"` 1776} 1777 1778func (s *Link) MarshalJSON() ([]byte, error) { 1779 type NoMethod Link 1780 raw := NoMethod(*s) 1781 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1782} 1783 1784// ListAnnouncementsResponse: Response when listing course work. 1785type ListAnnouncementsResponse struct { 1786 // Announcements: Announcement items that match the request. 1787 Announcements []*Announcement `json:"announcements,omitempty"` 1788 1789 // NextPageToken: Token identifying the next page of results to return. 1790 // If empty, no further results are available. 1791 NextPageToken string `json:"nextPageToken,omitempty"` 1792 1793 // ServerResponse contains the HTTP response code and headers from the 1794 // server. 1795 googleapi.ServerResponse `json:"-"` 1796 1797 // ForceSendFields is a list of field names (e.g. "Announcements") to 1798 // unconditionally include in API requests. By default, fields with 1799 // empty or default values are omitted from API requests. However, any 1800 // non-pointer, non-interface field appearing in ForceSendFields will be 1801 // sent to the server regardless of whether the field is empty or not. 1802 // This may be used to include empty fields in Patch requests. 1803 ForceSendFields []string `json:"-"` 1804 1805 // NullFields is a list of field names (e.g. "Announcements") to include 1806 // in API requests with the JSON null value. By default, fields with 1807 // empty values are omitted from API requests. However, any field with 1808 // an empty value appearing in NullFields will be sent to the server as 1809 // null. It is an error if a field in this list has a non-empty value. 1810 // This may be used to include null fields in Patch requests. 1811 NullFields []string `json:"-"` 1812} 1813 1814func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) { 1815 type NoMethod ListAnnouncementsResponse 1816 raw := NoMethod(*s) 1817 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1818} 1819 1820// ListCourseAliasesResponse: Response when listing course aliases. 1821type ListCourseAliasesResponse struct { 1822 // Aliases: The course aliases. 1823 Aliases []*CourseAlias `json:"aliases,omitempty"` 1824 1825 // NextPageToken: Token identifying the next page of results to return. 1826 // If empty, no further results are available. 1827 NextPageToken string `json:"nextPageToken,omitempty"` 1828 1829 // ServerResponse contains the HTTP response code and headers from the 1830 // server. 1831 googleapi.ServerResponse `json:"-"` 1832 1833 // ForceSendFields is a list of field names (e.g. "Aliases") to 1834 // unconditionally include in API requests. By default, fields with 1835 // empty or default values are omitted from API requests. However, any 1836 // non-pointer, non-interface field appearing in ForceSendFields will be 1837 // sent to the server regardless of whether the field is empty or not. 1838 // This may be used to include empty fields in Patch requests. 1839 ForceSendFields []string `json:"-"` 1840 1841 // NullFields is a list of field names (e.g. "Aliases") to include in 1842 // API requests with the JSON null value. By default, fields with empty 1843 // values are omitted from API requests. However, any field with an 1844 // empty value appearing in NullFields will be sent to the server as 1845 // null. It is an error if a field in this list has a non-empty value. 1846 // This may be used to include null fields in Patch requests. 1847 NullFields []string `json:"-"` 1848} 1849 1850func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) { 1851 type NoMethod ListCourseAliasesResponse 1852 raw := NoMethod(*s) 1853 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1854} 1855 1856// ListCourseWorkMaterialResponse: Response when listing course work 1857// material. 1858type ListCourseWorkMaterialResponse struct { 1859 // CourseWorkMaterial: Course work material items that match the 1860 // request. 1861 CourseWorkMaterial []*CourseWorkMaterial `json:"courseWorkMaterial,omitempty"` 1862 1863 // NextPageToken: Token identifying the next page of results to return. 1864 // If empty, no further results are available. 1865 NextPageToken string `json:"nextPageToken,omitempty"` 1866 1867 // ServerResponse contains the HTTP response code and headers from the 1868 // server. 1869 googleapi.ServerResponse `json:"-"` 1870 1871 // ForceSendFields is a list of field names (e.g. "CourseWorkMaterial") 1872 // to unconditionally include in API requests. By default, fields with 1873 // empty or default values are omitted from API requests. However, any 1874 // non-pointer, non-interface field appearing in ForceSendFields will be 1875 // sent to the server regardless of whether the field is empty or not. 1876 // This may be used to include empty fields in Patch requests. 1877 ForceSendFields []string `json:"-"` 1878 1879 // NullFields is a list of field names (e.g. "CourseWorkMaterial") to 1880 // include in API requests with the JSON null value. By default, fields 1881 // with empty values are omitted from API requests. However, any field 1882 // with an empty value appearing in NullFields will be sent to the 1883 // server as null. It is an error if a field in this list has a 1884 // non-empty value. This may be used to include null fields in Patch 1885 // requests. 1886 NullFields []string `json:"-"` 1887} 1888 1889func (s *ListCourseWorkMaterialResponse) MarshalJSON() ([]byte, error) { 1890 type NoMethod ListCourseWorkMaterialResponse 1891 raw := NoMethod(*s) 1892 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1893} 1894 1895// ListCourseWorkResponse: Response when listing course work. 1896type ListCourseWorkResponse struct { 1897 // CourseWork: Course work items that match the request. 1898 CourseWork []*CourseWork `json:"courseWork,omitempty"` 1899 1900 // NextPageToken: Token identifying the next page of results to return. 1901 // If empty, no further results are available. 1902 NextPageToken string `json:"nextPageToken,omitempty"` 1903 1904 // ServerResponse contains the HTTP response code and headers from the 1905 // server. 1906 googleapi.ServerResponse `json:"-"` 1907 1908 // ForceSendFields is a list of field names (e.g. "CourseWork") to 1909 // unconditionally include in API requests. By default, fields with 1910 // empty or default values are omitted from API requests. However, any 1911 // non-pointer, non-interface field appearing in ForceSendFields will be 1912 // sent to the server regardless of whether the field is empty or not. 1913 // This may be used to include empty fields in Patch requests. 1914 ForceSendFields []string `json:"-"` 1915 1916 // NullFields is a list of field names (e.g. "CourseWork") to include in 1917 // API requests with the JSON null value. By default, fields with empty 1918 // values are omitted from API requests. However, any field with an 1919 // empty value appearing in NullFields will be sent to the server as 1920 // null. It is an error if a field in this list has a non-empty value. 1921 // This may be used to include null fields in Patch requests. 1922 NullFields []string `json:"-"` 1923} 1924 1925func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) { 1926 type NoMethod ListCourseWorkResponse 1927 raw := NoMethod(*s) 1928 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1929} 1930 1931// ListCoursesResponse: Response when listing courses. 1932type ListCoursesResponse struct { 1933 // Courses: Courses that match the list request. 1934 Courses []*Course `json:"courses,omitempty"` 1935 1936 // NextPageToken: Token identifying the next page of results to return. 1937 // If empty, no further results are available. 1938 NextPageToken string `json:"nextPageToken,omitempty"` 1939 1940 // ServerResponse contains the HTTP response code and headers from the 1941 // server. 1942 googleapi.ServerResponse `json:"-"` 1943 1944 // ForceSendFields is a list of field names (e.g. "Courses") to 1945 // unconditionally include in API requests. By default, fields with 1946 // empty or default values are omitted from API requests. However, any 1947 // non-pointer, non-interface field appearing in ForceSendFields will be 1948 // sent to the server regardless of whether the field is empty or not. 1949 // This may be used to include empty fields in Patch requests. 1950 ForceSendFields []string `json:"-"` 1951 1952 // NullFields is a list of field names (e.g. "Courses") to include in 1953 // API requests with the JSON null value. By default, fields with empty 1954 // values are omitted from API requests. However, any field with an 1955 // empty value appearing in NullFields will be sent to the server as 1956 // null. It is an error if a field in this list has a non-empty value. 1957 // This may be used to include null fields in Patch requests. 1958 NullFields []string `json:"-"` 1959} 1960 1961func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) { 1962 type NoMethod ListCoursesResponse 1963 raw := NoMethod(*s) 1964 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1965} 1966 1967// ListGuardianInvitationsResponse: Response when listing guardian 1968// invitations. 1969type ListGuardianInvitationsResponse struct { 1970 // GuardianInvitations: Guardian invitations that matched the list 1971 // request. 1972 GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"` 1973 1974 // NextPageToken: Token identifying the next page of results to return. 1975 // If empty, no further results are available. 1976 NextPageToken string `json:"nextPageToken,omitempty"` 1977 1978 // ServerResponse contains the HTTP response code and headers from the 1979 // server. 1980 googleapi.ServerResponse `json:"-"` 1981 1982 // ForceSendFields is a list of field names (e.g. "GuardianInvitations") 1983 // to unconditionally include in API requests. By default, fields with 1984 // empty or default values are omitted from API requests. However, any 1985 // non-pointer, non-interface field appearing in ForceSendFields will be 1986 // sent to the server regardless of whether the field is empty or not. 1987 // This may be used to include empty fields in Patch requests. 1988 ForceSendFields []string `json:"-"` 1989 1990 // NullFields is a list of field names (e.g. "GuardianInvitations") to 1991 // include in API requests with the JSON null value. By default, fields 1992 // with empty values are omitted from API requests. However, any field 1993 // with an empty value appearing in NullFields will be sent to the 1994 // server as null. It is an error if a field in this list has a 1995 // non-empty value. This may be used to include null fields in Patch 1996 // requests. 1997 NullFields []string `json:"-"` 1998} 1999 2000func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) { 2001 type NoMethod ListGuardianInvitationsResponse 2002 raw := NoMethod(*s) 2003 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2004} 2005 2006// ListGuardiansResponse: Response when listing guardians. 2007type ListGuardiansResponse struct { 2008 // Guardians: Guardians on this page of results that met the criteria 2009 // specified in the request. 2010 Guardians []*Guardian `json:"guardians,omitempty"` 2011 2012 // NextPageToken: Token identifying the next page of results to return. 2013 // If empty, no further results are available. 2014 NextPageToken string `json:"nextPageToken,omitempty"` 2015 2016 // ServerResponse contains the HTTP response code and headers from the 2017 // server. 2018 googleapi.ServerResponse `json:"-"` 2019 2020 // ForceSendFields is a list of field names (e.g. "Guardians") to 2021 // unconditionally include in API requests. By default, fields with 2022 // empty or default values are omitted from API requests. However, any 2023 // non-pointer, non-interface field appearing in ForceSendFields will be 2024 // sent to the server regardless of whether the field is empty or not. 2025 // This may be used to include empty fields in Patch requests. 2026 ForceSendFields []string `json:"-"` 2027 2028 // NullFields is a list of field names (e.g. "Guardians") to include in 2029 // API requests with the JSON null value. By default, fields with empty 2030 // values are omitted from API requests. However, any field with an 2031 // empty value appearing in NullFields will be sent to the server as 2032 // null. It is an error if a field in this list has a non-empty value. 2033 // This may be used to include null fields in Patch requests. 2034 NullFields []string `json:"-"` 2035} 2036 2037func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) { 2038 type NoMethod ListGuardiansResponse 2039 raw := NoMethod(*s) 2040 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2041} 2042 2043// ListInvitationsResponse: Response when listing invitations. 2044type ListInvitationsResponse struct { 2045 // Invitations: Invitations that match the list request. 2046 Invitations []*Invitation `json:"invitations,omitempty"` 2047 2048 // NextPageToken: Token identifying the next page of results to return. 2049 // If empty, no further results are available. 2050 NextPageToken string `json:"nextPageToken,omitempty"` 2051 2052 // ServerResponse contains the HTTP response code and headers from the 2053 // server. 2054 googleapi.ServerResponse `json:"-"` 2055 2056 // ForceSendFields is a list of field names (e.g. "Invitations") to 2057 // unconditionally include in API requests. By default, fields with 2058 // empty or default values are omitted from API requests. However, any 2059 // non-pointer, non-interface field appearing in ForceSendFields will be 2060 // sent to the server regardless of whether the field is empty or not. 2061 // This may be used to include empty fields in Patch requests. 2062 ForceSendFields []string `json:"-"` 2063 2064 // NullFields is a list of field names (e.g. "Invitations") to include 2065 // in API requests with the JSON null value. By default, fields with 2066 // empty values are omitted from API requests. However, any field with 2067 // an empty value appearing in NullFields will be sent to the server as 2068 // null. It is an error if a field in this list has a non-empty value. 2069 // This may be used to include null fields in Patch requests. 2070 NullFields []string `json:"-"` 2071} 2072 2073func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) { 2074 type NoMethod ListInvitationsResponse 2075 raw := NoMethod(*s) 2076 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2077} 2078 2079// ListStudentSubmissionsResponse: Response when listing student 2080// submissions. 2081type ListStudentSubmissionsResponse struct { 2082 // NextPageToken: Token identifying the next page of results to return. 2083 // If empty, no further results are available. 2084 NextPageToken string `json:"nextPageToken,omitempty"` 2085 2086 // StudentSubmissions: Student work that matches the request. 2087 StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"` 2088 2089 // ServerResponse contains the HTTP response code and headers from the 2090 // server. 2091 googleapi.ServerResponse `json:"-"` 2092 2093 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2094 // unconditionally include in API requests. By default, fields with 2095 // empty or default values are omitted from API requests. However, any 2096 // non-pointer, non-interface field appearing in ForceSendFields will be 2097 // sent to the server regardless of whether the field is empty or not. 2098 // This may be used to include empty fields in Patch requests. 2099 ForceSendFields []string `json:"-"` 2100 2101 // NullFields is a list of field names (e.g. "NextPageToken") to include 2102 // in API requests with the JSON null value. By default, fields with 2103 // empty values are omitted from API requests. However, any field with 2104 // an empty value appearing in NullFields will be sent to the server as 2105 // null. It is an error if a field in this list has a non-empty value. 2106 // This may be used to include null fields in Patch requests. 2107 NullFields []string `json:"-"` 2108} 2109 2110func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) { 2111 type NoMethod ListStudentSubmissionsResponse 2112 raw := NoMethod(*s) 2113 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2114} 2115 2116// ListStudentsResponse: Response when listing students. 2117type ListStudentsResponse struct { 2118 // NextPageToken: Token identifying the next page of results to return. 2119 // If empty, no further results are available. 2120 NextPageToken string `json:"nextPageToken,omitempty"` 2121 2122 // Students: Students who match the list request. 2123 Students []*Student `json:"students,omitempty"` 2124 2125 // ServerResponse contains the HTTP response code and headers from the 2126 // server. 2127 googleapi.ServerResponse `json:"-"` 2128 2129 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2130 // unconditionally include in API requests. By default, fields with 2131 // empty or default values are omitted from API requests. However, any 2132 // non-pointer, non-interface field appearing in ForceSendFields will be 2133 // sent to the server regardless of whether the field is empty or not. 2134 // This may be used to include empty fields in Patch requests. 2135 ForceSendFields []string `json:"-"` 2136 2137 // NullFields is a list of field names (e.g. "NextPageToken") to include 2138 // in API requests with the JSON null value. By default, fields with 2139 // empty values are omitted from API requests. However, any field with 2140 // an empty value appearing in NullFields will be sent to the server as 2141 // null. It is an error if a field in this list has a non-empty value. 2142 // This may be used to include null fields in Patch requests. 2143 NullFields []string `json:"-"` 2144} 2145 2146func (s *ListStudentsResponse) MarshalJSON() ([]byte, error) { 2147 type NoMethod ListStudentsResponse 2148 raw := NoMethod(*s) 2149 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2150} 2151 2152// ListTeachersResponse: Response when listing teachers. 2153type ListTeachersResponse struct { 2154 // NextPageToken: Token identifying the next page of results to return. 2155 // If empty, no further results are available. 2156 NextPageToken string `json:"nextPageToken,omitempty"` 2157 2158 // Teachers: Teachers who match the list request. 2159 Teachers []*Teacher `json:"teachers,omitempty"` 2160 2161 // ServerResponse contains the HTTP response code and headers from the 2162 // server. 2163 googleapi.ServerResponse `json:"-"` 2164 2165 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2166 // unconditionally include in API requests. By default, fields with 2167 // empty or default values are omitted from API requests. However, any 2168 // non-pointer, non-interface field appearing in ForceSendFields will be 2169 // sent to the server regardless of whether the field is empty or not. 2170 // This may be used to include empty fields in Patch requests. 2171 ForceSendFields []string `json:"-"` 2172 2173 // NullFields is a list of field names (e.g. "NextPageToken") to include 2174 // in API requests with the JSON null value. By default, fields with 2175 // empty values are omitted from API requests. However, any field with 2176 // an empty value appearing in NullFields will be sent to the server as 2177 // null. It is an error if a field in this list has a non-empty value. 2178 // This may be used to include null fields in Patch requests. 2179 NullFields []string `json:"-"` 2180} 2181 2182func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) { 2183 type NoMethod ListTeachersResponse 2184 raw := NoMethod(*s) 2185 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2186} 2187 2188// ListTopicResponse: Response when listing topics. 2189type ListTopicResponse struct { 2190 // NextPageToken: Token identifying the next page of results to return. 2191 // If empty, no further results are available. 2192 NextPageToken string `json:"nextPageToken,omitempty"` 2193 2194 // Topic: Topic items that match the request. 2195 Topic []*Topic `json:"topic,omitempty"` 2196 2197 // ServerResponse contains the HTTP response code and headers from the 2198 // server. 2199 googleapi.ServerResponse `json:"-"` 2200 2201 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 2202 // unconditionally include in API requests. By default, fields with 2203 // empty or default values are omitted from API requests. However, any 2204 // non-pointer, non-interface field appearing in ForceSendFields will be 2205 // sent to the server regardless of whether the field is empty or not. 2206 // This may be used to include empty fields in Patch requests. 2207 ForceSendFields []string `json:"-"` 2208 2209 // NullFields is a list of field names (e.g. "NextPageToken") to include 2210 // in API requests with the JSON null value. By default, fields with 2211 // empty values are omitted from API requests. However, any field with 2212 // an empty value appearing in NullFields will be sent to the server as 2213 // null. It is an error if a field in this list has a non-empty value. 2214 // This may be used to include null fields in Patch requests. 2215 NullFields []string `json:"-"` 2216} 2217 2218func (s *ListTopicResponse) MarshalJSON() ([]byte, error) { 2219 type NoMethod ListTopicResponse 2220 raw := NoMethod(*s) 2221 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2222} 2223 2224// Material: Material attached to course work. When creating 2225// attachments, setting the `form` field is not supported. 2226type Material struct { 2227 // DriveFile: Google Drive file material. 2228 DriveFile *SharedDriveFile `json:"driveFile,omitempty"` 2229 2230 // Form: Google Forms material. 2231 Form *Form `json:"form,omitempty"` 2232 2233 // Link: Link material. On creation, this is upgraded to a more 2234 // appropriate type if possible, and this is reflected in the response. 2235 Link *Link `json:"link,omitempty"` 2236 2237 // YoutubeVideo: YouTube video material. 2238 YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"` 2239 2240 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2241 // unconditionally include in API requests. By default, fields with 2242 // empty or default values are omitted from API requests. However, any 2243 // non-pointer, non-interface field appearing in ForceSendFields will be 2244 // sent to the server regardless of whether the field is empty or not. 2245 // This may be used to include empty fields in Patch requests. 2246 ForceSendFields []string `json:"-"` 2247 2248 // NullFields is a list of field names (e.g. "DriveFile") to include in 2249 // API requests with the JSON null value. By default, fields with empty 2250 // values are omitted from API requests. However, any field with an 2251 // empty value appearing in NullFields will be sent to the server as 2252 // null. It is an error if a field in this list has a non-empty value. 2253 // This may be used to include null fields in Patch requests. 2254 NullFields []string `json:"-"` 2255} 2256 2257func (s *Material) MarshalJSON() ([]byte, error) { 2258 type NoMethod Material 2259 raw := NoMethod(*s) 2260 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2261} 2262 2263// ModifyAnnouncementAssigneesRequest: Request to modify assignee mode 2264// and options of an announcement. 2265type ModifyAnnouncementAssigneesRequest struct { 2266 // AssigneeMode: Mode of the announcement describing whether it is 2267 // accessible by all students or specified individual students. 2268 // 2269 // Possible values: 2270 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2271 // returned. 2272 // "ALL_STUDENTS" - All students can see the item. This is the default 2273 // state. 2274 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2275 AssigneeMode string `json:"assigneeMode,omitempty"` 2276 2277 // ModifyIndividualStudentsOptions: Set which students can view or 2278 // cannot view the announcement. Must be specified only when 2279 // `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2280 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2281 2282 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2283 // unconditionally include in API requests. By default, fields with 2284 // empty or default values are omitted from API requests. However, any 2285 // non-pointer, non-interface field appearing in ForceSendFields will be 2286 // sent to the server regardless of whether the field is empty or not. 2287 // This may be used to include empty fields in Patch requests. 2288 ForceSendFields []string `json:"-"` 2289 2290 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2291 // in API requests with the JSON null value. By default, fields with 2292 // empty values are omitted from API requests. However, any field with 2293 // an empty value appearing in NullFields will be sent to the server as 2294 // null. It is an error if a field in this list has a non-empty value. 2295 // This may be used to include null fields in Patch requests. 2296 NullFields []string `json:"-"` 2297} 2298 2299func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) { 2300 type NoMethod ModifyAnnouncementAssigneesRequest 2301 raw := NoMethod(*s) 2302 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2303} 2304 2305// ModifyAttachmentsRequest: Request to modify the attachments of a 2306// student submission. 2307type ModifyAttachmentsRequest struct { 2308 // AddAttachments: Attachments to add. A student submission may not have 2309 // more than 20 attachments. Form attachments are not supported. 2310 AddAttachments []*Attachment `json:"addAttachments,omitempty"` 2311 2312 // ForceSendFields is a list of field names (e.g. "AddAttachments") to 2313 // unconditionally include in API requests. By default, fields with 2314 // empty or default values are omitted from API requests. However, any 2315 // non-pointer, non-interface field appearing in ForceSendFields will be 2316 // sent to the server regardless of whether the field is empty or not. 2317 // This may be used to include empty fields in Patch requests. 2318 ForceSendFields []string `json:"-"` 2319 2320 // NullFields is a list of field names (e.g. "AddAttachments") to 2321 // include in API requests with the JSON null value. By default, fields 2322 // with empty values are omitted from API requests. However, any field 2323 // with an empty value appearing in NullFields will be sent to the 2324 // server as null. It is an error if a field in this list has a 2325 // non-empty value. This may be used to include null fields in Patch 2326 // requests. 2327 NullFields []string `json:"-"` 2328} 2329 2330func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) { 2331 type NoMethod ModifyAttachmentsRequest 2332 raw := NoMethod(*s) 2333 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2334} 2335 2336// ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and 2337// options of a coursework. 2338type ModifyCourseWorkAssigneesRequest struct { 2339 // AssigneeMode: Mode of the coursework describing whether it will be 2340 // assigned to all students or specified individual students. 2341 // 2342 // Possible values: 2343 // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never 2344 // returned. 2345 // "ALL_STUDENTS" - All students can see the item. This is the default 2346 // state. 2347 // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item. 2348 AssigneeMode string `json:"assigneeMode,omitempty"` 2349 2350 // ModifyIndividualStudentsOptions: Set which students are assigned or 2351 // not assigned to the coursework. Must be specified only when 2352 // `assigneeMode` is `INDIVIDUAL_STUDENTS`. 2353 ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"` 2354 2355 // ForceSendFields is a list of field names (e.g. "AssigneeMode") to 2356 // unconditionally include in API requests. By default, fields with 2357 // empty or default values are omitted from API requests. However, any 2358 // non-pointer, non-interface field appearing in ForceSendFields will be 2359 // sent to the server regardless of whether the field is empty or not. 2360 // This may be used to include empty fields in Patch requests. 2361 ForceSendFields []string `json:"-"` 2362 2363 // NullFields is a list of field names (e.g. "AssigneeMode") to include 2364 // in API requests with the JSON null value. By default, fields with 2365 // empty values are omitted from API requests. However, any field with 2366 // an empty value appearing in NullFields will be sent to the server as 2367 // null. It is an error if a field in this list has a non-empty value. 2368 // This may be used to include null fields in Patch requests. 2369 NullFields []string `json:"-"` 2370} 2371 2372func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) { 2373 type NoMethod ModifyCourseWorkAssigneesRequest 2374 raw := NoMethod(*s) 2375 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2376} 2377 2378// ModifyIndividualStudentsOptions: Contains fields to add or remove 2379// students from a course work or announcement where the `assigneeMode` 2380// is set to `INDIVIDUAL_STUDENTS`. 2381type ModifyIndividualStudentsOptions struct { 2382 // AddStudentIds: IDs of students to be added as having access to this 2383 // coursework/announcement. 2384 AddStudentIds []string `json:"addStudentIds,omitempty"` 2385 2386 // RemoveStudentIds: IDs of students to be removed from having access to 2387 // this coursework/announcement. 2388 RemoveStudentIds []string `json:"removeStudentIds,omitempty"` 2389 2390 // ForceSendFields is a list of field names (e.g. "AddStudentIds") to 2391 // unconditionally include in API requests. By default, fields with 2392 // empty or default values are omitted from API requests. However, any 2393 // non-pointer, non-interface field appearing in ForceSendFields will be 2394 // sent to the server regardless of whether the field is empty or not. 2395 // This may be used to include empty fields in Patch requests. 2396 ForceSendFields []string `json:"-"` 2397 2398 // NullFields is a list of field names (e.g. "AddStudentIds") to include 2399 // in API requests with the JSON null value. By default, fields with 2400 // empty values are omitted from API requests. However, any field with 2401 // an empty value appearing in NullFields will be sent to the server as 2402 // null. It is an error if a field in this list has a non-empty value. 2403 // This may be used to include null fields in Patch requests. 2404 NullFields []string `json:"-"` 2405} 2406 2407func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) { 2408 type NoMethod ModifyIndividualStudentsOptions 2409 raw := NoMethod(*s) 2410 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2411} 2412 2413// MultipleChoiceQuestion: Additional details for multiple-choice 2414// questions. 2415type MultipleChoiceQuestion struct { 2416 // Choices: Possible choices. 2417 Choices []string `json:"choices,omitempty"` 2418 2419 // ForceSendFields is a list of field names (e.g. "Choices") to 2420 // unconditionally include in API requests. By default, fields with 2421 // empty or default values are omitted from API requests. However, any 2422 // non-pointer, non-interface field appearing in ForceSendFields will be 2423 // sent to the server regardless of whether the field is empty or not. 2424 // This may be used to include empty fields in Patch requests. 2425 ForceSendFields []string `json:"-"` 2426 2427 // NullFields is a list of field names (e.g. "Choices") to include in 2428 // API requests with the JSON null value. By default, fields with empty 2429 // values are omitted from API requests. However, any field with an 2430 // empty value appearing in NullFields will be sent to the server as 2431 // null. It is an error if a field in this list has a non-empty value. 2432 // This may be used to include null fields in Patch requests. 2433 NullFields []string `json:"-"` 2434} 2435 2436func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) { 2437 type NoMethod MultipleChoiceQuestion 2438 raw := NoMethod(*s) 2439 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2440} 2441 2442// MultipleChoiceSubmission: Student work for a multiple-choice 2443// question. 2444type MultipleChoiceSubmission struct { 2445 // Answer: Student's select choice. 2446 Answer string `json:"answer,omitempty"` 2447 2448 // ForceSendFields is a list of field names (e.g. "Answer") to 2449 // unconditionally include in API requests. By default, fields with 2450 // empty or default values are omitted from API requests. However, any 2451 // non-pointer, non-interface field appearing in ForceSendFields will be 2452 // sent to the server regardless of whether the field is empty or not. 2453 // This may be used to include empty fields in Patch requests. 2454 ForceSendFields []string `json:"-"` 2455 2456 // NullFields is a list of field names (e.g. "Answer") to include in API 2457 // requests with the JSON null value. By default, fields with empty 2458 // values are omitted from API requests. However, any field with an 2459 // empty value appearing in NullFields will be sent to the server as 2460 // null. It is an error if a field in this list has a non-empty value. 2461 // This may be used to include null fields in Patch requests. 2462 NullFields []string `json:"-"` 2463} 2464 2465func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) { 2466 type NoMethod MultipleChoiceSubmission 2467 raw := NoMethod(*s) 2468 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2469} 2470 2471// Name: Details of the user's name. 2472type Name struct { 2473 // FamilyName: The user's last name. Read-only. 2474 FamilyName string `json:"familyName,omitempty"` 2475 2476 // FullName: The user's full name formed by concatenating the first and 2477 // last name values. Read-only. 2478 FullName string `json:"fullName,omitempty"` 2479 2480 // GivenName: The user's first name. Read-only. 2481 GivenName string `json:"givenName,omitempty"` 2482 2483 // ForceSendFields is a list of field names (e.g. "FamilyName") to 2484 // unconditionally include in API requests. By default, fields with 2485 // empty or default values are omitted from API requests. However, any 2486 // non-pointer, non-interface field appearing in ForceSendFields will be 2487 // sent to the server regardless of whether the field is empty or not. 2488 // This may be used to include empty fields in Patch requests. 2489 ForceSendFields []string `json:"-"` 2490 2491 // NullFields is a list of field names (e.g. "FamilyName") to include in 2492 // API requests with the JSON null value. By default, fields with empty 2493 // values are omitted from API requests. However, any field with an 2494 // empty value appearing in NullFields will be sent to the server as 2495 // null. It is an error if a field in this list has a non-empty value. 2496 // This may be used to include null fields in Patch requests. 2497 NullFields []string `json:"-"` 2498} 2499 2500func (s *Name) MarshalJSON() ([]byte, error) { 2501 type NoMethod Name 2502 raw := NoMethod(*s) 2503 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2504} 2505 2506// ReclaimStudentSubmissionRequest: Request to reclaim a student 2507// submission. 2508type ReclaimStudentSubmissionRequest struct { 2509} 2510 2511// Registration: An instruction to Classroom to send notifications from 2512// the `feed` to the provided destination. 2513type Registration struct { 2514 // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to 2515 // be sent to. 2516 CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"` 2517 2518 // ExpiryTime: The time until which the `Registration` is effective. 2519 // This is a read-only field assigned by the server. 2520 ExpiryTime string `json:"expiryTime,omitempty"` 2521 2522 // Feed: Specification for the class of notifications that Classroom 2523 // should deliver to the destination. 2524 Feed *Feed `json:"feed,omitempty"` 2525 2526 // RegistrationId: A server-generated unique identifier for this 2527 // `Registration`. Read-only. 2528 RegistrationId string `json:"registrationId,omitempty"` 2529 2530 // ServerResponse contains the HTTP response code and headers from the 2531 // server. 2532 googleapi.ServerResponse `json:"-"` 2533 2534 // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to 2535 // unconditionally include in API requests. By default, fields with 2536 // empty or default values are omitted from API requests. However, any 2537 // non-pointer, non-interface field appearing in ForceSendFields will be 2538 // sent to the server regardless of whether the field is empty or not. 2539 // This may be used to include empty fields in Patch requests. 2540 ForceSendFields []string `json:"-"` 2541 2542 // NullFields is a list of field names (e.g. "CloudPubsubTopic") to 2543 // include in API requests with the JSON null value. By default, fields 2544 // with empty values are omitted from API requests. However, any field 2545 // with an empty value appearing in NullFields will be sent to the 2546 // server as null. It is an error if a field in this list has a 2547 // non-empty value. This may be used to include null fields in Patch 2548 // requests. 2549 NullFields []string `json:"-"` 2550} 2551 2552func (s *Registration) MarshalJSON() ([]byte, error) { 2553 type NoMethod Registration 2554 raw := NoMethod(*s) 2555 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2556} 2557 2558// ReturnStudentSubmissionRequest: Request to return a student 2559// submission. 2560type ReturnStudentSubmissionRequest struct { 2561} 2562 2563// SharedDriveFile: Drive file that is used as material for course work. 2564type SharedDriveFile struct { 2565 // DriveFile: Drive file details. 2566 DriveFile *DriveFile `json:"driveFile,omitempty"` 2567 2568 // ShareMode: Mechanism by which students access the Drive item. 2569 // 2570 // Possible values: 2571 // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never 2572 // be returned. 2573 // "VIEW" - Students can view the shared file. 2574 // "EDIT" - Students can edit the shared file. 2575 // "STUDENT_COPY" - Students have a personal copy of the shared file. 2576 ShareMode string `json:"shareMode,omitempty"` 2577 2578 // ForceSendFields is a list of field names (e.g. "DriveFile") to 2579 // unconditionally include in API requests. By default, fields with 2580 // empty or default values are omitted from API requests. However, any 2581 // non-pointer, non-interface field appearing in ForceSendFields will be 2582 // sent to the server regardless of whether the field is empty or not. 2583 // This may be used to include empty fields in Patch requests. 2584 ForceSendFields []string `json:"-"` 2585 2586 // NullFields is a list of field names (e.g. "DriveFile") to include in 2587 // API requests with the JSON null value. By default, fields with empty 2588 // values are omitted from API requests. However, any field with an 2589 // empty value appearing in NullFields will be sent to the server as 2590 // null. It is an error if a field in this list has a non-empty value. 2591 // This may be used to include null fields in Patch requests. 2592 NullFields []string `json:"-"` 2593} 2594 2595func (s *SharedDriveFile) MarshalJSON() ([]byte, error) { 2596 type NoMethod SharedDriveFile 2597 raw := NoMethod(*s) 2598 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2599} 2600 2601// ShortAnswerSubmission: Student work for a short answer question. 2602type ShortAnswerSubmission struct { 2603 // Answer: Student response to a short-answer question. 2604 Answer string `json:"answer,omitempty"` 2605 2606 // ForceSendFields is a list of field names (e.g. "Answer") to 2607 // unconditionally include in API requests. By default, fields with 2608 // empty or default values are omitted from API requests. However, any 2609 // non-pointer, non-interface field appearing in ForceSendFields will be 2610 // sent to the server regardless of whether the field is empty or not. 2611 // This may be used to include empty fields in Patch requests. 2612 ForceSendFields []string `json:"-"` 2613 2614 // NullFields is a list of field names (e.g. "Answer") to include in API 2615 // requests with the JSON null value. By default, fields with empty 2616 // values are omitted from API requests. However, any field with an 2617 // empty value appearing in NullFields will be sent to the server as 2618 // null. It is an error if a field in this list has a non-empty value. 2619 // This may be used to include null fields in Patch requests. 2620 NullFields []string `json:"-"` 2621} 2622 2623func (s *ShortAnswerSubmission) MarshalJSON() ([]byte, error) { 2624 type NoMethod ShortAnswerSubmission 2625 raw := NoMethod(*s) 2626 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2627} 2628 2629// StateHistory: The history of each state this submission has been in. 2630type StateHistory struct { 2631 // ActorUserId: The teacher or student who made the change. 2632 ActorUserId string `json:"actorUserId,omitempty"` 2633 2634 // State: The workflow pipeline stage. 2635 // 2636 // Possible values: 2637 // "STATE_UNSPECIFIED" - No state specified. This should never be 2638 // returned. 2639 // "CREATED" - The Submission has been created. 2640 // "TURNED_IN" - The student has turned in an assigned document, which 2641 // may or may not be a template. 2642 // "RETURNED" - The teacher has returned the assigned document to the 2643 // student. 2644 // "RECLAIMED_BY_STUDENT" - The student turned in the assigned 2645 // document, and then chose to "unsubmit" the assignment, giving the 2646 // student control again as the owner. 2647 // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their 2648 // submission after turning it in. Currently, only used by Questions, 2649 // when the student edits their answer. 2650 State string `json:"state,omitempty"` 2651 2652 // StateTimestamp: When the submission entered this state. 2653 StateTimestamp string `json:"stateTimestamp,omitempty"` 2654 2655 // ForceSendFields is a list of field names (e.g. "ActorUserId") to 2656 // unconditionally include in API requests. By default, fields with 2657 // empty or default values are omitted from API requests. However, any 2658 // non-pointer, non-interface field appearing in ForceSendFields will be 2659 // sent to the server regardless of whether the field is empty or not. 2660 // This may be used to include empty fields in Patch requests. 2661 ForceSendFields []string `json:"-"` 2662 2663 // NullFields is a list of field names (e.g. "ActorUserId") to include 2664 // in API requests with the JSON null value. By default, fields with 2665 // empty values are omitted from API requests. However, any field with 2666 // an empty value appearing in NullFields will be sent to the server as 2667 // null. It is an error if a field in this list has a non-empty value. 2668 // This may be used to include null fields in Patch requests. 2669 NullFields []string `json:"-"` 2670} 2671 2672func (s *StateHistory) MarshalJSON() ([]byte, error) { 2673 type NoMethod StateHistory 2674 raw := NoMethod(*s) 2675 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2676} 2677 2678// Student: Student in a course. 2679type Student struct { 2680 // CourseId: Identifier of the course. Read-only. 2681 CourseId string `json:"courseId,omitempty"` 2682 2683 // Profile: Global user information for the student. Read-only. 2684 Profile *UserProfile `json:"profile,omitempty"` 2685 2686 // StudentWorkFolder: Information about a Drive Folder for this 2687 // student's work in this course. Only visible to the student and domain 2688 // administrators. Read-only. 2689 StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"` 2690 2691 // UserId: Identifier of the user. When specified as a parameter of a 2692 // request, this identifier can be one of the following: * the numeric 2693 // identifier for the user * the email address of the user * the string 2694 // literal "me", indicating the requesting user 2695 UserId string `json:"userId,omitempty"` 2696 2697 // ServerResponse contains the HTTP response code and headers from the 2698 // server. 2699 googleapi.ServerResponse `json:"-"` 2700 2701 // ForceSendFields is a list of field names (e.g. "CourseId") to 2702 // unconditionally include in API requests. By default, fields with 2703 // empty or default values are omitted from API requests. However, any 2704 // non-pointer, non-interface field appearing in ForceSendFields will be 2705 // sent to the server regardless of whether the field is empty or not. 2706 // This may be used to include empty fields in Patch requests. 2707 ForceSendFields []string `json:"-"` 2708 2709 // NullFields is a list of field names (e.g. "CourseId") to include in 2710 // API requests with the JSON null value. By default, fields with empty 2711 // values are omitted from API requests. However, any field with an 2712 // empty value appearing in NullFields will be sent to the server as 2713 // null. It is an error if a field in this list has a non-empty value. 2714 // This may be used to include null fields in Patch requests. 2715 NullFields []string `json:"-"` 2716} 2717 2718func (s *Student) MarshalJSON() ([]byte, error) { 2719 type NoMethod Student 2720 raw := NoMethod(*s) 2721 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2722} 2723 2724// StudentSubmission: Student submission for course work. 2725// StudentSubmission items are generated when a CourseWork item is 2726// created. StudentSubmissions that have never been accessed (i.e. with 2727// `state` = NEW) may not have a creation time or update time. 2728type StudentSubmission struct { 2729 // AlternateLink: Absolute link to the submission in the Classroom web 2730 // UI. Read-only. 2731 AlternateLink string `json:"alternateLink,omitempty"` 2732 2733 // AssignedGrade: Optional grade. If unset, no grade was set. This value 2734 // must be non-negative. Decimal (that is, non-integer) values are 2735 // allowed, but are rounded to two decimal places. This may be modified 2736 // only by course teachers. 2737 AssignedGrade float64 `json:"assignedGrade,omitempty"` 2738 2739 // AssignmentSubmission: Submission content when course_work_type is 2740 // ASSIGNMENT. Students can modify this content using ModifyAttachments. 2741 AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"` 2742 2743 // AssociatedWithDeveloper: Whether this student submission is 2744 // associated with the Developer Console project making the request. See 2745 // CreateCourseWork for more details. Read-only. 2746 AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"` 2747 2748 // CourseId: Identifier of the course. Read-only. 2749 CourseId string `json:"courseId,omitempty"` 2750 2751 // CourseWorkId: Identifier for the course work this corresponds to. 2752 // Read-only. 2753 CourseWorkId string `json:"courseWorkId,omitempty"` 2754 2755 // CourseWorkType: Type of course work this submission is for. 2756 // Read-only. 2757 // 2758 // Possible values: 2759 // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is 2760 // never returned. 2761 // "ASSIGNMENT" - An assignment. 2762 // "SHORT_ANSWER_QUESTION" - A short answer question. 2763 // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question. 2764 CourseWorkType string `json:"courseWorkType,omitempty"` 2765 2766 // CreationTime: Creation time of this submission. This may be unset if 2767 // the student has not accessed this item. Read-only. 2768 CreationTime string `json:"creationTime,omitempty"` 2769 2770 // DraftGrade: Optional pending grade. If unset, no grade was set. This 2771 // value must be non-negative. Decimal (that is, non-integer) values are 2772 // allowed, but are rounded to two decimal places. This is only visible 2773 // to and modifiable by course teachers. 2774 DraftGrade float64 `json:"draftGrade,omitempty"` 2775 2776 // Id: Classroom-assigned Identifier for the student submission. This is 2777 // unique among submissions for the relevant course work. Read-only. 2778 Id string `json:"id,omitempty"` 2779 2780 // Late: Whether this submission is late. Read-only. 2781 Late bool `json:"late,omitempty"` 2782 2783 // MultipleChoiceSubmission: Submission content when course_work_type is 2784 // MULTIPLE_CHOICE_QUESTION. 2785 MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"` 2786 2787 // ShortAnswerSubmission: Submission content when course_work_type is 2788 // SHORT_ANSWER_QUESTION. 2789 ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"` 2790 2791 // State: State of this submission. Read-only. 2792 // 2793 // Possible values: 2794 // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 2795 // never be returned. 2796 // "NEW" - The student has never accessed this submission. Attachments 2797 // are not returned and timestamps is not set. 2798 // "CREATED" - Has been created. 2799 // "TURNED_IN" - Has been turned in to the teacher. 2800 // "RETURNED" - Has been returned to the student. 2801 // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 2802 // assignment. 2803 State string `json:"state,omitempty"` 2804 2805 // SubmissionHistory: The history of the submission (includes state and 2806 // grade histories). Read-only. 2807 SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"` 2808 2809 // UpdateTime: Last update time of this submission. This may be unset if 2810 // the student has not accessed this item. Read-only. 2811 UpdateTime string `json:"updateTime,omitempty"` 2812 2813 // UserId: Identifier for the student that owns this submission. 2814 // Read-only. 2815 UserId string `json:"userId,omitempty"` 2816 2817 // ServerResponse contains the HTTP response code and headers from the 2818 // server. 2819 googleapi.ServerResponse `json:"-"` 2820 2821 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 2822 // unconditionally include in API requests. By default, fields with 2823 // empty or default values are omitted from API requests. However, any 2824 // non-pointer, non-interface field appearing in ForceSendFields will be 2825 // sent to the server regardless of whether the field is empty or not. 2826 // This may be used to include empty fields in Patch requests. 2827 ForceSendFields []string `json:"-"` 2828 2829 // NullFields is a list of field names (e.g. "AlternateLink") to include 2830 // in API requests with the JSON null value. By default, fields with 2831 // empty values are omitted from API requests. However, any field with 2832 // an empty value appearing in NullFields will be sent to the server as 2833 // null. It is an error if a field in this list has a non-empty value. 2834 // This may be used to include null fields in Patch requests. 2835 NullFields []string `json:"-"` 2836} 2837 2838func (s *StudentSubmission) MarshalJSON() ([]byte, error) { 2839 type NoMethod StudentSubmission 2840 raw := NoMethod(*s) 2841 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2842} 2843 2844func (s *StudentSubmission) UnmarshalJSON(data []byte) error { 2845 type NoMethod StudentSubmission 2846 var s1 struct { 2847 AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"` 2848 DraftGrade gensupport.JSONFloat64 `json:"draftGrade"` 2849 *NoMethod 2850 } 2851 s1.NoMethod = (*NoMethod)(s) 2852 if err := json.Unmarshal(data, &s1); err != nil { 2853 return err 2854 } 2855 s.AssignedGrade = float64(s1.AssignedGrade) 2856 s.DraftGrade = float64(s1.DraftGrade) 2857 return nil 2858} 2859 2860// SubmissionHistory: The history of the submission. This currently 2861// includes state and grade histories. 2862type SubmissionHistory struct { 2863 // GradeHistory: The grade history information of the submission, if 2864 // present. 2865 GradeHistory *GradeHistory `json:"gradeHistory,omitempty"` 2866 2867 // StateHistory: The state history information of the submission, if 2868 // present. 2869 StateHistory *StateHistory `json:"stateHistory,omitempty"` 2870 2871 // ForceSendFields is a list of field names (e.g. "GradeHistory") to 2872 // unconditionally include in API requests. By default, fields with 2873 // empty or default values are omitted from API requests. However, any 2874 // non-pointer, non-interface field appearing in ForceSendFields will be 2875 // sent to the server regardless of whether the field is empty or not. 2876 // This may be used to include empty fields in Patch requests. 2877 ForceSendFields []string `json:"-"` 2878 2879 // NullFields is a list of field names (e.g. "GradeHistory") to include 2880 // in API requests with the JSON null value. By default, fields with 2881 // empty values are omitted from API requests. However, any field with 2882 // an empty value appearing in NullFields will be sent to the server as 2883 // null. It is an error if a field in this list has a non-empty value. 2884 // This may be used to include null fields in Patch requests. 2885 NullFields []string `json:"-"` 2886} 2887 2888func (s *SubmissionHistory) MarshalJSON() ([]byte, error) { 2889 type NoMethod SubmissionHistory 2890 raw := NoMethod(*s) 2891 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2892} 2893 2894// Teacher: Teacher of a course. 2895type Teacher struct { 2896 // CourseId: Identifier of the course. Read-only. 2897 CourseId string `json:"courseId,omitempty"` 2898 2899 // Profile: Global user information for the teacher. Read-only. 2900 Profile *UserProfile `json:"profile,omitempty"` 2901 2902 // UserId: Identifier of the user. When specified as a parameter of a 2903 // request, this identifier can be one of the following: * the numeric 2904 // identifier for the user * the email address of the user * the string 2905 // literal "me", indicating the requesting user 2906 UserId string `json:"userId,omitempty"` 2907 2908 // ServerResponse contains the HTTP response code and headers from the 2909 // server. 2910 googleapi.ServerResponse `json:"-"` 2911 2912 // ForceSendFields is a list of field names (e.g. "CourseId") to 2913 // unconditionally include in API requests. By default, fields with 2914 // empty or default values are omitted from API requests. However, any 2915 // non-pointer, non-interface field appearing in ForceSendFields will be 2916 // sent to the server regardless of whether the field is empty or not. 2917 // This may be used to include empty fields in Patch requests. 2918 ForceSendFields []string `json:"-"` 2919 2920 // NullFields is a list of field names (e.g. "CourseId") to include in 2921 // API requests with the JSON null value. By default, fields with empty 2922 // values are omitted from API requests. However, any field with an 2923 // empty value appearing in NullFields will be sent to the server as 2924 // null. It is an error if a field in this list has a non-empty value. 2925 // This may be used to include null fields in Patch requests. 2926 NullFields []string `json:"-"` 2927} 2928 2929func (s *Teacher) MarshalJSON() ([]byte, error) { 2930 type NoMethod Teacher 2931 raw := NoMethod(*s) 2932 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2933} 2934 2935// TimeOfDay: Represents a time of day. The date and time zone are 2936// either not significant or are specified elsewhere. An API may choose 2937// to allow leap seconds. Related types are google.type.Date and 2938// `google.protobuf.Timestamp`. 2939type TimeOfDay struct { 2940 // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API 2941 // may choose to allow the value "24:00:00" for scenarios like business 2942 // closing time. 2943 Hours int64 `json:"hours,omitempty"` 2944 2945 // Minutes: Minutes of hour of day. Must be from 0 to 59. 2946 Minutes int64 `json:"minutes,omitempty"` 2947 2948 // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to 2949 // 999,999,999. 2950 Nanos int64 `json:"nanos,omitempty"` 2951 2952 // Seconds: Seconds of minutes of the time. Must normally be from 0 to 2953 // 59. An API may allow the value 60 if it allows leap-seconds. 2954 Seconds int64 `json:"seconds,omitempty"` 2955 2956 // ForceSendFields is a list of field names (e.g. "Hours") to 2957 // unconditionally include in API requests. By default, fields with 2958 // empty or default values are omitted from API requests. However, any 2959 // non-pointer, non-interface field appearing in ForceSendFields will be 2960 // sent to the server regardless of whether the field is empty or not. 2961 // This may be used to include empty fields in Patch requests. 2962 ForceSendFields []string `json:"-"` 2963 2964 // NullFields is a list of field names (e.g. "Hours") to include in API 2965 // requests with the JSON null value. By default, fields with empty 2966 // values are omitted from API requests. However, any field with an 2967 // empty value appearing in NullFields will be sent to the server as 2968 // null. It is an error if a field in this list has a non-empty value. 2969 // This may be used to include null fields in Patch requests. 2970 NullFields []string `json:"-"` 2971} 2972 2973func (s *TimeOfDay) MarshalJSON() ([]byte, error) { 2974 type NoMethod TimeOfDay 2975 raw := NoMethod(*s) 2976 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2977} 2978 2979// Topic: Topic created by a teacher for the course 2980type Topic struct { 2981 // CourseId: Identifier of the course. Read-only. 2982 CourseId string `json:"courseId,omitempty"` 2983 2984 // Name: The name of the topic, generated by the user. Leading and 2985 // trailing whitespaces, if any, are trimmed. Also, multiple consecutive 2986 // whitespaces are collapsed into one inside the name. The result must 2987 // be a non-empty string. Topic names are case sensitive, and must be no 2988 // longer than 100 characters. 2989 Name string `json:"name,omitempty"` 2990 2991 // TopicId: Unique identifier for the topic. Read-only. 2992 TopicId string `json:"topicId,omitempty"` 2993 2994 // UpdateTime: The time the topic was last updated by the system. 2995 // Read-only. 2996 UpdateTime string `json:"updateTime,omitempty"` 2997 2998 // ServerResponse contains the HTTP response code and headers from the 2999 // server. 3000 googleapi.ServerResponse `json:"-"` 3001 3002 // ForceSendFields is a list of field names (e.g. "CourseId") to 3003 // unconditionally include in API requests. By default, fields with 3004 // empty or default values are omitted from API requests. However, any 3005 // non-pointer, non-interface field appearing in ForceSendFields will be 3006 // sent to the server regardless of whether the field is empty or not. 3007 // This may be used to include empty fields in Patch requests. 3008 ForceSendFields []string `json:"-"` 3009 3010 // NullFields is a list of field names (e.g. "CourseId") to include in 3011 // API requests with the JSON null value. By default, fields with empty 3012 // values are omitted from API requests. However, any field with an 3013 // empty value appearing in NullFields will be sent to the server as 3014 // null. It is an error if a field in this list has a non-empty value. 3015 // This may be used to include null fields in Patch requests. 3016 NullFields []string `json:"-"` 3017} 3018 3019func (s *Topic) MarshalJSON() ([]byte, error) { 3020 type NoMethod Topic 3021 raw := NoMethod(*s) 3022 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3023} 3024 3025// TurnInStudentSubmissionRequest: Request to turn in a student 3026// submission. 3027type TurnInStudentSubmissionRequest struct { 3028} 3029 3030// UserProfile: Global information for a user. 3031type UserProfile struct { 3032 // EmailAddress: Email address of the user. Read-only. 3033 EmailAddress string `json:"emailAddress,omitempty"` 3034 3035 // Id: Identifier of the user. Read-only. 3036 Id string `json:"id,omitempty"` 3037 3038 // Name: Name of the user. Read-only. 3039 Name *Name `json:"name,omitempty"` 3040 3041 // Permissions: Global permissions of the user. Read-only. 3042 Permissions []*GlobalPermission `json:"permissions,omitempty"` 3043 3044 // PhotoUrl: URL of user's profile photo. Read-only. 3045 PhotoUrl string `json:"photoUrl,omitempty"` 3046 3047 // VerifiedTeacher: Represents whether a G Suite for Education user's 3048 // domain administrator has explicitly verified them as being a teacher. 3049 // If the user is not a member of a G Suite for Education domain, than 3050 // this field is always false. Read-only 3051 VerifiedTeacher bool `json:"verifiedTeacher,omitempty"` 3052 3053 // ServerResponse contains the HTTP response code and headers from the 3054 // server. 3055 googleapi.ServerResponse `json:"-"` 3056 3057 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 3058 // unconditionally include in API requests. By default, fields with 3059 // empty or default values are omitted from API requests. However, any 3060 // non-pointer, non-interface field appearing in ForceSendFields will be 3061 // sent to the server regardless of whether the field is empty or not. 3062 // This may be used to include empty fields in Patch requests. 3063 ForceSendFields []string `json:"-"` 3064 3065 // NullFields is a list of field names (e.g. "EmailAddress") to include 3066 // in API requests with the JSON null value. By default, fields with 3067 // empty values are omitted from API requests. However, any field with 3068 // an empty value appearing in NullFields will be sent to the server as 3069 // null. It is an error if a field in this list has a non-empty value. 3070 // This may be used to include null fields in Patch requests. 3071 NullFields []string `json:"-"` 3072} 3073 3074func (s *UserProfile) MarshalJSON() ([]byte, error) { 3075 type NoMethod UserProfile 3076 raw := NoMethod(*s) 3077 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3078} 3079 3080// YouTubeVideo: YouTube video item. 3081type YouTubeVideo struct { 3082 // AlternateLink: URL that can be used to view the YouTube video. 3083 // Read-only. 3084 AlternateLink string `json:"alternateLink,omitempty"` 3085 3086 // Id: YouTube API resource ID. 3087 Id string `json:"id,omitempty"` 3088 3089 // ThumbnailUrl: URL of a thumbnail image of the YouTube video. 3090 // Read-only. 3091 ThumbnailUrl string `json:"thumbnailUrl,omitempty"` 3092 3093 // Title: Title of the YouTube video. Read-only. 3094 Title string `json:"title,omitempty"` 3095 3096 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 3097 // unconditionally include in API requests. By default, fields with 3098 // empty or default values are omitted from API requests. However, any 3099 // non-pointer, non-interface field appearing in ForceSendFields will be 3100 // sent to the server regardless of whether the field is empty or not. 3101 // This may be used to include empty fields in Patch requests. 3102 ForceSendFields []string `json:"-"` 3103 3104 // NullFields is a list of field names (e.g. "AlternateLink") to include 3105 // in API requests with the JSON null value. By default, fields with 3106 // empty values are omitted from API requests. However, any field with 3107 // an empty value appearing in NullFields will be sent to the server as 3108 // null. It is an error if a field in this list has a non-empty value. 3109 // This may be used to include null fields in Patch requests. 3110 NullFields []string `json:"-"` 3111} 3112 3113func (s *YouTubeVideo) MarshalJSON() ([]byte, error) { 3114 type NoMethod YouTubeVideo 3115 raw := NoMethod(*s) 3116 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3117} 3118 3119// method id "classroom.courses.create": 3120 3121type CoursesCreateCall struct { 3122 s *Service 3123 course *Course 3124 urlParams_ gensupport.URLParams 3125 ctx_ context.Context 3126 header_ http.Header 3127} 3128 3129// Create: Creates a course. The user specified in `ownerId` is the 3130// owner of the created course and added as a teacher. This method 3131// returns the following error codes: * `PERMISSION_DENIED` if the 3132// requesting user is not permitted to create courses or for access 3133// errors. * `NOT_FOUND` if the primary teacher is not a valid user. * 3134// `FAILED_PRECONDITION` if the course owner's account is disabled or 3135// for the following request errors: * UserGroupsMembershipLimitReached 3136// * `ALREADY_EXISTS` if an alias was specified in the `id` and already 3137// exists. 3138func (r *CoursesService) Create(course *Course) *CoursesCreateCall { 3139 c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3140 c.course = course 3141 return c 3142} 3143 3144// Fields allows partial responses to be retrieved. See 3145// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3146// for more information. 3147func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall { 3148 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3149 return c 3150} 3151 3152// Context sets the context to be used in this call's Do method. Any 3153// pending HTTP request will be aborted if the provided context is 3154// canceled. 3155func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall { 3156 c.ctx_ = ctx 3157 return c 3158} 3159 3160// Header returns an http.Header that can be modified by the caller to 3161// add HTTP headers to the request. 3162func (c *CoursesCreateCall) Header() http.Header { 3163 if c.header_ == nil { 3164 c.header_ = make(http.Header) 3165 } 3166 return c.header_ 3167} 3168 3169func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) { 3170 reqHeaders := make(http.Header) 3171 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3172 for k, v := range c.header_ { 3173 reqHeaders[k] = v 3174 } 3175 reqHeaders.Set("User-Agent", c.s.userAgent()) 3176 var body io.Reader = nil 3177 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3178 if err != nil { 3179 return nil, err 3180 } 3181 reqHeaders.Set("Content-Type", "application/json") 3182 c.urlParams_.Set("alt", alt) 3183 c.urlParams_.Set("prettyPrint", "false") 3184 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3185 urls += "?" + c.urlParams_.Encode() 3186 req, err := http.NewRequest("POST", urls, body) 3187 if err != nil { 3188 return nil, err 3189 } 3190 req.Header = reqHeaders 3191 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3192} 3193 3194// Do executes the "classroom.courses.create" call. 3195// Exactly one of *Course or error will be non-nil. Any non-2xx status 3196// code is an error. Response headers are in either 3197// *Course.ServerResponse.Header or (if a response was returned at all) 3198// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3199// check whether the returned error was because http.StatusNotModified 3200// was returned. 3201func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3202 gensupport.SetOptions(c.urlParams_, opts...) 3203 res, err := c.doRequest("json") 3204 if res != nil && res.StatusCode == http.StatusNotModified { 3205 if res.Body != nil { 3206 res.Body.Close() 3207 } 3208 return nil, &googleapi.Error{ 3209 Code: res.StatusCode, 3210 Header: res.Header, 3211 } 3212 } 3213 if err != nil { 3214 return nil, err 3215 } 3216 defer googleapi.CloseBody(res) 3217 if err := googleapi.CheckResponse(res); err != nil { 3218 return nil, err 3219 } 3220 ret := &Course{ 3221 ServerResponse: googleapi.ServerResponse{ 3222 Header: res.Header, 3223 HTTPStatusCode: res.StatusCode, 3224 }, 3225 } 3226 target := &ret 3227 if err := gensupport.DecodeResponse(target, res); err != nil { 3228 return nil, err 3229 } 3230 return ret, nil 3231 // { 3232 // "description": "Creates a course. The user specified in `ownerId` is the owner of the created course and added as a teacher. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create courses or for access errors. * `NOT_FOUND` if the primary teacher is not a valid user. * `FAILED_PRECONDITION` if the course owner's account is disabled or for the following request errors: * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if an alias was specified in the `id` and already exists.", 3233 // "flatPath": "v1/courses", 3234 // "httpMethod": "POST", 3235 // "id": "classroom.courses.create", 3236 // "parameterOrder": [], 3237 // "parameters": {}, 3238 // "path": "v1/courses", 3239 // "request": { 3240 // "$ref": "Course" 3241 // }, 3242 // "response": { 3243 // "$ref": "Course" 3244 // }, 3245 // "scopes": [ 3246 // "https://www.googleapis.com/auth/classroom.courses" 3247 // ] 3248 // } 3249 3250} 3251 3252// method id "classroom.courses.delete": 3253 3254type CoursesDeleteCall struct { 3255 s *Service 3256 id string 3257 urlParams_ gensupport.URLParams 3258 ctx_ context.Context 3259 header_ http.Header 3260} 3261 3262// Delete: Deletes a course. This method returns the following error 3263// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 3264// to delete the requested course or for access errors. * `NOT_FOUND` if 3265// no course exists with the requested ID. 3266// 3267// - id: Identifier of the course to delete. This identifier can be 3268// either the Classroom-assigned identifier or an alias. 3269func (r *CoursesService) Delete(id string) *CoursesDeleteCall { 3270 c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3271 c.id = id 3272 return c 3273} 3274 3275// Fields allows partial responses to be retrieved. See 3276// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3277// for more information. 3278func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall { 3279 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3280 return c 3281} 3282 3283// Context sets the context to be used in this call's Do method. Any 3284// pending HTTP request will be aborted if the provided context is 3285// canceled. 3286func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall { 3287 c.ctx_ = ctx 3288 return c 3289} 3290 3291// Header returns an http.Header that can be modified by the caller to 3292// add HTTP headers to the request. 3293func (c *CoursesDeleteCall) Header() http.Header { 3294 if c.header_ == nil { 3295 c.header_ = make(http.Header) 3296 } 3297 return c.header_ 3298} 3299 3300func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) { 3301 reqHeaders := make(http.Header) 3302 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3303 for k, v := range c.header_ { 3304 reqHeaders[k] = v 3305 } 3306 reqHeaders.Set("User-Agent", c.s.userAgent()) 3307 var body io.Reader = nil 3308 c.urlParams_.Set("alt", alt) 3309 c.urlParams_.Set("prettyPrint", "false") 3310 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3311 urls += "?" + c.urlParams_.Encode() 3312 req, err := http.NewRequest("DELETE", urls, body) 3313 if err != nil { 3314 return nil, err 3315 } 3316 req.Header = reqHeaders 3317 googleapi.Expand(req.URL, map[string]string{ 3318 "id": c.id, 3319 }) 3320 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3321} 3322 3323// Do executes the "classroom.courses.delete" call. 3324// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3325// code is an error. Response headers are in either 3326// *Empty.ServerResponse.Header or (if a response was returned at all) 3327// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3328// check whether the returned error was because http.StatusNotModified 3329// was returned. 3330func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3331 gensupport.SetOptions(c.urlParams_, opts...) 3332 res, err := c.doRequest("json") 3333 if res != nil && res.StatusCode == http.StatusNotModified { 3334 if res.Body != nil { 3335 res.Body.Close() 3336 } 3337 return nil, &googleapi.Error{ 3338 Code: res.StatusCode, 3339 Header: res.Header, 3340 } 3341 } 3342 if err != nil { 3343 return nil, err 3344 } 3345 defer googleapi.CloseBody(res) 3346 if err := googleapi.CheckResponse(res); err != nil { 3347 return nil, err 3348 } 3349 ret := &Empty{ 3350 ServerResponse: googleapi.ServerResponse{ 3351 Header: res.Header, 3352 HTTPStatusCode: res.StatusCode, 3353 }, 3354 } 3355 target := &ret 3356 if err := gensupport.DecodeResponse(target, res); err != nil { 3357 return nil, err 3358 } 3359 return ret, nil 3360 // { 3361 // "description": "Deletes a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID.", 3362 // "flatPath": "v1/courses/{id}", 3363 // "httpMethod": "DELETE", 3364 // "id": "classroom.courses.delete", 3365 // "parameterOrder": [ 3366 // "id" 3367 // ], 3368 // "parameters": { 3369 // "id": { 3370 // "description": "Identifier of the course to delete. This identifier can be either the Classroom-assigned identifier or an alias.", 3371 // "location": "path", 3372 // "required": true, 3373 // "type": "string" 3374 // } 3375 // }, 3376 // "path": "v1/courses/{id}", 3377 // "response": { 3378 // "$ref": "Empty" 3379 // }, 3380 // "scopes": [ 3381 // "https://www.googleapis.com/auth/classroom.courses" 3382 // ] 3383 // } 3384 3385} 3386 3387// method id "classroom.courses.get": 3388 3389type CoursesGetCall struct { 3390 s *Service 3391 id string 3392 urlParams_ gensupport.URLParams 3393 ifNoneMatch_ string 3394 ctx_ context.Context 3395 header_ http.Header 3396} 3397 3398// Get: Returns a course. This method returns the following error codes: 3399// * `PERMISSION_DENIED` if the requesting user is not permitted to 3400// access the requested course or for access errors. * `NOT_FOUND` if no 3401// course exists with the requested ID. 3402// 3403// - id: Identifier of the course to return. This identifier can be 3404// either the Classroom-assigned identifier or an alias. 3405func (r *CoursesService) Get(id string) *CoursesGetCall { 3406 c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3407 c.id = id 3408 return c 3409} 3410 3411// Fields allows partial responses to be retrieved. See 3412// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3413// for more information. 3414func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall { 3415 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3416 return c 3417} 3418 3419// IfNoneMatch sets the optional parameter which makes the operation 3420// fail if the object's ETag matches the given value. This is useful for 3421// getting updates only after the object has changed since the last 3422// request. Use googleapi.IsNotModified to check whether the response 3423// error from Do is the result of In-None-Match. 3424func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall { 3425 c.ifNoneMatch_ = entityTag 3426 return c 3427} 3428 3429// Context sets the context to be used in this call's Do method. Any 3430// pending HTTP request will be aborted if the provided context is 3431// canceled. 3432func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall { 3433 c.ctx_ = ctx 3434 return c 3435} 3436 3437// Header returns an http.Header that can be modified by the caller to 3438// add HTTP headers to the request. 3439func (c *CoursesGetCall) Header() http.Header { 3440 if c.header_ == nil { 3441 c.header_ = make(http.Header) 3442 } 3443 return c.header_ 3444} 3445 3446func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) { 3447 reqHeaders := make(http.Header) 3448 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3449 for k, v := range c.header_ { 3450 reqHeaders[k] = v 3451 } 3452 reqHeaders.Set("User-Agent", c.s.userAgent()) 3453 if c.ifNoneMatch_ != "" { 3454 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3455 } 3456 var body io.Reader = nil 3457 c.urlParams_.Set("alt", alt) 3458 c.urlParams_.Set("prettyPrint", "false") 3459 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3460 urls += "?" + c.urlParams_.Encode() 3461 req, err := http.NewRequest("GET", urls, body) 3462 if err != nil { 3463 return nil, err 3464 } 3465 req.Header = reqHeaders 3466 googleapi.Expand(req.URL, map[string]string{ 3467 "id": c.id, 3468 }) 3469 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3470} 3471 3472// Do executes the "classroom.courses.get" call. 3473// Exactly one of *Course or error will be non-nil. Any non-2xx status 3474// code is an error. Response headers are in either 3475// *Course.ServerResponse.Header or (if a response was returned at all) 3476// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3477// check whether the returned error was because http.StatusNotModified 3478// was returned. 3479func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3480 gensupport.SetOptions(c.urlParams_, opts...) 3481 res, err := c.doRequest("json") 3482 if res != nil && res.StatusCode == http.StatusNotModified { 3483 if res.Body != nil { 3484 res.Body.Close() 3485 } 3486 return nil, &googleapi.Error{ 3487 Code: res.StatusCode, 3488 Header: res.Header, 3489 } 3490 } 3491 if err != nil { 3492 return nil, err 3493 } 3494 defer googleapi.CloseBody(res) 3495 if err := googleapi.CheckResponse(res); err != nil { 3496 return nil, err 3497 } 3498 ret := &Course{ 3499 ServerResponse: googleapi.ServerResponse{ 3500 Header: res.Header, 3501 HTTPStatusCode: res.StatusCode, 3502 }, 3503 } 3504 target := &ret 3505 if err := gensupport.DecodeResponse(target, res); err != nil { 3506 return nil, err 3507 } 3508 return ret, nil 3509 // { 3510 // "description": "Returns a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID.", 3511 // "flatPath": "v1/courses/{id}", 3512 // "httpMethod": "GET", 3513 // "id": "classroom.courses.get", 3514 // "parameterOrder": [ 3515 // "id" 3516 // ], 3517 // "parameters": { 3518 // "id": { 3519 // "description": "Identifier of the course to return. This identifier can be either the Classroom-assigned identifier or an alias.", 3520 // "location": "path", 3521 // "required": true, 3522 // "type": "string" 3523 // } 3524 // }, 3525 // "path": "v1/courses/{id}", 3526 // "response": { 3527 // "$ref": "Course" 3528 // }, 3529 // "scopes": [ 3530 // "https://www.googleapis.com/auth/classroom.courses", 3531 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3532 // ] 3533 // } 3534 3535} 3536 3537// method id "classroom.courses.list": 3538 3539type CoursesListCall struct { 3540 s *Service 3541 urlParams_ gensupport.URLParams 3542 ifNoneMatch_ string 3543 ctx_ context.Context 3544 header_ http.Header 3545} 3546 3547// List: Returns a list of courses that the requesting user is permitted 3548// to view, restricted to those that match the request. Returned courses 3549// are ordered by creation time, with the most recently created coming 3550// first. This method returns the following error codes: * 3551// `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the 3552// query argument is malformed. * `NOT_FOUND` if any users specified in 3553// the query arguments do not exist. 3554func (r *CoursesService) List() *CoursesListCall { 3555 c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3556 return c 3557} 3558 3559// CourseStates sets the optional parameter "courseStates": Restricts 3560// returned courses to those in one of the specified states The default 3561// value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED. 3562// 3563// Possible values: 3564// "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course 3565// message will use this value. 3566// "ACTIVE" - The course is active. 3567// "ARCHIVED" - The course has been archived. You cannot modify it 3568// except to change it to a different state. 3569// "PROVISIONED" - The course has been created, but not yet activated. 3570// It is accessible by the primary teacher and domain administrators, 3571// who may modify it or change it to the `ACTIVE` or `DECLINED` states. 3572// A course may only be changed to `PROVISIONED` if it is in the 3573// `DECLINED` state. 3574// "DECLINED" - The course has been created, but declined. It is 3575// accessible by the course owner and domain administrators, though it 3576// will not be displayed in the web UI. You cannot modify the course 3577// except to change it to the `PROVISIONED` state. A course may only be 3578// changed to `DECLINED` if it is in the `PROVISIONED` state. 3579// "SUSPENDED" - The course has been suspended. You cannot modify the 3580// course, and only the user identified by the `owner_id` can view the 3581// course. A course may be placed in this state if it potentially 3582// violates the Terms of Service. 3583func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall { 3584 c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...)) 3585 return c 3586} 3587 3588// PageSize sets the optional parameter "pageSize": Maximum number of 3589// items to return. Zero or unspecified indicates that the server may 3590// assign a maximum. The server may return fewer than the specified 3591// number of results. 3592func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall { 3593 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3594 return c 3595} 3596 3597// PageToken sets the optional parameter "pageToken": nextPageToken 3598// value returned from a previous list call, indicating that the 3599// subsequent page of results should be returned. The list request must 3600// be otherwise identical to the one that resulted in this token. 3601func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall { 3602 c.urlParams_.Set("pageToken", pageToken) 3603 return c 3604} 3605 3606// StudentId sets the optional parameter "studentId": Restricts returned 3607// courses to those having a student with the specified identifier. The 3608// identifier can be one of the following: * the numeric identifier for 3609// the user * the email address of the user * the string literal "me", 3610// indicating the requesting user 3611func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall { 3612 c.urlParams_.Set("studentId", studentId) 3613 return c 3614} 3615 3616// TeacherId sets the optional parameter "teacherId": Restricts returned 3617// courses to those having a teacher with the specified identifier. The 3618// identifier can be one of the following: * the numeric identifier for 3619// the user * the email address of the user * the string literal "me", 3620// indicating the requesting user 3621func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall { 3622 c.urlParams_.Set("teacherId", teacherId) 3623 return c 3624} 3625 3626// Fields allows partial responses to be retrieved. See 3627// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3628// for more information. 3629func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall { 3630 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3631 return c 3632} 3633 3634// IfNoneMatch sets the optional parameter which makes the operation 3635// fail if the object's ETag matches the given value. This is useful for 3636// getting updates only after the object has changed since the last 3637// request. Use googleapi.IsNotModified to check whether the response 3638// error from Do is the result of In-None-Match. 3639func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall { 3640 c.ifNoneMatch_ = entityTag 3641 return c 3642} 3643 3644// Context sets the context to be used in this call's Do method. Any 3645// pending HTTP request will be aborted if the provided context is 3646// canceled. 3647func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall { 3648 c.ctx_ = ctx 3649 return c 3650} 3651 3652// Header returns an http.Header that can be modified by the caller to 3653// add HTTP headers to the request. 3654func (c *CoursesListCall) Header() http.Header { 3655 if c.header_ == nil { 3656 c.header_ = make(http.Header) 3657 } 3658 return c.header_ 3659} 3660 3661func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) { 3662 reqHeaders := make(http.Header) 3663 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3664 for k, v := range c.header_ { 3665 reqHeaders[k] = v 3666 } 3667 reqHeaders.Set("User-Agent", c.s.userAgent()) 3668 if c.ifNoneMatch_ != "" { 3669 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3670 } 3671 var body io.Reader = nil 3672 c.urlParams_.Set("alt", alt) 3673 c.urlParams_.Set("prettyPrint", "false") 3674 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses") 3675 urls += "?" + c.urlParams_.Encode() 3676 req, err := http.NewRequest("GET", urls, body) 3677 if err != nil { 3678 return nil, err 3679 } 3680 req.Header = reqHeaders 3681 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3682} 3683 3684// Do executes the "classroom.courses.list" call. 3685// Exactly one of *ListCoursesResponse or error will be non-nil. Any 3686// non-2xx status code is an error. Response headers are in either 3687// *ListCoursesResponse.ServerResponse.Header or (if a response was 3688// returned at all) in error.(*googleapi.Error).Header. Use 3689// googleapi.IsNotModified to check whether the returned error was 3690// because http.StatusNotModified was returned. 3691func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) { 3692 gensupport.SetOptions(c.urlParams_, opts...) 3693 res, err := c.doRequest("json") 3694 if res != nil && res.StatusCode == http.StatusNotModified { 3695 if res.Body != nil { 3696 res.Body.Close() 3697 } 3698 return nil, &googleapi.Error{ 3699 Code: res.StatusCode, 3700 Header: res.Header, 3701 } 3702 } 3703 if err != nil { 3704 return nil, err 3705 } 3706 defer googleapi.CloseBody(res) 3707 if err := googleapi.CheckResponse(res); err != nil { 3708 return nil, err 3709 } 3710 ret := &ListCoursesResponse{ 3711 ServerResponse: googleapi.ServerResponse{ 3712 Header: res.Header, 3713 HTTPStatusCode: res.StatusCode, 3714 }, 3715 } 3716 target := &ret 3717 if err := gensupport.DecodeResponse(target, res); err != nil { 3718 return nil, err 3719 } 3720 return ret, nil 3721 // { 3722 // "description": "Returns a list of courses that the requesting user is permitted to view, restricted to those that match the request. Returned courses are ordered by creation time, with the most recently created coming first. This method returns the following error codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the query argument is malformed. * `NOT_FOUND` if any users specified in the query arguments do not exist.", 3723 // "flatPath": "v1/courses", 3724 // "httpMethod": "GET", 3725 // "id": "classroom.courses.list", 3726 // "parameterOrder": [], 3727 // "parameters": { 3728 // "courseStates": { 3729 // "description": "Restricts returned courses to those in one of the specified states The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.", 3730 // "enum": [ 3731 // "COURSE_STATE_UNSPECIFIED", 3732 // "ACTIVE", 3733 // "ARCHIVED", 3734 // "PROVISIONED", 3735 // "DECLINED", 3736 // "SUSPENDED" 3737 // ], 3738 // "enumDescriptions": [ 3739 // "No course state. No returned Course message will use this value.", 3740 // "The course is active.", 3741 // "The course has been archived. You cannot modify it except to change it to a different state.", 3742 // "The course has been created, but not yet activated. It is accessible by the primary teacher and domain administrators, who may modify it or change it to the `ACTIVE` or `DECLINED` states. A course may only be changed to `PROVISIONED` if it is in the `DECLINED` state.", 3743 // "The course has been created, but declined. It is accessible by the course owner and domain administrators, though it will not be displayed in the web UI. You cannot modify the course except to change it to the `PROVISIONED` state. A course may only be changed to `DECLINED` if it is in the `PROVISIONED` state.", 3744 // "The course has been suspended. You cannot modify the course, and only the user identified by the `owner_id` can view the course. A course may be placed in this state if it potentially violates the Terms of Service." 3745 // ], 3746 // "location": "query", 3747 // "repeated": true, 3748 // "type": "string" 3749 // }, 3750 // "pageSize": { 3751 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 3752 // "format": "int32", 3753 // "location": "query", 3754 // "type": "integer" 3755 // }, 3756 // "pageToken": { 3757 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 3758 // "location": "query", 3759 // "type": "string" 3760 // }, 3761 // "studentId": { 3762 // "description": "Restricts returned courses to those having a student with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 3763 // "location": "query", 3764 // "type": "string" 3765 // }, 3766 // "teacherId": { 3767 // "description": "Restricts returned courses to those having a teacher with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 3768 // "location": "query", 3769 // "type": "string" 3770 // } 3771 // }, 3772 // "path": "v1/courses", 3773 // "response": { 3774 // "$ref": "ListCoursesResponse" 3775 // }, 3776 // "scopes": [ 3777 // "https://www.googleapis.com/auth/classroom.courses", 3778 // "https://www.googleapis.com/auth/classroom.courses.readonly" 3779 // ] 3780 // } 3781 3782} 3783 3784// Pages invokes f for each page of results. 3785// A non-nil error returned from f will halt the iteration. 3786// The provided context supersedes any context provided to the Context method. 3787func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error { 3788 c.ctx_ = ctx 3789 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3790 for { 3791 x, err := c.Do() 3792 if err != nil { 3793 return err 3794 } 3795 if err := f(x); err != nil { 3796 return err 3797 } 3798 if x.NextPageToken == "" { 3799 return nil 3800 } 3801 c.PageToken(x.NextPageToken) 3802 } 3803} 3804 3805// method id "classroom.courses.patch": 3806 3807type CoursesPatchCall struct { 3808 s *Service 3809 id string 3810 course *Course 3811 urlParams_ gensupport.URLParams 3812 ctx_ context.Context 3813 header_ http.Header 3814} 3815 3816// Patch: Updates one or more fields in a course. This method returns 3817// the following error codes: * `PERMISSION_DENIED` if the requesting 3818// user is not permitted to modify the requested course or for access 3819// errors. * `NOT_FOUND` if no course exists with the requested ID. * 3820// `INVALID_ARGUMENT` if invalid fields are specified in the update mask 3821// or if no update mask is supplied. * `FAILED_PRECONDITION` for the 3822// following request errors: * CourseNotModifiable 3823// 3824// - id: Identifier of the course to update. This identifier can be 3825// either the Classroom-assigned identifier or an alias. 3826func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall { 3827 c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3828 c.id = id 3829 c.course = course 3830 return c 3831} 3832 3833// UpdateMask sets the optional parameter "updateMask": Mask that 3834// identifies which fields on the course to update. This field is 3835// required to do an update. The update will fail if invalid fields are 3836// specified. The following fields are valid: * `name` * `section` * 3837// `descriptionHeading` * `description` * `room` * `courseState` * 3838// `ownerId` Note: patches to ownerId are treated as being effective 3839// immediately, but in practice it may take some time for the ownership 3840// transfer of all affected resources to complete. When set in a query 3841// parameter, this field should be specified as `updateMask=,,...` 3842func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall { 3843 c.urlParams_.Set("updateMask", updateMask) 3844 return c 3845} 3846 3847// Fields allows partial responses to be retrieved. See 3848// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3849// for more information. 3850func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall { 3851 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3852 return c 3853} 3854 3855// Context sets the context to be used in this call's Do method. Any 3856// pending HTTP request will be aborted if the provided context is 3857// canceled. 3858func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall { 3859 c.ctx_ = ctx 3860 return c 3861} 3862 3863// Header returns an http.Header that can be modified by the caller to 3864// add HTTP headers to the request. 3865func (c *CoursesPatchCall) Header() http.Header { 3866 if c.header_ == nil { 3867 c.header_ = make(http.Header) 3868 } 3869 return c.header_ 3870} 3871 3872func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) { 3873 reqHeaders := make(http.Header) 3874 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3875 for k, v := range c.header_ { 3876 reqHeaders[k] = v 3877 } 3878 reqHeaders.Set("User-Agent", c.s.userAgent()) 3879 var body io.Reader = nil 3880 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 3881 if err != nil { 3882 return nil, err 3883 } 3884 reqHeaders.Set("Content-Type", "application/json") 3885 c.urlParams_.Set("alt", alt) 3886 c.urlParams_.Set("prettyPrint", "false") 3887 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 3888 urls += "?" + c.urlParams_.Encode() 3889 req, err := http.NewRequest("PATCH", urls, body) 3890 if err != nil { 3891 return nil, err 3892 } 3893 req.Header = reqHeaders 3894 googleapi.Expand(req.URL, map[string]string{ 3895 "id": c.id, 3896 }) 3897 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3898} 3899 3900// Do executes the "classroom.courses.patch" call. 3901// Exactly one of *Course or error will be non-nil. Any non-2xx status 3902// code is an error. Response headers are in either 3903// *Course.ServerResponse.Header or (if a response was returned at all) 3904// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3905// check whether the returned error was because http.StatusNotModified 3906// was returned. 3907func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) { 3908 gensupport.SetOptions(c.urlParams_, opts...) 3909 res, err := c.doRequest("json") 3910 if res != nil && res.StatusCode == http.StatusNotModified { 3911 if res.Body != nil { 3912 res.Body.Close() 3913 } 3914 return nil, &googleapi.Error{ 3915 Code: res.StatusCode, 3916 Header: res.Header, 3917 } 3918 } 3919 if err != nil { 3920 return nil, err 3921 } 3922 defer googleapi.CloseBody(res) 3923 if err := googleapi.CheckResponse(res); err != nil { 3924 return nil, err 3925 } 3926 ret := &Course{ 3927 ServerResponse: googleapi.ServerResponse{ 3928 Header: res.Header, 3929 HTTPStatusCode: res.StatusCode, 3930 }, 3931 } 3932 target := &ret 3933 if err := gensupport.DecodeResponse(target, res); err != nil { 3934 return nil, err 3935 } 3936 return ret, nil 3937 // { 3938 // "description": "Updates one or more fields in a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to modify the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID. * `INVALID_ARGUMENT` if invalid fields are specified in the update mask or if no update mask is supplied. * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable", 3939 // "flatPath": "v1/courses/{id}", 3940 // "httpMethod": "PATCH", 3941 // "id": "classroom.courses.patch", 3942 // "parameterOrder": [ 3943 // "id" 3944 // ], 3945 // "parameters": { 3946 // "id": { 3947 // "description": "Identifier of the course to update. This identifier can be either the Classroom-assigned identifier or an alias.", 3948 // "location": "path", 3949 // "required": true, 3950 // "type": "string" 3951 // }, 3952 // "updateMask": { 3953 // "description": "Mask that identifies which fields on the course to update. This field is required to do an update. The update will fail if invalid fields are specified. The following fields are valid: * `name` * `section` * `descriptionHeading` * `description` * `room` * `courseState` * `ownerId` Note: patches to ownerId are treated as being effective immediately, but in practice it may take some time for the ownership transfer of all affected resources to complete. When set in a query parameter, this field should be specified as `updateMask=,,...`", 3954 // "format": "google-fieldmask", 3955 // "location": "query", 3956 // "type": "string" 3957 // } 3958 // }, 3959 // "path": "v1/courses/{id}", 3960 // "request": { 3961 // "$ref": "Course" 3962 // }, 3963 // "response": { 3964 // "$ref": "Course" 3965 // }, 3966 // "scopes": [ 3967 // "https://www.googleapis.com/auth/classroom.courses" 3968 // ] 3969 // } 3970 3971} 3972 3973// method id "classroom.courses.update": 3974 3975type CoursesUpdateCall struct { 3976 s *Service 3977 id string 3978 course *Course 3979 urlParams_ gensupport.URLParams 3980 ctx_ context.Context 3981 header_ http.Header 3982} 3983 3984// Update: Updates a course. This method returns the following error 3985// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 3986// to modify the requested course or for access errors. * `NOT_FOUND` if 3987// no course exists with the requested ID. * `FAILED_PRECONDITION` for 3988// the following request errors: * CourseNotModifiable 3989// 3990// - id: Identifier of the course to update. This identifier can be 3991// either the Classroom-assigned identifier or an alias. 3992func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall { 3993 c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3994 c.id = id 3995 c.course = course 3996 return c 3997} 3998 3999// Fields allows partial responses to be retrieved. See 4000// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4001// for more information. 4002func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall { 4003 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4004 return c 4005} 4006 4007// Context sets the context to be used in this call's Do method. Any 4008// pending HTTP request will be aborted if the provided context is 4009// canceled. 4010func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall { 4011 c.ctx_ = ctx 4012 return c 4013} 4014 4015// Header returns an http.Header that can be modified by the caller to 4016// add HTTP headers to the request. 4017func (c *CoursesUpdateCall) Header() http.Header { 4018 if c.header_ == nil { 4019 c.header_ = make(http.Header) 4020 } 4021 return c.header_ 4022} 4023 4024func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) { 4025 reqHeaders := make(http.Header) 4026 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4027 for k, v := range c.header_ { 4028 reqHeaders[k] = v 4029 } 4030 reqHeaders.Set("User-Agent", c.s.userAgent()) 4031 var body io.Reader = nil 4032 body, err := googleapi.WithoutDataWrapper.JSONReader(c.course) 4033 if err != nil { 4034 return nil, err 4035 } 4036 reqHeaders.Set("Content-Type", "application/json") 4037 c.urlParams_.Set("alt", alt) 4038 c.urlParams_.Set("prettyPrint", "false") 4039 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}") 4040 urls += "?" + c.urlParams_.Encode() 4041 req, err := http.NewRequest("PUT", urls, body) 4042 if err != nil { 4043 return nil, err 4044 } 4045 req.Header = reqHeaders 4046 googleapi.Expand(req.URL, map[string]string{ 4047 "id": c.id, 4048 }) 4049 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4050} 4051 4052// Do executes the "classroom.courses.update" call. 4053// Exactly one of *Course or error will be non-nil. Any non-2xx status 4054// code is an error. Response headers are in either 4055// *Course.ServerResponse.Header or (if a response was returned at all) 4056// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4057// check whether the returned error was because http.StatusNotModified 4058// was returned. 4059func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) { 4060 gensupport.SetOptions(c.urlParams_, opts...) 4061 res, err := c.doRequest("json") 4062 if res != nil && res.StatusCode == http.StatusNotModified { 4063 if res.Body != nil { 4064 res.Body.Close() 4065 } 4066 return nil, &googleapi.Error{ 4067 Code: res.StatusCode, 4068 Header: res.Header, 4069 } 4070 } 4071 if err != nil { 4072 return nil, err 4073 } 4074 defer googleapi.CloseBody(res) 4075 if err := googleapi.CheckResponse(res); err != nil { 4076 return nil, err 4077 } 4078 ret := &Course{ 4079 ServerResponse: googleapi.ServerResponse{ 4080 Header: res.Header, 4081 HTTPStatusCode: res.StatusCode, 4082 }, 4083 } 4084 target := &ret 4085 if err := gensupport.DecodeResponse(target, res); err != nil { 4086 return nil, err 4087 } 4088 return ret, nil 4089 // { 4090 // "description": "Updates a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to modify the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID. * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable", 4091 // "flatPath": "v1/courses/{id}", 4092 // "httpMethod": "PUT", 4093 // "id": "classroom.courses.update", 4094 // "parameterOrder": [ 4095 // "id" 4096 // ], 4097 // "parameters": { 4098 // "id": { 4099 // "description": "Identifier of the course to update. This identifier can be either the Classroom-assigned identifier or an alias.", 4100 // "location": "path", 4101 // "required": true, 4102 // "type": "string" 4103 // } 4104 // }, 4105 // "path": "v1/courses/{id}", 4106 // "request": { 4107 // "$ref": "Course" 4108 // }, 4109 // "response": { 4110 // "$ref": "Course" 4111 // }, 4112 // "scopes": [ 4113 // "https://www.googleapis.com/auth/classroom.courses" 4114 // ] 4115 // } 4116 4117} 4118 4119// method id "classroom.courses.aliases.create": 4120 4121type CoursesAliasesCreateCall struct { 4122 s *Service 4123 courseId string 4124 coursealias *CourseAlias 4125 urlParams_ gensupport.URLParams 4126 ctx_ context.Context 4127 header_ http.Header 4128} 4129 4130// Create: Creates an alias for a course. This method returns the 4131// following error codes: * `PERMISSION_DENIED` if the requesting user 4132// is not permitted to create the alias or for access errors. * 4133// `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the 4134// alias already exists. * `FAILED_PRECONDITION` if the alias requested 4135// does not make sense for the requesting user or course (for example, 4136// if a user not in a domain attempts to access a domain-scoped alias). 4137// 4138// - courseId: Identifier of the course to alias. This identifier can be 4139// either the Classroom-assigned identifier or an alias. 4140func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall { 4141 c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4142 c.courseId = courseId 4143 c.coursealias = coursealias 4144 return c 4145} 4146 4147// Fields allows partial responses to be retrieved. See 4148// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4149// for more information. 4150func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall { 4151 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4152 return c 4153} 4154 4155// Context sets the context to be used in this call's Do method. Any 4156// pending HTTP request will be aborted if the provided context is 4157// canceled. 4158func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall { 4159 c.ctx_ = ctx 4160 return c 4161} 4162 4163// Header returns an http.Header that can be modified by the caller to 4164// add HTTP headers to the request. 4165func (c *CoursesAliasesCreateCall) Header() http.Header { 4166 if c.header_ == nil { 4167 c.header_ = make(http.Header) 4168 } 4169 return c.header_ 4170} 4171 4172func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) { 4173 reqHeaders := make(http.Header) 4174 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4175 for k, v := range c.header_ { 4176 reqHeaders[k] = v 4177 } 4178 reqHeaders.Set("User-Agent", c.s.userAgent()) 4179 var body io.Reader = nil 4180 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias) 4181 if err != nil { 4182 return nil, err 4183 } 4184 reqHeaders.Set("Content-Type", "application/json") 4185 c.urlParams_.Set("alt", alt) 4186 c.urlParams_.Set("prettyPrint", "false") 4187 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4188 urls += "?" + c.urlParams_.Encode() 4189 req, err := http.NewRequest("POST", urls, body) 4190 if err != nil { 4191 return nil, err 4192 } 4193 req.Header = reqHeaders 4194 googleapi.Expand(req.URL, map[string]string{ 4195 "courseId": c.courseId, 4196 }) 4197 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4198} 4199 4200// Do executes the "classroom.courses.aliases.create" call. 4201// Exactly one of *CourseAlias or error will be non-nil. Any non-2xx 4202// status code is an error. Response headers are in either 4203// *CourseAlias.ServerResponse.Header or (if a response was returned at 4204// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4205// to check whether the returned error was because 4206// http.StatusNotModified was returned. 4207func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) { 4208 gensupport.SetOptions(c.urlParams_, opts...) 4209 res, err := c.doRequest("json") 4210 if res != nil && res.StatusCode == http.StatusNotModified { 4211 if res.Body != nil { 4212 res.Body.Close() 4213 } 4214 return nil, &googleapi.Error{ 4215 Code: res.StatusCode, 4216 Header: res.Header, 4217 } 4218 } 4219 if err != nil { 4220 return nil, err 4221 } 4222 defer googleapi.CloseBody(res) 4223 if err := googleapi.CheckResponse(res); err != nil { 4224 return nil, err 4225 } 4226 ret := &CourseAlias{ 4227 ServerResponse: googleapi.ServerResponse{ 4228 Header: res.Header, 4229 HTTPStatusCode: res.StatusCode, 4230 }, 4231 } 4232 target := &ret 4233 if err := gensupport.DecodeResponse(target, res); err != nil { 4234 return nil, err 4235 } 4236 return ret, nil 4237 // { 4238 // "description": "Creates an alias for a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create the alias or for access errors. * `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the alias already exists. * `FAILED_PRECONDITION` if the alias requested does not make sense for the requesting user or course (for example, if a user not in a domain attempts to access a domain-scoped alias).", 4239 // "flatPath": "v1/courses/{courseId}/aliases", 4240 // "httpMethod": "POST", 4241 // "id": "classroom.courses.aliases.create", 4242 // "parameterOrder": [ 4243 // "courseId" 4244 // ], 4245 // "parameters": { 4246 // "courseId": { 4247 // "description": "Identifier of the course to alias. This identifier can be either the Classroom-assigned identifier or an alias.", 4248 // "location": "path", 4249 // "required": true, 4250 // "type": "string" 4251 // } 4252 // }, 4253 // "path": "v1/courses/{courseId}/aliases", 4254 // "request": { 4255 // "$ref": "CourseAlias" 4256 // }, 4257 // "response": { 4258 // "$ref": "CourseAlias" 4259 // }, 4260 // "scopes": [ 4261 // "https://www.googleapis.com/auth/classroom.courses" 4262 // ] 4263 // } 4264 4265} 4266 4267// method id "classroom.courses.aliases.delete": 4268 4269type CoursesAliasesDeleteCall struct { 4270 s *Service 4271 courseId string 4272 aliasid string 4273 urlParams_ gensupport.URLParams 4274 ctx_ context.Context 4275 header_ http.Header 4276} 4277 4278// Delete: Deletes an alias of a course. This method returns the 4279// following error codes: * `PERMISSION_DENIED` if the requesting user 4280// is not permitted to remove the alias or for access errors. * 4281// `NOT_FOUND` if the alias does not exist. * `FAILED_PRECONDITION` if 4282// the alias requested does not make sense for the requesting user or 4283// course (for example, if a user not in a domain attempts to delete a 4284// domain-scoped alias). 4285// 4286// - alias: Alias to delete. This may not be the Classroom-assigned 4287// identifier. 4288// - courseId: Identifier of the course whose alias should be deleted. 4289// This identifier can be either the Classroom-assigned identifier or 4290// an alias. 4291func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall { 4292 c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4293 c.courseId = courseId 4294 c.aliasid = aliasid 4295 return c 4296} 4297 4298// Fields allows partial responses to be retrieved. See 4299// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4300// for more information. 4301func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall { 4302 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4303 return c 4304} 4305 4306// Context sets the context to be used in this call's Do method. Any 4307// pending HTTP request will be aborted if the provided context is 4308// canceled. 4309func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall { 4310 c.ctx_ = ctx 4311 return c 4312} 4313 4314// Header returns an http.Header that can be modified by the caller to 4315// add HTTP headers to the request. 4316func (c *CoursesAliasesDeleteCall) Header() http.Header { 4317 if c.header_ == nil { 4318 c.header_ = make(http.Header) 4319 } 4320 return c.header_ 4321} 4322 4323func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) { 4324 reqHeaders := make(http.Header) 4325 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4326 for k, v := range c.header_ { 4327 reqHeaders[k] = v 4328 } 4329 reqHeaders.Set("User-Agent", c.s.userAgent()) 4330 var body io.Reader = nil 4331 c.urlParams_.Set("alt", alt) 4332 c.urlParams_.Set("prettyPrint", "false") 4333 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}") 4334 urls += "?" + c.urlParams_.Encode() 4335 req, err := http.NewRequest("DELETE", urls, body) 4336 if err != nil { 4337 return nil, err 4338 } 4339 req.Header = reqHeaders 4340 googleapi.Expand(req.URL, map[string]string{ 4341 "courseId": c.courseId, 4342 "alias": c.aliasid, 4343 }) 4344 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4345} 4346 4347// Do executes the "classroom.courses.aliases.delete" call. 4348// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4349// code is an error. Response headers are in either 4350// *Empty.ServerResponse.Header or (if a response was returned at all) 4351// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4352// check whether the returned error was because http.StatusNotModified 4353// was returned. 4354func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4355 gensupport.SetOptions(c.urlParams_, opts...) 4356 res, err := c.doRequest("json") 4357 if res != nil && res.StatusCode == http.StatusNotModified { 4358 if res.Body != nil { 4359 res.Body.Close() 4360 } 4361 return nil, &googleapi.Error{ 4362 Code: res.StatusCode, 4363 Header: res.Header, 4364 } 4365 } 4366 if err != nil { 4367 return nil, err 4368 } 4369 defer googleapi.CloseBody(res) 4370 if err := googleapi.CheckResponse(res); err != nil { 4371 return nil, err 4372 } 4373 ret := &Empty{ 4374 ServerResponse: googleapi.ServerResponse{ 4375 Header: res.Header, 4376 HTTPStatusCode: res.StatusCode, 4377 }, 4378 } 4379 target := &ret 4380 if err := gensupport.DecodeResponse(target, res); err != nil { 4381 return nil, err 4382 } 4383 return ret, nil 4384 // { 4385 // "description": "Deletes an alias of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to remove the alias or for access errors. * `NOT_FOUND` if the alias does not exist. * `FAILED_PRECONDITION` if the alias requested does not make sense for the requesting user or course (for example, if a user not in a domain attempts to delete a domain-scoped alias).", 4386 // "flatPath": "v1/courses/{courseId}/aliases/{alias}", 4387 // "httpMethod": "DELETE", 4388 // "id": "classroom.courses.aliases.delete", 4389 // "parameterOrder": [ 4390 // "courseId", 4391 // "alias" 4392 // ], 4393 // "parameters": { 4394 // "alias": { 4395 // "description": "Alias to delete. This may not be the Classroom-assigned identifier.", 4396 // "location": "path", 4397 // "required": true, 4398 // "type": "string" 4399 // }, 4400 // "courseId": { 4401 // "description": "Identifier of the course whose alias should be deleted. This identifier can be either the Classroom-assigned identifier or an alias.", 4402 // "location": "path", 4403 // "required": true, 4404 // "type": "string" 4405 // } 4406 // }, 4407 // "path": "v1/courses/{courseId}/aliases/{alias}", 4408 // "response": { 4409 // "$ref": "Empty" 4410 // }, 4411 // "scopes": [ 4412 // "https://www.googleapis.com/auth/classroom.courses" 4413 // ] 4414 // } 4415 4416} 4417 4418// method id "classroom.courses.aliases.list": 4419 4420type CoursesAliasesListCall struct { 4421 s *Service 4422 courseId string 4423 urlParams_ gensupport.URLParams 4424 ifNoneMatch_ string 4425 ctx_ context.Context 4426 header_ http.Header 4427} 4428 4429// List: Returns a list of aliases for a course. This method returns the 4430// following error codes: * `PERMISSION_DENIED` if the requesting user 4431// is not permitted to access the course or for access errors. * 4432// `NOT_FOUND` if the course does not exist. 4433// 4434// - courseId: The identifier of the course. This identifier can be 4435// either the Classroom-assigned identifier or an alias. 4436func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall { 4437 c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4438 c.courseId = courseId 4439 return c 4440} 4441 4442// PageSize sets the optional parameter "pageSize": Maximum number of 4443// items to return. Zero or unspecified indicates that the server may 4444// assign a maximum. The server may return fewer than the specified 4445// number of results. 4446func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall { 4447 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4448 return c 4449} 4450 4451// PageToken sets the optional parameter "pageToken": nextPageToken 4452// value returned from a previous list call, indicating that the 4453// subsequent page of results should be returned. The list request must 4454// be otherwise identical to the one that resulted in this token. 4455func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall { 4456 c.urlParams_.Set("pageToken", pageToken) 4457 return c 4458} 4459 4460// Fields allows partial responses to be retrieved. See 4461// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4462// for more information. 4463func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall { 4464 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4465 return c 4466} 4467 4468// IfNoneMatch sets the optional parameter which makes the operation 4469// fail if the object's ETag matches the given value. This is useful for 4470// getting updates only after the object has changed since the last 4471// request. Use googleapi.IsNotModified to check whether the response 4472// error from Do is the result of In-None-Match. 4473func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall { 4474 c.ifNoneMatch_ = entityTag 4475 return c 4476} 4477 4478// Context sets the context to be used in this call's Do method. Any 4479// pending HTTP request will be aborted if the provided context is 4480// canceled. 4481func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall { 4482 c.ctx_ = ctx 4483 return c 4484} 4485 4486// Header returns an http.Header that can be modified by the caller to 4487// add HTTP headers to the request. 4488func (c *CoursesAliasesListCall) Header() http.Header { 4489 if c.header_ == nil { 4490 c.header_ = make(http.Header) 4491 } 4492 return c.header_ 4493} 4494 4495func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) { 4496 reqHeaders := make(http.Header) 4497 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4498 for k, v := range c.header_ { 4499 reqHeaders[k] = v 4500 } 4501 reqHeaders.Set("User-Agent", c.s.userAgent()) 4502 if c.ifNoneMatch_ != "" { 4503 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4504 } 4505 var body io.Reader = nil 4506 c.urlParams_.Set("alt", alt) 4507 c.urlParams_.Set("prettyPrint", "false") 4508 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases") 4509 urls += "?" + c.urlParams_.Encode() 4510 req, err := http.NewRequest("GET", urls, body) 4511 if err != nil { 4512 return nil, err 4513 } 4514 req.Header = reqHeaders 4515 googleapi.Expand(req.URL, map[string]string{ 4516 "courseId": c.courseId, 4517 }) 4518 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4519} 4520 4521// Do executes the "classroom.courses.aliases.list" call. 4522// Exactly one of *ListCourseAliasesResponse or error will be non-nil. 4523// Any non-2xx status code is an error. Response headers are in either 4524// *ListCourseAliasesResponse.ServerResponse.Header or (if a response 4525// was returned at all) in error.(*googleapi.Error).Header. Use 4526// googleapi.IsNotModified to check whether the returned error was 4527// because http.StatusNotModified was returned. 4528func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) { 4529 gensupport.SetOptions(c.urlParams_, opts...) 4530 res, err := c.doRequest("json") 4531 if res != nil && res.StatusCode == http.StatusNotModified { 4532 if res.Body != nil { 4533 res.Body.Close() 4534 } 4535 return nil, &googleapi.Error{ 4536 Code: res.StatusCode, 4537 Header: res.Header, 4538 } 4539 } 4540 if err != nil { 4541 return nil, err 4542 } 4543 defer googleapi.CloseBody(res) 4544 if err := googleapi.CheckResponse(res); err != nil { 4545 return nil, err 4546 } 4547 ret := &ListCourseAliasesResponse{ 4548 ServerResponse: googleapi.ServerResponse{ 4549 Header: res.Header, 4550 HTTPStatusCode: res.StatusCode, 4551 }, 4552 } 4553 target := &ret 4554 if err := gensupport.DecodeResponse(target, res); err != nil { 4555 return nil, err 4556 } 4557 return ret, nil 4558 // { 4559 // "description": "Returns a list of aliases for a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the course or for access errors. * `NOT_FOUND` if the course does not exist.", 4560 // "flatPath": "v1/courses/{courseId}/aliases", 4561 // "httpMethod": "GET", 4562 // "id": "classroom.courses.aliases.list", 4563 // "parameterOrder": [ 4564 // "courseId" 4565 // ], 4566 // "parameters": { 4567 // "courseId": { 4568 // "description": "The identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 4569 // "location": "path", 4570 // "required": true, 4571 // "type": "string" 4572 // }, 4573 // "pageSize": { 4574 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 4575 // "format": "int32", 4576 // "location": "query", 4577 // "type": "integer" 4578 // }, 4579 // "pageToken": { 4580 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 4581 // "location": "query", 4582 // "type": "string" 4583 // } 4584 // }, 4585 // "path": "v1/courses/{courseId}/aliases", 4586 // "response": { 4587 // "$ref": "ListCourseAliasesResponse" 4588 // }, 4589 // "scopes": [ 4590 // "https://www.googleapis.com/auth/classroom.courses", 4591 // "https://www.googleapis.com/auth/classroom.courses.readonly" 4592 // ] 4593 // } 4594 4595} 4596 4597// Pages invokes f for each page of results. 4598// A non-nil error returned from f will halt the iteration. 4599// The provided context supersedes any context provided to the Context method. 4600func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error { 4601 c.ctx_ = ctx 4602 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4603 for { 4604 x, err := c.Do() 4605 if err != nil { 4606 return err 4607 } 4608 if err := f(x); err != nil { 4609 return err 4610 } 4611 if x.NextPageToken == "" { 4612 return nil 4613 } 4614 c.PageToken(x.NextPageToken) 4615 } 4616} 4617 4618// method id "classroom.courses.announcements.create": 4619 4620type CoursesAnnouncementsCreateCall struct { 4621 s *Service 4622 courseId string 4623 announcement *Announcement 4624 urlParams_ gensupport.URLParams 4625 ctx_ context.Context 4626 header_ http.Header 4627} 4628 4629// Create: Creates an announcement. This method returns the following 4630// error codes: * `PERMISSION_DENIED` if the requesting user is not 4631// permitted to access the requested course, create announcements in the 4632// requested course, share a Drive attachment, or for access errors. * 4633// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 4634// requested course does not exist. * `FAILED_PRECONDITION` for the 4635// following request error: * AttachmentNotVisible 4636// 4637// - courseId: Identifier of the course. This identifier can be either 4638// the Classroom-assigned identifier or an alias. 4639func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall { 4640 c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4641 c.courseId = courseId 4642 c.announcement = announcement 4643 return c 4644} 4645 4646// Fields allows partial responses to be retrieved. See 4647// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4648// for more information. 4649func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall { 4650 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4651 return c 4652} 4653 4654// Context sets the context to be used in this call's Do method. Any 4655// pending HTTP request will be aborted if the provided context is 4656// canceled. 4657func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall { 4658 c.ctx_ = ctx 4659 return c 4660} 4661 4662// Header returns an http.Header that can be modified by the caller to 4663// add HTTP headers to the request. 4664func (c *CoursesAnnouncementsCreateCall) Header() http.Header { 4665 if c.header_ == nil { 4666 c.header_ = make(http.Header) 4667 } 4668 return c.header_ 4669} 4670 4671func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) { 4672 reqHeaders := make(http.Header) 4673 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4674 for k, v := range c.header_ { 4675 reqHeaders[k] = v 4676 } 4677 reqHeaders.Set("User-Agent", c.s.userAgent()) 4678 var body io.Reader = nil 4679 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 4680 if err != nil { 4681 return nil, err 4682 } 4683 reqHeaders.Set("Content-Type", "application/json") 4684 c.urlParams_.Set("alt", alt) 4685 c.urlParams_.Set("prettyPrint", "false") 4686 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 4687 urls += "?" + c.urlParams_.Encode() 4688 req, err := http.NewRequest("POST", urls, body) 4689 if err != nil { 4690 return nil, err 4691 } 4692 req.Header = reqHeaders 4693 googleapi.Expand(req.URL, map[string]string{ 4694 "courseId": c.courseId, 4695 }) 4696 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4697} 4698 4699// Do executes the "classroom.courses.announcements.create" call. 4700// Exactly one of *Announcement or error will be non-nil. Any non-2xx 4701// status code is an error. Response headers are in either 4702// *Announcement.ServerResponse.Header or (if a response was returned at 4703// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4704// to check whether the returned error was because 4705// http.StatusNotModified was returned. 4706func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 4707 gensupport.SetOptions(c.urlParams_, opts...) 4708 res, err := c.doRequest("json") 4709 if res != nil && res.StatusCode == http.StatusNotModified { 4710 if res.Body != nil { 4711 res.Body.Close() 4712 } 4713 return nil, &googleapi.Error{ 4714 Code: res.StatusCode, 4715 Header: res.Header, 4716 } 4717 } 4718 if err != nil { 4719 return nil, err 4720 } 4721 defer googleapi.CloseBody(res) 4722 if err := googleapi.CheckResponse(res); err != nil { 4723 return nil, err 4724 } 4725 ret := &Announcement{ 4726 ServerResponse: googleapi.ServerResponse{ 4727 Header: res.Header, 4728 HTTPStatusCode: res.StatusCode, 4729 }, 4730 } 4731 target := &ret 4732 if err := gensupport.DecodeResponse(target, res); err != nil { 4733 return nil, err 4734 } 4735 return ret, nil 4736 // { 4737 // "description": "Creates an announcement. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create announcements in the requested course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible", 4738 // "flatPath": "v1/courses/{courseId}/announcements", 4739 // "httpMethod": "POST", 4740 // "id": "classroom.courses.announcements.create", 4741 // "parameterOrder": [ 4742 // "courseId" 4743 // ], 4744 // "parameters": { 4745 // "courseId": { 4746 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 4747 // "location": "path", 4748 // "required": true, 4749 // "type": "string" 4750 // } 4751 // }, 4752 // "path": "v1/courses/{courseId}/announcements", 4753 // "request": { 4754 // "$ref": "Announcement" 4755 // }, 4756 // "response": { 4757 // "$ref": "Announcement" 4758 // }, 4759 // "scopes": [ 4760 // "https://www.googleapis.com/auth/classroom.announcements" 4761 // ] 4762 // } 4763 4764} 4765 4766// method id "classroom.courses.announcements.delete": 4767 4768type CoursesAnnouncementsDeleteCall struct { 4769 s *Service 4770 courseId string 4771 id string 4772 urlParams_ gensupport.URLParams 4773 ctx_ context.Context 4774 header_ http.Header 4775} 4776 4777// Delete: Deletes an announcement. This request must be made by the 4778// Developer Console project of the OAuth client ID 4779// (https://support.google.com/cloud/answer/6158849) used to create the 4780// corresponding announcement item. This method returns the following 4781// error codes: * `PERMISSION_DENIED` if the requesting developer 4782// project did not create the corresponding announcement, if the 4783// requesting user is not permitted to delete the requested course or 4784// for access errors. * `FAILED_PRECONDITION` if the requested 4785// announcement has already been deleted. * `NOT_FOUND` if no course 4786// exists with the requested ID. 4787// 4788// - courseId: Identifier of the course. This identifier can be either 4789// the Classroom-assigned identifier or an alias. 4790// - id: Identifier of the announcement to delete. This identifier is a 4791// Classroom-assigned identifier. 4792func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall { 4793 c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4794 c.courseId = courseId 4795 c.id = id 4796 return c 4797} 4798 4799// Fields allows partial responses to be retrieved. See 4800// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4801// for more information. 4802func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall { 4803 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4804 return c 4805} 4806 4807// Context sets the context to be used in this call's Do method. Any 4808// pending HTTP request will be aborted if the provided context is 4809// canceled. 4810func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall { 4811 c.ctx_ = ctx 4812 return c 4813} 4814 4815// Header returns an http.Header that can be modified by the caller to 4816// add HTTP headers to the request. 4817func (c *CoursesAnnouncementsDeleteCall) Header() http.Header { 4818 if c.header_ == nil { 4819 c.header_ = make(http.Header) 4820 } 4821 return c.header_ 4822} 4823 4824func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) { 4825 reqHeaders := make(http.Header) 4826 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4827 for k, v := range c.header_ { 4828 reqHeaders[k] = v 4829 } 4830 reqHeaders.Set("User-Agent", c.s.userAgent()) 4831 var body io.Reader = nil 4832 c.urlParams_.Set("alt", alt) 4833 c.urlParams_.Set("prettyPrint", "false") 4834 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 4835 urls += "?" + c.urlParams_.Encode() 4836 req, err := http.NewRequest("DELETE", urls, body) 4837 if err != nil { 4838 return nil, err 4839 } 4840 req.Header = reqHeaders 4841 googleapi.Expand(req.URL, map[string]string{ 4842 "courseId": c.courseId, 4843 "id": c.id, 4844 }) 4845 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4846} 4847 4848// Do executes the "classroom.courses.announcements.delete" call. 4849// Exactly one of *Empty or error will be non-nil. Any non-2xx status 4850// code is an error. Response headers are in either 4851// *Empty.ServerResponse.Header or (if a response was returned at all) 4852// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4853// check whether the returned error was because http.StatusNotModified 4854// was returned. 4855func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 4856 gensupport.SetOptions(c.urlParams_, opts...) 4857 res, err := c.doRequest("json") 4858 if res != nil && res.StatusCode == http.StatusNotModified { 4859 if res.Body != nil { 4860 res.Body.Close() 4861 } 4862 return nil, &googleapi.Error{ 4863 Code: res.StatusCode, 4864 Header: res.Header, 4865 } 4866 } 4867 if err != nil { 4868 return nil, err 4869 } 4870 defer googleapi.CloseBody(res) 4871 if err := googleapi.CheckResponse(res); err != nil { 4872 return nil, err 4873 } 4874 ret := &Empty{ 4875 ServerResponse: googleapi.ServerResponse{ 4876 Header: res.Header, 4877 HTTPStatusCode: res.StatusCode, 4878 }, 4879 } 4880 target := &ret 4881 if err := gensupport.DecodeResponse(target, res); err != nil { 4882 return nil, err 4883 } 4884 return ret, nil 4885 // { 4886 // "description": "Deletes an announcement. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding announcement item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding announcement, if the requesting user is not permitted to delete the requested course or for access errors. * `FAILED_PRECONDITION` if the requested announcement has already been deleted. * `NOT_FOUND` if no course exists with the requested ID.", 4887 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 4888 // "httpMethod": "DELETE", 4889 // "id": "classroom.courses.announcements.delete", 4890 // "parameterOrder": [ 4891 // "courseId", 4892 // "id" 4893 // ], 4894 // "parameters": { 4895 // "courseId": { 4896 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 4897 // "location": "path", 4898 // "required": true, 4899 // "type": "string" 4900 // }, 4901 // "id": { 4902 // "description": "Identifier of the announcement to delete. This identifier is a Classroom-assigned identifier.", 4903 // "location": "path", 4904 // "required": true, 4905 // "type": "string" 4906 // } 4907 // }, 4908 // "path": "v1/courses/{courseId}/announcements/{id}", 4909 // "response": { 4910 // "$ref": "Empty" 4911 // }, 4912 // "scopes": [ 4913 // "https://www.googleapis.com/auth/classroom.announcements" 4914 // ] 4915 // } 4916 4917} 4918 4919// method id "classroom.courses.announcements.get": 4920 4921type CoursesAnnouncementsGetCall struct { 4922 s *Service 4923 courseId string 4924 id string 4925 urlParams_ gensupport.URLParams 4926 ifNoneMatch_ string 4927 ctx_ context.Context 4928 header_ http.Header 4929} 4930 4931// Get: Returns an announcement. This method returns the following error 4932// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 4933// to access the requested course or announcement, or for access errors. 4934// * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if 4935// the requested course or announcement does not exist. 4936// 4937// - courseId: Identifier of the course. This identifier can be either 4938// the Classroom-assigned identifier or an alias. 4939// - id: Identifier of the announcement. 4940func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall { 4941 c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4942 c.courseId = courseId 4943 c.id = id 4944 return c 4945} 4946 4947// Fields allows partial responses to be retrieved. See 4948// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4949// for more information. 4950func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall { 4951 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4952 return c 4953} 4954 4955// IfNoneMatch sets the optional parameter which makes the operation 4956// fail if the object's ETag matches the given value. This is useful for 4957// getting updates only after the object has changed since the last 4958// request. Use googleapi.IsNotModified to check whether the response 4959// error from Do is the result of In-None-Match. 4960func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall { 4961 c.ifNoneMatch_ = entityTag 4962 return c 4963} 4964 4965// Context sets the context to be used in this call's Do method. Any 4966// pending HTTP request will be aborted if the provided context is 4967// canceled. 4968func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall { 4969 c.ctx_ = ctx 4970 return c 4971} 4972 4973// Header returns an http.Header that can be modified by the caller to 4974// add HTTP headers to the request. 4975func (c *CoursesAnnouncementsGetCall) Header() http.Header { 4976 if c.header_ == nil { 4977 c.header_ = make(http.Header) 4978 } 4979 return c.header_ 4980} 4981 4982func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) { 4983 reqHeaders := make(http.Header) 4984 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4985 for k, v := range c.header_ { 4986 reqHeaders[k] = v 4987 } 4988 reqHeaders.Set("User-Agent", c.s.userAgent()) 4989 if c.ifNoneMatch_ != "" { 4990 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4991 } 4992 var body io.Reader = nil 4993 c.urlParams_.Set("alt", alt) 4994 c.urlParams_.Set("prettyPrint", "false") 4995 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 4996 urls += "?" + c.urlParams_.Encode() 4997 req, err := http.NewRequest("GET", urls, body) 4998 if err != nil { 4999 return nil, err 5000 } 5001 req.Header = reqHeaders 5002 googleapi.Expand(req.URL, map[string]string{ 5003 "courseId": c.courseId, 5004 "id": c.id, 5005 }) 5006 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5007} 5008 5009// Do executes the "classroom.courses.announcements.get" call. 5010// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5011// status code is an error. Response headers are in either 5012// *Announcement.ServerResponse.Header or (if a response was returned at 5013// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5014// to check whether the returned error was because 5015// http.StatusNotModified was returned. 5016func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5017 gensupport.SetOptions(c.urlParams_, opts...) 5018 res, err := c.doRequest("json") 5019 if res != nil && res.StatusCode == http.StatusNotModified { 5020 if res.Body != nil { 5021 res.Body.Close() 5022 } 5023 return nil, &googleapi.Error{ 5024 Code: res.StatusCode, 5025 Header: res.Header, 5026 } 5027 } 5028 if err != nil { 5029 return nil, err 5030 } 5031 defer googleapi.CloseBody(res) 5032 if err := googleapi.CheckResponse(res); err != nil { 5033 return nil, err 5034 } 5035 ret := &Announcement{ 5036 ServerResponse: googleapi.ServerResponse{ 5037 Header: res.Header, 5038 HTTPStatusCode: res.StatusCode, 5039 }, 5040 } 5041 target := &ret 5042 if err := gensupport.DecodeResponse(target, res); err != nil { 5043 return nil, err 5044 } 5045 return ret, nil 5046 // { 5047 // "description": "Returns an announcement. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or announcement, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or announcement does not exist.", 5048 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5049 // "httpMethod": "GET", 5050 // "id": "classroom.courses.announcements.get", 5051 // "parameterOrder": [ 5052 // "courseId", 5053 // "id" 5054 // ], 5055 // "parameters": { 5056 // "courseId": { 5057 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5058 // "location": "path", 5059 // "required": true, 5060 // "type": "string" 5061 // }, 5062 // "id": { 5063 // "description": "Identifier of the announcement.", 5064 // "location": "path", 5065 // "required": true, 5066 // "type": "string" 5067 // } 5068 // }, 5069 // "path": "v1/courses/{courseId}/announcements/{id}", 5070 // "response": { 5071 // "$ref": "Announcement" 5072 // }, 5073 // "scopes": [ 5074 // "https://www.googleapis.com/auth/classroom.announcements", 5075 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5076 // ] 5077 // } 5078 5079} 5080 5081// method id "classroom.courses.announcements.list": 5082 5083type CoursesAnnouncementsListCall struct { 5084 s *Service 5085 courseId string 5086 urlParams_ gensupport.URLParams 5087 ifNoneMatch_ string 5088 ctx_ context.Context 5089 header_ http.Header 5090} 5091 5092// List: Returns a list of announcements that the requester is permitted 5093// to view. Course students may only view `PUBLISHED` announcements. 5094// Course teachers and domain administrators may view all announcements. 5095// This method returns the following error codes: * `PERMISSION_DENIED` 5096// if the requesting user is not permitted to access the requested 5097// course or for access errors. * `INVALID_ARGUMENT` if the request is 5098// malformed. * `NOT_FOUND` if the requested course does not exist. 5099// 5100// - courseId: Identifier of the course. This identifier can be either 5101// the Classroom-assigned identifier or an alias. 5102func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall { 5103 c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5104 c.courseId = courseId 5105 return c 5106} 5107 5108// AnnouncementStates sets the optional parameter "announcementStates": 5109// Restriction on the `state` of announcements returned. If this 5110// argument is left unspecified, the default value is `PUBLISHED`. 5111// 5112// Possible values: 5113// "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is 5114// never returned. 5115// "PUBLISHED" - Status for announcement that has been published. This 5116// is the default state. 5117// "DRAFT" - Status for an announcement that is not yet published. 5118// Announcement in this state is visible only to course teachers and 5119// domain administrators. 5120// "DELETED" - Status for announcement that was published but is now 5121// deleted. Announcement in this state is visible only to course 5122// teachers and domain administrators. Announcement in this state is 5123// deleted after some time. 5124func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall { 5125 c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...)) 5126 return c 5127} 5128 5129// OrderBy sets the optional parameter "orderBy": Optional sort ordering 5130// for results. A comma-separated list of fields with an optional sort 5131// direction keyword. Supported field is `updateTime`. Supported 5132// direction keywords are `asc` and `desc`. If not specified, 5133// `updateTime desc` is the default behavior. Examples: `updateTime 5134// asc`, `updateTime` 5135func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall { 5136 c.urlParams_.Set("orderBy", orderBy) 5137 return c 5138} 5139 5140// PageSize sets the optional parameter "pageSize": Maximum number of 5141// items to return. Zero or unspecified indicates that the server may 5142// assign a maximum. The server may return fewer than the specified 5143// number of results. 5144func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall { 5145 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5146 return c 5147} 5148 5149// PageToken sets the optional parameter "pageToken": nextPageToken 5150// value returned from a previous list call, indicating that the 5151// subsequent page of results should be returned. The list request must 5152// be otherwise identical to the one that resulted in this token. 5153func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall { 5154 c.urlParams_.Set("pageToken", pageToken) 5155 return c 5156} 5157 5158// Fields allows partial responses to be retrieved. See 5159// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5160// for more information. 5161func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall { 5162 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5163 return c 5164} 5165 5166// IfNoneMatch sets the optional parameter which makes the operation 5167// fail if the object's ETag matches the given value. This is useful for 5168// getting updates only after the object has changed since the last 5169// request. Use googleapi.IsNotModified to check whether the response 5170// error from Do is the result of In-None-Match. 5171func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall { 5172 c.ifNoneMatch_ = entityTag 5173 return c 5174} 5175 5176// Context sets the context to be used in this call's Do method. Any 5177// pending HTTP request will be aborted if the provided context is 5178// canceled. 5179func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall { 5180 c.ctx_ = ctx 5181 return c 5182} 5183 5184// Header returns an http.Header that can be modified by the caller to 5185// add HTTP headers to the request. 5186func (c *CoursesAnnouncementsListCall) Header() http.Header { 5187 if c.header_ == nil { 5188 c.header_ = make(http.Header) 5189 } 5190 return c.header_ 5191} 5192 5193func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) { 5194 reqHeaders := make(http.Header) 5195 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 5196 for k, v := range c.header_ { 5197 reqHeaders[k] = v 5198 } 5199 reqHeaders.Set("User-Agent", c.s.userAgent()) 5200 if c.ifNoneMatch_ != "" { 5201 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5202 } 5203 var body io.Reader = nil 5204 c.urlParams_.Set("alt", alt) 5205 c.urlParams_.Set("prettyPrint", "false") 5206 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements") 5207 urls += "?" + c.urlParams_.Encode() 5208 req, err := http.NewRequest("GET", urls, body) 5209 if err != nil { 5210 return nil, err 5211 } 5212 req.Header = reqHeaders 5213 googleapi.Expand(req.URL, map[string]string{ 5214 "courseId": c.courseId, 5215 }) 5216 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5217} 5218 5219// Do executes the "classroom.courses.announcements.list" call. 5220// Exactly one of *ListAnnouncementsResponse or error will be non-nil. 5221// Any non-2xx status code is an error. Response headers are in either 5222// *ListAnnouncementsResponse.ServerResponse.Header or (if a response 5223// was returned at all) in error.(*googleapi.Error).Header. Use 5224// googleapi.IsNotModified to check whether the returned error was 5225// because http.StatusNotModified was returned. 5226func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) { 5227 gensupport.SetOptions(c.urlParams_, opts...) 5228 res, err := c.doRequest("json") 5229 if res != nil && res.StatusCode == http.StatusNotModified { 5230 if res.Body != nil { 5231 res.Body.Close() 5232 } 5233 return nil, &googleapi.Error{ 5234 Code: res.StatusCode, 5235 Header: res.Header, 5236 } 5237 } 5238 if err != nil { 5239 return nil, err 5240 } 5241 defer googleapi.CloseBody(res) 5242 if err := googleapi.CheckResponse(res); err != nil { 5243 return nil, err 5244 } 5245 ret := &ListAnnouncementsResponse{ 5246 ServerResponse: googleapi.ServerResponse{ 5247 Header: res.Header, 5248 HTTPStatusCode: res.StatusCode, 5249 }, 5250 } 5251 target := &ret 5252 if err := gensupport.DecodeResponse(target, res); err != nil { 5253 return nil, err 5254 } 5255 return ret, nil 5256 // { 5257 // "description": "Returns a list of announcements that the requester is permitted to view. Course students may only view `PUBLISHED` announcements. Course teachers and domain administrators may view all announcements. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 5258 // "flatPath": "v1/courses/{courseId}/announcements", 5259 // "httpMethod": "GET", 5260 // "id": "classroom.courses.announcements.list", 5261 // "parameterOrder": [ 5262 // "courseId" 5263 // ], 5264 // "parameters": { 5265 // "announcementStates": { 5266 // "description": "Restriction on the `state` of announcements returned. If this argument is left unspecified, the default value is `PUBLISHED`.", 5267 // "enum": [ 5268 // "ANNOUNCEMENT_STATE_UNSPECIFIED", 5269 // "PUBLISHED", 5270 // "DRAFT", 5271 // "DELETED" 5272 // ], 5273 // "enumDescriptions": [ 5274 // "No state specified. This is never returned.", 5275 // "Status for announcement that has been published. This is the default state.", 5276 // "Status for an announcement that is not yet published. Announcement in this state is visible only to course teachers and domain administrators.", 5277 // "Status for announcement that was published but is now deleted. Announcement in this state is visible only to course teachers and domain administrators. Announcement in this state is deleted after some time." 5278 // ], 5279 // "location": "query", 5280 // "repeated": true, 5281 // "type": "string" 5282 // }, 5283 // "courseId": { 5284 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5285 // "location": "path", 5286 // "required": true, 5287 // "type": "string" 5288 // }, 5289 // "orderBy": { 5290 // "description": "Optional sort ordering for results. A comma-separated list of fields with an optional sort direction keyword. Supported field is `updateTime`. Supported direction keywords are `asc` and `desc`. If not specified, `updateTime desc` is the default behavior. Examples: `updateTime asc`, `updateTime`", 5291 // "location": "query", 5292 // "type": "string" 5293 // }, 5294 // "pageSize": { 5295 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 5296 // "format": "int32", 5297 // "location": "query", 5298 // "type": "integer" 5299 // }, 5300 // "pageToken": { 5301 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 5302 // "location": "query", 5303 // "type": "string" 5304 // } 5305 // }, 5306 // "path": "v1/courses/{courseId}/announcements", 5307 // "response": { 5308 // "$ref": "ListAnnouncementsResponse" 5309 // }, 5310 // "scopes": [ 5311 // "https://www.googleapis.com/auth/classroom.announcements", 5312 // "https://www.googleapis.com/auth/classroom.announcements.readonly" 5313 // ] 5314 // } 5315 5316} 5317 5318// Pages invokes f for each page of results. 5319// A non-nil error returned from f will halt the iteration. 5320// The provided context supersedes any context provided to the Context method. 5321func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error { 5322 c.ctx_ = ctx 5323 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5324 for { 5325 x, err := c.Do() 5326 if err != nil { 5327 return err 5328 } 5329 if err := f(x); err != nil { 5330 return err 5331 } 5332 if x.NextPageToken == "" { 5333 return nil 5334 } 5335 c.PageToken(x.NextPageToken) 5336 } 5337} 5338 5339// method id "classroom.courses.announcements.modifyAssignees": 5340 5341type CoursesAnnouncementsModifyAssigneesCall struct { 5342 s *Service 5343 courseId string 5344 id string 5345 modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest 5346 urlParams_ gensupport.URLParams 5347 ctx_ context.Context 5348 header_ http.Header 5349} 5350 5351// ModifyAssignees: Modifies assignee mode and options of an 5352// announcement. Only a teacher of the course that contains the 5353// announcement may call this method. This method returns the following 5354// error codes: * `PERMISSION_DENIED` if the requesting user is not 5355// permitted to access the requested course or course work or for access 5356// errors. * `INVALID_ARGUMENT` if the request is malformed. * 5357// `NOT_FOUND` if the requested course or course work does not exist. 5358// 5359// - courseId: Identifier of the course. This identifier can be either 5360// the Classroom-assigned identifier or an alias. 5361// - id: Identifier of the announcement. 5362func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall { 5363 c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5364 c.courseId = courseId 5365 c.id = id 5366 c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest 5367 return c 5368} 5369 5370// Fields allows partial responses to be retrieved. See 5371// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5372// for more information. 5373func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall { 5374 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5375 return c 5376} 5377 5378// Context sets the context to be used in this call's Do method. Any 5379// pending HTTP request will be aborted if the provided context is 5380// canceled. 5381func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall { 5382 c.ctx_ = ctx 5383 return c 5384} 5385 5386// Header returns an http.Header that can be modified by the caller to 5387// add HTTP headers to the request. 5388func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header { 5389 if c.header_ == nil { 5390 c.header_ = make(http.Header) 5391 } 5392 return c.header_ 5393} 5394 5395func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 5396 reqHeaders := make(http.Header) 5397 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 5398 for k, v := range c.header_ { 5399 reqHeaders[k] = v 5400 } 5401 reqHeaders.Set("User-Agent", c.s.userAgent()) 5402 var body io.Reader = nil 5403 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest) 5404 if err != nil { 5405 return nil, err 5406 } 5407 reqHeaders.Set("Content-Type", "application/json") 5408 c.urlParams_.Set("alt", alt) 5409 c.urlParams_.Set("prettyPrint", "false") 5410 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees") 5411 urls += "?" + c.urlParams_.Encode() 5412 req, err := http.NewRequest("POST", urls, body) 5413 if err != nil { 5414 return nil, err 5415 } 5416 req.Header = reqHeaders 5417 googleapi.Expand(req.URL, map[string]string{ 5418 "courseId": c.courseId, 5419 "id": c.id, 5420 }) 5421 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5422} 5423 5424// Do executes the "classroom.courses.announcements.modifyAssignees" call. 5425// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5426// status code is an error. Response headers are in either 5427// *Announcement.ServerResponse.Header or (if a response was returned at 5428// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5429// to check whether the returned error was because 5430// http.StatusNotModified was returned. 5431func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5432 gensupport.SetOptions(c.urlParams_, opts...) 5433 res, err := c.doRequest("json") 5434 if res != nil && res.StatusCode == http.StatusNotModified { 5435 if res.Body != nil { 5436 res.Body.Close() 5437 } 5438 return nil, &googleapi.Error{ 5439 Code: res.StatusCode, 5440 Header: res.Header, 5441 } 5442 } 5443 if err != nil { 5444 return nil, err 5445 } 5446 defer googleapi.CloseBody(res) 5447 if err := googleapi.CheckResponse(res); err != nil { 5448 return nil, err 5449 } 5450 ret := &Announcement{ 5451 ServerResponse: googleapi.ServerResponse{ 5452 Header: res.Header, 5453 HTTPStatusCode: res.StatusCode, 5454 }, 5455 } 5456 target := &ret 5457 if err := gensupport.DecodeResponse(target, res); err != nil { 5458 return nil, err 5459 } 5460 return ret, nil 5461 // { 5462 // "description": "Modifies assignee mode and options of an announcement. Only a teacher of the course that contains the announcement may call this method. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work does not exist.", 5463 // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5464 // "httpMethod": "POST", 5465 // "id": "classroom.courses.announcements.modifyAssignees", 5466 // "parameterOrder": [ 5467 // "courseId", 5468 // "id" 5469 // ], 5470 // "parameters": { 5471 // "courseId": { 5472 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5473 // "location": "path", 5474 // "required": true, 5475 // "type": "string" 5476 // }, 5477 // "id": { 5478 // "description": "Identifier of the announcement.", 5479 // "location": "path", 5480 // "required": true, 5481 // "type": "string" 5482 // } 5483 // }, 5484 // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees", 5485 // "request": { 5486 // "$ref": "ModifyAnnouncementAssigneesRequest" 5487 // }, 5488 // "response": { 5489 // "$ref": "Announcement" 5490 // }, 5491 // "scopes": [ 5492 // "https://www.googleapis.com/auth/classroom.announcements" 5493 // ] 5494 // } 5495 5496} 5497 5498// method id "classroom.courses.announcements.patch": 5499 5500type CoursesAnnouncementsPatchCall struct { 5501 s *Service 5502 courseId string 5503 id string 5504 announcement *Announcement 5505 urlParams_ gensupport.URLParams 5506 ctx_ context.Context 5507 header_ http.Header 5508} 5509 5510// Patch: Updates one or more fields of an announcement. This method 5511// returns the following error codes: * `PERMISSION_DENIED` if the 5512// requesting developer project did not create the corresponding 5513// announcement or for access errors. * `INVALID_ARGUMENT` if the 5514// request is malformed. * `FAILED_PRECONDITION` if the requested 5515// announcement has already been deleted. * `NOT_FOUND` if the requested 5516// course or announcement does not exist 5517// 5518// - courseId: Identifier of the course. This identifier can be either 5519// the Classroom-assigned identifier or an alias. 5520// - id: Identifier of the announcement. 5521func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall { 5522 c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5523 c.courseId = courseId 5524 c.id = id 5525 c.announcement = announcement 5526 return c 5527} 5528 5529// UpdateMask sets the optional parameter "updateMask": Mask that 5530// identifies which fields on the announcement to update. This field is 5531// required to do an update. The update fails if invalid fields are 5532// specified. If a field supports empty values, it can be cleared by 5533// specifying it in the update mask and not in the Announcement object. 5534// If a field that does not support empty values is included in the 5535// update mask and not set in the Announcement object, an 5536// `INVALID_ARGUMENT` error is returned. The following fields may be 5537// specified by teachers: * `text` * `state` * `scheduled_time` 5538func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall { 5539 c.urlParams_.Set("updateMask", updateMask) 5540 return c 5541} 5542 5543// Fields allows partial responses to be retrieved. See 5544// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5545// for more information. 5546func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall { 5547 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5548 return c 5549} 5550 5551// Context sets the context to be used in this call's Do method. Any 5552// pending HTTP request will be aborted if the provided context is 5553// canceled. 5554func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall { 5555 c.ctx_ = ctx 5556 return c 5557} 5558 5559// Header returns an http.Header that can be modified by the caller to 5560// add HTTP headers to the request. 5561func (c *CoursesAnnouncementsPatchCall) Header() http.Header { 5562 if c.header_ == nil { 5563 c.header_ = make(http.Header) 5564 } 5565 return c.header_ 5566} 5567 5568func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) { 5569 reqHeaders := make(http.Header) 5570 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 5571 for k, v := range c.header_ { 5572 reqHeaders[k] = v 5573 } 5574 reqHeaders.Set("User-Agent", c.s.userAgent()) 5575 var body io.Reader = nil 5576 body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement) 5577 if err != nil { 5578 return nil, err 5579 } 5580 reqHeaders.Set("Content-Type", "application/json") 5581 c.urlParams_.Set("alt", alt) 5582 c.urlParams_.Set("prettyPrint", "false") 5583 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}") 5584 urls += "?" + c.urlParams_.Encode() 5585 req, err := http.NewRequest("PATCH", urls, body) 5586 if err != nil { 5587 return nil, err 5588 } 5589 req.Header = reqHeaders 5590 googleapi.Expand(req.URL, map[string]string{ 5591 "courseId": c.courseId, 5592 "id": c.id, 5593 }) 5594 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5595} 5596 5597// Do executes the "classroom.courses.announcements.patch" call. 5598// Exactly one of *Announcement or error will be non-nil. Any non-2xx 5599// status code is an error. Response headers are in either 5600// *Announcement.ServerResponse.Header or (if a response was returned at 5601// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5602// to check whether the returned error was because 5603// http.StatusNotModified was returned. 5604func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) { 5605 gensupport.SetOptions(c.urlParams_, opts...) 5606 res, err := c.doRequest("json") 5607 if res != nil && res.StatusCode == http.StatusNotModified { 5608 if res.Body != nil { 5609 res.Body.Close() 5610 } 5611 return nil, &googleapi.Error{ 5612 Code: res.StatusCode, 5613 Header: res.Header, 5614 } 5615 } 5616 if err != nil { 5617 return nil, err 5618 } 5619 defer googleapi.CloseBody(res) 5620 if err := googleapi.CheckResponse(res); err != nil { 5621 return nil, err 5622 } 5623 ret := &Announcement{ 5624 ServerResponse: googleapi.ServerResponse{ 5625 Header: res.Header, 5626 HTTPStatusCode: res.StatusCode, 5627 }, 5628 } 5629 target := &ret 5630 if err := gensupport.DecodeResponse(target, res); err != nil { 5631 return nil, err 5632 } 5633 return ret, nil 5634 // { 5635 // "description": "Updates one or more fields of an announcement. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding announcement or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the requested announcement has already been deleted. * `NOT_FOUND` if the requested course or announcement does not exist", 5636 // "flatPath": "v1/courses/{courseId}/announcements/{id}", 5637 // "httpMethod": "PATCH", 5638 // "id": "classroom.courses.announcements.patch", 5639 // "parameterOrder": [ 5640 // "courseId", 5641 // "id" 5642 // ], 5643 // "parameters": { 5644 // "courseId": { 5645 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5646 // "location": "path", 5647 // "required": true, 5648 // "type": "string" 5649 // }, 5650 // "id": { 5651 // "description": "Identifier of the announcement.", 5652 // "location": "path", 5653 // "required": true, 5654 // "type": "string" 5655 // }, 5656 // "updateMask": { 5657 // "description": "Mask that identifies which fields on the announcement to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the Announcement object. If a field that does not support empty values is included in the update mask and not set in the Announcement object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified by teachers: * `text` * `state` * `scheduled_time`", 5658 // "format": "google-fieldmask", 5659 // "location": "query", 5660 // "type": "string" 5661 // } 5662 // }, 5663 // "path": "v1/courses/{courseId}/announcements/{id}", 5664 // "request": { 5665 // "$ref": "Announcement" 5666 // }, 5667 // "response": { 5668 // "$ref": "Announcement" 5669 // }, 5670 // "scopes": [ 5671 // "https://www.googleapis.com/auth/classroom.announcements" 5672 // ] 5673 // } 5674 5675} 5676 5677// method id "classroom.courses.courseWork.create": 5678 5679type CoursesCourseWorkCreateCall struct { 5680 s *Service 5681 courseId string 5682 coursework *CourseWork 5683 urlParams_ gensupport.URLParams 5684 ctx_ context.Context 5685 header_ http.Header 5686} 5687 5688// Create: Creates course work. The resulting course work (and 5689// corresponding student submissions) are associated with the Developer 5690// Console project of the OAuth client ID 5691// (https://support.google.com/cloud/answer/6158849) used to make the 5692// request. Classroom API requests to modify course work and student 5693// submissions must be made with an OAuth client ID from the associated 5694// Developer Console project. This method returns the following error 5695// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 5696// to access the requested course, create course work in the requested 5697// course, share a Drive attachment, or for access errors. * 5698// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 5699// requested course does not exist. * `FAILED_PRECONDITION` for the 5700// following request error: * AttachmentNotVisible 5701// 5702// - courseId: Identifier of the course. This identifier can be either 5703// the Classroom-assigned identifier or an alias. 5704func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall { 5705 c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5706 c.courseId = courseId 5707 c.coursework = coursework 5708 return c 5709} 5710 5711// Fields allows partial responses to be retrieved. See 5712// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5713// for more information. 5714func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall { 5715 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5716 return c 5717} 5718 5719// Context sets the context to be used in this call's Do method. Any 5720// pending HTTP request will be aborted if the provided context is 5721// canceled. 5722func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall { 5723 c.ctx_ = ctx 5724 return c 5725} 5726 5727// Header returns an http.Header that can be modified by the caller to 5728// add HTTP headers to the request. 5729func (c *CoursesCourseWorkCreateCall) Header() http.Header { 5730 if c.header_ == nil { 5731 c.header_ = make(http.Header) 5732 } 5733 return c.header_ 5734} 5735 5736func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) { 5737 reqHeaders := make(http.Header) 5738 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 5739 for k, v := range c.header_ { 5740 reqHeaders[k] = v 5741 } 5742 reqHeaders.Set("User-Agent", c.s.userAgent()) 5743 var body io.Reader = nil 5744 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 5745 if err != nil { 5746 return nil, err 5747 } 5748 reqHeaders.Set("Content-Type", "application/json") 5749 c.urlParams_.Set("alt", alt) 5750 c.urlParams_.Set("prettyPrint", "false") 5751 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 5752 urls += "?" + c.urlParams_.Encode() 5753 req, err := http.NewRequest("POST", urls, body) 5754 if err != nil { 5755 return nil, err 5756 } 5757 req.Header = reqHeaders 5758 googleapi.Expand(req.URL, map[string]string{ 5759 "courseId": c.courseId, 5760 }) 5761 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5762} 5763 5764// Do executes the "classroom.courses.courseWork.create" call. 5765// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 5766// status code is an error. Response headers are in either 5767// *CourseWork.ServerResponse.Header or (if a response was returned at 5768// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5769// to check whether the returned error was because 5770// http.StatusNotModified was returned. 5771func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 5772 gensupport.SetOptions(c.urlParams_, opts...) 5773 res, err := c.doRequest("json") 5774 if res != nil && res.StatusCode == http.StatusNotModified { 5775 if res.Body != nil { 5776 res.Body.Close() 5777 } 5778 return nil, &googleapi.Error{ 5779 Code: res.StatusCode, 5780 Header: res.Header, 5781 } 5782 } 5783 if err != nil { 5784 return nil, err 5785 } 5786 defer googleapi.CloseBody(res) 5787 if err := googleapi.CheckResponse(res); err != nil { 5788 return nil, err 5789 } 5790 ret := &CourseWork{ 5791 ServerResponse: googleapi.ServerResponse{ 5792 Header: res.Header, 5793 HTTPStatusCode: res.StatusCode, 5794 }, 5795 } 5796 target := &ret 5797 if err := gensupport.DecodeResponse(target, res); err != nil { 5798 return nil, err 5799 } 5800 return ret, nil 5801 // { 5802 // "description": "Creates course work. The resulting course work (and corresponding student submissions) are associated with the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to make the request. Classroom API requests to modify course work and student submissions must be made with an OAuth client ID from the associated Developer Console project. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create course work in the requested course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible", 5803 // "flatPath": "v1/courses/{courseId}/courseWork", 5804 // "httpMethod": "POST", 5805 // "id": "classroom.courses.courseWork.create", 5806 // "parameterOrder": [ 5807 // "courseId" 5808 // ], 5809 // "parameters": { 5810 // "courseId": { 5811 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5812 // "location": "path", 5813 // "required": true, 5814 // "type": "string" 5815 // } 5816 // }, 5817 // "path": "v1/courses/{courseId}/courseWork", 5818 // "request": { 5819 // "$ref": "CourseWork" 5820 // }, 5821 // "response": { 5822 // "$ref": "CourseWork" 5823 // }, 5824 // "scopes": [ 5825 // "https://www.googleapis.com/auth/classroom.coursework.students" 5826 // ] 5827 // } 5828 5829} 5830 5831// method id "classroom.courses.courseWork.delete": 5832 5833type CoursesCourseWorkDeleteCall struct { 5834 s *Service 5835 courseId string 5836 id string 5837 urlParams_ gensupport.URLParams 5838 ctx_ context.Context 5839 header_ http.Header 5840} 5841 5842// Delete: Deletes a course work. This request must be made by the 5843// Developer Console project of the OAuth client ID 5844// (https://support.google.com/cloud/answer/6158849) used to create the 5845// corresponding course work item. This method returns the following 5846// error codes: * `PERMISSION_DENIED` if the requesting developer 5847// project did not create the corresponding course work, if the 5848// requesting user is not permitted to delete the requested course or 5849// for access errors. * `FAILED_PRECONDITION` if the requested course 5850// work has already been deleted. * `NOT_FOUND` if no course exists with 5851// the requested ID. 5852// 5853// - courseId: Identifier of the course. This identifier can be either 5854// the Classroom-assigned identifier or an alias. 5855// - id: Identifier of the course work to delete. This identifier is a 5856// Classroom-assigned identifier. 5857func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall { 5858 c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5859 c.courseId = courseId 5860 c.id = id 5861 return c 5862} 5863 5864// Fields allows partial responses to be retrieved. See 5865// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5866// for more information. 5867func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall { 5868 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5869 return c 5870} 5871 5872// Context sets the context to be used in this call's Do method. Any 5873// pending HTTP request will be aborted if the provided context is 5874// canceled. 5875func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall { 5876 c.ctx_ = ctx 5877 return c 5878} 5879 5880// Header returns an http.Header that can be modified by the caller to 5881// add HTTP headers to the request. 5882func (c *CoursesCourseWorkDeleteCall) Header() http.Header { 5883 if c.header_ == nil { 5884 c.header_ = make(http.Header) 5885 } 5886 return c.header_ 5887} 5888 5889func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) { 5890 reqHeaders := make(http.Header) 5891 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 5892 for k, v := range c.header_ { 5893 reqHeaders[k] = v 5894 } 5895 reqHeaders.Set("User-Agent", c.s.userAgent()) 5896 var body io.Reader = nil 5897 c.urlParams_.Set("alt", alt) 5898 c.urlParams_.Set("prettyPrint", "false") 5899 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 5900 urls += "?" + c.urlParams_.Encode() 5901 req, err := http.NewRequest("DELETE", urls, body) 5902 if err != nil { 5903 return nil, err 5904 } 5905 req.Header = reqHeaders 5906 googleapi.Expand(req.URL, map[string]string{ 5907 "courseId": c.courseId, 5908 "id": c.id, 5909 }) 5910 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5911} 5912 5913// Do executes the "classroom.courses.courseWork.delete" call. 5914// Exactly one of *Empty or error will be non-nil. Any non-2xx status 5915// code is an error. Response headers are in either 5916// *Empty.ServerResponse.Header or (if a response was returned at all) 5917// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5918// check whether the returned error was because http.StatusNotModified 5919// was returned. 5920func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 5921 gensupport.SetOptions(c.urlParams_, opts...) 5922 res, err := c.doRequest("json") 5923 if res != nil && res.StatusCode == http.StatusNotModified { 5924 if res.Body != nil { 5925 res.Body.Close() 5926 } 5927 return nil, &googleapi.Error{ 5928 Code: res.StatusCode, 5929 Header: res.Header, 5930 } 5931 } 5932 if err != nil { 5933 return nil, err 5934 } 5935 defer googleapi.CloseBody(res) 5936 if err := googleapi.CheckResponse(res); err != nil { 5937 return nil, err 5938 } 5939 ret := &Empty{ 5940 ServerResponse: googleapi.ServerResponse{ 5941 Header: res.Header, 5942 HTTPStatusCode: res.StatusCode, 5943 }, 5944 } 5945 target := &ret 5946 if err := gensupport.DecodeResponse(target, res); err != nil { 5947 return nil, err 5948 } 5949 return ret, nil 5950 // { 5951 // "description": "Deletes a course work. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the requesting user is not permitted to delete the requested course or for access errors. * `FAILED_PRECONDITION` if the requested course work has already been deleted. * `NOT_FOUND` if no course exists with the requested ID.", 5952 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 5953 // "httpMethod": "DELETE", 5954 // "id": "classroom.courses.courseWork.delete", 5955 // "parameterOrder": [ 5956 // "courseId", 5957 // "id" 5958 // ], 5959 // "parameters": { 5960 // "courseId": { 5961 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 5962 // "location": "path", 5963 // "required": true, 5964 // "type": "string" 5965 // }, 5966 // "id": { 5967 // "description": "Identifier of the course work to delete. This identifier is a Classroom-assigned identifier.", 5968 // "location": "path", 5969 // "required": true, 5970 // "type": "string" 5971 // } 5972 // }, 5973 // "path": "v1/courses/{courseId}/courseWork/{id}", 5974 // "response": { 5975 // "$ref": "Empty" 5976 // }, 5977 // "scopes": [ 5978 // "https://www.googleapis.com/auth/classroom.coursework.students" 5979 // ] 5980 // } 5981 5982} 5983 5984// method id "classroom.courses.courseWork.get": 5985 5986type CoursesCourseWorkGetCall struct { 5987 s *Service 5988 courseId string 5989 id string 5990 urlParams_ gensupport.URLParams 5991 ifNoneMatch_ string 5992 ctx_ context.Context 5993 header_ http.Header 5994} 5995 5996// Get: Returns course work. This method returns the following error 5997// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 5998// to access the requested course or course work, or for access errors. 5999// * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if 6000// the requested course or course work does not exist. 6001// 6002// - courseId: Identifier of the course. This identifier can be either 6003// the Classroom-assigned identifier or an alias. 6004// - id: Identifier of the course work. 6005func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall { 6006 c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6007 c.courseId = courseId 6008 c.id = id 6009 return c 6010} 6011 6012// Fields allows partial responses to be retrieved. See 6013// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6014// for more information. 6015func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall { 6016 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6017 return c 6018} 6019 6020// IfNoneMatch sets the optional parameter which makes the operation 6021// fail if the object's ETag matches the given value. This is useful for 6022// getting updates only after the object has changed since the last 6023// request. Use googleapi.IsNotModified to check whether the response 6024// error from Do is the result of In-None-Match. 6025func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall { 6026 c.ifNoneMatch_ = entityTag 6027 return c 6028} 6029 6030// Context sets the context to be used in this call's Do method. Any 6031// pending HTTP request will be aborted if the provided context is 6032// canceled. 6033func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall { 6034 c.ctx_ = ctx 6035 return c 6036} 6037 6038// Header returns an http.Header that can be modified by the caller to 6039// add HTTP headers to the request. 6040func (c *CoursesCourseWorkGetCall) Header() http.Header { 6041 if c.header_ == nil { 6042 c.header_ = make(http.Header) 6043 } 6044 return c.header_ 6045} 6046 6047func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) { 6048 reqHeaders := make(http.Header) 6049 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 6050 for k, v := range c.header_ { 6051 reqHeaders[k] = v 6052 } 6053 reqHeaders.Set("User-Agent", c.s.userAgent()) 6054 if c.ifNoneMatch_ != "" { 6055 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6056 } 6057 var body io.Reader = nil 6058 c.urlParams_.Set("alt", alt) 6059 c.urlParams_.Set("prettyPrint", "false") 6060 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6061 urls += "?" + c.urlParams_.Encode() 6062 req, err := http.NewRequest("GET", urls, body) 6063 if err != nil { 6064 return nil, err 6065 } 6066 req.Header = reqHeaders 6067 googleapi.Expand(req.URL, map[string]string{ 6068 "courseId": c.courseId, 6069 "id": c.id, 6070 }) 6071 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6072} 6073 6074// Do executes the "classroom.courses.courseWork.get" call. 6075// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6076// status code is an error. Response headers are in either 6077// *CourseWork.ServerResponse.Header or (if a response was returned at 6078// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6079// to check whether the returned error was because 6080// http.StatusNotModified was returned. 6081func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6082 gensupport.SetOptions(c.urlParams_, opts...) 6083 res, err := c.doRequest("json") 6084 if res != nil && res.StatusCode == http.StatusNotModified { 6085 if res.Body != nil { 6086 res.Body.Close() 6087 } 6088 return nil, &googleapi.Error{ 6089 Code: res.StatusCode, 6090 Header: res.Header, 6091 } 6092 } 6093 if err != nil { 6094 return nil, err 6095 } 6096 defer googleapi.CloseBody(res) 6097 if err := googleapi.CheckResponse(res); err != nil { 6098 return nil, err 6099 } 6100 ret := &CourseWork{ 6101 ServerResponse: googleapi.ServerResponse{ 6102 Header: res.Header, 6103 HTTPStatusCode: res.StatusCode, 6104 }, 6105 } 6106 target := &ret 6107 if err := gensupport.DecodeResponse(target, res); err != nil { 6108 return nil, err 6109 } 6110 return ret, nil 6111 // { 6112 // "description": "Returns course work. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work does not exist.", 6113 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6114 // "httpMethod": "GET", 6115 // "id": "classroom.courses.courseWork.get", 6116 // "parameterOrder": [ 6117 // "courseId", 6118 // "id" 6119 // ], 6120 // "parameters": { 6121 // "courseId": { 6122 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6123 // "location": "path", 6124 // "required": true, 6125 // "type": "string" 6126 // }, 6127 // "id": { 6128 // "description": "Identifier of the course work.", 6129 // "location": "path", 6130 // "required": true, 6131 // "type": "string" 6132 // } 6133 // }, 6134 // "path": "v1/courses/{courseId}/courseWork/{id}", 6135 // "response": { 6136 // "$ref": "CourseWork" 6137 // }, 6138 // "scopes": [ 6139 // "https://www.googleapis.com/auth/classroom.coursework.me", 6140 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6141 // "https://www.googleapis.com/auth/classroom.coursework.students", 6142 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6143 // ] 6144 // } 6145 6146} 6147 6148// method id "classroom.courses.courseWork.list": 6149 6150type CoursesCourseWorkListCall struct { 6151 s *Service 6152 courseId string 6153 urlParams_ gensupport.URLParams 6154 ifNoneMatch_ string 6155 ctx_ context.Context 6156 header_ http.Header 6157} 6158 6159// List: Returns a list of course work that the requester is permitted 6160// to view. Course students may only view `PUBLISHED` course work. 6161// Course teachers and domain administrators may view all course work. 6162// This method returns the following error codes: * `PERMISSION_DENIED` 6163// if the requesting user is not permitted to access the requested 6164// course or for access errors. * `INVALID_ARGUMENT` if the request is 6165// malformed. * `NOT_FOUND` if the requested course does not exist. 6166// 6167// - courseId: Identifier of the course. This identifier can be either 6168// the Classroom-assigned identifier or an alias. 6169func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall { 6170 c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6171 c.courseId = courseId 6172 return c 6173} 6174 6175// CourseWorkStates sets the optional parameter "courseWorkStates": 6176// Restriction on the work status to return. Only courseWork that 6177// matches is returned. If unspecified, items with a work status of 6178// `PUBLISHED` is returned. 6179// 6180// Possible values: 6181// "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never 6182// returned. 6183// "PUBLISHED" - Status for work that has been published. This is the 6184// default state. 6185// "DRAFT" - Status for work that is not yet published. Work in this 6186// state is visible only to course teachers and domain administrators. 6187// "DELETED" - Status for work that was published but is now deleted. 6188// Work in this state is visible only to course teachers and domain 6189// administrators. Work in this state is deleted after some time. 6190func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall { 6191 c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...)) 6192 return c 6193} 6194 6195// OrderBy sets the optional parameter "orderBy": Optional sort ordering 6196// for results. A comma-separated list of fields with an optional sort 6197// direction keyword. Supported fields are `updateTime` and `dueDate`. 6198// Supported direction keywords are `asc` and `desc`. If not specified, 6199// `updateTime desc` is the default behavior. Examples: `dueDate 6200// asc,updateTime desc`, `updateTime,dueDate desc` 6201func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall { 6202 c.urlParams_.Set("orderBy", orderBy) 6203 return c 6204} 6205 6206// PageSize sets the optional parameter "pageSize": Maximum number of 6207// items to return. Zero or unspecified indicates that the server may 6208// assign a maximum. The server may return fewer than the specified 6209// number of results. 6210func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall { 6211 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6212 return c 6213} 6214 6215// PageToken sets the optional parameter "pageToken": nextPageToken 6216// value returned from a previous list call, indicating that the 6217// subsequent page of results should be returned. The list request must 6218// be otherwise identical to the one that resulted in this token. 6219func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall { 6220 c.urlParams_.Set("pageToken", pageToken) 6221 return c 6222} 6223 6224// Fields allows partial responses to be retrieved. See 6225// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6226// for more information. 6227func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall { 6228 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6229 return c 6230} 6231 6232// IfNoneMatch sets the optional parameter which makes the operation 6233// fail if the object's ETag matches the given value. This is useful for 6234// getting updates only after the object has changed since the last 6235// request. Use googleapi.IsNotModified to check whether the response 6236// error from Do is the result of In-None-Match. 6237func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall { 6238 c.ifNoneMatch_ = entityTag 6239 return c 6240} 6241 6242// Context sets the context to be used in this call's Do method. Any 6243// pending HTTP request will be aborted if the provided context is 6244// canceled. 6245func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall { 6246 c.ctx_ = ctx 6247 return c 6248} 6249 6250// Header returns an http.Header that can be modified by the caller to 6251// add HTTP headers to the request. 6252func (c *CoursesCourseWorkListCall) Header() http.Header { 6253 if c.header_ == nil { 6254 c.header_ = make(http.Header) 6255 } 6256 return c.header_ 6257} 6258 6259func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) { 6260 reqHeaders := make(http.Header) 6261 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 6262 for k, v := range c.header_ { 6263 reqHeaders[k] = v 6264 } 6265 reqHeaders.Set("User-Agent", c.s.userAgent()) 6266 if c.ifNoneMatch_ != "" { 6267 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6268 } 6269 var body io.Reader = nil 6270 c.urlParams_.Set("alt", alt) 6271 c.urlParams_.Set("prettyPrint", "false") 6272 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork") 6273 urls += "?" + c.urlParams_.Encode() 6274 req, err := http.NewRequest("GET", urls, body) 6275 if err != nil { 6276 return nil, err 6277 } 6278 req.Header = reqHeaders 6279 googleapi.Expand(req.URL, map[string]string{ 6280 "courseId": c.courseId, 6281 }) 6282 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6283} 6284 6285// Do executes the "classroom.courses.courseWork.list" call. 6286// Exactly one of *ListCourseWorkResponse or error will be non-nil. Any 6287// non-2xx status code is an error. Response headers are in either 6288// *ListCourseWorkResponse.ServerResponse.Header or (if a response was 6289// returned at all) in error.(*googleapi.Error).Header. Use 6290// googleapi.IsNotModified to check whether the returned error was 6291// because http.StatusNotModified was returned. 6292func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) { 6293 gensupport.SetOptions(c.urlParams_, opts...) 6294 res, err := c.doRequest("json") 6295 if res != nil && res.StatusCode == http.StatusNotModified { 6296 if res.Body != nil { 6297 res.Body.Close() 6298 } 6299 return nil, &googleapi.Error{ 6300 Code: res.StatusCode, 6301 Header: res.Header, 6302 } 6303 } 6304 if err != nil { 6305 return nil, err 6306 } 6307 defer googleapi.CloseBody(res) 6308 if err := googleapi.CheckResponse(res); err != nil { 6309 return nil, err 6310 } 6311 ret := &ListCourseWorkResponse{ 6312 ServerResponse: googleapi.ServerResponse{ 6313 Header: res.Header, 6314 HTTPStatusCode: res.StatusCode, 6315 }, 6316 } 6317 target := &ret 6318 if err := gensupport.DecodeResponse(target, res); err != nil { 6319 return nil, err 6320 } 6321 return ret, nil 6322 // { 6323 // "description": "Returns a list of course work that the requester is permitted to view. Course students may only view `PUBLISHED` course work. Course teachers and domain administrators may view all course work. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 6324 // "flatPath": "v1/courses/{courseId}/courseWork", 6325 // "httpMethod": "GET", 6326 // "id": "classroom.courses.courseWork.list", 6327 // "parameterOrder": [ 6328 // "courseId" 6329 // ], 6330 // "parameters": { 6331 // "courseId": { 6332 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6333 // "location": "path", 6334 // "required": true, 6335 // "type": "string" 6336 // }, 6337 // "courseWorkStates": { 6338 // "description": "Restriction on the work status to return. Only courseWork that matches is returned. If unspecified, items with a work status of `PUBLISHED` is returned.", 6339 // "enum": [ 6340 // "COURSE_WORK_STATE_UNSPECIFIED", 6341 // "PUBLISHED", 6342 // "DRAFT", 6343 // "DELETED" 6344 // ], 6345 // "enumDescriptions": [ 6346 // "No state specified. This is never returned.", 6347 // "Status for work that has been published. This is the default state.", 6348 // "Status for work that is not yet published. Work in this state is visible only to course teachers and domain administrators.", 6349 // "Status for work that was published but is now deleted. Work in this state is visible only to course teachers and domain administrators. Work in this state is deleted after some time." 6350 // ], 6351 // "location": "query", 6352 // "repeated": true, 6353 // "type": "string" 6354 // }, 6355 // "orderBy": { 6356 // "description": "Optional sort ordering for results. A comma-separated list of fields with an optional sort direction keyword. Supported fields are `updateTime` and `dueDate`. Supported direction keywords are `asc` and `desc`. If not specified, `updateTime desc` is the default behavior. Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc`", 6357 // "location": "query", 6358 // "type": "string" 6359 // }, 6360 // "pageSize": { 6361 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 6362 // "format": "int32", 6363 // "location": "query", 6364 // "type": "integer" 6365 // }, 6366 // "pageToken": { 6367 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 6368 // "location": "query", 6369 // "type": "string" 6370 // } 6371 // }, 6372 // "path": "v1/courses/{courseId}/courseWork", 6373 // "response": { 6374 // "$ref": "ListCourseWorkResponse" 6375 // }, 6376 // "scopes": [ 6377 // "https://www.googleapis.com/auth/classroom.coursework.me", 6378 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6379 // "https://www.googleapis.com/auth/classroom.coursework.students", 6380 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly" 6381 // ] 6382 // } 6383 6384} 6385 6386// Pages invokes f for each page of results. 6387// A non-nil error returned from f will halt the iteration. 6388// The provided context supersedes any context provided to the Context method. 6389func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error { 6390 c.ctx_ = ctx 6391 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6392 for { 6393 x, err := c.Do() 6394 if err != nil { 6395 return err 6396 } 6397 if err := f(x); err != nil { 6398 return err 6399 } 6400 if x.NextPageToken == "" { 6401 return nil 6402 } 6403 c.PageToken(x.NextPageToken) 6404 } 6405} 6406 6407// method id "classroom.courses.courseWork.modifyAssignees": 6408 6409type CoursesCourseWorkModifyAssigneesCall struct { 6410 s *Service 6411 courseId string 6412 id string 6413 modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest 6414 urlParams_ gensupport.URLParams 6415 ctx_ context.Context 6416 header_ http.Header 6417} 6418 6419// ModifyAssignees: Modifies assignee mode and options of a coursework. 6420// Only a teacher of the course that contains the coursework may call 6421// this method. This method returns the following error codes: * 6422// `PERMISSION_DENIED` if the requesting user is not permitted to access 6423// the requested course or course work or for access errors. * 6424// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 6425// requested course or course work does not exist. 6426// 6427// - courseId: Identifier of the course. This identifier can be either 6428// the Classroom-assigned identifier or an alias. 6429// - id: Identifier of the coursework. 6430func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall { 6431 c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6432 c.courseId = courseId 6433 c.id = id 6434 c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest 6435 return c 6436} 6437 6438// Fields allows partial responses to be retrieved. See 6439// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6440// for more information. 6441func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall { 6442 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6443 return c 6444} 6445 6446// Context sets the context to be used in this call's Do method. Any 6447// pending HTTP request will be aborted if the provided context is 6448// canceled. 6449func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall { 6450 c.ctx_ = ctx 6451 return c 6452} 6453 6454// Header returns an http.Header that can be modified by the caller to 6455// add HTTP headers to the request. 6456func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header { 6457 if c.header_ == nil { 6458 c.header_ = make(http.Header) 6459 } 6460 return c.header_ 6461} 6462 6463func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) { 6464 reqHeaders := make(http.Header) 6465 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 6466 for k, v := range c.header_ { 6467 reqHeaders[k] = v 6468 } 6469 reqHeaders.Set("User-Agent", c.s.userAgent()) 6470 var body io.Reader = nil 6471 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest) 6472 if err != nil { 6473 return nil, err 6474 } 6475 reqHeaders.Set("Content-Type", "application/json") 6476 c.urlParams_.Set("alt", alt) 6477 c.urlParams_.Set("prettyPrint", "false") 6478 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees") 6479 urls += "?" + c.urlParams_.Encode() 6480 req, err := http.NewRequest("POST", urls, body) 6481 if err != nil { 6482 return nil, err 6483 } 6484 req.Header = reqHeaders 6485 googleapi.Expand(req.URL, map[string]string{ 6486 "courseId": c.courseId, 6487 "id": c.id, 6488 }) 6489 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6490} 6491 6492// Do executes the "classroom.courses.courseWork.modifyAssignees" call. 6493// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6494// status code is an error. Response headers are in either 6495// *CourseWork.ServerResponse.Header or (if a response was returned at 6496// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6497// to check whether the returned error was because 6498// http.StatusNotModified was returned. 6499func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6500 gensupport.SetOptions(c.urlParams_, opts...) 6501 res, err := c.doRequest("json") 6502 if res != nil && res.StatusCode == http.StatusNotModified { 6503 if res.Body != nil { 6504 res.Body.Close() 6505 } 6506 return nil, &googleapi.Error{ 6507 Code: res.StatusCode, 6508 Header: res.Header, 6509 } 6510 } 6511 if err != nil { 6512 return nil, err 6513 } 6514 defer googleapi.CloseBody(res) 6515 if err := googleapi.CheckResponse(res); err != nil { 6516 return nil, err 6517 } 6518 ret := &CourseWork{ 6519 ServerResponse: googleapi.ServerResponse{ 6520 Header: res.Header, 6521 HTTPStatusCode: res.StatusCode, 6522 }, 6523 } 6524 target := &ret 6525 if err := gensupport.DecodeResponse(target, res); err != nil { 6526 return nil, err 6527 } 6528 return ret, nil 6529 // { 6530 // "description": "Modifies assignee mode and options of a coursework. Only a teacher of the course that contains the coursework may call this method. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work does not exist.", 6531 // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6532 // "httpMethod": "POST", 6533 // "id": "classroom.courses.courseWork.modifyAssignees", 6534 // "parameterOrder": [ 6535 // "courseId", 6536 // "id" 6537 // ], 6538 // "parameters": { 6539 // "courseId": { 6540 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6541 // "location": "path", 6542 // "required": true, 6543 // "type": "string" 6544 // }, 6545 // "id": { 6546 // "description": "Identifier of the coursework.", 6547 // "location": "path", 6548 // "required": true, 6549 // "type": "string" 6550 // } 6551 // }, 6552 // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees", 6553 // "request": { 6554 // "$ref": "ModifyCourseWorkAssigneesRequest" 6555 // }, 6556 // "response": { 6557 // "$ref": "CourseWork" 6558 // }, 6559 // "scopes": [ 6560 // "https://www.googleapis.com/auth/classroom.coursework.students" 6561 // ] 6562 // } 6563 6564} 6565 6566// method id "classroom.courses.courseWork.patch": 6567 6568type CoursesCourseWorkPatchCall struct { 6569 s *Service 6570 courseId string 6571 id string 6572 coursework *CourseWork 6573 urlParams_ gensupport.URLParams 6574 ctx_ context.Context 6575 header_ http.Header 6576} 6577 6578// Patch: Updates one or more fields of a course work. See 6579// google.classroom.v1.CourseWork for details of which fields may be 6580// updated and who may change them. This request must be made by the 6581// Developer Console project of the OAuth client ID 6582// (https://support.google.com/cloud/answer/6158849) used to create the 6583// corresponding course work item. This method returns the following 6584// error codes: * `PERMISSION_DENIED` if the requesting developer 6585// project did not create the corresponding course work, if the user is 6586// not permitted to make the requested modification to the student 6587// submission, or for access errors. * `INVALID_ARGUMENT` if the request 6588// is malformed. * `FAILED_PRECONDITION` if the requested course work 6589// has already been deleted. * `NOT_FOUND` if the requested course, 6590// course work, or student submission does not exist. 6591// 6592// - courseId: Identifier of the course. This identifier can be either 6593// the Classroom-assigned identifier or an alias. 6594// - id: Identifier of the course work. 6595func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall { 6596 c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6597 c.courseId = courseId 6598 c.id = id 6599 c.coursework = coursework 6600 return c 6601} 6602 6603// UpdateMask sets the optional parameter "updateMask": Mask that 6604// identifies which fields on the course work to update. This field is 6605// required to do an update. The update fails if invalid fields are 6606// specified. If a field supports empty values, it can be cleared by 6607// specifying it in the update mask and not in the CourseWork object. If 6608// a field that does not support empty values is included in the update 6609// mask and not set in the CourseWork object, an `INVALID_ARGUMENT` 6610// error is returned. The following fields may be specified by teachers: 6611// * `title` * `description` * `state` * `due_date` * `due_time` * 6612// `max_points` * `scheduled_time` * `submission_modification_mode` * 6613// `topic_id` 6614func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall { 6615 c.urlParams_.Set("updateMask", updateMask) 6616 return c 6617} 6618 6619// Fields allows partial responses to be retrieved. See 6620// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6621// for more information. 6622func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall { 6623 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6624 return c 6625} 6626 6627// Context sets the context to be used in this call's Do method. Any 6628// pending HTTP request will be aborted if the provided context is 6629// canceled. 6630func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall { 6631 c.ctx_ = ctx 6632 return c 6633} 6634 6635// Header returns an http.Header that can be modified by the caller to 6636// add HTTP headers to the request. 6637func (c *CoursesCourseWorkPatchCall) Header() http.Header { 6638 if c.header_ == nil { 6639 c.header_ = make(http.Header) 6640 } 6641 return c.header_ 6642} 6643 6644func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) { 6645 reqHeaders := make(http.Header) 6646 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 6647 for k, v := range c.header_ { 6648 reqHeaders[k] = v 6649 } 6650 reqHeaders.Set("User-Agent", c.s.userAgent()) 6651 var body io.Reader = nil 6652 body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework) 6653 if err != nil { 6654 return nil, err 6655 } 6656 reqHeaders.Set("Content-Type", "application/json") 6657 c.urlParams_.Set("alt", alt) 6658 c.urlParams_.Set("prettyPrint", "false") 6659 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}") 6660 urls += "?" + c.urlParams_.Encode() 6661 req, err := http.NewRequest("PATCH", urls, body) 6662 if err != nil { 6663 return nil, err 6664 } 6665 req.Header = reqHeaders 6666 googleapi.Expand(req.URL, map[string]string{ 6667 "courseId": c.courseId, 6668 "id": c.id, 6669 }) 6670 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6671} 6672 6673// Do executes the "classroom.courses.courseWork.patch" call. 6674// Exactly one of *CourseWork or error will be non-nil. Any non-2xx 6675// status code is an error. Response headers are in either 6676// *CourseWork.ServerResponse.Header or (if a response was returned at 6677// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6678// to check whether the returned error was because 6679// http.StatusNotModified was returned. 6680func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) { 6681 gensupport.SetOptions(c.urlParams_, opts...) 6682 res, err := c.doRequest("json") 6683 if res != nil && res.StatusCode == http.StatusNotModified { 6684 if res.Body != nil { 6685 res.Body.Close() 6686 } 6687 return nil, &googleapi.Error{ 6688 Code: res.StatusCode, 6689 Header: res.Header, 6690 } 6691 } 6692 if err != nil { 6693 return nil, err 6694 } 6695 defer googleapi.CloseBody(res) 6696 if err := googleapi.CheckResponse(res); err != nil { 6697 return nil, err 6698 } 6699 ret := &CourseWork{ 6700 ServerResponse: googleapi.ServerResponse{ 6701 Header: res.Header, 6702 HTTPStatusCode: res.StatusCode, 6703 }, 6704 } 6705 target := &ret 6706 if err := gensupport.DecodeResponse(target, res); err != nil { 6707 return nil, err 6708 } 6709 return ret, nil 6710 // { 6711 // "description": "Updates one or more fields of a course work. See google.classroom.v1.CourseWork for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the requested course work has already been deleted. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 6712 // "flatPath": "v1/courses/{courseId}/courseWork/{id}", 6713 // "httpMethod": "PATCH", 6714 // "id": "classroom.courses.courseWork.patch", 6715 // "parameterOrder": [ 6716 // "courseId", 6717 // "id" 6718 // ], 6719 // "parameters": { 6720 // "courseId": { 6721 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6722 // "location": "path", 6723 // "required": true, 6724 // "type": "string" 6725 // }, 6726 // "id": { 6727 // "description": "Identifier of the course work.", 6728 // "location": "path", 6729 // "required": true, 6730 // "type": "string" 6731 // }, 6732 // "updateMask": { 6733 // "description": "Mask that identifies which fields on the course work to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the CourseWork object. If a field that does not support empty values is included in the update mask and not set in the CourseWork object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified by teachers: * `title` * `description` * `state` * `due_date` * `due_time` * `max_points` * `scheduled_time` * `submission_modification_mode` * `topic_id`", 6734 // "format": "google-fieldmask", 6735 // "location": "query", 6736 // "type": "string" 6737 // } 6738 // }, 6739 // "path": "v1/courses/{courseId}/courseWork/{id}", 6740 // "request": { 6741 // "$ref": "CourseWork" 6742 // }, 6743 // "response": { 6744 // "$ref": "CourseWork" 6745 // }, 6746 // "scopes": [ 6747 // "https://www.googleapis.com/auth/classroom.coursework.students" 6748 // ] 6749 // } 6750 6751} 6752 6753// method id "classroom.courses.courseWork.studentSubmissions.get": 6754 6755type CoursesCourseWorkStudentSubmissionsGetCall struct { 6756 s *Service 6757 courseId string 6758 courseWorkId string 6759 id string 6760 urlParams_ gensupport.URLParams 6761 ifNoneMatch_ string 6762 ctx_ context.Context 6763 header_ http.Header 6764} 6765 6766// Get: Returns a student submission. * `PERMISSION_DENIED` if the 6767// requesting user is not permitted to access the requested course, 6768// course work, or student submission or for access errors. * 6769// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 6770// requested course, course work, or student submission does not exist. 6771// 6772// - courseId: Identifier of the course. This identifier can be either 6773// the Classroom-assigned identifier or an alias. 6774// - courseWorkId: Identifier of the course work. 6775// - id: Identifier of the student submission. 6776func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall { 6777 c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6778 c.courseId = courseId 6779 c.courseWorkId = courseWorkId 6780 c.id = id 6781 return c 6782} 6783 6784// Fields allows partial responses to be retrieved. See 6785// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6786// for more information. 6787func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall { 6788 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6789 return c 6790} 6791 6792// IfNoneMatch sets the optional parameter which makes the operation 6793// fail if the object's ETag matches the given value. This is useful for 6794// getting updates only after the object has changed since the last 6795// request. Use googleapi.IsNotModified to check whether the response 6796// error from Do is the result of In-None-Match. 6797func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall { 6798 c.ifNoneMatch_ = entityTag 6799 return c 6800} 6801 6802// Context sets the context to be used in this call's Do method. Any 6803// pending HTTP request will be aborted if the provided context is 6804// canceled. 6805func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall { 6806 c.ctx_ = ctx 6807 return c 6808} 6809 6810// Header returns an http.Header that can be modified by the caller to 6811// add HTTP headers to the request. 6812func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header { 6813 if c.header_ == nil { 6814 c.header_ = make(http.Header) 6815 } 6816 return c.header_ 6817} 6818 6819func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) { 6820 reqHeaders := make(http.Header) 6821 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 6822 for k, v := range c.header_ { 6823 reqHeaders[k] = v 6824 } 6825 reqHeaders.Set("User-Agent", c.s.userAgent()) 6826 if c.ifNoneMatch_ != "" { 6827 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6828 } 6829 var body io.Reader = nil 6830 c.urlParams_.Set("alt", alt) 6831 c.urlParams_.Set("prettyPrint", "false") 6832 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 6833 urls += "?" + c.urlParams_.Encode() 6834 req, err := http.NewRequest("GET", urls, body) 6835 if err != nil { 6836 return nil, err 6837 } 6838 req.Header = reqHeaders 6839 googleapi.Expand(req.URL, map[string]string{ 6840 "courseId": c.courseId, 6841 "courseWorkId": c.courseWorkId, 6842 "id": c.id, 6843 }) 6844 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6845} 6846 6847// Do executes the "classroom.courses.courseWork.studentSubmissions.get" call. 6848// Exactly one of *StudentSubmission or error will be non-nil. Any 6849// non-2xx status code is an error. Response headers are in either 6850// *StudentSubmission.ServerResponse.Header or (if a response was 6851// returned at all) in error.(*googleapi.Error).Header. Use 6852// googleapi.IsNotModified to check whether the returned error was 6853// because http.StatusNotModified was returned. 6854func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 6855 gensupport.SetOptions(c.urlParams_, opts...) 6856 res, err := c.doRequest("json") 6857 if res != nil && res.StatusCode == http.StatusNotModified { 6858 if res.Body != nil { 6859 res.Body.Close() 6860 } 6861 return nil, &googleapi.Error{ 6862 Code: res.StatusCode, 6863 Header: res.Header, 6864 } 6865 } 6866 if err != nil { 6867 return nil, err 6868 } 6869 defer googleapi.CloseBody(res) 6870 if err := googleapi.CheckResponse(res); err != nil { 6871 return nil, err 6872 } 6873 ret := &StudentSubmission{ 6874 ServerResponse: googleapi.ServerResponse{ 6875 Header: res.Header, 6876 HTTPStatusCode: res.StatusCode, 6877 }, 6878 } 6879 target := &ret 6880 if err := gensupport.DecodeResponse(target, res); err != nil { 6881 return nil, err 6882 } 6883 return ret, nil 6884 // { 6885 // "description": "Returns a student submission. * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, course work, or student submission or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 6886 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 6887 // "httpMethod": "GET", 6888 // "id": "classroom.courses.courseWork.studentSubmissions.get", 6889 // "parameterOrder": [ 6890 // "courseId", 6891 // "courseWorkId", 6892 // "id" 6893 // ], 6894 // "parameters": { 6895 // "courseId": { 6896 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 6897 // "location": "path", 6898 // "required": true, 6899 // "type": "string" 6900 // }, 6901 // "courseWorkId": { 6902 // "description": "Identifier of the course work.", 6903 // "location": "path", 6904 // "required": true, 6905 // "type": "string" 6906 // }, 6907 // "id": { 6908 // "description": "Identifier of the student submission.", 6909 // "location": "path", 6910 // "required": true, 6911 // "type": "string" 6912 // } 6913 // }, 6914 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 6915 // "response": { 6916 // "$ref": "StudentSubmission" 6917 // }, 6918 // "scopes": [ 6919 // "https://www.googleapis.com/auth/classroom.coursework.me", 6920 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 6921 // "https://www.googleapis.com/auth/classroom.coursework.students", 6922 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 6923 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 6924 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 6925 // ] 6926 // } 6927 6928} 6929 6930// method id "classroom.courses.courseWork.studentSubmissions.list": 6931 6932type CoursesCourseWorkStudentSubmissionsListCall struct { 6933 s *Service 6934 courseId string 6935 courseWorkId string 6936 urlParams_ gensupport.URLParams 6937 ifNoneMatch_ string 6938 ctx_ context.Context 6939 header_ http.Header 6940} 6941 6942// List: Returns a list of student submissions that the requester is 6943// permitted to view, factoring in the OAuth scopes of the request. `-` 6944// may be specified as the `course_work_id` to include student 6945// submissions for multiple course work items. Course students may only 6946// view their own work. Course teachers and domain administrators may 6947// view all student submissions. This method returns the following error 6948// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 6949// to access the requested course or course work, or for access errors. 6950// * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if 6951// the requested course does not exist. 6952// 6953// - courseId: Identifier of the course. This identifier can be either 6954// the Classroom-assigned identifier or an alias. 6955// - courseWorkId: Identifier of the student work to request. This may 6956// be set to the string literal "-" to request student work for all 6957// course work in the specified course. 6958func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall { 6959 c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6960 c.courseId = courseId 6961 c.courseWorkId = courseWorkId 6962 return c 6963} 6964 6965// Late sets the optional parameter "late": Requested lateness value. If 6966// specified, returned student submissions are restricted by the 6967// requested value. If unspecified, submissions are returned regardless 6968// of `late` value. 6969// 6970// Possible values: 6971// "LATE_VALUES_UNSPECIFIED" - No restriction on submission late 6972// values specified. 6973// "LATE_ONLY" - Return StudentSubmissions where late is true. 6974// "NOT_LATE_ONLY" - Return StudentSubmissions where late is false. 6975func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall { 6976 c.urlParams_.Set("late", late) 6977 return c 6978} 6979 6980// PageSize sets the optional parameter "pageSize": Maximum number of 6981// items to return. Zero or unspecified indicates that the server may 6982// assign a maximum. The server may return fewer than the specified 6983// number of results. 6984func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall { 6985 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6986 return c 6987} 6988 6989// PageToken sets the optional parameter "pageToken": nextPageToken 6990// value returned from a previous list call, indicating that the 6991// subsequent page of results should be returned. The list request must 6992// be otherwise identical to the one that resulted in this token. 6993func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall { 6994 c.urlParams_.Set("pageToken", pageToken) 6995 return c 6996} 6997 6998// States sets the optional parameter "states": Requested submission 6999// states. If specified, returned student submissions match one of the 7000// specified submission states. 7001// 7002// Possible values: 7003// "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should 7004// never be returned. 7005// "NEW" - The student has never accessed this submission. Attachments 7006// are not returned and timestamps is not set. 7007// "CREATED" - Has been created. 7008// "TURNED_IN" - Has been turned in to the teacher. 7009// "RETURNED" - Has been returned to the student. 7010// "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the 7011// assignment. 7012func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall { 7013 c.urlParams_.SetMulti("states", append([]string{}, states...)) 7014 return c 7015} 7016 7017// UserId sets the optional parameter "userId": Optional argument to 7018// restrict returned student work to those owned by the student with the 7019// specified identifier. The identifier can be one of the following: * 7020// the numeric identifier for the user * the email address of the user * 7021// the string literal "me", indicating the requesting user 7022func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall { 7023 c.urlParams_.Set("userId", userId) 7024 return c 7025} 7026 7027// Fields allows partial responses to be retrieved. See 7028// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7029// for more information. 7030func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall { 7031 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7032 return c 7033} 7034 7035// IfNoneMatch sets the optional parameter which makes the operation 7036// fail if the object's ETag matches the given value. This is useful for 7037// getting updates only after the object has changed since the last 7038// request. Use googleapi.IsNotModified to check whether the response 7039// error from Do is the result of In-None-Match. 7040func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall { 7041 c.ifNoneMatch_ = entityTag 7042 return c 7043} 7044 7045// Context sets the context to be used in this call's Do method. Any 7046// pending HTTP request will be aborted if the provided context is 7047// canceled. 7048func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall { 7049 c.ctx_ = ctx 7050 return c 7051} 7052 7053// Header returns an http.Header that can be modified by the caller to 7054// add HTTP headers to the request. 7055func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header { 7056 if c.header_ == nil { 7057 c.header_ = make(http.Header) 7058 } 7059 return c.header_ 7060} 7061 7062func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) { 7063 reqHeaders := make(http.Header) 7064 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 7065 for k, v := range c.header_ { 7066 reqHeaders[k] = v 7067 } 7068 reqHeaders.Set("User-Agent", c.s.userAgent()) 7069 if c.ifNoneMatch_ != "" { 7070 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7071 } 7072 var body io.Reader = nil 7073 c.urlParams_.Set("alt", alt) 7074 c.urlParams_.Set("prettyPrint", "false") 7075 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions") 7076 urls += "?" + c.urlParams_.Encode() 7077 req, err := http.NewRequest("GET", urls, body) 7078 if err != nil { 7079 return nil, err 7080 } 7081 req.Header = reqHeaders 7082 googleapi.Expand(req.URL, map[string]string{ 7083 "courseId": c.courseId, 7084 "courseWorkId": c.courseWorkId, 7085 }) 7086 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7087} 7088 7089// Do executes the "classroom.courses.courseWork.studentSubmissions.list" call. 7090// Exactly one of *ListStudentSubmissionsResponse or error will be 7091// non-nil. Any non-2xx status code is an error. Response headers are in 7092// either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a 7093// response was returned at all) in error.(*googleapi.Error).Header. Use 7094// googleapi.IsNotModified to check whether the returned error was 7095// because http.StatusNotModified was returned. 7096func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) { 7097 gensupport.SetOptions(c.urlParams_, opts...) 7098 res, err := c.doRequest("json") 7099 if res != nil && res.StatusCode == http.StatusNotModified { 7100 if res.Body != nil { 7101 res.Body.Close() 7102 } 7103 return nil, &googleapi.Error{ 7104 Code: res.StatusCode, 7105 Header: res.Header, 7106 } 7107 } 7108 if err != nil { 7109 return nil, err 7110 } 7111 defer googleapi.CloseBody(res) 7112 if err := googleapi.CheckResponse(res); err != nil { 7113 return nil, err 7114 } 7115 ret := &ListStudentSubmissionsResponse{ 7116 ServerResponse: googleapi.ServerResponse{ 7117 Header: res.Header, 7118 HTTPStatusCode: res.StatusCode, 7119 }, 7120 } 7121 target := &ret 7122 if err := gensupport.DecodeResponse(target, res); err != nil { 7123 return nil, err 7124 } 7125 return ret, nil 7126 // { 7127 // "description": "Returns a list of student submissions that the requester is permitted to view, factoring in the OAuth scopes of the request. `-` may be specified as the `course_work_id` to include student submissions for multiple course work items. Course students may only view their own work. Course teachers and domain administrators may view all student submissions. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 7128 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7129 // "httpMethod": "GET", 7130 // "id": "classroom.courses.courseWork.studentSubmissions.list", 7131 // "parameterOrder": [ 7132 // "courseId", 7133 // "courseWorkId" 7134 // ], 7135 // "parameters": { 7136 // "courseId": { 7137 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7138 // "location": "path", 7139 // "required": true, 7140 // "type": "string" 7141 // }, 7142 // "courseWorkId": { 7143 // "description": "Identifier of the student work to request. This may be set to the string literal `\"-\"` to request student work for all course work in the specified course.", 7144 // "location": "path", 7145 // "required": true, 7146 // "type": "string" 7147 // }, 7148 // "late": { 7149 // "description": "Requested lateness value. If specified, returned student submissions are restricted by the requested value. If unspecified, submissions are returned regardless of `late` value.", 7150 // "enum": [ 7151 // "LATE_VALUES_UNSPECIFIED", 7152 // "LATE_ONLY", 7153 // "NOT_LATE_ONLY" 7154 // ], 7155 // "enumDescriptions": [ 7156 // "No restriction on submission late values specified.", 7157 // "Return StudentSubmissions where late is true.", 7158 // "Return StudentSubmissions where late is false." 7159 // ], 7160 // "location": "query", 7161 // "type": "string" 7162 // }, 7163 // "pageSize": { 7164 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 7165 // "format": "int32", 7166 // "location": "query", 7167 // "type": "integer" 7168 // }, 7169 // "pageToken": { 7170 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 7171 // "location": "query", 7172 // "type": "string" 7173 // }, 7174 // "states": { 7175 // "description": "Requested submission states. If specified, returned student submissions match one of the specified submission states.", 7176 // "enum": [ 7177 // "SUBMISSION_STATE_UNSPECIFIED", 7178 // "NEW", 7179 // "CREATED", 7180 // "TURNED_IN", 7181 // "RETURNED", 7182 // "RECLAIMED_BY_STUDENT" 7183 // ], 7184 // "enumDescriptions": [ 7185 // "No state specified. This should never be returned.", 7186 // "The student has never accessed this submission. Attachments are not returned and timestamps is not set.", 7187 // "Has been created.", 7188 // "Has been turned in to the teacher.", 7189 // "Has been returned to the student.", 7190 // "Student chose to \"unsubmit\" the assignment." 7191 // ], 7192 // "location": "query", 7193 // "repeated": true, 7194 // "type": "string" 7195 // }, 7196 // "userId": { 7197 // "description": "Optional argument to restrict returned student work to those owned by the student with the specified identifier. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 7198 // "location": "query", 7199 // "type": "string" 7200 // } 7201 // }, 7202 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions", 7203 // "response": { 7204 // "$ref": "ListStudentSubmissionsResponse" 7205 // }, 7206 // "scopes": [ 7207 // "https://www.googleapis.com/auth/classroom.coursework.me", 7208 // "https://www.googleapis.com/auth/classroom.coursework.me.readonly", 7209 // "https://www.googleapis.com/auth/classroom.coursework.students", 7210 // "https://www.googleapis.com/auth/classroom.coursework.students.readonly", 7211 // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", 7212 // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly" 7213 // ] 7214 // } 7215 7216} 7217 7218// Pages invokes f for each page of results. 7219// A non-nil error returned from f will halt the iteration. 7220// The provided context supersedes any context provided to the Context method. 7221func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error { 7222 c.ctx_ = ctx 7223 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7224 for { 7225 x, err := c.Do() 7226 if err != nil { 7227 return err 7228 } 7229 if err := f(x); err != nil { 7230 return err 7231 } 7232 if x.NextPageToken == "" { 7233 return nil 7234 } 7235 c.PageToken(x.NextPageToken) 7236 } 7237} 7238 7239// method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments": 7240 7241type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct { 7242 s *Service 7243 courseId string 7244 courseWorkId string 7245 id string 7246 modifyattachmentsrequest *ModifyAttachmentsRequest 7247 urlParams_ gensupport.URLParams 7248 ctx_ context.Context 7249 header_ http.Header 7250} 7251 7252// ModifyAttachments: Modifies attachments of student submission. 7253// Attachments may only be added to student submissions belonging to 7254// course work objects with a `workType` of `ASSIGNMENT`. This request 7255// must be made by the Developer Console project of the OAuth client ID 7256// (https://support.google.com/cloud/answer/6158849) used to create the 7257// corresponding course work item. This method returns the following 7258// error codes: * `PERMISSION_DENIED` if the requesting user is not 7259// permitted to access the requested course or course work, if the user 7260// is not permitted to modify attachments on the requested student 7261// submission, or for access errors. * `INVALID_ARGUMENT` if the request 7262// is malformed. * `NOT_FOUND` if the requested course, course work, or 7263// student submission does not exist. 7264// 7265// - courseId: Identifier of the course. This identifier can be either 7266// the Classroom-assigned identifier or an alias. 7267// - courseWorkId: Identifier of the course work. 7268// - id: Identifier of the student submission. 7269func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7270 c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7271 c.courseId = courseId 7272 c.courseWorkId = courseWorkId 7273 c.id = id 7274 c.modifyattachmentsrequest = modifyattachmentsrequest 7275 return c 7276} 7277 7278// Fields allows partial responses to be retrieved. See 7279// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7280// for more information. 7281func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7282 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7283 return c 7284} 7285 7286// Context sets the context to be used in this call's Do method. Any 7287// pending HTTP request will be aborted if the provided context is 7288// canceled. 7289func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall { 7290 c.ctx_ = ctx 7291 return c 7292} 7293 7294// Header returns an http.Header that can be modified by the caller to 7295// add HTTP headers to the request. 7296func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header { 7297 if c.header_ == nil { 7298 c.header_ = make(http.Header) 7299 } 7300 return c.header_ 7301} 7302 7303func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) { 7304 reqHeaders := make(http.Header) 7305 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 7306 for k, v := range c.header_ { 7307 reqHeaders[k] = v 7308 } 7309 reqHeaders.Set("User-Agent", c.s.userAgent()) 7310 var body io.Reader = nil 7311 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest) 7312 if err != nil { 7313 return nil, err 7314 } 7315 reqHeaders.Set("Content-Type", "application/json") 7316 c.urlParams_.Set("alt", alt) 7317 c.urlParams_.Set("prettyPrint", "false") 7318 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments") 7319 urls += "?" + c.urlParams_.Encode() 7320 req, err := http.NewRequest("POST", urls, body) 7321 if err != nil { 7322 return nil, err 7323 } 7324 req.Header = reqHeaders 7325 googleapi.Expand(req.URL, map[string]string{ 7326 "courseId": c.courseId, 7327 "courseWorkId": c.courseWorkId, 7328 "id": c.id, 7329 }) 7330 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7331} 7332 7333// Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call. 7334// Exactly one of *StudentSubmission or error will be non-nil. Any 7335// non-2xx status code is an error. Response headers are in either 7336// *StudentSubmission.ServerResponse.Header or (if a response was 7337// returned at all) in error.(*googleapi.Error).Header. Use 7338// googleapi.IsNotModified to check whether the returned error was 7339// because http.StatusNotModified was returned. 7340func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7341 gensupport.SetOptions(c.urlParams_, opts...) 7342 res, err := c.doRequest("json") 7343 if res != nil && res.StatusCode == http.StatusNotModified { 7344 if res.Body != nil { 7345 res.Body.Close() 7346 } 7347 return nil, &googleapi.Error{ 7348 Code: res.StatusCode, 7349 Header: res.Header, 7350 } 7351 } 7352 if err != nil { 7353 return nil, err 7354 } 7355 defer googleapi.CloseBody(res) 7356 if err := googleapi.CheckResponse(res); err != nil { 7357 return nil, err 7358 } 7359 ret := &StudentSubmission{ 7360 ServerResponse: googleapi.ServerResponse{ 7361 Header: res.Header, 7362 HTTPStatusCode: res.StatusCode, 7363 }, 7364 } 7365 target := &ret 7366 if err := gensupport.DecodeResponse(target, res); err != nil { 7367 return nil, err 7368 } 7369 return ret, nil 7370 // { 7371 // "description": "Modifies attachments of student submission. Attachments may only be added to student submissions belonging to course work objects with a `workType` of `ASSIGNMENT`. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, if the user is not permitted to modify attachments on the requested student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7372 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7373 // "httpMethod": "POST", 7374 // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments", 7375 // "parameterOrder": [ 7376 // "courseId", 7377 // "courseWorkId", 7378 // "id" 7379 // ], 7380 // "parameters": { 7381 // "courseId": { 7382 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7383 // "location": "path", 7384 // "required": true, 7385 // "type": "string" 7386 // }, 7387 // "courseWorkId": { 7388 // "description": "Identifier of the course work.", 7389 // "location": "path", 7390 // "required": true, 7391 // "type": "string" 7392 // }, 7393 // "id": { 7394 // "description": "Identifier of the student submission.", 7395 // "location": "path", 7396 // "required": true, 7397 // "type": "string" 7398 // } 7399 // }, 7400 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments", 7401 // "request": { 7402 // "$ref": "ModifyAttachmentsRequest" 7403 // }, 7404 // "response": { 7405 // "$ref": "StudentSubmission" 7406 // }, 7407 // "scopes": [ 7408 // "https://www.googleapis.com/auth/classroom.coursework.me", 7409 // "https://www.googleapis.com/auth/classroom.coursework.students" 7410 // ] 7411 // } 7412 7413} 7414 7415// method id "classroom.courses.courseWork.studentSubmissions.patch": 7416 7417type CoursesCourseWorkStudentSubmissionsPatchCall struct { 7418 s *Service 7419 courseId string 7420 courseWorkId string 7421 id string 7422 studentsubmission *StudentSubmission 7423 urlParams_ gensupport.URLParams 7424 ctx_ context.Context 7425 header_ http.Header 7426} 7427 7428// Patch: Updates one or more fields of a student submission. See 7429// google.classroom.v1.StudentSubmission for details of which fields may 7430// be updated and who may change them. This request must be made by the 7431// Developer Console project of the OAuth client ID 7432// (https://support.google.com/cloud/answer/6158849) used to create the 7433// corresponding course work item. This method returns the following 7434// error codes: * `PERMISSION_DENIED` if the requesting developer 7435// project did not create the corresponding course work, if the user is 7436// not permitted to make the requested modification to the student 7437// submission, or for access errors. * `INVALID_ARGUMENT` if the request 7438// is malformed. * `NOT_FOUND` if the requested course, course work, or 7439// student submission does not exist. 7440// 7441// - courseId: Identifier of the course. This identifier can be either 7442// the Classroom-assigned identifier or an alias. 7443// - courseWorkId: Identifier of the course work. 7444// - id: Identifier of the student submission. 7445func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall { 7446 c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7447 c.courseId = courseId 7448 c.courseWorkId = courseWorkId 7449 c.id = id 7450 c.studentsubmission = studentsubmission 7451 return c 7452} 7453 7454// UpdateMask sets the optional parameter "updateMask": Mask that 7455// identifies which fields on the student submission to update. This 7456// field is required to do an update. The update fails if invalid fields 7457// are specified. The following fields may be specified by teachers: * 7458// `draft_grade` * `assigned_grade` 7459func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall { 7460 c.urlParams_.Set("updateMask", updateMask) 7461 return c 7462} 7463 7464// Fields allows partial responses to be retrieved. See 7465// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7466// for more information. 7467func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall { 7468 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7469 return c 7470} 7471 7472// Context sets the context to be used in this call's Do method. Any 7473// pending HTTP request will be aborted if the provided context is 7474// canceled. 7475func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall { 7476 c.ctx_ = ctx 7477 return c 7478} 7479 7480// Header returns an http.Header that can be modified by the caller to 7481// add HTTP headers to the request. 7482func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header { 7483 if c.header_ == nil { 7484 c.header_ = make(http.Header) 7485 } 7486 return c.header_ 7487} 7488 7489func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) { 7490 reqHeaders := make(http.Header) 7491 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 7492 for k, v := range c.header_ { 7493 reqHeaders[k] = v 7494 } 7495 reqHeaders.Set("User-Agent", c.s.userAgent()) 7496 var body io.Reader = nil 7497 body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission) 7498 if err != nil { 7499 return nil, err 7500 } 7501 reqHeaders.Set("Content-Type", "application/json") 7502 c.urlParams_.Set("alt", alt) 7503 c.urlParams_.Set("prettyPrint", "false") 7504 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}") 7505 urls += "?" + c.urlParams_.Encode() 7506 req, err := http.NewRequest("PATCH", urls, body) 7507 if err != nil { 7508 return nil, err 7509 } 7510 req.Header = reqHeaders 7511 googleapi.Expand(req.URL, map[string]string{ 7512 "courseId": c.courseId, 7513 "courseWorkId": c.courseWorkId, 7514 "id": c.id, 7515 }) 7516 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7517} 7518 7519// Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call. 7520// Exactly one of *StudentSubmission or error will be non-nil. Any 7521// non-2xx status code is an error. Response headers are in either 7522// *StudentSubmission.ServerResponse.Header or (if a response was 7523// returned at all) in error.(*googleapi.Error).Header. Use 7524// googleapi.IsNotModified to check whether the returned error was 7525// because http.StatusNotModified was returned. 7526func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) { 7527 gensupport.SetOptions(c.urlParams_, opts...) 7528 res, err := c.doRequest("json") 7529 if res != nil && res.StatusCode == http.StatusNotModified { 7530 if res.Body != nil { 7531 res.Body.Close() 7532 } 7533 return nil, &googleapi.Error{ 7534 Code: res.StatusCode, 7535 Header: res.Header, 7536 } 7537 } 7538 if err != nil { 7539 return nil, err 7540 } 7541 defer googleapi.CloseBody(res) 7542 if err := googleapi.CheckResponse(res); err != nil { 7543 return nil, err 7544 } 7545 ret := &StudentSubmission{ 7546 ServerResponse: googleapi.ServerResponse{ 7547 Header: res.Header, 7548 HTTPStatusCode: res.StatusCode, 7549 }, 7550 } 7551 target := &ret 7552 if err := gensupport.DecodeResponse(target, res); err != nil { 7553 return nil, err 7554 } 7555 return ret, nil 7556 // { 7557 // "description": "Updates one or more fields of a student submission. See google.classroom.v1.StudentSubmission for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7558 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7559 // "httpMethod": "PATCH", 7560 // "id": "classroom.courses.courseWork.studentSubmissions.patch", 7561 // "parameterOrder": [ 7562 // "courseId", 7563 // "courseWorkId", 7564 // "id" 7565 // ], 7566 // "parameters": { 7567 // "courseId": { 7568 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7569 // "location": "path", 7570 // "required": true, 7571 // "type": "string" 7572 // }, 7573 // "courseWorkId": { 7574 // "description": "Identifier of the course work.", 7575 // "location": "path", 7576 // "required": true, 7577 // "type": "string" 7578 // }, 7579 // "id": { 7580 // "description": "Identifier of the student submission.", 7581 // "location": "path", 7582 // "required": true, 7583 // "type": "string" 7584 // }, 7585 // "updateMask": { 7586 // "description": "Mask that identifies which fields on the student submission to update. This field is required to do an update. The update fails if invalid fields are specified. The following fields may be specified by teachers: * `draft_grade` * `assigned_grade`", 7587 // "format": "google-fieldmask", 7588 // "location": "query", 7589 // "type": "string" 7590 // } 7591 // }, 7592 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}", 7593 // "request": { 7594 // "$ref": "StudentSubmission" 7595 // }, 7596 // "response": { 7597 // "$ref": "StudentSubmission" 7598 // }, 7599 // "scopes": [ 7600 // "https://www.googleapis.com/auth/classroom.coursework.me", 7601 // "https://www.googleapis.com/auth/classroom.coursework.students" 7602 // ] 7603 // } 7604 7605} 7606 7607// method id "classroom.courses.courseWork.studentSubmissions.reclaim": 7608 7609type CoursesCourseWorkStudentSubmissionsReclaimCall struct { 7610 s *Service 7611 courseId string 7612 courseWorkId string 7613 id string 7614 reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest 7615 urlParams_ gensupport.URLParams 7616 ctx_ context.Context 7617 header_ http.Header 7618} 7619 7620// Reclaim: Reclaims a student submission on behalf of the student that 7621// owns it. Reclaiming a student submission transfers ownership of 7622// attached Drive files to the student and updates the submission state. 7623// Only the student that owns the requested student submission may call 7624// this method, and only for a student submission that has been turned 7625// in. This request must be made by the Developer Console project of the 7626// OAuth client ID (https://support.google.com/cloud/answer/6158849) 7627// used to create the corresponding course work item. This method 7628// returns the following error codes: * `PERMISSION_DENIED` if the 7629// requesting user is not permitted to access the requested course or 7630// course work, unsubmit the requested student submission, or for access 7631// errors. * `FAILED_PRECONDITION` if the student submission has not 7632// been turned in. * `INVALID_ARGUMENT` if the request is malformed. * 7633// `NOT_FOUND` if the requested course, course work, or student 7634// submission does not exist. 7635// 7636// - courseId: Identifier of the course. This identifier can be either 7637// the Classroom-assigned identifier or an alias. 7638// - courseWorkId: Identifier of the course work. 7639// - id: Identifier of the student submission. 7640func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7641 c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7642 c.courseId = courseId 7643 c.courseWorkId = courseWorkId 7644 c.id = id 7645 c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest 7646 return c 7647} 7648 7649// Fields allows partial responses to be retrieved. See 7650// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7651// for more information. 7652func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7653 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7654 return c 7655} 7656 7657// Context sets the context to be used in this call's Do method. Any 7658// pending HTTP request will be aborted if the provided context is 7659// canceled. 7660func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall { 7661 c.ctx_ = ctx 7662 return c 7663} 7664 7665// Header returns an http.Header that can be modified by the caller to 7666// add HTTP headers to the request. 7667func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header { 7668 if c.header_ == nil { 7669 c.header_ = make(http.Header) 7670 } 7671 return c.header_ 7672} 7673 7674func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) { 7675 reqHeaders := make(http.Header) 7676 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 7677 for k, v := range c.header_ { 7678 reqHeaders[k] = v 7679 } 7680 reqHeaders.Set("User-Agent", c.s.userAgent()) 7681 var body io.Reader = nil 7682 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest) 7683 if err != nil { 7684 return nil, err 7685 } 7686 reqHeaders.Set("Content-Type", "application/json") 7687 c.urlParams_.Set("alt", alt) 7688 c.urlParams_.Set("prettyPrint", "false") 7689 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim") 7690 urls += "?" + c.urlParams_.Encode() 7691 req, err := http.NewRequest("POST", urls, body) 7692 if err != nil { 7693 return nil, err 7694 } 7695 req.Header = reqHeaders 7696 googleapi.Expand(req.URL, map[string]string{ 7697 "courseId": c.courseId, 7698 "courseWorkId": c.courseWorkId, 7699 "id": c.id, 7700 }) 7701 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7702} 7703 7704// Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call. 7705// Exactly one of *Empty or error will be non-nil. Any non-2xx status 7706// code is an error. Response headers are in either 7707// *Empty.ServerResponse.Header or (if a response was returned at all) 7708// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7709// check whether the returned error was because http.StatusNotModified 7710// was returned. 7711func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 7712 gensupport.SetOptions(c.urlParams_, opts...) 7713 res, err := c.doRequest("json") 7714 if res != nil && res.StatusCode == http.StatusNotModified { 7715 if res.Body != nil { 7716 res.Body.Close() 7717 } 7718 return nil, &googleapi.Error{ 7719 Code: res.StatusCode, 7720 Header: res.Header, 7721 } 7722 } 7723 if err != nil { 7724 return nil, err 7725 } 7726 defer googleapi.CloseBody(res) 7727 if err := googleapi.CheckResponse(res); err != nil { 7728 return nil, err 7729 } 7730 ret := &Empty{ 7731 ServerResponse: googleapi.ServerResponse{ 7732 Header: res.Header, 7733 HTTPStatusCode: res.StatusCode, 7734 }, 7735 } 7736 target := &ret 7737 if err := gensupport.DecodeResponse(target, res); err != nil { 7738 return nil, err 7739 } 7740 return ret, nil 7741 // { 7742 // "description": "Reclaims a student submission on behalf of the student that owns it. Reclaiming a student submission transfers ownership of attached Drive files to the student and updates the submission state. Only the student that owns the requested student submission may call this method, and only for a student submission that has been turned in. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, unsubmit the requested student submission, or for access errors. * `FAILED_PRECONDITION` if the student submission has not been turned in. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7743 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 7744 // "httpMethod": "POST", 7745 // "id": "classroom.courses.courseWork.studentSubmissions.reclaim", 7746 // "parameterOrder": [ 7747 // "courseId", 7748 // "courseWorkId", 7749 // "id" 7750 // ], 7751 // "parameters": { 7752 // "courseId": { 7753 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7754 // "location": "path", 7755 // "required": true, 7756 // "type": "string" 7757 // }, 7758 // "courseWorkId": { 7759 // "description": "Identifier of the course work.", 7760 // "location": "path", 7761 // "required": true, 7762 // "type": "string" 7763 // }, 7764 // "id": { 7765 // "description": "Identifier of the student submission.", 7766 // "location": "path", 7767 // "required": true, 7768 // "type": "string" 7769 // } 7770 // }, 7771 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim", 7772 // "request": { 7773 // "$ref": "ReclaimStudentSubmissionRequest" 7774 // }, 7775 // "response": { 7776 // "$ref": "Empty" 7777 // }, 7778 // "scopes": [ 7779 // "https://www.googleapis.com/auth/classroom.coursework.me" 7780 // ] 7781 // } 7782 7783} 7784 7785// method id "classroom.courses.courseWork.studentSubmissions.return": 7786 7787type CoursesCourseWorkStudentSubmissionsReturnCall struct { 7788 s *Service 7789 courseId string 7790 courseWorkId string 7791 id string 7792 returnstudentsubmissionrequest *ReturnStudentSubmissionRequest 7793 urlParams_ gensupport.URLParams 7794 ctx_ context.Context 7795 header_ http.Header 7796} 7797 7798// Return: Returns a student submission. Returning a student submission 7799// transfers ownership of attached Drive files to the student and may 7800// also update the submission state. Unlike the Classroom application, 7801// returning a student submission does not set assignedGrade to the 7802// draftGrade value. Only a teacher of the course that contains the 7803// requested student submission may call this method. This request must 7804// be made by the Developer Console project of the OAuth client ID 7805// (https://support.google.com/cloud/answer/6158849) used to create the 7806// corresponding course work item. This method returns the following 7807// error codes: * `PERMISSION_DENIED` if the requesting user is not 7808// permitted to access the requested course or course work, return the 7809// requested student submission, or for access errors. * 7810// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 7811// requested course, course work, or student submission does not exist. 7812// 7813// - courseId: Identifier of the course. This identifier can be either 7814// the Classroom-assigned identifier or an alias. 7815// - courseWorkId: Identifier of the course work. 7816// - id: Identifier of the student submission. 7817func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall { 7818 c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7819 c.courseId = courseId 7820 c.courseWorkId = courseWorkId 7821 c.id = id 7822 c.returnstudentsubmissionrequest = returnstudentsubmissionrequest 7823 return c 7824} 7825 7826// Fields allows partial responses to be retrieved. See 7827// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7828// for more information. 7829func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall { 7830 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7831 return c 7832} 7833 7834// Context sets the context to be used in this call's Do method. Any 7835// pending HTTP request will be aborted if the provided context is 7836// canceled. 7837func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall { 7838 c.ctx_ = ctx 7839 return c 7840} 7841 7842// Header returns an http.Header that can be modified by the caller to 7843// add HTTP headers to the request. 7844func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header { 7845 if c.header_ == nil { 7846 c.header_ = make(http.Header) 7847 } 7848 return c.header_ 7849} 7850 7851func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) { 7852 reqHeaders := make(http.Header) 7853 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 7854 for k, v := range c.header_ { 7855 reqHeaders[k] = v 7856 } 7857 reqHeaders.Set("User-Agent", c.s.userAgent()) 7858 var body io.Reader = nil 7859 body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest) 7860 if err != nil { 7861 return nil, err 7862 } 7863 reqHeaders.Set("Content-Type", "application/json") 7864 c.urlParams_.Set("alt", alt) 7865 c.urlParams_.Set("prettyPrint", "false") 7866 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return") 7867 urls += "?" + c.urlParams_.Encode() 7868 req, err := http.NewRequest("POST", urls, body) 7869 if err != nil { 7870 return nil, err 7871 } 7872 req.Header = reqHeaders 7873 googleapi.Expand(req.URL, map[string]string{ 7874 "courseId": c.courseId, 7875 "courseWorkId": c.courseWorkId, 7876 "id": c.id, 7877 }) 7878 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7879} 7880 7881// Do executes the "classroom.courses.courseWork.studentSubmissions.return" call. 7882// Exactly one of *Empty or error will be non-nil. Any non-2xx status 7883// code is an error. Response headers are in either 7884// *Empty.ServerResponse.Header or (if a response was returned at all) 7885// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7886// check whether the returned error was because http.StatusNotModified 7887// was returned. 7888func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 7889 gensupport.SetOptions(c.urlParams_, opts...) 7890 res, err := c.doRequest("json") 7891 if res != nil && res.StatusCode == http.StatusNotModified { 7892 if res.Body != nil { 7893 res.Body.Close() 7894 } 7895 return nil, &googleapi.Error{ 7896 Code: res.StatusCode, 7897 Header: res.Header, 7898 } 7899 } 7900 if err != nil { 7901 return nil, err 7902 } 7903 defer googleapi.CloseBody(res) 7904 if err := googleapi.CheckResponse(res); err != nil { 7905 return nil, err 7906 } 7907 ret := &Empty{ 7908 ServerResponse: googleapi.ServerResponse{ 7909 Header: res.Header, 7910 HTTPStatusCode: res.StatusCode, 7911 }, 7912 } 7913 target := &ret 7914 if err := gensupport.DecodeResponse(target, res); err != nil { 7915 return nil, err 7916 } 7917 return ret, nil 7918 // { 7919 // "description": "Returns a student submission. Returning a student submission transfers ownership of attached Drive files to the student and may also update the submission state. Unlike the Classroom application, returning a student submission does not set assignedGrade to the draftGrade value. Only a teacher of the course that contains the requested student submission may call this method. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, return the requested student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 7920 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 7921 // "httpMethod": "POST", 7922 // "id": "classroom.courses.courseWork.studentSubmissions.return", 7923 // "parameterOrder": [ 7924 // "courseId", 7925 // "courseWorkId", 7926 // "id" 7927 // ], 7928 // "parameters": { 7929 // "courseId": { 7930 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 7931 // "location": "path", 7932 // "required": true, 7933 // "type": "string" 7934 // }, 7935 // "courseWorkId": { 7936 // "description": "Identifier of the course work.", 7937 // "location": "path", 7938 // "required": true, 7939 // "type": "string" 7940 // }, 7941 // "id": { 7942 // "description": "Identifier of the student submission.", 7943 // "location": "path", 7944 // "required": true, 7945 // "type": "string" 7946 // } 7947 // }, 7948 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return", 7949 // "request": { 7950 // "$ref": "ReturnStudentSubmissionRequest" 7951 // }, 7952 // "response": { 7953 // "$ref": "Empty" 7954 // }, 7955 // "scopes": [ 7956 // "https://www.googleapis.com/auth/classroom.coursework.students" 7957 // ] 7958 // } 7959 7960} 7961 7962// method id "classroom.courses.courseWork.studentSubmissions.turnIn": 7963 7964type CoursesCourseWorkStudentSubmissionsTurnInCall struct { 7965 s *Service 7966 courseId string 7967 courseWorkId string 7968 id string 7969 turninstudentsubmissionrequest *TurnInStudentSubmissionRequest 7970 urlParams_ gensupport.URLParams 7971 ctx_ context.Context 7972 header_ http.Header 7973} 7974 7975// TurnIn: Turns in a student submission. Turning in a student 7976// submission transfers ownership of attached Drive files to the teacher 7977// and may also update the submission state. This may only be called by 7978// the student that owns the specified student submission. This request 7979// must be made by the Developer Console project of the OAuth client ID 7980// (https://support.google.com/cloud/answer/6158849) used to create the 7981// corresponding course work item. This method returns the following 7982// error codes: * `PERMISSION_DENIED` if the requesting user is not 7983// permitted to access the requested course or course work, turn in the 7984// requested student submission, or for access errors. * 7985// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 7986// requested course, course work, or student submission does not exist. 7987// 7988// - courseId: Identifier of the course. This identifier can be either 7989// the Classroom-assigned identifier or an alias. 7990// - courseWorkId: Identifier of the course work. 7991// - id: Identifier of the student submission. 7992func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall { 7993 c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7994 c.courseId = courseId 7995 c.courseWorkId = courseWorkId 7996 c.id = id 7997 c.turninstudentsubmissionrequest = turninstudentsubmissionrequest 7998 return c 7999} 8000 8001// Fields allows partial responses to be retrieved. See 8002// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8003// for more information. 8004func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8005 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8006 return c 8007} 8008 8009// Context sets the context to be used in this call's Do method. Any 8010// pending HTTP request will be aborted if the provided context is 8011// canceled. 8012func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall { 8013 c.ctx_ = ctx 8014 return c 8015} 8016 8017// Header returns an http.Header that can be modified by the caller to 8018// add HTTP headers to the request. 8019func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header { 8020 if c.header_ == nil { 8021 c.header_ = make(http.Header) 8022 } 8023 return c.header_ 8024} 8025 8026func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) { 8027 reqHeaders := make(http.Header) 8028 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 8029 for k, v := range c.header_ { 8030 reqHeaders[k] = v 8031 } 8032 reqHeaders.Set("User-Agent", c.s.userAgent()) 8033 var body io.Reader = nil 8034 body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest) 8035 if err != nil { 8036 return nil, err 8037 } 8038 reqHeaders.Set("Content-Type", "application/json") 8039 c.urlParams_.Set("alt", alt) 8040 c.urlParams_.Set("prettyPrint", "false") 8041 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn") 8042 urls += "?" + c.urlParams_.Encode() 8043 req, err := http.NewRequest("POST", urls, body) 8044 if err != nil { 8045 return nil, err 8046 } 8047 req.Header = reqHeaders 8048 googleapi.Expand(req.URL, map[string]string{ 8049 "courseId": c.courseId, 8050 "courseWorkId": c.courseWorkId, 8051 "id": c.id, 8052 }) 8053 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8054} 8055 8056// Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call. 8057// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8058// code is an error. Response headers are in either 8059// *Empty.ServerResponse.Header or (if a response was returned at all) 8060// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8061// check whether the returned error was because http.StatusNotModified 8062// was returned. 8063func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8064 gensupport.SetOptions(c.urlParams_, opts...) 8065 res, err := c.doRequest("json") 8066 if res != nil && res.StatusCode == http.StatusNotModified { 8067 if res.Body != nil { 8068 res.Body.Close() 8069 } 8070 return nil, &googleapi.Error{ 8071 Code: res.StatusCode, 8072 Header: res.Header, 8073 } 8074 } 8075 if err != nil { 8076 return nil, err 8077 } 8078 defer googleapi.CloseBody(res) 8079 if err := googleapi.CheckResponse(res); err != nil { 8080 return nil, err 8081 } 8082 ret := &Empty{ 8083 ServerResponse: googleapi.ServerResponse{ 8084 Header: res.Header, 8085 HTTPStatusCode: res.StatusCode, 8086 }, 8087 } 8088 target := &ret 8089 if err := gensupport.DecodeResponse(target, res); err != nil { 8090 return nil, err 8091 } 8092 return ret, nil 8093 // { 8094 // "description": "Turns in a student submission. Turning in a student submission transfers ownership of attached Drive files to the teacher and may also update the submission state. This may only be called by the student that owns the specified student submission. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work, turn in the requested student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.", 8095 // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8096 // "httpMethod": "POST", 8097 // "id": "classroom.courses.courseWork.studentSubmissions.turnIn", 8098 // "parameterOrder": [ 8099 // "courseId", 8100 // "courseWorkId", 8101 // "id" 8102 // ], 8103 // "parameters": { 8104 // "courseId": { 8105 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8106 // "location": "path", 8107 // "required": true, 8108 // "type": "string" 8109 // }, 8110 // "courseWorkId": { 8111 // "description": "Identifier of the course work.", 8112 // "location": "path", 8113 // "required": true, 8114 // "type": "string" 8115 // }, 8116 // "id": { 8117 // "description": "Identifier of the student submission.", 8118 // "location": "path", 8119 // "required": true, 8120 // "type": "string" 8121 // } 8122 // }, 8123 // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn", 8124 // "request": { 8125 // "$ref": "TurnInStudentSubmissionRequest" 8126 // }, 8127 // "response": { 8128 // "$ref": "Empty" 8129 // }, 8130 // "scopes": [ 8131 // "https://www.googleapis.com/auth/classroom.coursework.me" 8132 // ] 8133 // } 8134 8135} 8136 8137// method id "classroom.courses.courseWorkMaterials.create": 8138 8139type CoursesCourseWorkMaterialsCreateCall struct { 8140 s *Service 8141 courseId string 8142 courseworkmaterial *CourseWorkMaterial 8143 urlParams_ gensupport.URLParams 8144 ctx_ context.Context 8145 header_ http.Header 8146} 8147 8148// Create: Creates a course work material. This method returns the 8149// following error codes: * `PERMISSION_DENIED` if the requesting user 8150// is not permitted to access the requested course, create course work 8151// material in the requested course, share a Drive attachment, or for 8152// access errors. * `INVALID_ARGUMENT` if the request is malformed or if 8153// more than 20 * materials are provided. * `NOT_FOUND` if the requested 8154// course does not exist. * `FAILED_PRECONDITION` for the following 8155// request error: * AttachmentNotVisible 8156// 8157// - courseId: Identifier of the course. This identifier can be either 8158// the Classroom-assigned identifier or an alias. 8159func (r *CoursesCourseWorkMaterialsService) Create(courseId string, courseworkmaterial *CourseWorkMaterial) *CoursesCourseWorkMaterialsCreateCall { 8160 c := &CoursesCourseWorkMaterialsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8161 c.courseId = courseId 8162 c.courseworkmaterial = courseworkmaterial 8163 return c 8164} 8165 8166// Fields allows partial responses to be retrieved. See 8167// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8168// for more information. 8169func (c *CoursesCourseWorkMaterialsCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsCreateCall { 8170 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8171 return c 8172} 8173 8174// Context sets the context to be used in this call's Do method. Any 8175// pending HTTP request will be aborted if the provided context is 8176// canceled. 8177func (c *CoursesCourseWorkMaterialsCreateCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsCreateCall { 8178 c.ctx_ = ctx 8179 return c 8180} 8181 8182// Header returns an http.Header that can be modified by the caller to 8183// add HTTP headers to the request. 8184func (c *CoursesCourseWorkMaterialsCreateCall) Header() http.Header { 8185 if c.header_ == nil { 8186 c.header_ = make(http.Header) 8187 } 8188 return c.header_ 8189} 8190 8191func (c *CoursesCourseWorkMaterialsCreateCall) doRequest(alt string) (*http.Response, error) { 8192 reqHeaders := make(http.Header) 8193 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 8194 for k, v := range c.header_ { 8195 reqHeaders[k] = v 8196 } 8197 reqHeaders.Set("User-Agent", c.s.userAgent()) 8198 var body io.Reader = nil 8199 body, err := googleapi.WithoutDataWrapper.JSONReader(c.courseworkmaterial) 8200 if err != nil { 8201 return nil, err 8202 } 8203 reqHeaders.Set("Content-Type", "application/json") 8204 c.urlParams_.Set("alt", alt) 8205 c.urlParams_.Set("prettyPrint", "false") 8206 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials") 8207 urls += "?" + c.urlParams_.Encode() 8208 req, err := http.NewRequest("POST", urls, body) 8209 if err != nil { 8210 return nil, err 8211 } 8212 req.Header = reqHeaders 8213 googleapi.Expand(req.URL, map[string]string{ 8214 "courseId": c.courseId, 8215 }) 8216 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8217} 8218 8219// Do executes the "classroom.courses.courseWorkMaterials.create" call. 8220// Exactly one of *CourseWorkMaterial or error will be non-nil. Any 8221// non-2xx status code is an error. Response headers are in either 8222// *CourseWorkMaterial.ServerResponse.Header or (if a response was 8223// returned at all) in error.(*googleapi.Error).Header. Use 8224// googleapi.IsNotModified to check whether the returned error was 8225// because http.StatusNotModified was returned. 8226func (c *CoursesCourseWorkMaterialsCreateCall) Do(opts ...googleapi.CallOption) (*CourseWorkMaterial, error) { 8227 gensupport.SetOptions(c.urlParams_, opts...) 8228 res, err := c.doRequest("json") 8229 if res != nil && res.StatusCode == http.StatusNotModified { 8230 if res.Body != nil { 8231 res.Body.Close() 8232 } 8233 return nil, &googleapi.Error{ 8234 Code: res.StatusCode, 8235 Header: res.Header, 8236 } 8237 } 8238 if err != nil { 8239 return nil, err 8240 } 8241 defer googleapi.CloseBody(res) 8242 if err := googleapi.CheckResponse(res); err != nil { 8243 return nil, err 8244 } 8245 ret := &CourseWorkMaterial{ 8246 ServerResponse: googleapi.ServerResponse{ 8247 Header: res.Header, 8248 HTTPStatusCode: res.StatusCode, 8249 }, 8250 } 8251 target := &ret 8252 if err := gensupport.DecodeResponse(target, res); err != nil { 8253 return nil, err 8254 } 8255 return ret, nil 8256 // { 8257 // "description": "Creates a course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create course work material in the requested course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT` if the request is malformed or if more than 20 * materials are provided. * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION` for the following request error: * AttachmentNotVisible", 8258 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials", 8259 // "httpMethod": "POST", 8260 // "id": "classroom.courses.courseWorkMaterials.create", 8261 // "parameterOrder": [ 8262 // "courseId" 8263 // ], 8264 // "parameters": { 8265 // "courseId": { 8266 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8267 // "location": "path", 8268 // "required": true, 8269 // "type": "string" 8270 // } 8271 // }, 8272 // "path": "v1/courses/{courseId}/courseWorkMaterials", 8273 // "request": { 8274 // "$ref": "CourseWorkMaterial" 8275 // }, 8276 // "response": { 8277 // "$ref": "CourseWorkMaterial" 8278 // }, 8279 // "scopes": [ 8280 // "https://www.googleapis.com/auth/classroom.courseworkmaterials" 8281 // ] 8282 // } 8283 8284} 8285 8286// method id "classroom.courses.courseWorkMaterials.delete": 8287 8288type CoursesCourseWorkMaterialsDeleteCall struct { 8289 s *Service 8290 courseId string 8291 id string 8292 urlParams_ gensupport.URLParams 8293 ctx_ context.Context 8294 header_ http.Header 8295} 8296 8297// Delete: Deletes a course work material. This request must be made by 8298// the Developer Console project of the OAuth client ID 8299// (https://support.google.com/cloud/answer/6158849) used to create the 8300// corresponding course work material item. This method returns the 8301// following error codes: * `PERMISSION_DENIED` if the requesting 8302// developer project did not create the corresponding course work 8303// material, if the requesting user is not permitted to delete the 8304// requested course or for access errors. * `FAILED_PRECONDITION` if the 8305// requested course work material has already been deleted. * 8306// `NOT_FOUND` if no course exists with the requested ID. 8307// 8308// - courseId: Identifier of the course. This identifier can be either 8309// the Classroom-assigned identifier or an alias. 8310// - id: Identifier of the course work material to delete. This 8311// identifier is a Classroom-assigned identifier. 8312func (r *CoursesCourseWorkMaterialsService) Delete(courseId string, id string) *CoursesCourseWorkMaterialsDeleteCall { 8313 c := &CoursesCourseWorkMaterialsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8314 c.courseId = courseId 8315 c.id = id 8316 return c 8317} 8318 8319// Fields allows partial responses to be retrieved. See 8320// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8321// for more information. 8322func (c *CoursesCourseWorkMaterialsDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsDeleteCall { 8323 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8324 return c 8325} 8326 8327// Context sets the context to be used in this call's Do method. Any 8328// pending HTTP request will be aborted if the provided context is 8329// canceled. 8330func (c *CoursesCourseWorkMaterialsDeleteCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsDeleteCall { 8331 c.ctx_ = ctx 8332 return c 8333} 8334 8335// Header returns an http.Header that can be modified by the caller to 8336// add HTTP headers to the request. 8337func (c *CoursesCourseWorkMaterialsDeleteCall) Header() http.Header { 8338 if c.header_ == nil { 8339 c.header_ = make(http.Header) 8340 } 8341 return c.header_ 8342} 8343 8344func (c *CoursesCourseWorkMaterialsDeleteCall) doRequest(alt string) (*http.Response, error) { 8345 reqHeaders := make(http.Header) 8346 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 8347 for k, v := range c.header_ { 8348 reqHeaders[k] = v 8349 } 8350 reqHeaders.Set("User-Agent", c.s.userAgent()) 8351 var body io.Reader = nil 8352 c.urlParams_.Set("alt", alt) 8353 c.urlParams_.Set("prettyPrint", "false") 8354 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials/{id}") 8355 urls += "?" + c.urlParams_.Encode() 8356 req, err := http.NewRequest("DELETE", urls, body) 8357 if err != nil { 8358 return nil, err 8359 } 8360 req.Header = reqHeaders 8361 googleapi.Expand(req.URL, map[string]string{ 8362 "courseId": c.courseId, 8363 "id": c.id, 8364 }) 8365 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8366} 8367 8368// Do executes the "classroom.courses.courseWorkMaterials.delete" call. 8369// Exactly one of *Empty or error will be non-nil. Any non-2xx status 8370// code is an error. Response headers are in either 8371// *Empty.ServerResponse.Header or (if a response was returned at all) 8372// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8373// check whether the returned error was because http.StatusNotModified 8374// was returned. 8375func (c *CoursesCourseWorkMaterialsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 8376 gensupport.SetOptions(c.urlParams_, opts...) 8377 res, err := c.doRequest("json") 8378 if res != nil && res.StatusCode == http.StatusNotModified { 8379 if res.Body != nil { 8380 res.Body.Close() 8381 } 8382 return nil, &googleapi.Error{ 8383 Code: res.StatusCode, 8384 Header: res.Header, 8385 } 8386 } 8387 if err != nil { 8388 return nil, err 8389 } 8390 defer googleapi.CloseBody(res) 8391 if err := googleapi.CheckResponse(res); err != nil { 8392 return nil, err 8393 } 8394 ret := &Empty{ 8395 ServerResponse: googleapi.ServerResponse{ 8396 Header: res.Header, 8397 HTTPStatusCode: res.StatusCode, 8398 }, 8399 } 8400 target := &ret 8401 if err := gensupport.DecodeResponse(target, res); err != nil { 8402 return nil, err 8403 } 8404 return ret, nil 8405 // { 8406 // "description": "Deletes a course work material. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work material item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work material, if the requesting user is not permitted to delete the requested course or for access errors. * `FAILED_PRECONDITION` if the requested course work material has already been deleted. * `NOT_FOUND` if no course exists with the requested ID.", 8407 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8408 // "httpMethod": "DELETE", 8409 // "id": "classroom.courses.courseWorkMaterials.delete", 8410 // "parameterOrder": [ 8411 // "courseId", 8412 // "id" 8413 // ], 8414 // "parameters": { 8415 // "courseId": { 8416 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8417 // "location": "path", 8418 // "required": true, 8419 // "type": "string" 8420 // }, 8421 // "id": { 8422 // "description": "Identifier of the course work material to delete. This identifier is a Classroom-assigned identifier.", 8423 // "location": "path", 8424 // "required": true, 8425 // "type": "string" 8426 // } 8427 // }, 8428 // "path": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8429 // "response": { 8430 // "$ref": "Empty" 8431 // }, 8432 // "scopes": [ 8433 // "https://www.googleapis.com/auth/classroom.courseworkmaterials" 8434 // ] 8435 // } 8436 8437} 8438 8439// method id "classroom.courses.courseWorkMaterials.get": 8440 8441type CoursesCourseWorkMaterialsGetCall struct { 8442 s *Service 8443 courseId string 8444 id string 8445 urlParams_ gensupport.URLParams 8446 ifNoneMatch_ string 8447 ctx_ context.Context 8448 header_ http.Header 8449} 8450 8451// Get: Returns a course work material. This method returns the 8452// following error codes: * `PERMISSION_DENIED` if the requesting user 8453// is not permitted to access the requested course or course work 8454// material, or for access errors. * `INVALID_ARGUMENT` if the request 8455// is malformed. * `NOT_FOUND` if the requested course or course work 8456// material does not exist. 8457// 8458// - courseId: Identifier of the course. This identifier can be either 8459// the Classroom-assigned identifier or an alias. 8460// - id: Identifier of the course work material. 8461func (r *CoursesCourseWorkMaterialsService) Get(courseId string, id string) *CoursesCourseWorkMaterialsGetCall { 8462 c := &CoursesCourseWorkMaterialsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8463 c.courseId = courseId 8464 c.id = id 8465 return c 8466} 8467 8468// Fields allows partial responses to be retrieved. See 8469// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8470// for more information. 8471func (c *CoursesCourseWorkMaterialsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsGetCall { 8472 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8473 return c 8474} 8475 8476// IfNoneMatch sets the optional parameter which makes the operation 8477// fail if the object's ETag matches the given value. This is useful for 8478// getting updates only after the object has changed since the last 8479// request. Use googleapi.IsNotModified to check whether the response 8480// error from Do is the result of In-None-Match. 8481func (c *CoursesCourseWorkMaterialsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkMaterialsGetCall { 8482 c.ifNoneMatch_ = entityTag 8483 return c 8484} 8485 8486// Context sets the context to be used in this call's Do method. Any 8487// pending HTTP request will be aborted if the provided context is 8488// canceled. 8489func (c *CoursesCourseWorkMaterialsGetCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsGetCall { 8490 c.ctx_ = ctx 8491 return c 8492} 8493 8494// Header returns an http.Header that can be modified by the caller to 8495// add HTTP headers to the request. 8496func (c *CoursesCourseWorkMaterialsGetCall) Header() http.Header { 8497 if c.header_ == nil { 8498 c.header_ = make(http.Header) 8499 } 8500 return c.header_ 8501} 8502 8503func (c *CoursesCourseWorkMaterialsGetCall) doRequest(alt string) (*http.Response, error) { 8504 reqHeaders := make(http.Header) 8505 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 8506 for k, v := range c.header_ { 8507 reqHeaders[k] = v 8508 } 8509 reqHeaders.Set("User-Agent", c.s.userAgent()) 8510 if c.ifNoneMatch_ != "" { 8511 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8512 } 8513 var body io.Reader = nil 8514 c.urlParams_.Set("alt", alt) 8515 c.urlParams_.Set("prettyPrint", "false") 8516 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials/{id}") 8517 urls += "?" + c.urlParams_.Encode() 8518 req, err := http.NewRequest("GET", urls, body) 8519 if err != nil { 8520 return nil, err 8521 } 8522 req.Header = reqHeaders 8523 googleapi.Expand(req.URL, map[string]string{ 8524 "courseId": c.courseId, 8525 "id": c.id, 8526 }) 8527 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8528} 8529 8530// Do executes the "classroom.courses.courseWorkMaterials.get" call. 8531// Exactly one of *CourseWorkMaterial or error will be non-nil. Any 8532// non-2xx status code is an error. Response headers are in either 8533// *CourseWorkMaterial.ServerResponse.Header or (if a response was 8534// returned at all) in error.(*googleapi.Error).Header. Use 8535// googleapi.IsNotModified to check whether the returned error was 8536// because http.StatusNotModified was returned. 8537func (c *CoursesCourseWorkMaterialsGetCall) Do(opts ...googleapi.CallOption) (*CourseWorkMaterial, error) { 8538 gensupport.SetOptions(c.urlParams_, opts...) 8539 res, err := c.doRequest("json") 8540 if res != nil && res.StatusCode == http.StatusNotModified { 8541 if res.Body != nil { 8542 res.Body.Close() 8543 } 8544 return nil, &googleapi.Error{ 8545 Code: res.StatusCode, 8546 Header: res.Header, 8547 } 8548 } 8549 if err != nil { 8550 return nil, err 8551 } 8552 defer googleapi.CloseBody(res) 8553 if err := googleapi.CheckResponse(res); err != nil { 8554 return nil, err 8555 } 8556 ret := &CourseWorkMaterial{ 8557 ServerResponse: googleapi.ServerResponse{ 8558 Header: res.Header, 8559 HTTPStatusCode: res.StatusCode, 8560 }, 8561 } 8562 target := &ret 8563 if err := gensupport.DecodeResponse(target, res); err != nil { 8564 return nil, err 8565 } 8566 return ret, nil 8567 // { 8568 // "description": "Returns a course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or course work material, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or course work material does not exist.", 8569 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8570 // "httpMethod": "GET", 8571 // "id": "classroom.courses.courseWorkMaterials.get", 8572 // "parameterOrder": [ 8573 // "courseId", 8574 // "id" 8575 // ], 8576 // "parameters": { 8577 // "courseId": { 8578 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8579 // "location": "path", 8580 // "required": true, 8581 // "type": "string" 8582 // }, 8583 // "id": { 8584 // "description": "Identifier of the course work material.", 8585 // "location": "path", 8586 // "required": true, 8587 // "type": "string" 8588 // } 8589 // }, 8590 // "path": "v1/courses/{courseId}/courseWorkMaterials/{id}", 8591 // "response": { 8592 // "$ref": "CourseWorkMaterial" 8593 // }, 8594 // "scopes": [ 8595 // "https://www.googleapis.com/auth/classroom.courseworkmaterials", 8596 // "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly" 8597 // ] 8598 // } 8599 8600} 8601 8602// method id "classroom.courses.courseWorkMaterials.list": 8603 8604type CoursesCourseWorkMaterialsListCall struct { 8605 s *Service 8606 courseId string 8607 urlParams_ gensupport.URLParams 8608 ifNoneMatch_ string 8609 ctx_ context.Context 8610 header_ http.Header 8611} 8612 8613// List: Returns a list of course work material that the requester is 8614// permitted to view. Course students may only view `PUBLISHED` course 8615// work material. Course teachers and domain administrators may view all 8616// course work material. This method returns the following error codes: 8617// * `PERMISSION_DENIED` if the requesting user is not permitted to 8618// access the requested course or for access errors. * 8619// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 8620// requested course does not exist. 8621// 8622// - courseId: Identifier of the course. This identifier can be either 8623// the Classroom-assigned identifier or an alias. 8624func (r *CoursesCourseWorkMaterialsService) List(courseId string) *CoursesCourseWorkMaterialsListCall { 8625 c := &CoursesCourseWorkMaterialsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8626 c.courseId = courseId 8627 return c 8628} 8629 8630// CourseWorkMaterialStates sets the optional parameter 8631// "courseWorkMaterialStates": Restriction on the work status to return. 8632// Only course work material that matches is returned. If unspecified, 8633// items with a work status of `PUBLISHED` is returned. 8634// 8635// Possible values: 8636// "COURSEWORK_MATERIAL_STATE_UNSPECIFIED" - No state specified. This 8637// is never returned. 8638// "PUBLISHED" - Status for course work material that has been 8639// published. This is the default state. 8640// "DRAFT" - Status for an course work material that is not yet 8641// published. Course work material in this state is visible only to 8642// course teachers and domain administrators. 8643// "DELETED" - Status for course work material that was published but 8644// is now deleted. Course work material in this state is visible only to 8645// course teachers and domain administrators. Course work material in 8646// this state is deleted after some time. 8647func (c *CoursesCourseWorkMaterialsListCall) CourseWorkMaterialStates(courseWorkMaterialStates ...string) *CoursesCourseWorkMaterialsListCall { 8648 c.urlParams_.SetMulti("courseWorkMaterialStates", append([]string{}, courseWorkMaterialStates...)) 8649 return c 8650} 8651 8652// MaterialDriveId sets the optional parameter "materialDriveId": 8653// Optional filtering for course work material with at least one Drive 8654// material whose ID matches the provided string. If `material_link` is 8655// also specified, course work material must have materials matching 8656// both filters. 8657func (c *CoursesCourseWorkMaterialsListCall) MaterialDriveId(materialDriveId string) *CoursesCourseWorkMaterialsListCall { 8658 c.urlParams_.Set("materialDriveId", materialDriveId) 8659 return c 8660} 8661 8662// MaterialLink sets the optional parameter "materialLink": Optional 8663// filtering for course work material with at least one link material 8664// whose URL partially matches the provided string. 8665func (c *CoursesCourseWorkMaterialsListCall) MaterialLink(materialLink string) *CoursesCourseWorkMaterialsListCall { 8666 c.urlParams_.Set("materialLink", materialLink) 8667 return c 8668} 8669 8670// OrderBy sets the optional parameter "orderBy": Optional sort ordering 8671// for results. A comma-separated list of fields with an optional sort 8672// direction keyword. Supported field is `updateTime`. Supported 8673// direction keywords are `asc` and `desc`. If not specified, 8674// `updateTime desc` is the default behavior. Examples: `updateTime 8675// asc`, `updateTime` 8676func (c *CoursesCourseWorkMaterialsListCall) OrderBy(orderBy string) *CoursesCourseWorkMaterialsListCall { 8677 c.urlParams_.Set("orderBy", orderBy) 8678 return c 8679} 8680 8681// PageSize sets the optional parameter "pageSize": Maximum number of 8682// items to return. Zero or unspecified indicates that the server may 8683// assign a maximum. The server may return fewer than the specified 8684// number of results. 8685func (c *CoursesCourseWorkMaterialsListCall) PageSize(pageSize int64) *CoursesCourseWorkMaterialsListCall { 8686 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8687 return c 8688} 8689 8690// PageToken sets the optional parameter "pageToken": nextPageToken 8691// value returned from a previous list call, indicating that the 8692// subsequent page of results should be returned. The list request must 8693// be otherwise identical to the one that resulted in this token. 8694func (c *CoursesCourseWorkMaterialsListCall) PageToken(pageToken string) *CoursesCourseWorkMaterialsListCall { 8695 c.urlParams_.Set("pageToken", pageToken) 8696 return c 8697} 8698 8699// Fields allows partial responses to be retrieved. See 8700// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8701// for more information. 8702func (c *CoursesCourseWorkMaterialsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsListCall { 8703 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8704 return c 8705} 8706 8707// IfNoneMatch sets the optional parameter which makes the operation 8708// fail if the object's ETag matches the given value. This is useful for 8709// getting updates only after the object has changed since the last 8710// request. Use googleapi.IsNotModified to check whether the response 8711// error from Do is the result of In-None-Match. 8712func (c *CoursesCourseWorkMaterialsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkMaterialsListCall { 8713 c.ifNoneMatch_ = entityTag 8714 return c 8715} 8716 8717// Context sets the context to be used in this call's Do method. Any 8718// pending HTTP request will be aborted if the provided context is 8719// canceled. 8720func (c *CoursesCourseWorkMaterialsListCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsListCall { 8721 c.ctx_ = ctx 8722 return c 8723} 8724 8725// Header returns an http.Header that can be modified by the caller to 8726// add HTTP headers to the request. 8727func (c *CoursesCourseWorkMaterialsListCall) Header() http.Header { 8728 if c.header_ == nil { 8729 c.header_ = make(http.Header) 8730 } 8731 return c.header_ 8732} 8733 8734func (c *CoursesCourseWorkMaterialsListCall) doRequest(alt string) (*http.Response, error) { 8735 reqHeaders := make(http.Header) 8736 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 8737 for k, v := range c.header_ { 8738 reqHeaders[k] = v 8739 } 8740 reqHeaders.Set("User-Agent", c.s.userAgent()) 8741 if c.ifNoneMatch_ != "" { 8742 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8743 } 8744 var body io.Reader = nil 8745 c.urlParams_.Set("alt", alt) 8746 c.urlParams_.Set("prettyPrint", "false") 8747 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials") 8748 urls += "?" + c.urlParams_.Encode() 8749 req, err := http.NewRequest("GET", urls, body) 8750 if err != nil { 8751 return nil, err 8752 } 8753 req.Header = reqHeaders 8754 googleapi.Expand(req.URL, map[string]string{ 8755 "courseId": c.courseId, 8756 }) 8757 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8758} 8759 8760// Do executes the "classroom.courses.courseWorkMaterials.list" call. 8761// Exactly one of *ListCourseWorkMaterialResponse or error will be 8762// non-nil. Any non-2xx status code is an error. Response headers are in 8763// either *ListCourseWorkMaterialResponse.ServerResponse.Header or (if a 8764// response was returned at all) in error.(*googleapi.Error).Header. Use 8765// googleapi.IsNotModified to check whether the returned error was 8766// because http.StatusNotModified was returned. 8767func (c *CoursesCourseWorkMaterialsListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkMaterialResponse, error) { 8768 gensupport.SetOptions(c.urlParams_, opts...) 8769 res, err := c.doRequest("json") 8770 if res != nil && res.StatusCode == http.StatusNotModified { 8771 if res.Body != nil { 8772 res.Body.Close() 8773 } 8774 return nil, &googleapi.Error{ 8775 Code: res.StatusCode, 8776 Header: res.Header, 8777 } 8778 } 8779 if err != nil { 8780 return nil, err 8781 } 8782 defer googleapi.CloseBody(res) 8783 if err := googleapi.CheckResponse(res); err != nil { 8784 return nil, err 8785 } 8786 ret := &ListCourseWorkMaterialResponse{ 8787 ServerResponse: googleapi.ServerResponse{ 8788 Header: res.Header, 8789 HTTPStatusCode: res.StatusCode, 8790 }, 8791 } 8792 target := &ret 8793 if err := gensupport.DecodeResponse(target, res); err != nil { 8794 return nil, err 8795 } 8796 return ret, nil 8797 // { 8798 // "description": "Returns a list of course work material that the requester is permitted to view. Course students may only view `PUBLISHED` course work material. Course teachers and domain administrators may view all course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 8799 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials", 8800 // "httpMethod": "GET", 8801 // "id": "classroom.courses.courseWorkMaterials.list", 8802 // "parameterOrder": [ 8803 // "courseId" 8804 // ], 8805 // "parameters": { 8806 // "courseId": { 8807 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 8808 // "location": "path", 8809 // "required": true, 8810 // "type": "string" 8811 // }, 8812 // "courseWorkMaterialStates": { 8813 // "description": "Restriction on the work status to return. Only course work material that matches is returned. If unspecified, items with a work status of `PUBLISHED` is returned.", 8814 // "enum": [ 8815 // "COURSEWORK_MATERIAL_STATE_UNSPECIFIED", 8816 // "PUBLISHED", 8817 // "DRAFT", 8818 // "DELETED" 8819 // ], 8820 // "enumDescriptions": [ 8821 // "No state specified. This is never returned.", 8822 // "Status for course work material that has been published. This is the default state.", 8823 // "Status for an course work material that is not yet published. Course work material in this state is visible only to course teachers and domain administrators.", 8824 // "Status for course work material that was published but is now deleted. Course work material in this state is visible only to course teachers and domain administrators. Course work material in this state is deleted after some time." 8825 // ], 8826 // "location": "query", 8827 // "repeated": true, 8828 // "type": "string" 8829 // }, 8830 // "materialDriveId": { 8831 // "description": "Optional filtering for course work material with at least one Drive material whose ID matches the provided string. If `material_link` is also specified, course work material must have materials matching both filters.", 8832 // "location": "query", 8833 // "type": "string" 8834 // }, 8835 // "materialLink": { 8836 // "description": "Optional filtering for course work material with at least one link material whose URL partially matches the provided string.", 8837 // "location": "query", 8838 // "type": "string" 8839 // }, 8840 // "orderBy": { 8841 // "description": "Optional sort ordering for results. A comma-separated list of fields with an optional sort direction keyword. Supported field is `updateTime`. Supported direction keywords are `asc` and `desc`. If not specified, `updateTime desc` is the default behavior. Examples: `updateTime asc`, `updateTime`", 8842 // "location": "query", 8843 // "type": "string" 8844 // }, 8845 // "pageSize": { 8846 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 8847 // "format": "int32", 8848 // "location": "query", 8849 // "type": "integer" 8850 // }, 8851 // "pageToken": { 8852 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 8853 // "location": "query", 8854 // "type": "string" 8855 // } 8856 // }, 8857 // "path": "v1/courses/{courseId}/courseWorkMaterials", 8858 // "response": { 8859 // "$ref": "ListCourseWorkMaterialResponse" 8860 // }, 8861 // "scopes": [ 8862 // "https://www.googleapis.com/auth/classroom.courseworkmaterials", 8863 // "https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly" 8864 // ] 8865 // } 8866 8867} 8868 8869// Pages invokes f for each page of results. 8870// A non-nil error returned from f will halt the iteration. 8871// The provided context supersedes any context provided to the Context method. 8872func (c *CoursesCourseWorkMaterialsListCall) Pages(ctx context.Context, f func(*ListCourseWorkMaterialResponse) error) error { 8873 c.ctx_ = ctx 8874 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 8875 for { 8876 x, err := c.Do() 8877 if err != nil { 8878 return err 8879 } 8880 if err := f(x); err != nil { 8881 return err 8882 } 8883 if x.NextPageToken == "" { 8884 return nil 8885 } 8886 c.PageToken(x.NextPageToken) 8887 } 8888} 8889 8890// method id "classroom.courses.courseWorkMaterials.patch": 8891 8892type CoursesCourseWorkMaterialsPatchCall struct { 8893 s *Service 8894 courseId string 8895 id string 8896 courseworkmaterial *CourseWorkMaterial 8897 urlParams_ gensupport.URLParams 8898 ctx_ context.Context 8899 header_ http.Header 8900} 8901 8902// Patch: Updates one or more fields of a course work material. This 8903// method returns the following error codes: * `PERMISSION_DENIED` if 8904// the requesting developer project for access errors. * 8905// `INVALID_ARGUMENT` if the request is malformed. * 8906// `FAILED_PRECONDITION` if the requested course work material has 8907// already been deleted. * `NOT_FOUND` if the requested course or course 8908// work material does not exist 8909// 8910// - courseId: Identifier of the course. This identifier can be either 8911// the Classroom-assigned identifier or an alias. 8912// - id: Identifier of the course work material. 8913func (r *CoursesCourseWorkMaterialsService) Patch(courseId string, id string, courseworkmaterial *CourseWorkMaterial) *CoursesCourseWorkMaterialsPatchCall { 8914 c := &CoursesCourseWorkMaterialsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8915 c.courseId = courseId 8916 c.id = id 8917 c.courseworkmaterial = courseworkmaterial 8918 return c 8919} 8920 8921// UpdateMask sets the optional parameter "updateMask": Mask that 8922// identifies which fields on the course work material to update. This 8923// field is required to do an update. The update fails if invalid fields 8924// are specified. If a field supports empty values, it can be cleared by 8925// specifying it in the update mask and not in the course work material 8926// object. If a field that does not support empty values is included in 8927// the update mask and not set in the course work material object, an 8928// `INVALID_ARGUMENT` error is returned. The following fields may be 8929// specified by teachers: * `title` * `description` * `state` * 8930// `scheduled_time` * `topic_id` 8931func (c *CoursesCourseWorkMaterialsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkMaterialsPatchCall { 8932 c.urlParams_.Set("updateMask", updateMask) 8933 return c 8934} 8935 8936// Fields allows partial responses to be retrieved. See 8937// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8938// for more information. 8939func (c *CoursesCourseWorkMaterialsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkMaterialsPatchCall { 8940 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8941 return c 8942} 8943 8944// Context sets the context to be used in this call's Do method. Any 8945// pending HTTP request will be aborted if the provided context is 8946// canceled. 8947func (c *CoursesCourseWorkMaterialsPatchCall) Context(ctx context.Context) *CoursesCourseWorkMaterialsPatchCall { 8948 c.ctx_ = ctx 8949 return c 8950} 8951 8952// Header returns an http.Header that can be modified by the caller to 8953// add HTTP headers to the request. 8954func (c *CoursesCourseWorkMaterialsPatchCall) Header() http.Header { 8955 if c.header_ == nil { 8956 c.header_ = make(http.Header) 8957 } 8958 return c.header_ 8959} 8960 8961func (c *CoursesCourseWorkMaterialsPatchCall) doRequest(alt string) (*http.Response, error) { 8962 reqHeaders := make(http.Header) 8963 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 8964 for k, v := range c.header_ { 8965 reqHeaders[k] = v 8966 } 8967 reqHeaders.Set("User-Agent", c.s.userAgent()) 8968 var body io.Reader = nil 8969 body, err := googleapi.WithoutDataWrapper.JSONReader(c.courseworkmaterial) 8970 if err != nil { 8971 return nil, err 8972 } 8973 reqHeaders.Set("Content-Type", "application/json") 8974 c.urlParams_.Set("alt", alt) 8975 c.urlParams_.Set("prettyPrint", "false") 8976 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWorkMaterials/{id}") 8977 urls += "?" + c.urlParams_.Encode() 8978 req, err := http.NewRequest("PATCH", urls, body) 8979 if err != nil { 8980 return nil, err 8981 } 8982 req.Header = reqHeaders 8983 googleapi.Expand(req.URL, map[string]string{ 8984 "courseId": c.courseId, 8985 "id": c.id, 8986 }) 8987 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8988} 8989 8990// Do executes the "classroom.courses.courseWorkMaterials.patch" call. 8991// Exactly one of *CourseWorkMaterial or error will be non-nil. Any 8992// non-2xx status code is an error. Response headers are in either 8993// *CourseWorkMaterial.ServerResponse.Header or (if a response was 8994// returned at all) in error.(*googleapi.Error).Header. Use 8995// googleapi.IsNotModified to check whether the returned error was 8996// because http.StatusNotModified was returned. 8997func (c *CoursesCourseWorkMaterialsPatchCall) Do(opts ...googleapi.CallOption) (*CourseWorkMaterial, error) { 8998 gensupport.SetOptions(c.urlParams_, opts...) 8999 res, err := c.doRequest("json") 9000 if res != nil && res.StatusCode == http.StatusNotModified { 9001 if res.Body != nil { 9002 res.Body.Close() 9003 } 9004 return nil, &googleapi.Error{ 9005 Code: res.StatusCode, 9006 Header: res.Header, 9007 } 9008 } 9009 if err != nil { 9010 return nil, err 9011 } 9012 defer googleapi.CloseBody(res) 9013 if err := googleapi.CheckResponse(res); err != nil { 9014 return nil, err 9015 } 9016 ret := &CourseWorkMaterial{ 9017 ServerResponse: googleapi.ServerResponse{ 9018 Header: res.Header, 9019 HTTPStatusCode: res.StatusCode, 9020 }, 9021 } 9022 target := &ret 9023 if err := gensupport.DecodeResponse(target, res); err != nil { 9024 return nil, err 9025 } 9026 return ret, nil 9027 // { 9028 // "description": "Updates one or more fields of a course work material. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `FAILED_PRECONDITION` if the requested course work material has already been deleted. * `NOT_FOUND` if the requested course or course work material does not exist", 9029 // "flatPath": "v1/courses/{courseId}/courseWorkMaterials/{id}", 9030 // "httpMethod": "PATCH", 9031 // "id": "classroom.courses.courseWorkMaterials.patch", 9032 // "parameterOrder": [ 9033 // "courseId", 9034 // "id" 9035 // ], 9036 // "parameters": { 9037 // "courseId": { 9038 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9039 // "location": "path", 9040 // "required": true, 9041 // "type": "string" 9042 // }, 9043 // "id": { 9044 // "description": "Identifier of the course work material.", 9045 // "location": "path", 9046 // "required": true, 9047 // "type": "string" 9048 // }, 9049 // "updateMask": { 9050 // "description": "Mask that identifies which fields on the course work material to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the course work material object. If a field that does not support empty values is included in the update mask and not set in the course work material object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified by teachers: * `title` * `description` * `state` * `scheduled_time` * `topic_id`", 9051 // "format": "google-fieldmask", 9052 // "location": "query", 9053 // "type": "string" 9054 // } 9055 // }, 9056 // "path": "v1/courses/{courseId}/courseWorkMaterials/{id}", 9057 // "request": { 9058 // "$ref": "CourseWorkMaterial" 9059 // }, 9060 // "response": { 9061 // "$ref": "CourseWorkMaterial" 9062 // }, 9063 // "scopes": [ 9064 // "https://www.googleapis.com/auth/classroom.courseworkmaterials" 9065 // ] 9066 // } 9067 9068} 9069 9070// method id "classroom.courses.students.create": 9071 9072type CoursesStudentsCreateCall struct { 9073 s *Service 9074 courseId string 9075 student *Student 9076 urlParams_ gensupport.URLParams 9077 ctx_ context.Context 9078 header_ http.Header 9079} 9080 9081// Create: Adds a user as a student of a course. This method returns the 9082// following error codes: * `PERMISSION_DENIED` if the requesting user 9083// is not permitted to create students in this course or for access 9084// errors. * `NOT_FOUND` if the requested course ID does not exist. * 9085// `FAILED_PRECONDITION` if the requested user's account is disabled, 9086// for the following request errors: * CourseMemberLimitReached * 9087// CourseNotModifiable * UserGroupsMembershipLimitReached * 9088// `ALREADY_EXISTS` if the user is already a student or teacher in the 9089// course. 9090// 9091// - courseId: Identifier of the course to create the student in. This 9092// identifier can be either the Classroom-assigned identifier or an 9093// alias. 9094func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall { 9095 c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9096 c.courseId = courseId 9097 c.student = student 9098 return c 9099} 9100 9101// EnrollmentCode sets the optional parameter "enrollmentCode": 9102// Enrollment code of the course to create the student in. This code is 9103// required if userId corresponds to the requesting user; it may be 9104// omitted if the requesting user has administrative permissions to 9105// create students for any user. 9106func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall { 9107 c.urlParams_.Set("enrollmentCode", enrollmentCode) 9108 return c 9109} 9110 9111// Fields allows partial responses to be retrieved. See 9112// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9113// for more information. 9114func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall { 9115 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9116 return c 9117} 9118 9119// Context sets the context to be used in this call's Do method. Any 9120// pending HTTP request will be aborted if the provided context is 9121// canceled. 9122func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall { 9123 c.ctx_ = ctx 9124 return c 9125} 9126 9127// Header returns an http.Header that can be modified by the caller to 9128// add HTTP headers to the request. 9129func (c *CoursesStudentsCreateCall) Header() http.Header { 9130 if c.header_ == nil { 9131 c.header_ = make(http.Header) 9132 } 9133 return c.header_ 9134} 9135 9136func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) { 9137 reqHeaders := make(http.Header) 9138 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 9139 for k, v := range c.header_ { 9140 reqHeaders[k] = v 9141 } 9142 reqHeaders.Set("User-Agent", c.s.userAgent()) 9143 var body io.Reader = nil 9144 body, err := googleapi.WithoutDataWrapper.JSONReader(c.student) 9145 if err != nil { 9146 return nil, err 9147 } 9148 reqHeaders.Set("Content-Type", "application/json") 9149 c.urlParams_.Set("alt", alt) 9150 c.urlParams_.Set("prettyPrint", "false") 9151 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9152 urls += "?" + c.urlParams_.Encode() 9153 req, err := http.NewRequest("POST", urls, body) 9154 if err != nil { 9155 return nil, err 9156 } 9157 req.Header = reqHeaders 9158 googleapi.Expand(req.URL, map[string]string{ 9159 "courseId": c.courseId, 9160 }) 9161 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9162} 9163 9164// Do executes the "classroom.courses.students.create" call. 9165// Exactly one of *Student or error will be non-nil. Any non-2xx status 9166// code is an error. Response headers are in either 9167// *Student.ServerResponse.Header or (if a response was returned at all) 9168// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9169// check whether the returned error was because http.StatusNotModified 9170// was returned. 9171func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) { 9172 gensupport.SetOptions(c.urlParams_, opts...) 9173 res, err := c.doRequest("json") 9174 if res != nil && res.StatusCode == http.StatusNotModified { 9175 if res.Body != nil { 9176 res.Body.Close() 9177 } 9178 return nil, &googleapi.Error{ 9179 Code: res.StatusCode, 9180 Header: res.Header, 9181 } 9182 } 9183 if err != nil { 9184 return nil, err 9185 } 9186 defer googleapi.CloseBody(res) 9187 if err := googleapi.CheckResponse(res); err != nil { 9188 return nil, err 9189 } 9190 ret := &Student{ 9191 ServerResponse: googleapi.ServerResponse{ 9192 Header: res.Header, 9193 HTTPStatusCode: res.StatusCode, 9194 }, 9195 } 9196 target := &ret 9197 if err := gensupport.DecodeResponse(target, res); err != nil { 9198 return nil, err 9199 } 9200 return ret, nil 9201 // { 9202 // "description": "Adds a user as a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create students in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a student or teacher in the course.", 9203 // "flatPath": "v1/courses/{courseId}/students", 9204 // "httpMethod": "POST", 9205 // "id": "classroom.courses.students.create", 9206 // "parameterOrder": [ 9207 // "courseId" 9208 // ], 9209 // "parameters": { 9210 // "courseId": { 9211 // "description": "Identifier of the course to create the student in. This identifier can be either the Classroom-assigned identifier or an alias.", 9212 // "location": "path", 9213 // "required": true, 9214 // "type": "string" 9215 // }, 9216 // "enrollmentCode": { 9217 // "description": "Enrollment code of the course to create the student in. This code is required if userId corresponds to the requesting user; it may be omitted if the requesting user has administrative permissions to create students for any user.", 9218 // "location": "query", 9219 // "type": "string" 9220 // } 9221 // }, 9222 // "path": "v1/courses/{courseId}/students", 9223 // "request": { 9224 // "$ref": "Student" 9225 // }, 9226 // "response": { 9227 // "$ref": "Student" 9228 // }, 9229 // "scopes": [ 9230 // "https://www.googleapis.com/auth/classroom.profile.emails", 9231 // "https://www.googleapis.com/auth/classroom.profile.photos", 9232 // "https://www.googleapis.com/auth/classroom.rosters" 9233 // ] 9234 // } 9235 9236} 9237 9238// method id "classroom.courses.students.delete": 9239 9240type CoursesStudentsDeleteCall struct { 9241 s *Service 9242 courseId string 9243 userId string 9244 urlParams_ gensupport.URLParams 9245 ctx_ context.Context 9246 header_ http.Header 9247} 9248 9249// Delete: Deletes a student of a course. This method returns the 9250// following error codes: * `PERMISSION_DENIED` if the requesting user 9251// is not permitted to delete students of this course or for access 9252// errors. * `NOT_FOUND` if no student of this course has the requested 9253// ID or if the course does not exist. 9254// 9255// - courseId: Identifier of the course. This identifier can be either 9256// the Classroom-assigned identifier or an alias. 9257// - userId: Identifier of the student to delete. The identifier can be 9258// one of the following: * the numeric identifier for the user * the 9259// email address of the user * the string literal "me", indicating 9260// the requesting user. 9261func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall { 9262 c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9263 c.courseId = courseId 9264 c.userId = userId 9265 return c 9266} 9267 9268// Fields allows partial responses to be retrieved. See 9269// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9270// for more information. 9271func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall { 9272 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9273 return c 9274} 9275 9276// Context sets the context to be used in this call's Do method. Any 9277// pending HTTP request will be aborted if the provided context is 9278// canceled. 9279func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall { 9280 c.ctx_ = ctx 9281 return c 9282} 9283 9284// Header returns an http.Header that can be modified by the caller to 9285// add HTTP headers to the request. 9286func (c *CoursesStudentsDeleteCall) Header() http.Header { 9287 if c.header_ == nil { 9288 c.header_ = make(http.Header) 9289 } 9290 return c.header_ 9291} 9292 9293func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) { 9294 reqHeaders := make(http.Header) 9295 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 9296 for k, v := range c.header_ { 9297 reqHeaders[k] = v 9298 } 9299 reqHeaders.Set("User-Agent", c.s.userAgent()) 9300 var body io.Reader = nil 9301 c.urlParams_.Set("alt", alt) 9302 c.urlParams_.Set("prettyPrint", "false") 9303 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 9304 urls += "?" + c.urlParams_.Encode() 9305 req, err := http.NewRequest("DELETE", urls, body) 9306 if err != nil { 9307 return nil, err 9308 } 9309 req.Header = reqHeaders 9310 googleapi.Expand(req.URL, map[string]string{ 9311 "courseId": c.courseId, 9312 "userId": c.userId, 9313 }) 9314 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9315} 9316 9317// Do executes the "classroom.courses.students.delete" call. 9318// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9319// code is an error. Response headers are in either 9320// *Empty.ServerResponse.Header or (if a response was returned at all) 9321// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9322// check whether the returned error was because http.StatusNotModified 9323// was returned. 9324func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9325 gensupport.SetOptions(c.urlParams_, opts...) 9326 res, err := c.doRequest("json") 9327 if res != nil && res.StatusCode == http.StatusNotModified { 9328 if res.Body != nil { 9329 res.Body.Close() 9330 } 9331 return nil, &googleapi.Error{ 9332 Code: res.StatusCode, 9333 Header: res.Header, 9334 } 9335 } 9336 if err != nil { 9337 return nil, err 9338 } 9339 defer googleapi.CloseBody(res) 9340 if err := googleapi.CheckResponse(res); err != nil { 9341 return nil, err 9342 } 9343 ret := &Empty{ 9344 ServerResponse: googleapi.ServerResponse{ 9345 Header: res.Header, 9346 HTTPStatusCode: res.StatusCode, 9347 }, 9348 } 9349 target := &ret 9350 if err := gensupport.DecodeResponse(target, res); err != nil { 9351 return nil, err 9352 } 9353 return ret, nil 9354 // { 9355 // "description": "Deletes a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist.", 9356 // "flatPath": "v1/courses/{courseId}/students/{userId}", 9357 // "httpMethod": "DELETE", 9358 // "id": "classroom.courses.students.delete", 9359 // "parameterOrder": [ 9360 // "courseId", 9361 // "userId" 9362 // ], 9363 // "parameters": { 9364 // "courseId": { 9365 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9366 // "location": "path", 9367 // "required": true, 9368 // "type": "string" 9369 // }, 9370 // "userId": { 9371 // "description": "Identifier of the student to delete. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 9372 // "location": "path", 9373 // "required": true, 9374 // "type": "string" 9375 // } 9376 // }, 9377 // "path": "v1/courses/{courseId}/students/{userId}", 9378 // "response": { 9379 // "$ref": "Empty" 9380 // }, 9381 // "scopes": [ 9382 // "https://www.googleapis.com/auth/classroom.rosters" 9383 // ] 9384 // } 9385 9386} 9387 9388// method id "classroom.courses.students.get": 9389 9390type CoursesStudentsGetCall struct { 9391 s *Service 9392 courseId string 9393 userId string 9394 urlParams_ gensupport.URLParams 9395 ifNoneMatch_ string 9396 ctx_ context.Context 9397 header_ http.Header 9398} 9399 9400// Get: Returns a student of a course. This method returns the following 9401// error codes: * `PERMISSION_DENIED` if the requesting user is not 9402// permitted to view students of this course or for access errors. * 9403// `NOT_FOUND` if no student of this course has the requested ID or if 9404// the course does not exist. 9405// 9406// - courseId: Identifier of the course. This identifier can be either 9407// the Classroom-assigned identifier or an alias. 9408// - userId: Identifier of the student to return. The identifier can be 9409// one of the following: * the numeric identifier for the user * the 9410// email address of the user * the string literal "me", indicating 9411// the requesting user. 9412func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall { 9413 c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9414 c.courseId = courseId 9415 c.userId = userId 9416 return c 9417} 9418 9419// Fields allows partial responses to be retrieved. See 9420// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9421// for more information. 9422func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall { 9423 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9424 return c 9425} 9426 9427// IfNoneMatch sets the optional parameter which makes the operation 9428// fail if the object's ETag matches the given value. This is useful for 9429// getting updates only after the object has changed since the last 9430// request. Use googleapi.IsNotModified to check whether the response 9431// error from Do is the result of In-None-Match. 9432func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall { 9433 c.ifNoneMatch_ = entityTag 9434 return c 9435} 9436 9437// Context sets the context to be used in this call's Do method. Any 9438// pending HTTP request will be aborted if the provided context is 9439// canceled. 9440func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall { 9441 c.ctx_ = ctx 9442 return c 9443} 9444 9445// Header returns an http.Header that can be modified by the caller to 9446// add HTTP headers to the request. 9447func (c *CoursesStudentsGetCall) Header() http.Header { 9448 if c.header_ == nil { 9449 c.header_ = make(http.Header) 9450 } 9451 return c.header_ 9452} 9453 9454func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) { 9455 reqHeaders := make(http.Header) 9456 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 9457 for k, v := range c.header_ { 9458 reqHeaders[k] = v 9459 } 9460 reqHeaders.Set("User-Agent", c.s.userAgent()) 9461 if c.ifNoneMatch_ != "" { 9462 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9463 } 9464 var body io.Reader = nil 9465 c.urlParams_.Set("alt", alt) 9466 c.urlParams_.Set("prettyPrint", "false") 9467 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}") 9468 urls += "?" + c.urlParams_.Encode() 9469 req, err := http.NewRequest("GET", urls, body) 9470 if err != nil { 9471 return nil, err 9472 } 9473 req.Header = reqHeaders 9474 googleapi.Expand(req.URL, map[string]string{ 9475 "courseId": c.courseId, 9476 "userId": c.userId, 9477 }) 9478 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9479} 9480 9481// Do executes the "classroom.courses.students.get" call. 9482// Exactly one of *Student or error will be non-nil. Any non-2xx status 9483// code is an error. Response headers are in either 9484// *Student.ServerResponse.Header or (if a response was returned at all) 9485// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9486// check whether the returned error was because http.StatusNotModified 9487// was returned. 9488func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) { 9489 gensupport.SetOptions(c.urlParams_, opts...) 9490 res, err := c.doRequest("json") 9491 if res != nil && res.StatusCode == http.StatusNotModified { 9492 if res.Body != nil { 9493 res.Body.Close() 9494 } 9495 return nil, &googleapi.Error{ 9496 Code: res.StatusCode, 9497 Header: res.Header, 9498 } 9499 } 9500 if err != nil { 9501 return nil, err 9502 } 9503 defer googleapi.CloseBody(res) 9504 if err := googleapi.CheckResponse(res); err != nil { 9505 return nil, err 9506 } 9507 ret := &Student{ 9508 ServerResponse: googleapi.ServerResponse{ 9509 Header: res.Header, 9510 HTTPStatusCode: res.StatusCode, 9511 }, 9512 } 9513 target := &ret 9514 if err := gensupport.DecodeResponse(target, res); err != nil { 9515 return nil, err 9516 } 9517 return ret, nil 9518 // { 9519 // "description": "Returns a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist.", 9520 // "flatPath": "v1/courses/{courseId}/students/{userId}", 9521 // "httpMethod": "GET", 9522 // "id": "classroom.courses.students.get", 9523 // "parameterOrder": [ 9524 // "courseId", 9525 // "userId" 9526 // ], 9527 // "parameters": { 9528 // "courseId": { 9529 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9530 // "location": "path", 9531 // "required": true, 9532 // "type": "string" 9533 // }, 9534 // "userId": { 9535 // "description": "Identifier of the student to return. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 9536 // "location": "path", 9537 // "required": true, 9538 // "type": "string" 9539 // } 9540 // }, 9541 // "path": "v1/courses/{courseId}/students/{userId}", 9542 // "response": { 9543 // "$ref": "Student" 9544 // }, 9545 // "scopes": [ 9546 // "https://www.googleapis.com/auth/classroom.profile.emails", 9547 // "https://www.googleapis.com/auth/classroom.profile.photos", 9548 // "https://www.googleapis.com/auth/classroom.rosters", 9549 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9550 // ] 9551 // } 9552 9553} 9554 9555// method id "classroom.courses.students.list": 9556 9557type CoursesStudentsListCall struct { 9558 s *Service 9559 courseId string 9560 urlParams_ gensupport.URLParams 9561 ifNoneMatch_ string 9562 ctx_ context.Context 9563 header_ http.Header 9564} 9565 9566// List: Returns a list of students of this course that the requester is 9567// permitted to view. This method returns the following error codes: * 9568// `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for 9569// access errors. 9570// 9571// - courseId: Identifier of the course. This identifier can be either 9572// the Classroom-assigned identifier or an alias. 9573func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall { 9574 c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9575 c.courseId = courseId 9576 return c 9577} 9578 9579// PageSize sets the optional parameter "pageSize": Maximum number of 9580// items to return. The default is 30 if unspecified or `0`. The server 9581// may return fewer than the specified number of results. 9582func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall { 9583 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9584 return c 9585} 9586 9587// PageToken sets the optional parameter "pageToken": nextPageToken 9588// value returned from a previous list call, indicating that the 9589// subsequent page of results should be returned. The list request must 9590// be otherwise identical to the one that resulted in this token. 9591func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall { 9592 c.urlParams_.Set("pageToken", pageToken) 9593 return c 9594} 9595 9596// Fields allows partial responses to be retrieved. See 9597// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9598// for more information. 9599func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall { 9600 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9601 return c 9602} 9603 9604// IfNoneMatch sets the optional parameter which makes the operation 9605// fail if the object's ETag matches the given value. This is useful for 9606// getting updates only after the object has changed since the last 9607// request. Use googleapi.IsNotModified to check whether the response 9608// error from Do is the result of In-None-Match. 9609func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall { 9610 c.ifNoneMatch_ = entityTag 9611 return c 9612} 9613 9614// Context sets the context to be used in this call's Do method. Any 9615// pending HTTP request will be aborted if the provided context is 9616// canceled. 9617func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall { 9618 c.ctx_ = ctx 9619 return c 9620} 9621 9622// Header returns an http.Header that can be modified by the caller to 9623// add HTTP headers to the request. 9624func (c *CoursesStudentsListCall) Header() http.Header { 9625 if c.header_ == nil { 9626 c.header_ = make(http.Header) 9627 } 9628 return c.header_ 9629} 9630 9631func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) { 9632 reqHeaders := make(http.Header) 9633 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 9634 for k, v := range c.header_ { 9635 reqHeaders[k] = v 9636 } 9637 reqHeaders.Set("User-Agent", c.s.userAgent()) 9638 if c.ifNoneMatch_ != "" { 9639 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9640 } 9641 var body io.Reader = nil 9642 c.urlParams_.Set("alt", alt) 9643 c.urlParams_.Set("prettyPrint", "false") 9644 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students") 9645 urls += "?" + c.urlParams_.Encode() 9646 req, err := http.NewRequest("GET", urls, body) 9647 if err != nil { 9648 return nil, err 9649 } 9650 req.Header = reqHeaders 9651 googleapi.Expand(req.URL, map[string]string{ 9652 "courseId": c.courseId, 9653 }) 9654 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9655} 9656 9657// Do executes the "classroom.courses.students.list" call. 9658// Exactly one of *ListStudentsResponse or error will be non-nil. Any 9659// non-2xx status code is an error. Response headers are in either 9660// *ListStudentsResponse.ServerResponse.Header or (if a response was 9661// returned at all) in error.(*googleapi.Error).Header. Use 9662// googleapi.IsNotModified to check whether the returned error was 9663// because http.StatusNotModified was returned. 9664func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) { 9665 gensupport.SetOptions(c.urlParams_, opts...) 9666 res, err := c.doRequest("json") 9667 if res != nil && res.StatusCode == http.StatusNotModified { 9668 if res.Body != nil { 9669 res.Body.Close() 9670 } 9671 return nil, &googleapi.Error{ 9672 Code: res.StatusCode, 9673 Header: res.Header, 9674 } 9675 } 9676 if err != nil { 9677 return nil, err 9678 } 9679 defer googleapi.CloseBody(res) 9680 if err := googleapi.CheckResponse(res); err != nil { 9681 return nil, err 9682 } 9683 ret := &ListStudentsResponse{ 9684 ServerResponse: googleapi.ServerResponse{ 9685 Header: res.Header, 9686 HTTPStatusCode: res.StatusCode, 9687 }, 9688 } 9689 target := &ret 9690 if err := gensupport.DecodeResponse(target, res); err != nil { 9691 return nil, err 9692 } 9693 return ret, nil 9694 // { 9695 // "description": "Returns a list of students of this course that the requester is permitted to view. This method returns the following error codes: * `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for access errors.", 9696 // "flatPath": "v1/courses/{courseId}/students", 9697 // "httpMethod": "GET", 9698 // "id": "classroom.courses.students.list", 9699 // "parameterOrder": [ 9700 // "courseId" 9701 // ], 9702 // "parameters": { 9703 // "courseId": { 9704 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9705 // "location": "path", 9706 // "required": true, 9707 // "type": "string" 9708 // }, 9709 // "pageSize": { 9710 // "description": "Maximum number of items to return. The default is 30 if unspecified or `0`. The server may return fewer than the specified number of results.", 9711 // "format": "int32", 9712 // "location": "query", 9713 // "type": "integer" 9714 // }, 9715 // "pageToken": { 9716 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 9717 // "location": "query", 9718 // "type": "string" 9719 // } 9720 // }, 9721 // "path": "v1/courses/{courseId}/students", 9722 // "response": { 9723 // "$ref": "ListStudentsResponse" 9724 // }, 9725 // "scopes": [ 9726 // "https://www.googleapis.com/auth/classroom.profile.emails", 9727 // "https://www.googleapis.com/auth/classroom.profile.photos", 9728 // "https://www.googleapis.com/auth/classroom.rosters", 9729 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 9730 // ] 9731 // } 9732 9733} 9734 9735// Pages invokes f for each page of results. 9736// A non-nil error returned from f will halt the iteration. 9737// The provided context supersedes any context provided to the Context method. 9738func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error { 9739 c.ctx_ = ctx 9740 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9741 for { 9742 x, err := c.Do() 9743 if err != nil { 9744 return err 9745 } 9746 if err := f(x); err != nil { 9747 return err 9748 } 9749 if x.NextPageToken == "" { 9750 return nil 9751 } 9752 c.PageToken(x.NextPageToken) 9753 } 9754} 9755 9756// method id "classroom.courses.teachers.create": 9757 9758type CoursesTeachersCreateCall struct { 9759 s *Service 9760 courseId string 9761 teacher *Teacher 9762 urlParams_ gensupport.URLParams 9763 ctx_ context.Context 9764 header_ http.Header 9765} 9766 9767// Create: Creates a teacher of a course. This method returns the 9768// following error codes: * `PERMISSION_DENIED` if the requesting user 9769// is not permitted to create teachers in this course or for access 9770// errors. * `NOT_FOUND` if the requested course ID does not exist. * 9771// `FAILED_PRECONDITION` if the requested user's account is disabled, 9772// for the following request errors: * CourseMemberLimitReached * 9773// CourseNotModifiable * CourseTeacherLimitReached * 9774// UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is 9775// already a teacher or student in the course. 9776// 9777// - courseId: Identifier of the course. This identifier can be either 9778// the Classroom-assigned identifier or an alias. 9779func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall { 9780 c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9781 c.courseId = courseId 9782 c.teacher = teacher 9783 return c 9784} 9785 9786// Fields allows partial responses to be retrieved. See 9787// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9788// for more information. 9789func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall { 9790 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9791 return c 9792} 9793 9794// Context sets the context to be used in this call's Do method. Any 9795// pending HTTP request will be aborted if the provided context is 9796// canceled. 9797func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall { 9798 c.ctx_ = ctx 9799 return c 9800} 9801 9802// Header returns an http.Header that can be modified by the caller to 9803// add HTTP headers to the request. 9804func (c *CoursesTeachersCreateCall) Header() http.Header { 9805 if c.header_ == nil { 9806 c.header_ = make(http.Header) 9807 } 9808 return c.header_ 9809} 9810 9811func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) { 9812 reqHeaders := make(http.Header) 9813 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 9814 for k, v := range c.header_ { 9815 reqHeaders[k] = v 9816 } 9817 reqHeaders.Set("User-Agent", c.s.userAgent()) 9818 var body io.Reader = nil 9819 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher) 9820 if err != nil { 9821 return nil, err 9822 } 9823 reqHeaders.Set("Content-Type", "application/json") 9824 c.urlParams_.Set("alt", alt) 9825 c.urlParams_.Set("prettyPrint", "false") 9826 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 9827 urls += "?" + c.urlParams_.Encode() 9828 req, err := http.NewRequest("POST", urls, body) 9829 if err != nil { 9830 return nil, err 9831 } 9832 req.Header = reqHeaders 9833 googleapi.Expand(req.URL, map[string]string{ 9834 "courseId": c.courseId, 9835 }) 9836 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9837} 9838 9839// Do executes the "classroom.courses.teachers.create" call. 9840// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 9841// code is an error. Response headers are in either 9842// *Teacher.ServerResponse.Header or (if a response was returned at all) 9843// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9844// check whether the returned error was because http.StatusNotModified 9845// was returned. 9846func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 9847 gensupport.SetOptions(c.urlParams_, opts...) 9848 res, err := c.doRequest("json") 9849 if res != nil && res.StatusCode == http.StatusNotModified { 9850 if res.Body != nil { 9851 res.Body.Close() 9852 } 9853 return nil, &googleapi.Error{ 9854 Code: res.StatusCode, 9855 Header: res.Header, 9856 } 9857 } 9858 if err != nil { 9859 return nil, err 9860 } 9861 defer googleapi.CloseBody(res) 9862 if err := googleapi.CheckResponse(res); err != nil { 9863 return nil, err 9864 } 9865 ret := &Teacher{ 9866 ServerResponse: googleapi.ServerResponse{ 9867 Header: res.Header, 9868 HTTPStatusCode: res.StatusCode, 9869 }, 9870 } 9871 target := &ret 9872 if err := gensupport.DecodeResponse(target, res); err != nil { 9873 return nil, err 9874 } 9875 return ret, nil 9876 // { 9877 // "description": "Creates a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create teachers in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a teacher or student in the course.", 9878 // "flatPath": "v1/courses/{courseId}/teachers", 9879 // "httpMethod": "POST", 9880 // "id": "classroom.courses.teachers.create", 9881 // "parameterOrder": [ 9882 // "courseId" 9883 // ], 9884 // "parameters": { 9885 // "courseId": { 9886 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 9887 // "location": "path", 9888 // "required": true, 9889 // "type": "string" 9890 // } 9891 // }, 9892 // "path": "v1/courses/{courseId}/teachers", 9893 // "request": { 9894 // "$ref": "Teacher" 9895 // }, 9896 // "response": { 9897 // "$ref": "Teacher" 9898 // }, 9899 // "scopes": [ 9900 // "https://www.googleapis.com/auth/classroom.profile.emails", 9901 // "https://www.googleapis.com/auth/classroom.profile.photos", 9902 // "https://www.googleapis.com/auth/classroom.rosters" 9903 // ] 9904 // } 9905 9906} 9907 9908// method id "classroom.courses.teachers.delete": 9909 9910type CoursesTeachersDeleteCall struct { 9911 s *Service 9912 courseId string 9913 userId string 9914 urlParams_ gensupport.URLParams 9915 ctx_ context.Context 9916 header_ http.Header 9917} 9918 9919// Delete: Deletes a teacher of a course. This method returns the 9920// following error codes: * `PERMISSION_DENIED` if the requesting user 9921// is not permitted to delete teachers of this course or for access 9922// errors. * `NOT_FOUND` if no teacher of this course has the requested 9923// ID or if the course does not exist. * `FAILED_PRECONDITION` if the 9924// requested ID belongs to the primary teacher of this course. * 9925// `FAILED_PRECONDITION` if the requested ID belongs to the owner of the 9926// course Drive folder. * `FAILED_PRECONDITION` if the course no longer 9927// has an active owner. 9928// 9929// - courseId: Identifier of the course. This identifier can be either 9930// the Classroom-assigned identifier or an alias. 9931// - userId: Identifier of the teacher to delete. The identifier can be 9932// one of the following: * the numeric identifier for the user * the 9933// email address of the user * the string literal "me", indicating 9934// the requesting user. 9935func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall { 9936 c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9937 c.courseId = courseId 9938 c.userId = userId 9939 return c 9940} 9941 9942// Fields allows partial responses to be retrieved. See 9943// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9944// for more information. 9945func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall { 9946 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9947 return c 9948} 9949 9950// Context sets the context to be used in this call's Do method. Any 9951// pending HTTP request will be aborted if the provided context is 9952// canceled. 9953func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall { 9954 c.ctx_ = ctx 9955 return c 9956} 9957 9958// Header returns an http.Header that can be modified by the caller to 9959// add HTTP headers to the request. 9960func (c *CoursesTeachersDeleteCall) Header() http.Header { 9961 if c.header_ == nil { 9962 c.header_ = make(http.Header) 9963 } 9964 return c.header_ 9965} 9966 9967func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) { 9968 reqHeaders := make(http.Header) 9969 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 9970 for k, v := range c.header_ { 9971 reqHeaders[k] = v 9972 } 9973 reqHeaders.Set("User-Agent", c.s.userAgent()) 9974 var body io.Reader = nil 9975 c.urlParams_.Set("alt", alt) 9976 c.urlParams_.Set("prettyPrint", "false") 9977 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 9978 urls += "?" + c.urlParams_.Encode() 9979 req, err := http.NewRequest("DELETE", urls, body) 9980 if err != nil { 9981 return nil, err 9982 } 9983 req.Header = reqHeaders 9984 googleapi.Expand(req.URL, map[string]string{ 9985 "courseId": c.courseId, 9986 "userId": c.userId, 9987 }) 9988 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9989} 9990 9991// Do executes the "classroom.courses.teachers.delete" call. 9992// Exactly one of *Empty or error will be non-nil. Any non-2xx status 9993// code is an error. Response headers are in either 9994// *Empty.ServerResponse.Header or (if a response was returned at all) 9995// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9996// check whether the returned error was because http.StatusNotModified 9997// was returned. 9998func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 9999 gensupport.SetOptions(c.urlParams_, opts...) 10000 res, err := c.doRequest("json") 10001 if res != nil && res.StatusCode == http.StatusNotModified { 10002 if res.Body != nil { 10003 res.Body.Close() 10004 } 10005 return nil, &googleapi.Error{ 10006 Code: res.StatusCode, 10007 Header: res.Header, 10008 } 10009 } 10010 if err != nil { 10011 return nil, err 10012 } 10013 defer googleapi.CloseBody(res) 10014 if err := googleapi.CheckResponse(res); err != nil { 10015 return nil, err 10016 } 10017 ret := &Empty{ 10018 ServerResponse: googleapi.ServerResponse{ 10019 Header: res.Header, 10020 HTTPStatusCode: res.StatusCode, 10021 }, 10022 } 10023 target := &ret 10024 if err := gensupport.DecodeResponse(target, res); err != nil { 10025 return nil, err 10026 } 10027 return ret, nil 10028 // { 10029 // "description": "Deletes a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete teachers of this course or for access errors. * `NOT_FOUND` if no teacher of this course has the requested ID or if the course does not exist. * `FAILED_PRECONDITION` if the requested ID belongs to the primary teacher of this course. * `FAILED_PRECONDITION` if the requested ID belongs to the owner of the course Drive folder. * `FAILED_PRECONDITION` if the course no longer has an active owner.", 10030 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 10031 // "httpMethod": "DELETE", 10032 // "id": "classroom.courses.teachers.delete", 10033 // "parameterOrder": [ 10034 // "courseId", 10035 // "userId" 10036 // ], 10037 // "parameters": { 10038 // "courseId": { 10039 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10040 // "location": "path", 10041 // "required": true, 10042 // "type": "string" 10043 // }, 10044 // "userId": { 10045 // "description": "Identifier of the teacher to delete. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 10046 // "location": "path", 10047 // "required": true, 10048 // "type": "string" 10049 // } 10050 // }, 10051 // "path": "v1/courses/{courseId}/teachers/{userId}", 10052 // "response": { 10053 // "$ref": "Empty" 10054 // }, 10055 // "scopes": [ 10056 // "https://www.googleapis.com/auth/classroom.rosters" 10057 // ] 10058 // } 10059 10060} 10061 10062// method id "classroom.courses.teachers.get": 10063 10064type CoursesTeachersGetCall struct { 10065 s *Service 10066 courseId string 10067 userId string 10068 urlParams_ gensupport.URLParams 10069 ifNoneMatch_ string 10070 ctx_ context.Context 10071 header_ http.Header 10072} 10073 10074// Get: Returns a teacher of a course. This method returns the following 10075// error codes: * `PERMISSION_DENIED` if the requesting user is not 10076// permitted to view teachers of this course or for access errors. * 10077// `NOT_FOUND` if no teacher of this course has the requested ID or if 10078// the course does not exist. 10079// 10080// - courseId: Identifier of the course. This identifier can be either 10081// the Classroom-assigned identifier or an alias. 10082// - userId: Identifier of the teacher to return. The identifier can be 10083// one of the following: * the numeric identifier for the user * the 10084// email address of the user * the string literal "me", indicating 10085// the requesting user. 10086func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall { 10087 c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10088 c.courseId = courseId 10089 c.userId = userId 10090 return c 10091} 10092 10093// Fields allows partial responses to be retrieved. See 10094// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10095// for more information. 10096func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall { 10097 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10098 return c 10099} 10100 10101// IfNoneMatch sets the optional parameter which makes the operation 10102// fail if the object's ETag matches the given value. This is useful for 10103// getting updates only after the object has changed since the last 10104// request. Use googleapi.IsNotModified to check whether the response 10105// error from Do is the result of In-None-Match. 10106func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall { 10107 c.ifNoneMatch_ = entityTag 10108 return c 10109} 10110 10111// Context sets the context to be used in this call's Do method. Any 10112// pending HTTP request will be aborted if the provided context is 10113// canceled. 10114func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall { 10115 c.ctx_ = ctx 10116 return c 10117} 10118 10119// Header returns an http.Header that can be modified by the caller to 10120// add HTTP headers to the request. 10121func (c *CoursesTeachersGetCall) Header() http.Header { 10122 if c.header_ == nil { 10123 c.header_ = make(http.Header) 10124 } 10125 return c.header_ 10126} 10127 10128func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) { 10129 reqHeaders := make(http.Header) 10130 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 10131 for k, v := range c.header_ { 10132 reqHeaders[k] = v 10133 } 10134 reqHeaders.Set("User-Agent", c.s.userAgent()) 10135 if c.ifNoneMatch_ != "" { 10136 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10137 } 10138 var body io.Reader = nil 10139 c.urlParams_.Set("alt", alt) 10140 c.urlParams_.Set("prettyPrint", "false") 10141 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}") 10142 urls += "?" + c.urlParams_.Encode() 10143 req, err := http.NewRequest("GET", urls, body) 10144 if err != nil { 10145 return nil, err 10146 } 10147 req.Header = reqHeaders 10148 googleapi.Expand(req.URL, map[string]string{ 10149 "courseId": c.courseId, 10150 "userId": c.userId, 10151 }) 10152 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10153} 10154 10155// Do executes the "classroom.courses.teachers.get" call. 10156// Exactly one of *Teacher or error will be non-nil. Any non-2xx status 10157// code is an error. Response headers are in either 10158// *Teacher.ServerResponse.Header or (if a response was returned at all) 10159// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10160// check whether the returned error was because http.StatusNotModified 10161// was returned. 10162func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) { 10163 gensupport.SetOptions(c.urlParams_, opts...) 10164 res, err := c.doRequest("json") 10165 if res != nil && res.StatusCode == http.StatusNotModified { 10166 if res.Body != nil { 10167 res.Body.Close() 10168 } 10169 return nil, &googleapi.Error{ 10170 Code: res.StatusCode, 10171 Header: res.Header, 10172 } 10173 } 10174 if err != nil { 10175 return nil, err 10176 } 10177 defer googleapi.CloseBody(res) 10178 if err := googleapi.CheckResponse(res); err != nil { 10179 return nil, err 10180 } 10181 ret := &Teacher{ 10182 ServerResponse: googleapi.ServerResponse{ 10183 Header: res.Header, 10184 HTTPStatusCode: res.StatusCode, 10185 }, 10186 } 10187 target := &ret 10188 if err := gensupport.DecodeResponse(target, res); err != nil { 10189 return nil, err 10190 } 10191 return ret, nil 10192 // { 10193 // "description": "Returns a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view teachers of this course or for access errors. * `NOT_FOUND` if no teacher of this course has the requested ID or if the course does not exist.", 10194 // "flatPath": "v1/courses/{courseId}/teachers/{userId}", 10195 // "httpMethod": "GET", 10196 // "id": "classroom.courses.teachers.get", 10197 // "parameterOrder": [ 10198 // "courseId", 10199 // "userId" 10200 // ], 10201 // "parameters": { 10202 // "courseId": { 10203 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10204 // "location": "path", 10205 // "required": true, 10206 // "type": "string" 10207 // }, 10208 // "userId": { 10209 // "description": "Identifier of the teacher to return. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 10210 // "location": "path", 10211 // "required": true, 10212 // "type": "string" 10213 // } 10214 // }, 10215 // "path": "v1/courses/{courseId}/teachers/{userId}", 10216 // "response": { 10217 // "$ref": "Teacher" 10218 // }, 10219 // "scopes": [ 10220 // "https://www.googleapis.com/auth/classroom.profile.emails", 10221 // "https://www.googleapis.com/auth/classroom.profile.photos", 10222 // "https://www.googleapis.com/auth/classroom.rosters", 10223 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 10224 // ] 10225 // } 10226 10227} 10228 10229// method id "classroom.courses.teachers.list": 10230 10231type CoursesTeachersListCall struct { 10232 s *Service 10233 courseId string 10234 urlParams_ gensupport.URLParams 10235 ifNoneMatch_ string 10236 ctx_ context.Context 10237 header_ http.Header 10238} 10239 10240// List: Returns a list of teachers of this course that the requester is 10241// permitted to view. This method returns the following error codes: * 10242// `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for 10243// access errors. 10244// 10245// - courseId: Identifier of the course. This identifier can be either 10246// the Classroom-assigned identifier or an alias. 10247func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall { 10248 c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10249 c.courseId = courseId 10250 return c 10251} 10252 10253// PageSize sets the optional parameter "pageSize": Maximum number of 10254// items to return. The default is 30 if unspecified or `0`. The server 10255// may return fewer than the specified number of results. 10256func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall { 10257 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10258 return c 10259} 10260 10261// PageToken sets the optional parameter "pageToken": nextPageToken 10262// value returned from a previous list call, indicating that the 10263// subsequent page of results should be returned. The list request must 10264// be otherwise identical to the one that resulted in this token. 10265func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall { 10266 c.urlParams_.Set("pageToken", pageToken) 10267 return c 10268} 10269 10270// Fields allows partial responses to be retrieved. See 10271// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10272// for more information. 10273func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall { 10274 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10275 return c 10276} 10277 10278// IfNoneMatch sets the optional parameter which makes the operation 10279// fail if the object's ETag matches the given value. This is useful for 10280// getting updates only after the object has changed since the last 10281// request. Use googleapi.IsNotModified to check whether the response 10282// error from Do is the result of In-None-Match. 10283func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall { 10284 c.ifNoneMatch_ = entityTag 10285 return c 10286} 10287 10288// Context sets the context to be used in this call's Do method. Any 10289// pending HTTP request will be aborted if the provided context is 10290// canceled. 10291func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall { 10292 c.ctx_ = ctx 10293 return c 10294} 10295 10296// Header returns an http.Header that can be modified by the caller to 10297// add HTTP headers to the request. 10298func (c *CoursesTeachersListCall) Header() http.Header { 10299 if c.header_ == nil { 10300 c.header_ = make(http.Header) 10301 } 10302 return c.header_ 10303} 10304 10305func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) { 10306 reqHeaders := make(http.Header) 10307 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 10308 for k, v := range c.header_ { 10309 reqHeaders[k] = v 10310 } 10311 reqHeaders.Set("User-Agent", c.s.userAgent()) 10312 if c.ifNoneMatch_ != "" { 10313 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10314 } 10315 var body io.Reader = nil 10316 c.urlParams_.Set("alt", alt) 10317 c.urlParams_.Set("prettyPrint", "false") 10318 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers") 10319 urls += "?" + c.urlParams_.Encode() 10320 req, err := http.NewRequest("GET", urls, body) 10321 if err != nil { 10322 return nil, err 10323 } 10324 req.Header = reqHeaders 10325 googleapi.Expand(req.URL, map[string]string{ 10326 "courseId": c.courseId, 10327 }) 10328 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10329} 10330 10331// Do executes the "classroom.courses.teachers.list" call. 10332// Exactly one of *ListTeachersResponse or error will be non-nil. Any 10333// non-2xx status code is an error. Response headers are in either 10334// *ListTeachersResponse.ServerResponse.Header or (if a response was 10335// returned at all) in error.(*googleapi.Error).Header. Use 10336// googleapi.IsNotModified to check whether the returned error was 10337// because http.StatusNotModified was returned. 10338func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) { 10339 gensupport.SetOptions(c.urlParams_, opts...) 10340 res, err := c.doRequest("json") 10341 if res != nil && res.StatusCode == http.StatusNotModified { 10342 if res.Body != nil { 10343 res.Body.Close() 10344 } 10345 return nil, &googleapi.Error{ 10346 Code: res.StatusCode, 10347 Header: res.Header, 10348 } 10349 } 10350 if err != nil { 10351 return nil, err 10352 } 10353 defer googleapi.CloseBody(res) 10354 if err := googleapi.CheckResponse(res); err != nil { 10355 return nil, err 10356 } 10357 ret := &ListTeachersResponse{ 10358 ServerResponse: googleapi.ServerResponse{ 10359 Header: res.Header, 10360 HTTPStatusCode: res.StatusCode, 10361 }, 10362 } 10363 target := &ret 10364 if err := gensupport.DecodeResponse(target, res); err != nil { 10365 return nil, err 10366 } 10367 return ret, nil 10368 // { 10369 // "description": "Returns a list of teachers of this course that the requester is permitted to view. This method returns the following error codes: * `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for access errors.", 10370 // "flatPath": "v1/courses/{courseId}/teachers", 10371 // "httpMethod": "GET", 10372 // "id": "classroom.courses.teachers.list", 10373 // "parameterOrder": [ 10374 // "courseId" 10375 // ], 10376 // "parameters": { 10377 // "courseId": { 10378 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10379 // "location": "path", 10380 // "required": true, 10381 // "type": "string" 10382 // }, 10383 // "pageSize": { 10384 // "description": "Maximum number of items to return. The default is 30 if unspecified or `0`. The server may return fewer than the specified number of results.", 10385 // "format": "int32", 10386 // "location": "query", 10387 // "type": "integer" 10388 // }, 10389 // "pageToken": { 10390 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 10391 // "location": "query", 10392 // "type": "string" 10393 // } 10394 // }, 10395 // "path": "v1/courses/{courseId}/teachers", 10396 // "response": { 10397 // "$ref": "ListTeachersResponse" 10398 // }, 10399 // "scopes": [ 10400 // "https://www.googleapis.com/auth/classroom.profile.emails", 10401 // "https://www.googleapis.com/auth/classroom.profile.photos", 10402 // "https://www.googleapis.com/auth/classroom.rosters", 10403 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 10404 // ] 10405 // } 10406 10407} 10408 10409// Pages invokes f for each page of results. 10410// A non-nil error returned from f will halt the iteration. 10411// The provided context supersedes any context provided to the Context method. 10412func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error { 10413 c.ctx_ = ctx 10414 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10415 for { 10416 x, err := c.Do() 10417 if err != nil { 10418 return err 10419 } 10420 if err := f(x); err != nil { 10421 return err 10422 } 10423 if x.NextPageToken == "" { 10424 return nil 10425 } 10426 c.PageToken(x.NextPageToken) 10427 } 10428} 10429 10430// method id "classroom.courses.topics.create": 10431 10432type CoursesTopicsCreateCall struct { 10433 s *Service 10434 courseId string 10435 topic *Topic 10436 urlParams_ gensupport.URLParams 10437 ctx_ context.Context 10438 header_ http.Header 10439} 10440 10441// Create: Creates a topic. This method returns the following error 10442// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 10443// to access the requested course, create a topic in the requested 10444// course, or for access errors. * `INVALID_ARGUMENT` if the request is 10445// malformed. * `NOT_FOUND` if the requested course does not exist. 10446// 10447// - courseId: Identifier of the course. This identifier can be either 10448// the Classroom-assigned identifier or an alias. 10449func (r *CoursesTopicsService) Create(courseId string, topic *Topic) *CoursesTopicsCreateCall { 10450 c := &CoursesTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10451 c.courseId = courseId 10452 c.topic = topic 10453 return c 10454} 10455 10456// Fields allows partial responses to be retrieved. See 10457// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10458// for more information. 10459func (c *CoursesTopicsCreateCall) Fields(s ...googleapi.Field) *CoursesTopicsCreateCall { 10460 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10461 return c 10462} 10463 10464// Context sets the context to be used in this call's Do method. Any 10465// pending HTTP request will be aborted if the provided context is 10466// canceled. 10467func (c *CoursesTopicsCreateCall) Context(ctx context.Context) *CoursesTopicsCreateCall { 10468 c.ctx_ = ctx 10469 return c 10470} 10471 10472// Header returns an http.Header that can be modified by the caller to 10473// add HTTP headers to the request. 10474func (c *CoursesTopicsCreateCall) Header() http.Header { 10475 if c.header_ == nil { 10476 c.header_ = make(http.Header) 10477 } 10478 return c.header_ 10479} 10480 10481func (c *CoursesTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 10482 reqHeaders := make(http.Header) 10483 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 10484 for k, v := range c.header_ { 10485 reqHeaders[k] = v 10486 } 10487 reqHeaders.Set("User-Agent", c.s.userAgent()) 10488 var body io.Reader = nil 10489 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 10490 if err != nil { 10491 return nil, err 10492 } 10493 reqHeaders.Set("Content-Type", "application/json") 10494 c.urlParams_.Set("alt", alt) 10495 c.urlParams_.Set("prettyPrint", "false") 10496 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10497 urls += "?" + c.urlParams_.Encode() 10498 req, err := http.NewRequest("POST", urls, body) 10499 if err != nil { 10500 return nil, err 10501 } 10502 req.Header = reqHeaders 10503 googleapi.Expand(req.URL, map[string]string{ 10504 "courseId": c.courseId, 10505 }) 10506 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10507} 10508 10509// Do executes the "classroom.courses.topics.create" call. 10510// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10511// code is an error. Response headers are in either 10512// *Topic.ServerResponse.Header or (if a response was returned at all) 10513// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10514// check whether the returned error was because http.StatusNotModified 10515// was returned. 10516func (c *CoursesTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10517 gensupport.SetOptions(c.urlParams_, opts...) 10518 res, err := c.doRequest("json") 10519 if res != nil && res.StatusCode == http.StatusNotModified { 10520 if res.Body != nil { 10521 res.Body.Close() 10522 } 10523 return nil, &googleapi.Error{ 10524 Code: res.StatusCode, 10525 Header: res.Header, 10526 } 10527 } 10528 if err != nil { 10529 return nil, err 10530 } 10531 defer googleapi.CloseBody(res) 10532 if err := googleapi.CheckResponse(res); err != nil { 10533 return nil, err 10534 } 10535 ret := &Topic{ 10536 ServerResponse: googleapi.ServerResponse{ 10537 Header: res.Header, 10538 HTTPStatusCode: res.StatusCode, 10539 }, 10540 } 10541 target := &ret 10542 if err := gensupport.DecodeResponse(target, res); err != nil { 10543 return nil, err 10544 } 10545 return ret, nil 10546 // { 10547 // "description": "Creates a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create a topic in the requested course, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 10548 // "flatPath": "v1/courses/{courseId}/topics", 10549 // "httpMethod": "POST", 10550 // "id": "classroom.courses.topics.create", 10551 // "parameterOrder": [ 10552 // "courseId" 10553 // ], 10554 // "parameters": { 10555 // "courseId": { 10556 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10557 // "location": "path", 10558 // "required": true, 10559 // "type": "string" 10560 // } 10561 // }, 10562 // "path": "v1/courses/{courseId}/topics", 10563 // "request": { 10564 // "$ref": "Topic" 10565 // }, 10566 // "response": { 10567 // "$ref": "Topic" 10568 // }, 10569 // "scopes": [ 10570 // "https://www.googleapis.com/auth/classroom.topics" 10571 // ] 10572 // } 10573 10574} 10575 10576// method id "classroom.courses.topics.delete": 10577 10578type CoursesTopicsDeleteCall struct { 10579 s *Service 10580 courseId string 10581 id string 10582 urlParams_ gensupport.URLParams 10583 ctx_ context.Context 10584 header_ http.Header 10585} 10586 10587// Delete: Deletes a topic. This method returns the following error 10588// codes: * `PERMISSION_DENIED` if the requesting user is not allowed to 10589// delete the requested topic or for access errors. * 10590// `FAILED_PRECONDITION` if the requested topic has already been 10591// deleted. * `NOT_FOUND` if no course or topic exists with the 10592// requested ID. 10593// 10594// - courseId: Identifier of the course. This identifier can be either 10595// the Classroom-assigned identifier or an alias. 10596// - id: Identifier of the topic to delete. 10597func (r *CoursesTopicsService) Delete(courseId string, id string) *CoursesTopicsDeleteCall { 10598 c := &CoursesTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10599 c.courseId = courseId 10600 c.id = id 10601 return c 10602} 10603 10604// Fields allows partial responses to be retrieved. See 10605// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10606// for more information. 10607func (c *CoursesTopicsDeleteCall) Fields(s ...googleapi.Field) *CoursesTopicsDeleteCall { 10608 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10609 return c 10610} 10611 10612// Context sets the context to be used in this call's Do method. Any 10613// pending HTTP request will be aborted if the provided context is 10614// canceled. 10615func (c *CoursesTopicsDeleteCall) Context(ctx context.Context) *CoursesTopicsDeleteCall { 10616 c.ctx_ = ctx 10617 return c 10618} 10619 10620// Header returns an http.Header that can be modified by the caller to 10621// add HTTP headers to the request. 10622func (c *CoursesTopicsDeleteCall) Header() http.Header { 10623 if c.header_ == nil { 10624 c.header_ = make(http.Header) 10625 } 10626 return c.header_ 10627} 10628 10629func (c *CoursesTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 10630 reqHeaders := make(http.Header) 10631 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 10632 for k, v := range c.header_ { 10633 reqHeaders[k] = v 10634 } 10635 reqHeaders.Set("User-Agent", c.s.userAgent()) 10636 var body io.Reader = nil 10637 c.urlParams_.Set("alt", alt) 10638 c.urlParams_.Set("prettyPrint", "false") 10639 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10640 urls += "?" + c.urlParams_.Encode() 10641 req, err := http.NewRequest("DELETE", urls, body) 10642 if err != nil { 10643 return nil, err 10644 } 10645 req.Header = reqHeaders 10646 googleapi.Expand(req.URL, map[string]string{ 10647 "courseId": c.courseId, 10648 "id": c.id, 10649 }) 10650 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10651} 10652 10653// Do executes the "classroom.courses.topics.delete" call. 10654// Exactly one of *Empty or error will be non-nil. Any non-2xx status 10655// code is an error. Response headers are in either 10656// *Empty.ServerResponse.Header or (if a response was returned at all) 10657// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10658// check whether the returned error was because http.StatusNotModified 10659// was returned. 10660func (c *CoursesTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 10661 gensupport.SetOptions(c.urlParams_, opts...) 10662 res, err := c.doRequest("json") 10663 if res != nil && res.StatusCode == http.StatusNotModified { 10664 if res.Body != nil { 10665 res.Body.Close() 10666 } 10667 return nil, &googleapi.Error{ 10668 Code: res.StatusCode, 10669 Header: res.Header, 10670 } 10671 } 10672 if err != nil { 10673 return nil, err 10674 } 10675 defer googleapi.CloseBody(res) 10676 if err := googleapi.CheckResponse(res); err != nil { 10677 return nil, err 10678 } 10679 ret := &Empty{ 10680 ServerResponse: googleapi.ServerResponse{ 10681 Header: res.Header, 10682 HTTPStatusCode: res.StatusCode, 10683 }, 10684 } 10685 target := &ret 10686 if err := gensupport.DecodeResponse(target, res); err != nil { 10687 return nil, err 10688 } 10689 return ret, nil 10690 // { 10691 // "description": "Deletes a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not allowed to delete the requested topic or for access errors. * `FAILED_PRECONDITION` if the requested topic has already been deleted. * `NOT_FOUND` if no course or topic exists with the requested ID.", 10692 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10693 // "httpMethod": "DELETE", 10694 // "id": "classroom.courses.topics.delete", 10695 // "parameterOrder": [ 10696 // "courseId", 10697 // "id" 10698 // ], 10699 // "parameters": { 10700 // "courseId": { 10701 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 10702 // "location": "path", 10703 // "required": true, 10704 // "type": "string" 10705 // }, 10706 // "id": { 10707 // "description": "Identifier of the topic to delete.", 10708 // "location": "path", 10709 // "required": true, 10710 // "type": "string" 10711 // } 10712 // }, 10713 // "path": "v1/courses/{courseId}/topics/{id}", 10714 // "response": { 10715 // "$ref": "Empty" 10716 // }, 10717 // "scopes": [ 10718 // "https://www.googleapis.com/auth/classroom.topics" 10719 // ] 10720 // } 10721 10722} 10723 10724// method id "classroom.courses.topics.get": 10725 10726type CoursesTopicsGetCall struct { 10727 s *Service 10728 courseId string 10729 id string 10730 urlParams_ gensupport.URLParams 10731 ifNoneMatch_ string 10732 ctx_ context.Context 10733 header_ http.Header 10734} 10735 10736// Get: Returns a topic. This method returns the following error codes: 10737// * `PERMISSION_DENIED` if the requesting user is not permitted to 10738// access the requested course or topic, or for access errors. * 10739// `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the 10740// requested course or topic does not exist. 10741// 10742// - courseId: Identifier of the course. 10743// - id: Identifier of the topic. 10744func (r *CoursesTopicsService) Get(courseId string, id string) *CoursesTopicsGetCall { 10745 c := &CoursesTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10746 c.courseId = courseId 10747 c.id = id 10748 return c 10749} 10750 10751// Fields allows partial responses to be retrieved. See 10752// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10753// for more information. 10754func (c *CoursesTopicsGetCall) Fields(s ...googleapi.Field) *CoursesTopicsGetCall { 10755 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10756 return c 10757} 10758 10759// IfNoneMatch sets the optional parameter which makes the operation 10760// fail if the object's ETag matches the given value. This is useful for 10761// getting updates only after the object has changed since the last 10762// request. Use googleapi.IsNotModified to check whether the response 10763// error from Do is the result of In-None-Match. 10764func (c *CoursesTopicsGetCall) IfNoneMatch(entityTag string) *CoursesTopicsGetCall { 10765 c.ifNoneMatch_ = entityTag 10766 return c 10767} 10768 10769// Context sets the context to be used in this call's Do method. Any 10770// pending HTTP request will be aborted if the provided context is 10771// canceled. 10772func (c *CoursesTopicsGetCall) Context(ctx context.Context) *CoursesTopicsGetCall { 10773 c.ctx_ = ctx 10774 return c 10775} 10776 10777// Header returns an http.Header that can be modified by the caller to 10778// add HTTP headers to the request. 10779func (c *CoursesTopicsGetCall) Header() http.Header { 10780 if c.header_ == nil { 10781 c.header_ = make(http.Header) 10782 } 10783 return c.header_ 10784} 10785 10786func (c *CoursesTopicsGetCall) doRequest(alt string) (*http.Response, error) { 10787 reqHeaders := make(http.Header) 10788 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 10789 for k, v := range c.header_ { 10790 reqHeaders[k] = v 10791 } 10792 reqHeaders.Set("User-Agent", c.s.userAgent()) 10793 if c.ifNoneMatch_ != "" { 10794 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10795 } 10796 var body io.Reader = nil 10797 c.urlParams_.Set("alt", alt) 10798 c.urlParams_.Set("prettyPrint", "false") 10799 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 10800 urls += "?" + c.urlParams_.Encode() 10801 req, err := http.NewRequest("GET", urls, body) 10802 if err != nil { 10803 return nil, err 10804 } 10805 req.Header = reqHeaders 10806 googleapi.Expand(req.URL, map[string]string{ 10807 "courseId": c.courseId, 10808 "id": c.id, 10809 }) 10810 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10811} 10812 10813// Do executes the "classroom.courses.topics.get" call. 10814// Exactly one of *Topic or error will be non-nil. Any non-2xx status 10815// code is an error. Response headers are in either 10816// *Topic.ServerResponse.Header or (if a response was returned at all) 10817// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10818// check whether the returned error was because http.StatusNotModified 10819// was returned. 10820func (c *CoursesTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 10821 gensupport.SetOptions(c.urlParams_, opts...) 10822 res, err := c.doRequest("json") 10823 if res != nil && res.StatusCode == http.StatusNotModified { 10824 if res.Body != nil { 10825 res.Body.Close() 10826 } 10827 return nil, &googleapi.Error{ 10828 Code: res.StatusCode, 10829 Header: res.Header, 10830 } 10831 } 10832 if err != nil { 10833 return nil, err 10834 } 10835 defer googleapi.CloseBody(res) 10836 if err := googleapi.CheckResponse(res); err != nil { 10837 return nil, err 10838 } 10839 ret := &Topic{ 10840 ServerResponse: googleapi.ServerResponse{ 10841 Header: res.Header, 10842 HTTPStatusCode: res.StatusCode, 10843 }, 10844 } 10845 target := &ret 10846 if err := gensupport.DecodeResponse(target, res); err != nil { 10847 return nil, err 10848 } 10849 return ret, nil 10850 // { 10851 // "description": "Returns a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or topic, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or topic does not exist.", 10852 // "flatPath": "v1/courses/{courseId}/topics/{id}", 10853 // "httpMethod": "GET", 10854 // "id": "classroom.courses.topics.get", 10855 // "parameterOrder": [ 10856 // "courseId", 10857 // "id" 10858 // ], 10859 // "parameters": { 10860 // "courseId": { 10861 // "description": "Identifier of the course.", 10862 // "location": "path", 10863 // "required": true, 10864 // "type": "string" 10865 // }, 10866 // "id": { 10867 // "description": "Identifier of the topic.", 10868 // "location": "path", 10869 // "required": true, 10870 // "type": "string" 10871 // } 10872 // }, 10873 // "path": "v1/courses/{courseId}/topics/{id}", 10874 // "response": { 10875 // "$ref": "Topic" 10876 // }, 10877 // "scopes": [ 10878 // "https://www.googleapis.com/auth/classroom.topics", 10879 // "https://www.googleapis.com/auth/classroom.topics.readonly" 10880 // ] 10881 // } 10882 10883} 10884 10885// method id "classroom.courses.topics.list": 10886 10887type CoursesTopicsListCall struct { 10888 s *Service 10889 courseId string 10890 urlParams_ gensupport.URLParams 10891 ifNoneMatch_ string 10892 ctx_ context.Context 10893 header_ http.Header 10894} 10895 10896// List: Returns the list of topics that the requester is permitted to 10897// view. This method returns the following error codes: * 10898// `PERMISSION_DENIED` if the requesting user is not permitted to access 10899// the requested course or for access errors. * `INVALID_ARGUMENT` if 10900// the request is malformed. * `NOT_FOUND` if the requested course does 10901// not exist. 10902// 10903// - courseId: Identifier of the course. This identifier can be either 10904// the Classroom-assigned identifier or an alias. 10905func (r *CoursesTopicsService) List(courseId string) *CoursesTopicsListCall { 10906 c := &CoursesTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10907 c.courseId = courseId 10908 return c 10909} 10910 10911// PageSize sets the optional parameter "pageSize": Maximum number of 10912// items to return. Zero or unspecified indicates that the server may 10913// assign a maximum. The server may return fewer than the specified 10914// number of results. 10915func (c *CoursesTopicsListCall) PageSize(pageSize int64) *CoursesTopicsListCall { 10916 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10917 return c 10918} 10919 10920// PageToken sets the optional parameter "pageToken": nextPageToken 10921// value returned from a previous list call, indicating that the 10922// subsequent page of results should be returned. The list request must 10923// be otherwise identical to the one that resulted in this token. 10924func (c *CoursesTopicsListCall) PageToken(pageToken string) *CoursesTopicsListCall { 10925 c.urlParams_.Set("pageToken", pageToken) 10926 return c 10927} 10928 10929// Fields allows partial responses to be retrieved. See 10930// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10931// for more information. 10932func (c *CoursesTopicsListCall) Fields(s ...googleapi.Field) *CoursesTopicsListCall { 10933 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10934 return c 10935} 10936 10937// IfNoneMatch sets the optional parameter which makes the operation 10938// fail if the object's ETag matches the given value. This is useful for 10939// getting updates only after the object has changed since the last 10940// request. Use googleapi.IsNotModified to check whether the response 10941// error from Do is the result of In-None-Match. 10942func (c *CoursesTopicsListCall) IfNoneMatch(entityTag string) *CoursesTopicsListCall { 10943 c.ifNoneMatch_ = entityTag 10944 return c 10945} 10946 10947// Context sets the context to be used in this call's Do method. Any 10948// pending HTTP request will be aborted if the provided context is 10949// canceled. 10950func (c *CoursesTopicsListCall) Context(ctx context.Context) *CoursesTopicsListCall { 10951 c.ctx_ = ctx 10952 return c 10953} 10954 10955// Header returns an http.Header that can be modified by the caller to 10956// add HTTP headers to the request. 10957func (c *CoursesTopicsListCall) Header() http.Header { 10958 if c.header_ == nil { 10959 c.header_ = make(http.Header) 10960 } 10961 return c.header_ 10962} 10963 10964func (c *CoursesTopicsListCall) doRequest(alt string) (*http.Response, error) { 10965 reqHeaders := make(http.Header) 10966 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 10967 for k, v := range c.header_ { 10968 reqHeaders[k] = v 10969 } 10970 reqHeaders.Set("User-Agent", c.s.userAgent()) 10971 if c.ifNoneMatch_ != "" { 10972 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10973 } 10974 var body io.Reader = nil 10975 c.urlParams_.Set("alt", alt) 10976 c.urlParams_.Set("prettyPrint", "false") 10977 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics") 10978 urls += "?" + c.urlParams_.Encode() 10979 req, err := http.NewRequest("GET", urls, body) 10980 if err != nil { 10981 return nil, err 10982 } 10983 req.Header = reqHeaders 10984 googleapi.Expand(req.URL, map[string]string{ 10985 "courseId": c.courseId, 10986 }) 10987 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10988} 10989 10990// Do executes the "classroom.courses.topics.list" call. 10991// Exactly one of *ListTopicResponse or error will be non-nil. Any 10992// non-2xx status code is an error. Response headers are in either 10993// *ListTopicResponse.ServerResponse.Header or (if a response was 10994// returned at all) in error.(*googleapi.Error).Header. Use 10995// googleapi.IsNotModified to check whether the returned error was 10996// because http.StatusNotModified was returned. 10997func (c *CoursesTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicResponse, error) { 10998 gensupport.SetOptions(c.urlParams_, opts...) 10999 res, err := c.doRequest("json") 11000 if res != nil && res.StatusCode == http.StatusNotModified { 11001 if res.Body != nil { 11002 res.Body.Close() 11003 } 11004 return nil, &googleapi.Error{ 11005 Code: res.StatusCode, 11006 Header: res.Header, 11007 } 11008 } 11009 if err != nil { 11010 return nil, err 11011 } 11012 defer googleapi.CloseBody(res) 11013 if err := googleapi.CheckResponse(res); err != nil { 11014 return nil, err 11015 } 11016 ret := &ListTopicResponse{ 11017 ServerResponse: googleapi.ServerResponse{ 11018 Header: res.Header, 11019 HTTPStatusCode: res.StatusCode, 11020 }, 11021 } 11022 target := &ret 11023 if err := gensupport.DecodeResponse(target, res); err != nil { 11024 return nil, err 11025 } 11026 return ret, nil 11027 // { 11028 // "description": "Returns the list of topics that the requester is permitted to view. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course does not exist.", 11029 // "flatPath": "v1/courses/{courseId}/topics", 11030 // "httpMethod": "GET", 11031 // "id": "classroom.courses.topics.list", 11032 // "parameterOrder": [ 11033 // "courseId" 11034 // ], 11035 // "parameters": { 11036 // "courseId": { 11037 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 11038 // "location": "path", 11039 // "required": true, 11040 // "type": "string" 11041 // }, 11042 // "pageSize": { 11043 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 11044 // "format": "int32", 11045 // "location": "query", 11046 // "type": "integer" 11047 // }, 11048 // "pageToken": { 11049 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 11050 // "location": "query", 11051 // "type": "string" 11052 // } 11053 // }, 11054 // "path": "v1/courses/{courseId}/topics", 11055 // "response": { 11056 // "$ref": "ListTopicResponse" 11057 // }, 11058 // "scopes": [ 11059 // "https://www.googleapis.com/auth/classroom.topics", 11060 // "https://www.googleapis.com/auth/classroom.topics.readonly" 11061 // ] 11062 // } 11063 11064} 11065 11066// Pages invokes f for each page of results. 11067// A non-nil error returned from f will halt the iteration. 11068// The provided context supersedes any context provided to the Context method. 11069func (c *CoursesTopicsListCall) Pages(ctx context.Context, f func(*ListTopicResponse) error) error { 11070 c.ctx_ = ctx 11071 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 11072 for { 11073 x, err := c.Do() 11074 if err != nil { 11075 return err 11076 } 11077 if err := f(x); err != nil { 11078 return err 11079 } 11080 if x.NextPageToken == "" { 11081 return nil 11082 } 11083 c.PageToken(x.NextPageToken) 11084 } 11085} 11086 11087// method id "classroom.courses.topics.patch": 11088 11089type CoursesTopicsPatchCall struct { 11090 s *Service 11091 courseId string 11092 id string 11093 topic *Topic 11094 urlParams_ gensupport.URLParams 11095 ctx_ context.Context 11096 header_ http.Header 11097} 11098 11099// Patch: Updates one or more fields of a topic. This method returns the 11100// following error codes: * `PERMISSION_DENIED` if the requesting 11101// developer project did not create the corresponding topic or for 11102// access errors. * `INVALID_ARGUMENT` if the request is malformed. * 11103// `NOT_FOUND` if the requested course or topic does not exist 11104// 11105// - courseId: Identifier of the course. This identifier can be either 11106// the Classroom-assigned identifier or an alias. 11107// - id: Identifier of the topic. 11108func (r *CoursesTopicsService) Patch(courseId string, id string, topic *Topic) *CoursesTopicsPatchCall { 11109 c := &CoursesTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11110 c.courseId = courseId 11111 c.id = id 11112 c.topic = topic 11113 return c 11114} 11115 11116// UpdateMask sets the optional parameter "updateMask": Mask that 11117// identifies which fields on the topic to update. This field is 11118// required to do an update. The update fails if invalid fields are 11119// specified. If a field supports empty values, it can be cleared by 11120// specifying it in the update mask and not in the Topic object. If a 11121// field that does not support empty values is included in the update 11122// mask and not set in the Topic object, an `INVALID_ARGUMENT` error is 11123// returned. The following fields may be specified: * `name` 11124func (c *CoursesTopicsPatchCall) UpdateMask(updateMask string) *CoursesTopicsPatchCall { 11125 c.urlParams_.Set("updateMask", updateMask) 11126 return c 11127} 11128 11129// Fields allows partial responses to be retrieved. See 11130// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11131// for more information. 11132func (c *CoursesTopicsPatchCall) Fields(s ...googleapi.Field) *CoursesTopicsPatchCall { 11133 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11134 return c 11135} 11136 11137// Context sets the context to be used in this call's Do method. Any 11138// pending HTTP request will be aborted if the provided context is 11139// canceled. 11140func (c *CoursesTopicsPatchCall) Context(ctx context.Context) *CoursesTopicsPatchCall { 11141 c.ctx_ = ctx 11142 return c 11143} 11144 11145// Header returns an http.Header that can be modified by the caller to 11146// add HTTP headers to the request. 11147func (c *CoursesTopicsPatchCall) Header() http.Header { 11148 if c.header_ == nil { 11149 c.header_ = make(http.Header) 11150 } 11151 return c.header_ 11152} 11153 11154func (c *CoursesTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 11155 reqHeaders := make(http.Header) 11156 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 11157 for k, v := range c.header_ { 11158 reqHeaders[k] = v 11159 } 11160 reqHeaders.Set("User-Agent", c.s.userAgent()) 11161 var body io.Reader = nil 11162 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 11163 if err != nil { 11164 return nil, err 11165 } 11166 reqHeaders.Set("Content-Type", "application/json") 11167 c.urlParams_.Set("alt", alt) 11168 c.urlParams_.Set("prettyPrint", "false") 11169 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/topics/{id}") 11170 urls += "?" + c.urlParams_.Encode() 11171 req, err := http.NewRequest("PATCH", urls, body) 11172 if err != nil { 11173 return nil, err 11174 } 11175 req.Header = reqHeaders 11176 googleapi.Expand(req.URL, map[string]string{ 11177 "courseId": c.courseId, 11178 "id": c.id, 11179 }) 11180 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11181} 11182 11183// Do executes the "classroom.courses.topics.patch" call. 11184// Exactly one of *Topic or error will be non-nil. Any non-2xx status 11185// code is an error. Response headers are in either 11186// *Topic.ServerResponse.Header or (if a response was returned at all) 11187// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11188// check whether the returned error was because http.StatusNotModified 11189// was returned. 11190func (c *CoursesTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 11191 gensupport.SetOptions(c.urlParams_, opts...) 11192 res, err := c.doRequest("json") 11193 if res != nil && res.StatusCode == http.StatusNotModified { 11194 if res.Body != nil { 11195 res.Body.Close() 11196 } 11197 return nil, &googleapi.Error{ 11198 Code: res.StatusCode, 11199 Header: res.Header, 11200 } 11201 } 11202 if err != nil { 11203 return nil, err 11204 } 11205 defer googleapi.CloseBody(res) 11206 if err := googleapi.CheckResponse(res); err != nil { 11207 return nil, err 11208 } 11209 ret := &Topic{ 11210 ServerResponse: googleapi.ServerResponse{ 11211 Header: res.Header, 11212 HTTPStatusCode: res.StatusCode, 11213 }, 11214 } 11215 target := &ret 11216 if err := gensupport.DecodeResponse(target, res); err != nil { 11217 return nil, err 11218 } 11219 return ret, nil 11220 // { 11221 // "description": "Updates one or more fields of a topic. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding topic or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course or topic does not exist", 11222 // "flatPath": "v1/courses/{courseId}/topics/{id}", 11223 // "httpMethod": "PATCH", 11224 // "id": "classroom.courses.topics.patch", 11225 // "parameterOrder": [ 11226 // "courseId", 11227 // "id" 11228 // ], 11229 // "parameters": { 11230 // "courseId": { 11231 // "description": "Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.", 11232 // "location": "path", 11233 // "required": true, 11234 // "type": "string" 11235 // }, 11236 // "id": { 11237 // "description": "Identifier of the topic.", 11238 // "location": "path", 11239 // "required": true, 11240 // "type": "string" 11241 // }, 11242 // "updateMask": { 11243 // "description": "Mask that identifies which fields on the topic to update. This field is required to do an update. The update fails if invalid fields are specified. If a field supports empty values, it can be cleared by specifying it in the update mask and not in the Topic object. If a field that does not support empty values is included in the update mask and not set in the Topic object, an `INVALID_ARGUMENT` error is returned. The following fields may be specified: * `name`", 11244 // "format": "google-fieldmask", 11245 // "location": "query", 11246 // "type": "string" 11247 // } 11248 // }, 11249 // "path": "v1/courses/{courseId}/topics/{id}", 11250 // "request": { 11251 // "$ref": "Topic" 11252 // }, 11253 // "response": { 11254 // "$ref": "Topic" 11255 // }, 11256 // "scopes": [ 11257 // "https://www.googleapis.com/auth/classroom.topics" 11258 // ] 11259 // } 11260 11261} 11262 11263// method id "classroom.invitations.accept": 11264 11265type InvitationsAcceptCall struct { 11266 s *Service 11267 id string 11268 urlParams_ gensupport.URLParams 11269 ctx_ context.Context 11270 header_ http.Header 11271} 11272 11273// Accept: Accepts an invitation, removing it and adding the invited 11274// user to the teachers or students (as appropriate) of the specified 11275// course. Only the invited user may accept an invitation. This method 11276// returns the following error codes: * `PERMISSION_DENIED` if the 11277// requesting user is not permitted to accept the requested invitation 11278// or for access errors. * `FAILED_PRECONDITION` for the following 11279// request errors: * CourseMemberLimitReached * CourseNotModifiable * 11280// CourseTeacherLimitReached * UserGroupsMembershipLimitReached * 11281// `NOT_FOUND` if no invitation exists with the requested ID. 11282// 11283// - id: Identifier of the invitation to accept. 11284func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall { 11285 c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11286 c.id = id 11287 return c 11288} 11289 11290// Fields allows partial responses to be retrieved. See 11291// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11292// for more information. 11293func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall { 11294 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11295 return c 11296} 11297 11298// Context sets the context to be used in this call's Do method. Any 11299// pending HTTP request will be aborted if the provided context is 11300// canceled. 11301func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall { 11302 c.ctx_ = ctx 11303 return c 11304} 11305 11306// Header returns an http.Header that can be modified by the caller to 11307// add HTTP headers to the request. 11308func (c *InvitationsAcceptCall) Header() http.Header { 11309 if c.header_ == nil { 11310 c.header_ = make(http.Header) 11311 } 11312 return c.header_ 11313} 11314 11315func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) { 11316 reqHeaders := make(http.Header) 11317 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 11318 for k, v := range c.header_ { 11319 reqHeaders[k] = v 11320 } 11321 reqHeaders.Set("User-Agent", c.s.userAgent()) 11322 var body io.Reader = nil 11323 c.urlParams_.Set("alt", alt) 11324 c.urlParams_.Set("prettyPrint", "false") 11325 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept") 11326 urls += "?" + c.urlParams_.Encode() 11327 req, err := http.NewRequest("POST", urls, body) 11328 if err != nil { 11329 return nil, err 11330 } 11331 req.Header = reqHeaders 11332 googleapi.Expand(req.URL, map[string]string{ 11333 "id": c.id, 11334 }) 11335 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11336} 11337 11338// Do executes the "classroom.invitations.accept" call. 11339// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11340// code is an error. Response headers are in either 11341// *Empty.ServerResponse.Header or (if a response was returned at all) 11342// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11343// check whether the returned error was because http.StatusNotModified 11344// was returned. 11345func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11346 gensupport.SetOptions(c.urlParams_, opts...) 11347 res, err := c.doRequest("json") 11348 if res != nil && res.StatusCode == http.StatusNotModified { 11349 if res.Body != nil { 11350 res.Body.Close() 11351 } 11352 return nil, &googleapi.Error{ 11353 Code: res.StatusCode, 11354 Header: res.Header, 11355 } 11356 } 11357 if err != nil { 11358 return nil, err 11359 } 11360 defer googleapi.CloseBody(res) 11361 if err := googleapi.CheckResponse(res); err != nil { 11362 return nil, err 11363 } 11364 ret := &Empty{ 11365 ServerResponse: googleapi.ServerResponse{ 11366 Header: res.Header, 11367 HTTPStatusCode: res.StatusCode, 11368 }, 11369 } 11370 target := &ret 11371 if err := gensupport.DecodeResponse(target, res); err != nil { 11372 return nil, err 11373 } 11374 return ret, nil 11375 // { 11376 // "description": "Accepts an invitation, removing it and adding the invited user to the teachers or students (as appropriate) of the specified course. Only the invited user may accept an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to accept the requested invitation or for access errors. * `FAILED_PRECONDITION` for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `NOT_FOUND` if no invitation exists with the requested ID.", 11377 // "flatPath": "v1/invitations/{id}:accept", 11378 // "httpMethod": "POST", 11379 // "id": "classroom.invitations.accept", 11380 // "parameterOrder": [ 11381 // "id" 11382 // ], 11383 // "parameters": { 11384 // "id": { 11385 // "description": "Identifier of the invitation to accept.", 11386 // "location": "path", 11387 // "required": true, 11388 // "type": "string" 11389 // } 11390 // }, 11391 // "path": "v1/invitations/{id}:accept", 11392 // "response": { 11393 // "$ref": "Empty" 11394 // }, 11395 // "scopes": [ 11396 // "https://www.googleapis.com/auth/classroom.rosters" 11397 // ] 11398 // } 11399 11400} 11401 11402// method id "classroom.invitations.create": 11403 11404type InvitationsCreateCall struct { 11405 s *Service 11406 invitation *Invitation 11407 urlParams_ gensupport.URLParams 11408 ctx_ context.Context 11409 header_ http.Header 11410} 11411 11412// Create: Creates an invitation. Only one invitation for a user and 11413// course may exist at a time. Delete and re-create an invitation to 11414// make changes. This method returns the following error codes: * 11415// `PERMISSION_DENIED` if the requesting user is not permitted to create 11416// invitations for this course or for access errors. * `NOT_FOUND` if 11417// the course or the user does not exist. * `FAILED_PRECONDITION` if the 11418// requested user's account is disabled or if the user already has this 11419// role or a role with greater permissions. * `ALREADY_EXISTS` if an 11420// invitation for the specified user and course already exists. 11421func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall { 11422 c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11423 c.invitation = invitation 11424 return c 11425} 11426 11427// Fields allows partial responses to be retrieved. See 11428// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11429// for more information. 11430func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall { 11431 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11432 return c 11433} 11434 11435// Context sets the context to be used in this call's Do method. Any 11436// pending HTTP request will be aborted if the provided context is 11437// canceled. 11438func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall { 11439 c.ctx_ = ctx 11440 return c 11441} 11442 11443// Header returns an http.Header that can be modified by the caller to 11444// add HTTP headers to the request. 11445func (c *InvitationsCreateCall) Header() http.Header { 11446 if c.header_ == nil { 11447 c.header_ = make(http.Header) 11448 } 11449 return c.header_ 11450} 11451 11452func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 11453 reqHeaders := make(http.Header) 11454 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 11455 for k, v := range c.header_ { 11456 reqHeaders[k] = v 11457 } 11458 reqHeaders.Set("User-Agent", c.s.userAgent()) 11459 var body io.Reader = nil 11460 body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation) 11461 if err != nil { 11462 return nil, err 11463 } 11464 reqHeaders.Set("Content-Type", "application/json") 11465 c.urlParams_.Set("alt", alt) 11466 c.urlParams_.Set("prettyPrint", "false") 11467 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11468 urls += "?" + c.urlParams_.Encode() 11469 req, err := http.NewRequest("POST", urls, body) 11470 if err != nil { 11471 return nil, err 11472 } 11473 req.Header = reqHeaders 11474 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11475} 11476 11477// Do executes the "classroom.invitations.create" call. 11478// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11479// status code is an error. Response headers are in either 11480// *Invitation.ServerResponse.Header or (if a response was returned at 11481// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11482// to check whether the returned error was because 11483// http.StatusNotModified was returned. 11484func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11485 gensupport.SetOptions(c.urlParams_, opts...) 11486 res, err := c.doRequest("json") 11487 if res != nil && res.StatusCode == http.StatusNotModified { 11488 if res.Body != nil { 11489 res.Body.Close() 11490 } 11491 return nil, &googleapi.Error{ 11492 Code: res.StatusCode, 11493 Header: res.Header, 11494 } 11495 } 11496 if err != nil { 11497 return nil, err 11498 } 11499 defer googleapi.CloseBody(res) 11500 if err := googleapi.CheckResponse(res); err != nil { 11501 return nil, err 11502 } 11503 ret := &Invitation{ 11504 ServerResponse: googleapi.ServerResponse{ 11505 Header: res.Header, 11506 HTTPStatusCode: res.StatusCode, 11507 }, 11508 } 11509 target := &ret 11510 if err := gensupport.DecodeResponse(target, res); err != nil { 11511 return nil, err 11512 } 11513 return ret, nil 11514 // { 11515 // "description": "Creates an invitation. Only one invitation for a user and course may exist at a time. Delete and re-create an invitation to make changes. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create invitations for this course or for access errors. * `NOT_FOUND` if the course or the user does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled or if the user already has this role or a role with greater permissions. * `ALREADY_EXISTS` if an invitation for the specified user and course already exists.", 11516 // "flatPath": "v1/invitations", 11517 // "httpMethod": "POST", 11518 // "id": "classroom.invitations.create", 11519 // "parameterOrder": [], 11520 // "parameters": {}, 11521 // "path": "v1/invitations", 11522 // "request": { 11523 // "$ref": "Invitation" 11524 // }, 11525 // "response": { 11526 // "$ref": "Invitation" 11527 // }, 11528 // "scopes": [ 11529 // "https://www.googleapis.com/auth/classroom.rosters" 11530 // ] 11531 // } 11532 11533} 11534 11535// method id "classroom.invitations.delete": 11536 11537type InvitationsDeleteCall struct { 11538 s *Service 11539 id string 11540 urlParams_ gensupport.URLParams 11541 ctx_ context.Context 11542 header_ http.Header 11543} 11544 11545// Delete: Deletes an invitation. This method returns the following 11546// error codes: * `PERMISSION_DENIED` if the requesting user is not 11547// permitted to delete the requested invitation or for access errors. * 11548// `NOT_FOUND` if no invitation exists with the requested ID. 11549// 11550// - id: Identifier of the invitation to delete. 11551func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall { 11552 c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11553 c.id = id 11554 return c 11555} 11556 11557// Fields allows partial responses to be retrieved. See 11558// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11559// for more information. 11560func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall { 11561 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11562 return c 11563} 11564 11565// Context sets the context to be used in this call's Do method. Any 11566// pending HTTP request will be aborted if the provided context is 11567// canceled. 11568func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall { 11569 c.ctx_ = ctx 11570 return c 11571} 11572 11573// Header returns an http.Header that can be modified by the caller to 11574// add HTTP headers to the request. 11575func (c *InvitationsDeleteCall) Header() http.Header { 11576 if c.header_ == nil { 11577 c.header_ = make(http.Header) 11578 } 11579 return c.header_ 11580} 11581 11582func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) { 11583 reqHeaders := make(http.Header) 11584 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 11585 for k, v := range c.header_ { 11586 reqHeaders[k] = v 11587 } 11588 reqHeaders.Set("User-Agent", c.s.userAgent()) 11589 var body io.Reader = nil 11590 c.urlParams_.Set("alt", alt) 11591 c.urlParams_.Set("prettyPrint", "false") 11592 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11593 urls += "?" + c.urlParams_.Encode() 11594 req, err := http.NewRequest("DELETE", urls, body) 11595 if err != nil { 11596 return nil, err 11597 } 11598 req.Header = reqHeaders 11599 googleapi.Expand(req.URL, map[string]string{ 11600 "id": c.id, 11601 }) 11602 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11603} 11604 11605// Do executes the "classroom.invitations.delete" call. 11606// Exactly one of *Empty or error will be non-nil. Any non-2xx status 11607// code is an error. Response headers are in either 11608// *Empty.ServerResponse.Header or (if a response was returned at all) 11609// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11610// check whether the returned error was because http.StatusNotModified 11611// was returned. 11612func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 11613 gensupport.SetOptions(c.urlParams_, opts...) 11614 res, err := c.doRequest("json") 11615 if res != nil && res.StatusCode == http.StatusNotModified { 11616 if res.Body != nil { 11617 res.Body.Close() 11618 } 11619 return nil, &googleapi.Error{ 11620 Code: res.StatusCode, 11621 Header: res.Header, 11622 } 11623 } 11624 if err != nil { 11625 return nil, err 11626 } 11627 defer googleapi.CloseBody(res) 11628 if err := googleapi.CheckResponse(res); err != nil { 11629 return nil, err 11630 } 11631 ret := &Empty{ 11632 ServerResponse: googleapi.ServerResponse{ 11633 Header: res.Header, 11634 HTTPStatusCode: res.StatusCode, 11635 }, 11636 } 11637 target := &ret 11638 if err := gensupport.DecodeResponse(target, res); err != nil { 11639 return nil, err 11640 } 11641 return ret, nil 11642 // { 11643 // "description": "Deletes an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete the requested invitation or for access errors. * `NOT_FOUND` if no invitation exists with the requested ID.", 11644 // "flatPath": "v1/invitations/{id}", 11645 // "httpMethod": "DELETE", 11646 // "id": "classroom.invitations.delete", 11647 // "parameterOrder": [ 11648 // "id" 11649 // ], 11650 // "parameters": { 11651 // "id": { 11652 // "description": "Identifier of the invitation to delete.", 11653 // "location": "path", 11654 // "required": true, 11655 // "type": "string" 11656 // } 11657 // }, 11658 // "path": "v1/invitations/{id}", 11659 // "response": { 11660 // "$ref": "Empty" 11661 // }, 11662 // "scopes": [ 11663 // "https://www.googleapis.com/auth/classroom.rosters" 11664 // ] 11665 // } 11666 11667} 11668 11669// method id "classroom.invitations.get": 11670 11671type InvitationsGetCall struct { 11672 s *Service 11673 id string 11674 urlParams_ gensupport.URLParams 11675 ifNoneMatch_ string 11676 ctx_ context.Context 11677 header_ http.Header 11678} 11679 11680// Get: Returns an invitation. This method returns the following error 11681// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 11682// to view the requested invitation or for access errors. * `NOT_FOUND` 11683// if no invitation exists with the requested ID. 11684// 11685// - id: Identifier of the invitation to return. 11686func (r *InvitationsService) Get(id string) *InvitationsGetCall { 11687 c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11688 c.id = id 11689 return c 11690} 11691 11692// Fields allows partial responses to be retrieved. See 11693// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11694// for more information. 11695func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall { 11696 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11697 return c 11698} 11699 11700// IfNoneMatch sets the optional parameter which makes the operation 11701// fail if the object's ETag matches the given value. This is useful for 11702// getting updates only after the object has changed since the last 11703// request. Use googleapi.IsNotModified to check whether the response 11704// error from Do is the result of In-None-Match. 11705func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall { 11706 c.ifNoneMatch_ = entityTag 11707 return c 11708} 11709 11710// Context sets the context to be used in this call's Do method. Any 11711// pending HTTP request will be aborted if the provided context is 11712// canceled. 11713func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall { 11714 c.ctx_ = ctx 11715 return c 11716} 11717 11718// Header returns an http.Header that can be modified by the caller to 11719// add HTTP headers to the request. 11720func (c *InvitationsGetCall) Header() http.Header { 11721 if c.header_ == nil { 11722 c.header_ = make(http.Header) 11723 } 11724 return c.header_ 11725} 11726 11727func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) { 11728 reqHeaders := make(http.Header) 11729 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 11730 for k, v := range c.header_ { 11731 reqHeaders[k] = v 11732 } 11733 reqHeaders.Set("User-Agent", c.s.userAgent()) 11734 if c.ifNoneMatch_ != "" { 11735 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11736 } 11737 var body io.Reader = nil 11738 c.urlParams_.Set("alt", alt) 11739 c.urlParams_.Set("prettyPrint", "false") 11740 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}") 11741 urls += "?" + c.urlParams_.Encode() 11742 req, err := http.NewRequest("GET", urls, body) 11743 if err != nil { 11744 return nil, err 11745 } 11746 req.Header = reqHeaders 11747 googleapi.Expand(req.URL, map[string]string{ 11748 "id": c.id, 11749 }) 11750 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11751} 11752 11753// Do executes the "classroom.invitations.get" call. 11754// Exactly one of *Invitation or error will be non-nil. Any non-2xx 11755// status code is an error. Response headers are in either 11756// *Invitation.ServerResponse.Header or (if a response was returned at 11757// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11758// to check whether the returned error was because 11759// http.StatusNotModified was returned. 11760func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) { 11761 gensupport.SetOptions(c.urlParams_, opts...) 11762 res, err := c.doRequest("json") 11763 if res != nil && res.StatusCode == http.StatusNotModified { 11764 if res.Body != nil { 11765 res.Body.Close() 11766 } 11767 return nil, &googleapi.Error{ 11768 Code: res.StatusCode, 11769 Header: res.Header, 11770 } 11771 } 11772 if err != nil { 11773 return nil, err 11774 } 11775 defer googleapi.CloseBody(res) 11776 if err := googleapi.CheckResponse(res); err != nil { 11777 return nil, err 11778 } 11779 ret := &Invitation{ 11780 ServerResponse: googleapi.ServerResponse{ 11781 Header: res.Header, 11782 HTTPStatusCode: res.StatusCode, 11783 }, 11784 } 11785 target := &ret 11786 if err := gensupport.DecodeResponse(target, res); err != nil { 11787 return nil, err 11788 } 11789 return ret, nil 11790 // { 11791 // "description": "Returns an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view the requested invitation or for access errors. * `NOT_FOUND` if no invitation exists with the requested ID.", 11792 // "flatPath": "v1/invitations/{id}", 11793 // "httpMethod": "GET", 11794 // "id": "classroom.invitations.get", 11795 // "parameterOrder": [ 11796 // "id" 11797 // ], 11798 // "parameters": { 11799 // "id": { 11800 // "description": "Identifier of the invitation to return.", 11801 // "location": "path", 11802 // "required": true, 11803 // "type": "string" 11804 // } 11805 // }, 11806 // "path": "v1/invitations/{id}", 11807 // "response": { 11808 // "$ref": "Invitation" 11809 // }, 11810 // "scopes": [ 11811 // "https://www.googleapis.com/auth/classroom.rosters", 11812 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 11813 // ] 11814 // } 11815 11816} 11817 11818// method id "classroom.invitations.list": 11819 11820type InvitationsListCall struct { 11821 s *Service 11822 urlParams_ gensupport.URLParams 11823 ifNoneMatch_ string 11824 ctx_ context.Context 11825 header_ http.Header 11826} 11827 11828// List: Returns a list of invitations that the requesting user is 11829// permitted to view, restricted to those that match the list request. 11830// *Note:* At least one of `user_id` or `course_id` must be supplied. 11831// Both fields can be supplied. This method returns the following error 11832// codes: * `PERMISSION_DENIED` for access errors. 11833func (r *InvitationsService) List() *InvitationsListCall { 11834 c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11835 return c 11836} 11837 11838// CourseId sets the optional parameter "courseId": Restricts returned 11839// invitations to those for a course with the specified identifier. 11840func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall { 11841 c.urlParams_.Set("courseId", courseId) 11842 return c 11843} 11844 11845// PageSize sets the optional parameter "pageSize": Maximum number of 11846// items to return. The default is 500 if unspecified or `0`. The server 11847// may return fewer than the specified number of results. 11848func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall { 11849 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 11850 return c 11851} 11852 11853// PageToken sets the optional parameter "pageToken": nextPageToken 11854// value returned from a previous list call, indicating that the 11855// subsequent page of results should be returned. The list request must 11856// be otherwise identical to the one that resulted in this token. 11857func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall { 11858 c.urlParams_.Set("pageToken", pageToken) 11859 return c 11860} 11861 11862// UserId sets the optional parameter "userId": Restricts returned 11863// invitations to those for a specific user. The identifier can be one 11864// of the following: * the numeric identifier for the user * the email 11865// address of the user * the string literal "me", indicating the 11866// requesting user 11867func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall { 11868 c.urlParams_.Set("userId", userId) 11869 return c 11870} 11871 11872// Fields allows partial responses to be retrieved. See 11873// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11874// for more information. 11875func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall { 11876 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11877 return c 11878} 11879 11880// IfNoneMatch sets the optional parameter which makes the operation 11881// fail if the object's ETag matches the given value. This is useful for 11882// getting updates only after the object has changed since the last 11883// request. Use googleapi.IsNotModified to check whether the response 11884// error from Do is the result of In-None-Match. 11885func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall { 11886 c.ifNoneMatch_ = entityTag 11887 return c 11888} 11889 11890// Context sets the context to be used in this call's Do method. Any 11891// pending HTTP request will be aborted if the provided context is 11892// canceled. 11893func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall { 11894 c.ctx_ = ctx 11895 return c 11896} 11897 11898// Header returns an http.Header that can be modified by the caller to 11899// add HTTP headers to the request. 11900func (c *InvitationsListCall) Header() http.Header { 11901 if c.header_ == nil { 11902 c.header_ = make(http.Header) 11903 } 11904 return c.header_ 11905} 11906 11907func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) { 11908 reqHeaders := make(http.Header) 11909 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 11910 for k, v := range c.header_ { 11911 reqHeaders[k] = v 11912 } 11913 reqHeaders.Set("User-Agent", c.s.userAgent()) 11914 if c.ifNoneMatch_ != "" { 11915 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11916 } 11917 var body io.Reader = nil 11918 c.urlParams_.Set("alt", alt) 11919 c.urlParams_.Set("prettyPrint", "false") 11920 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations") 11921 urls += "?" + c.urlParams_.Encode() 11922 req, err := http.NewRequest("GET", urls, body) 11923 if err != nil { 11924 return nil, err 11925 } 11926 req.Header = reqHeaders 11927 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11928} 11929 11930// Do executes the "classroom.invitations.list" call. 11931// Exactly one of *ListInvitationsResponse or error will be non-nil. Any 11932// non-2xx status code is an error. Response headers are in either 11933// *ListInvitationsResponse.ServerResponse.Header or (if a response was 11934// returned at all) in error.(*googleapi.Error).Header. Use 11935// googleapi.IsNotModified to check whether the returned error was 11936// because http.StatusNotModified was returned. 11937func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) { 11938 gensupport.SetOptions(c.urlParams_, opts...) 11939 res, err := c.doRequest("json") 11940 if res != nil && res.StatusCode == http.StatusNotModified { 11941 if res.Body != nil { 11942 res.Body.Close() 11943 } 11944 return nil, &googleapi.Error{ 11945 Code: res.StatusCode, 11946 Header: res.Header, 11947 } 11948 } 11949 if err != nil { 11950 return nil, err 11951 } 11952 defer googleapi.CloseBody(res) 11953 if err := googleapi.CheckResponse(res); err != nil { 11954 return nil, err 11955 } 11956 ret := &ListInvitationsResponse{ 11957 ServerResponse: googleapi.ServerResponse{ 11958 Header: res.Header, 11959 HTTPStatusCode: res.StatusCode, 11960 }, 11961 } 11962 target := &ret 11963 if err := gensupport.DecodeResponse(target, res); err != nil { 11964 return nil, err 11965 } 11966 return ret, nil 11967 // { 11968 // "description": "Returns a list of invitations that the requesting user is permitted to view, restricted to those that match the list request. *Note:* At least one of `user_id` or `course_id` must be supplied. Both fields can be supplied. This method returns the following error codes: * `PERMISSION_DENIED` for access errors.", 11969 // "flatPath": "v1/invitations", 11970 // "httpMethod": "GET", 11971 // "id": "classroom.invitations.list", 11972 // "parameterOrder": [], 11973 // "parameters": { 11974 // "courseId": { 11975 // "description": "Restricts returned invitations to those for a course with the specified identifier.", 11976 // "location": "query", 11977 // "type": "string" 11978 // }, 11979 // "pageSize": { 11980 // "description": "Maximum number of items to return. The default is 500 if unspecified or `0`. The server may return fewer than the specified number of results.", 11981 // "format": "int32", 11982 // "location": "query", 11983 // "type": "integer" 11984 // }, 11985 // "pageToken": { 11986 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 11987 // "location": "query", 11988 // "type": "string" 11989 // }, 11990 // "userId": { 11991 // "description": "Restricts returned invitations to those for a specific user. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 11992 // "location": "query", 11993 // "type": "string" 11994 // } 11995 // }, 11996 // "path": "v1/invitations", 11997 // "response": { 11998 // "$ref": "ListInvitationsResponse" 11999 // }, 12000 // "scopes": [ 12001 // "https://www.googleapis.com/auth/classroom.rosters", 12002 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 12003 // ] 12004 // } 12005 12006} 12007 12008// Pages invokes f for each page of results. 12009// A non-nil error returned from f will halt the iteration. 12010// The provided context supersedes any context provided to the Context method. 12011func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error { 12012 c.ctx_ = ctx 12013 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12014 for { 12015 x, err := c.Do() 12016 if err != nil { 12017 return err 12018 } 12019 if err := f(x); err != nil { 12020 return err 12021 } 12022 if x.NextPageToken == "" { 12023 return nil 12024 } 12025 c.PageToken(x.NextPageToken) 12026 } 12027} 12028 12029// method id "classroom.registrations.create": 12030 12031type RegistrationsCreateCall struct { 12032 s *Service 12033 registration *Registration 12034 urlParams_ gensupport.URLParams 12035 ctx_ context.Context 12036 header_ http.Header 12037} 12038 12039// Create: Creates a `Registration`, causing Classroom to start sending 12040// notifications from the provided `feed` to the destination provided in 12041// `cloudPubSubTopic`. Returns the created `Registration`. Currently, 12042// this will be the same as the argument, but with server-assigned 12043// fields such as `expiry_time` and `id` filled in. Note that any value 12044// specified for the `expiry_time` or `id` fields will be ignored. While 12045// Classroom may validate the `cloudPubSubTopic` and return errors on a 12046// best effort basis, it is the caller's responsibility to ensure that 12047// it exists and that Classroom has permission to publish to it. This 12048// method may return the following error codes: * `PERMISSION_DENIED` 12049// if: * the authenticated user does not have permission to receive 12050// notifications from the requested field; or * the current user has not 12051// granted access to the current Cloud project with the appropriate 12052// scope for the requested feed. Note that domain-wide delegation of 12053// authority is not currently supported for this purpose. If the request 12054// has the appropriate scope, but no grant exists, a Request Errors is 12055// returned. * another access error is encountered. * `INVALID_ARGUMENT` 12056// if: * no `cloudPubsubTopic` is specified, or the specified 12057// `cloudPubsubTopic` is not valid; or * no `feed` is specified, or the 12058// specified `feed` is not valid. * `NOT_FOUND` if: * the specified 12059// `feed` cannot be located, or the requesting user does not have 12060// permission to determine whether or not it exists; or * the specified 12061// `cloudPubsubTopic` cannot be located, or Classroom has not been 12062// granted permission to publish to it. 12063func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall { 12064 c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12065 c.registration = registration 12066 return c 12067} 12068 12069// Fields allows partial responses to be retrieved. See 12070// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12071// for more information. 12072func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall { 12073 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12074 return c 12075} 12076 12077// Context sets the context to be used in this call's Do method. Any 12078// pending HTTP request will be aborted if the provided context is 12079// canceled. 12080func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall { 12081 c.ctx_ = ctx 12082 return c 12083} 12084 12085// Header returns an http.Header that can be modified by the caller to 12086// add HTTP headers to the request. 12087func (c *RegistrationsCreateCall) Header() http.Header { 12088 if c.header_ == nil { 12089 c.header_ = make(http.Header) 12090 } 12091 return c.header_ 12092} 12093 12094func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) { 12095 reqHeaders := make(http.Header) 12096 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 12097 for k, v := range c.header_ { 12098 reqHeaders[k] = v 12099 } 12100 reqHeaders.Set("User-Agent", c.s.userAgent()) 12101 var body io.Reader = nil 12102 body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration) 12103 if err != nil { 12104 return nil, err 12105 } 12106 reqHeaders.Set("Content-Type", "application/json") 12107 c.urlParams_.Set("alt", alt) 12108 c.urlParams_.Set("prettyPrint", "false") 12109 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations") 12110 urls += "?" + c.urlParams_.Encode() 12111 req, err := http.NewRequest("POST", urls, body) 12112 if err != nil { 12113 return nil, err 12114 } 12115 req.Header = reqHeaders 12116 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12117} 12118 12119// Do executes the "classroom.registrations.create" call. 12120// Exactly one of *Registration or error will be non-nil. Any non-2xx 12121// status code is an error. Response headers are in either 12122// *Registration.ServerResponse.Header or (if a response was returned at 12123// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12124// to check whether the returned error was because 12125// http.StatusNotModified was returned. 12126func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) { 12127 gensupport.SetOptions(c.urlParams_, opts...) 12128 res, err := c.doRequest("json") 12129 if res != nil && res.StatusCode == http.StatusNotModified { 12130 if res.Body != nil { 12131 res.Body.Close() 12132 } 12133 return nil, &googleapi.Error{ 12134 Code: res.StatusCode, 12135 Header: res.Header, 12136 } 12137 } 12138 if err != nil { 12139 return nil, err 12140 } 12141 defer googleapi.CloseBody(res) 12142 if err := googleapi.CheckResponse(res); err != nil { 12143 return nil, err 12144 } 12145 ret := &Registration{ 12146 ServerResponse: googleapi.ServerResponse{ 12147 Header: res.Header, 12148 HTTPStatusCode: res.StatusCode, 12149 }, 12150 } 12151 target := &ret 12152 if err := gensupport.DecodeResponse(target, res); err != nil { 12153 return nil, err 12154 } 12155 return ret, nil 12156 // { 12157 // "description": "Creates a `Registration`, causing Classroom to start sending notifications from the provided `feed` to the destination provided in `cloudPubSubTopic`. Returns the created `Registration`. Currently, this will be the same as the argument, but with server-assigned fields such as `expiry_time` and `id` filled in. Note that any value specified for the `expiry_time` or `id` fields will be ignored. While Classroom may validate the `cloudPubSubTopic` and return errors on a best effort basis, it is the caller's responsibility to ensure that it exists and that Classroom has permission to publish to it. This method may return the following error codes: * `PERMISSION_DENIED` if: * the authenticated user does not have permission to receive notifications from the requested field; or * the current user has not granted access to the current Cloud project with the appropriate scope for the requested feed. Note that domain-wide delegation of authority is not currently supported for this purpose. If the request has the appropriate scope, but no grant exists, a Request Errors is returned. * another access error is encountered. * `INVALID_ARGUMENT` if: * no `cloudPubsubTopic` is specified, or the specified `cloudPubsubTopic` is not valid; or * no `feed` is specified, or the specified `feed` is not valid. * `NOT_FOUND` if: * the specified `feed` cannot be located, or the requesting user does not have permission to determine whether or not it exists; or * the specified `cloudPubsubTopic` cannot be located, or Classroom has not been granted permission to publish to it.", 12158 // "flatPath": "v1/registrations", 12159 // "httpMethod": "POST", 12160 // "id": "classroom.registrations.create", 12161 // "parameterOrder": [], 12162 // "parameters": {}, 12163 // "path": "v1/registrations", 12164 // "request": { 12165 // "$ref": "Registration" 12166 // }, 12167 // "response": { 12168 // "$ref": "Registration" 12169 // }, 12170 // "scopes": [ 12171 // "https://www.googleapis.com/auth/classroom.push-notifications" 12172 // ] 12173 // } 12174 12175} 12176 12177// method id "classroom.registrations.delete": 12178 12179type RegistrationsDeleteCall struct { 12180 s *Service 12181 registrationId string 12182 urlParams_ gensupport.URLParams 12183 ctx_ context.Context 12184 header_ http.Header 12185} 12186 12187// Delete: Deletes a `Registration`, causing Classroom to stop sending 12188// notifications for that `Registration`. 12189// 12190// - registrationId: The `registration_id` of the `Registration` to be 12191// deleted. 12192func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall { 12193 c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12194 c.registrationId = registrationId 12195 return c 12196} 12197 12198// Fields allows partial responses to be retrieved. See 12199// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12200// for more information. 12201func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall { 12202 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12203 return c 12204} 12205 12206// Context sets the context to be used in this call's Do method. Any 12207// pending HTTP request will be aborted if the provided context is 12208// canceled. 12209func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall { 12210 c.ctx_ = ctx 12211 return c 12212} 12213 12214// Header returns an http.Header that can be modified by the caller to 12215// add HTTP headers to the request. 12216func (c *RegistrationsDeleteCall) Header() http.Header { 12217 if c.header_ == nil { 12218 c.header_ = make(http.Header) 12219 } 12220 return c.header_ 12221} 12222 12223func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) { 12224 reqHeaders := make(http.Header) 12225 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 12226 for k, v := range c.header_ { 12227 reqHeaders[k] = v 12228 } 12229 reqHeaders.Set("User-Agent", c.s.userAgent()) 12230 var body io.Reader = nil 12231 c.urlParams_.Set("alt", alt) 12232 c.urlParams_.Set("prettyPrint", "false") 12233 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}") 12234 urls += "?" + c.urlParams_.Encode() 12235 req, err := http.NewRequest("DELETE", urls, body) 12236 if err != nil { 12237 return nil, err 12238 } 12239 req.Header = reqHeaders 12240 googleapi.Expand(req.URL, map[string]string{ 12241 "registrationId": c.registrationId, 12242 }) 12243 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12244} 12245 12246// Do executes the "classroom.registrations.delete" call. 12247// Exactly one of *Empty or error will be non-nil. Any non-2xx status 12248// code is an error. Response headers are in either 12249// *Empty.ServerResponse.Header or (if a response was returned at all) 12250// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12251// check whether the returned error was because http.StatusNotModified 12252// was returned. 12253func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 12254 gensupport.SetOptions(c.urlParams_, opts...) 12255 res, err := c.doRequest("json") 12256 if res != nil && res.StatusCode == http.StatusNotModified { 12257 if res.Body != nil { 12258 res.Body.Close() 12259 } 12260 return nil, &googleapi.Error{ 12261 Code: res.StatusCode, 12262 Header: res.Header, 12263 } 12264 } 12265 if err != nil { 12266 return nil, err 12267 } 12268 defer googleapi.CloseBody(res) 12269 if err := googleapi.CheckResponse(res); err != nil { 12270 return nil, err 12271 } 12272 ret := &Empty{ 12273 ServerResponse: googleapi.ServerResponse{ 12274 Header: res.Header, 12275 HTTPStatusCode: res.StatusCode, 12276 }, 12277 } 12278 target := &ret 12279 if err := gensupport.DecodeResponse(target, res); err != nil { 12280 return nil, err 12281 } 12282 return ret, nil 12283 // { 12284 // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications for that `Registration`.", 12285 // "flatPath": "v1/registrations/{registrationId}", 12286 // "httpMethod": "DELETE", 12287 // "id": "classroom.registrations.delete", 12288 // "parameterOrder": [ 12289 // "registrationId" 12290 // ], 12291 // "parameters": { 12292 // "registrationId": { 12293 // "description": "The `registration_id` of the `Registration` to be deleted.", 12294 // "location": "path", 12295 // "required": true, 12296 // "type": "string" 12297 // } 12298 // }, 12299 // "path": "v1/registrations/{registrationId}", 12300 // "response": { 12301 // "$ref": "Empty" 12302 // }, 12303 // "scopes": [ 12304 // "https://www.googleapis.com/auth/classroom.push-notifications" 12305 // ] 12306 // } 12307 12308} 12309 12310// method id "classroom.userProfiles.get": 12311 12312type UserProfilesGetCall struct { 12313 s *Service 12314 userId string 12315 urlParams_ gensupport.URLParams 12316 ifNoneMatch_ string 12317 ctx_ context.Context 12318 header_ http.Header 12319} 12320 12321// Get: Returns a user profile. This method returns the following error 12322// codes: * `PERMISSION_DENIED` if the requesting user is not permitted 12323// to access this user profile, if no profile exists with the requested 12324// ID, or for access errors. 12325// 12326// - userId: Identifier of the profile to return. The identifier can be 12327// one of the following: * the numeric identifier for the user * the 12328// email address of the user * the string literal "me", indicating 12329// the requesting user. 12330func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall { 12331 c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12332 c.userId = userId 12333 return c 12334} 12335 12336// Fields allows partial responses to be retrieved. See 12337// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12338// for more information. 12339func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall { 12340 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12341 return c 12342} 12343 12344// IfNoneMatch sets the optional parameter which makes the operation 12345// fail if the object's ETag matches the given value. This is useful for 12346// getting updates only after the object has changed since the last 12347// request. Use googleapi.IsNotModified to check whether the response 12348// error from Do is the result of In-None-Match. 12349func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall { 12350 c.ifNoneMatch_ = entityTag 12351 return c 12352} 12353 12354// Context sets the context to be used in this call's Do method. Any 12355// pending HTTP request will be aborted if the provided context is 12356// canceled. 12357func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall { 12358 c.ctx_ = ctx 12359 return c 12360} 12361 12362// Header returns an http.Header that can be modified by the caller to 12363// add HTTP headers to the request. 12364func (c *UserProfilesGetCall) Header() http.Header { 12365 if c.header_ == nil { 12366 c.header_ = make(http.Header) 12367 } 12368 return c.header_ 12369} 12370 12371func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) { 12372 reqHeaders := make(http.Header) 12373 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 12374 for k, v := range c.header_ { 12375 reqHeaders[k] = v 12376 } 12377 reqHeaders.Set("User-Agent", c.s.userAgent()) 12378 if c.ifNoneMatch_ != "" { 12379 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12380 } 12381 var body io.Reader = nil 12382 c.urlParams_.Set("alt", alt) 12383 c.urlParams_.Set("prettyPrint", "false") 12384 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}") 12385 urls += "?" + c.urlParams_.Encode() 12386 req, err := http.NewRequest("GET", urls, body) 12387 if err != nil { 12388 return nil, err 12389 } 12390 req.Header = reqHeaders 12391 googleapi.Expand(req.URL, map[string]string{ 12392 "userId": c.userId, 12393 }) 12394 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12395} 12396 12397// Do executes the "classroom.userProfiles.get" call. 12398// Exactly one of *UserProfile or error will be non-nil. Any non-2xx 12399// status code is an error. Response headers are in either 12400// *UserProfile.ServerResponse.Header or (if a response was returned at 12401// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12402// to check whether the returned error was because 12403// http.StatusNotModified was returned. 12404func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) { 12405 gensupport.SetOptions(c.urlParams_, opts...) 12406 res, err := c.doRequest("json") 12407 if res != nil && res.StatusCode == http.StatusNotModified { 12408 if res.Body != nil { 12409 res.Body.Close() 12410 } 12411 return nil, &googleapi.Error{ 12412 Code: res.StatusCode, 12413 Header: res.Header, 12414 } 12415 } 12416 if err != nil { 12417 return nil, err 12418 } 12419 defer googleapi.CloseBody(res) 12420 if err := googleapi.CheckResponse(res); err != nil { 12421 return nil, err 12422 } 12423 ret := &UserProfile{ 12424 ServerResponse: googleapi.ServerResponse{ 12425 Header: res.Header, 12426 HTTPStatusCode: res.StatusCode, 12427 }, 12428 } 12429 target := &ret 12430 if err := gensupport.DecodeResponse(target, res); err != nil { 12431 return nil, err 12432 } 12433 return ret, nil 12434 // { 12435 // "description": "Returns a user profile. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access this user profile, if no profile exists with the requested ID, or for access errors.", 12436 // "flatPath": "v1/userProfiles/{userId}", 12437 // "httpMethod": "GET", 12438 // "id": "classroom.userProfiles.get", 12439 // "parameterOrder": [ 12440 // "userId" 12441 // ], 12442 // "parameters": { 12443 // "userId": { 12444 // "description": "Identifier of the profile to return. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 12445 // "location": "path", 12446 // "required": true, 12447 // "type": "string" 12448 // } 12449 // }, 12450 // "path": "v1/userProfiles/{userId}", 12451 // "response": { 12452 // "$ref": "UserProfile" 12453 // }, 12454 // "scopes": [ 12455 // "https://www.googleapis.com/auth/classroom.profile.emails", 12456 // "https://www.googleapis.com/auth/classroom.profile.photos", 12457 // "https://www.googleapis.com/auth/classroom.rosters", 12458 // "https://www.googleapis.com/auth/classroom.rosters.readonly" 12459 // ] 12460 // } 12461 12462} 12463 12464// method id "classroom.userProfiles.guardianInvitations.create": 12465 12466type UserProfilesGuardianInvitationsCreateCall struct { 12467 s *Service 12468 studentId string 12469 guardianinvitation *GuardianInvitation 12470 urlParams_ gensupport.URLParams 12471 ctx_ context.Context 12472 header_ http.Header 12473} 12474 12475// Create: Creates a guardian invitation, and sends an email to the 12476// guardian asking them to confirm that they are the student's guardian. 12477// Once the guardian accepts the invitation, their `state` will change 12478// to `COMPLETED` and they will start receiving guardian notifications. 12479// A `Guardian` resource will also be created to represent the active 12480// guardian. The request object must have the `student_id` and 12481// `invited_email_address` fields set. Failing to set these fields, or 12482// setting any other fields in the request, will result in an error. 12483// This method returns the following error codes: * `PERMISSION_DENIED` 12484// if the current user does not have permission to manage guardians, if 12485// the guardian in question has already rejected too many requests for 12486// that student, if guardians are not enabled for the domain in 12487// question, or for other access errors. * `RESOURCE_EXHAUSTED` if the 12488// student or guardian has exceeded the guardian link limit. * 12489// `INVALID_ARGUMENT` if the guardian email address is not valid (for 12490// example, if it is too long), or if the format of the student ID 12491// provided cannot be recognized (it is not an email address, nor a 12492// `user_id` from this API). This error will also be returned if 12493// read-only fields are set, or if the `state` field is set to to a 12494// value other than `PENDING`. * `NOT_FOUND` if the student ID provided 12495// is a valid student ID, but Classroom has no record of that student. * 12496// `ALREADY_EXISTS` if there is already a pending guardian invitation 12497// for the student and `invited_email_address` provided, or if the 12498// provided `invited_email_address` matches the Google account of an 12499// existing `Guardian` for this user. 12500// 12501// - studentId: ID of the student (in standard format). 12502func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall { 12503 c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12504 c.studentId = studentId 12505 c.guardianinvitation = guardianinvitation 12506 return c 12507} 12508 12509// Fields allows partial responses to be retrieved. See 12510// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12511// for more information. 12512func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall { 12513 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12514 return c 12515} 12516 12517// Context sets the context to be used in this call's Do method. Any 12518// pending HTTP request will be aborted if the provided context is 12519// canceled. 12520func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall { 12521 c.ctx_ = ctx 12522 return c 12523} 12524 12525// Header returns an http.Header that can be modified by the caller to 12526// add HTTP headers to the request. 12527func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header { 12528 if c.header_ == nil { 12529 c.header_ = make(http.Header) 12530 } 12531 return c.header_ 12532} 12533 12534func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) { 12535 reqHeaders := make(http.Header) 12536 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 12537 for k, v := range c.header_ { 12538 reqHeaders[k] = v 12539 } 12540 reqHeaders.Set("User-Agent", c.s.userAgent()) 12541 var body io.Reader = nil 12542 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 12543 if err != nil { 12544 return nil, err 12545 } 12546 reqHeaders.Set("Content-Type", "application/json") 12547 c.urlParams_.Set("alt", alt) 12548 c.urlParams_.Set("prettyPrint", "false") 12549 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12550 urls += "?" + c.urlParams_.Encode() 12551 req, err := http.NewRequest("POST", urls, body) 12552 if err != nil { 12553 return nil, err 12554 } 12555 req.Header = reqHeaders 12556 googleapi.Expand(req.URL, map[string]string{ 12557 "studentId": c.studentId, 12558 }) 12559 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12560} 12561 12562// Do executes the "classroom.userProfiles.guardianInvitations.create" call. 12563// Exactly one of *GuardianInvitation or error will be non-nil. Any 12564// non-2xx status code is an error. Response headers are in either 12565// *GuardianInvitation.ServerResponse.Header or (if a response was 12566// returned at all) in error.(*googleapi.Error).Header. Use 12567// googleapi.IsNotModified to check whether the returned error was 12568// because http.StatusNotModified was returned. 12569func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12570 gensupport.SetOptions(c.urlParams_, opts...) 12571 res, err := c.doRequest("json") 12572 if res != nil && res.StatusCode == http.StatusNotModified { 12573 if res.Body != nil { 12574 res.Body.Close() 12575 } 12576 return nil, &googleapi.Error{ 12577 Code: res.StatusCode, 12578 Header: res.Header, 12579 } 12580 } 12581 if err != nil { 12582 return nil, err 12583 } 12584 defer googleapi.CloseBody(res) 12585 if err := googleapi.CheckResponse(res); err != nil { 12586 return nil, err 12587 } 12588 ret := &GuardianInvitation{ 12589 ServerResponse: googleapi.ServerResponse{ 12590 Header: res.Header, 12591 HTTPStatusCode: res.StatusCode, 12592 }, 12593 } 12594 target := &ret 12595 if err := gensupport.DecodeResponse(target, res); err != nil { 12596 return nil, err 12597 } 12598 return ret, nil 12599 // { 12600 // "description": "Creates a guardian invitation, and sends an email to the guardian asking them to confirm that they are the student's guardian. Once the guardian accepts the invitation, their `state` will change to `COMPLETED` and they will start receiving guardian notifications. A `Guardian` resource will also be created to represent the active guardian. The request object must have the `student_id` and `invited_email_address` fields set. Failing to set these fields, or setting any other fields in the request, will result in an error. This method returns the following error codes: * `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if the guardian in question has already rejected too many requests for that student, if guardians are not enabled for the domain in question, or for other access errors. * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the guardian link limit. * `INVALID_ARGUMENT` if the guardian email address is not valid (for example, if it is too long), or if the format of the student ID provided cannot be recognized (it is not an email address, nor a `user_id` from this API). This error will also be returned if read-only fields are set, or if the `state` field is set to to a value other than `PENDING`. * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student. * `ALREADY_EXISTS` if there is already a pending guardian invitation for the student and `invited_email_address` provided, or if the provided `invited_email_address` matches the Google account of an existing `Guardian` for this user.", 12601 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12602 // "httpMethod": "POST", 12603 // "id": "classroom.userProfiles.guardianInvitations.create", 12604 // "parameterOrder": [ 12605 // "studentId" 12606 // ], 12607 // "parameters": { 12608 // "studentId": { 12609 // "description": "ID of the student (in standard format)", 12610 // "location": "path", 12611 // "required": true, 12612 // "type": "string" 12613 // } 12614 // }, 12615 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 12616 // "request": { 12617 // "$ref": "GuardianInvitation" 12618 // }, 12619 // "response": { 12620 // "$ref": "GuardianInvitation" 12621 // }, 12622 // "scopes": [ 12623 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 12624 // ] 12625 // } 12626 12627} 12628 12629// method id "classroom.userProfiles.guardianInvitations.get": 12630 12631type UserProfilesGuardianInvitationsGetCall struct { 12632 s *Service 12633 studentId string 12634 invitationId string 12635 urlParams_ gensupport.URLParams 12636 ifNoneMatch_ string 12637 ctx_ context.Context 12638 header_ http.Header 12639} 12640 12641// Get: Returns a specific guardian invitation. This method returns the 12642// following error codes: * `PERMISSION_DENIED` if the requesting user 12643// is not permitted to view guardian invitations for the student 12644// identified by the `student_id`, if guardians are not enabled for the 12645// domain in question, or for other access errors. * `INVALID_ARGUMENT` 12646// if a `student_id` is specified, but its format cannot be recognized 12647// (it is not an email address, nor a `student_id` from the API, nor the 12648// literal string `me`). * `NOT_FOUND` if Classroom cannot find any 12649// record of the given student or `invitation_id`. May also be returned 12650// if the student exists, but the requesting user does not have access 12651// to see that student. 12652// 12653// - invitationId: The `id` field of the `GuardianInvitation` being 12654// requested. 12655// - studentId: The ID of the student whose guardian invitation is being 12656// requested. 12657func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall { 12658 c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12659 c.studentId = studentId 12660 c.invitationId = invitationId 12661 return c 12662} 12663 12664// Fields allows partial responses to be retrieved. See 12665// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12666// for more information. 12667func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall { 12668 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12669 return c 12670} 12671 12672// IfNoneMatch sets the optional parameter which makes the operation 12673// fail if the object's ETag matches the given value. This is useful for 12674// getting updates only after the object has changed since the last 12675// request. Use googleapi.IsNotModified to check whether the response 12676// error from Do is the result of In-None-Match. 12677func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall { 12678 c.ifNoneMatch_ = entityTag 12679 return c 12680} 12681 12682// Context sets the context to be used in this call's Do method. Any 12683// pending HTTP request will be aborted if the provided context is 12684// canceled. 12685func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall { 12686 c.ctx_ = ctx 12687 return c 12688} 12689 12690// Header returns an http.Header that can be modified by the caller to 12691// add HTTP headers to the request. 12692func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header { 12693 if c.header_ == nil { 12694 c.header_ = make(http.Header) 12695 } 12696 return c.header_ 12697} 12698 12699func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) { 12700 reqHeaders := make(http.Header) 12701 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 12702 for k, v := range c.header_ { 12703 reqHeaders[k] = v 12704 } 12705 reqHeaders.Set("User-Agent", c.s.userAgent()) 12706 if c.ifNoneMatch_ != "" { 12707 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12708 } 12709 var body io.Reader = nil 12710 c.urlParams_.Set("alt", alt) 12711 c.urlParams_.Set("prettyPrint", "false") 12712 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 12713 urls += "?" + c.urlParams_.Encode() 12714 req, err := http.NewRequest("GET", urls, body) 12715 if err != nil { 12716 return nil, err 12717 } 12718 req.Header = reqHeaders 12719 googleapi.Expand(req.URL, map[string]string{ 12720 "studentId": c.studentId, 12721 "invitationId": c.invitationId, 12722 }) 12723 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12724} 12725 12726// Do executes the "classroom.userProfiles.guardianInvitations.get" call. 12727// Exactly one of *GuardianInvitation or error will be non-nil. Any 12728// non-2xx status code is an error. Response headers are in either 12729// *GuardianInvitation.ServerResponse.Header or (if a response was 12730// returned at all) in error.(*googleapi.Error).Header. Use 12731// googleapi.IsNotModified to check whether the returned error was 12732// because http.StatusNotModified was returned. 12733func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 12734 gensupport.SetOptions(c.urlParams_, opts...) 12735 res, err := c.doRequest("json") 12736 if res != nil && res.StatusCode == http.StatusNotModified { 12737 if res.Body != nil { 12738 res.Body.Close() 12739 } 12740 return nil, &googleapi.Error{ 12741 Code: res.StatusCode, 12742 Header: res.Header, 12743 } 12744 } 12745 if err != nil { 12746 return nil, err 12747 } 12748 defer googleapi.CloseBody(res) 12749 if err := googleapi.CheckResponse(res); err != nil { 12750 return nil, err 12751 } 12752 ret := &GuardianInvitation{ 12753 ServerResponse: googleapi.ServerResponse{ 12754 Header: res.Header, 12755 HTTPStatusCode: res.StatusCode, 12756 }, 12757 } 12758 target := &ret 12759 if err := gensupport.DecodeResponse(target, res); err != nil { 12760 return nil, err 12761 } 12762 return ret, nil 12763 // { 12764 // "description": "Returns a specific guardian invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view guardian invitations for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). * `NOT_FOUND` if Classroom cannot find any record of the given student or `invitation_id`. May also be returned if the student exists, but the requesting user does not have access to see that student.", 12765 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12766 // "httpMethod": "GET", 12767 // "id": "classroom.userProfiles.guardianInvitations.get", 12768 // "parameterOrder": [ 12769 // "studentId", 12770 // "invitationId" 12771 // ], 12772 // "parameters": { 12773 // "invitationId": { 12774 // "description": "The `id` field of the `GuardianInvitation` being requested.", 12775 // "location": "path", 12776 // "required": true, 12777 // "type": "string" 12778 // }, 12779 // "studentId": { 12780 // "description": "The ID of the student whose guardian invitation is being requested.", 12781 // "location": "path", 12782 // "required": true, 12783 // "type": "string" 12784 // } 12785 // }, 12786 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 12787 // "response": { 12788 // "$ref": "GuardianInvitation" 12789 // }, 12790 // "scopes": [ 12791 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 12792 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 12793 // ] 12794 // } 12795 12796} 12797 12798// method id "classroom.userProfiles.guardianInvitations.list": 12799 12800type UserProfilesGuardianInvitationsListCall struct { 12801 s *Service 12802 studentId string 12803 urlParams_ gensupport.URLParams 12804 ifNoneMatch_ string 12805 ctx_ context.Context 12806 header_ http.Header 12807} 12808 12809// List: Returns a list of guardian invitations that the requesting user 12810// is permitted to view, filtered by the parameters provided. This 12811// method returns the following error codes: * `PERMISSION_DENIED` if a 12812// `student_id` is specified, and the requesting user is not permitted 12813// to view guardian invitations for that student, if "-" is specified 12814// as the `student_id` and the user is not a domain administrator, if 12815// guardians are not enabled for the domain in question, or for other 12816// access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, 12817// but its format cannot be recognized (it is not an email address, nor 12818// a `student_id` from the API, nor the literal string `me`). May also 12819// be returned if an invalid `page_token` or `state` is provided. * 12820// `NOT_FOUND` if a `student_id` is specified, and its format can be 12821// recognized, but Classroom has no record of that student. 12822// 12823// - studentId: The ID of the student whose guardian invitations are to 12824// be returned. The identifier can be one of the following: * the 12825// numeric identifier for the user * the email address of the user * 12826// the string literal "me", indicating the requesting user * the 12827// string literal "-", indicating that results should be returned 12828// for all students that the requesting user is permitted to view 12829// guardian invitations. 12830func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall { 12831 c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12832 c.studentId = studentId 12833 return c 12834} 12835 12836// InvitedEmailAddress sets the optional parameter 12837// "invitedEmailAddress": If specified, only results with the specified 12838// `invited_email_address` are returned. 12839func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall { 12840 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 12841 return c 12842} 12843 12844// PageSize sets the optional parameter "pageSize": Maximum number of 12845// items to return. Zero or unspecified indicates that the server may 12846// assign a maximum. The server may return fewer than the specified 12847// number of results. 12848func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall { 12849 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 12850 return c 12851} 12852 12853// PageToken sets the optional parameter "pageToken": nextPageToken 12854// value returned from a previous list call, indicating that the 12855// subsequent page of results should be returned. The list request must 12856// be otherwise identical to the one that resulted in this token. 12857func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall { 12858 c.urlParams_.Set("pageToken", pageToken) 12859 return c 12860} 12861 12862// States sets the optional parameter "states": If specified, only 12863// results with the specified `state` values are returned. Otherwise, 12864// results with a `state` of `PENDING` are returned. 12865// 12866// Possible values: 12867// "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned. 12868// "PENDING" - The invitation is active and awaiting a response. 12869// "COMPLETE" - The invitation is no longer active. It may have been 12870// accepted, declined, withdrawn or it may have expired. 12871func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall { 12872 c.urlParams_.SetMulti("states", append([]string{}, states...)) 12873 return c 12874} 12875 12876// Fields allows partial responses to be retrieved. See 12877// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12878// for more information. 12879func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall { 12880 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12881 return c 12882} 12883 12884// IfNoneMatch sets the optional parameter which makes the operation 12885// fail if the object's ETag matches the given value. This is useful for 12886// getting updates only after the object has changed since the last 12887// request. Use googleapi.IsNotModified to check whether the response 12888// error from Do is the result of In-None-Match. 12889func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall { 12890 c.ifNoneMatch_ = entityTag 12891 return c 12892} 12893 12894// Context sets the context to be used in this call's Do method. Any 12895// pending HTTP request will be aborted if the provided context is 12896// canceled. 12897func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall { 12898 c.ctx_ = ctx 12899 return c 12900} 12901 12902// Header returns an http.Header that can be modified by the caller to 12903// add HTTP headers to the request. 12904func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header { 12905 if c.header_ == nil { 12906 c.header_ = make(http.Header) 12907 } 12908 return c.header_ 12909} 12910 12911func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) { 12912 reqHeaders := make(http.Header) 12913 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 12914 for k, v := range c.header_ { 12915 reqHeaders[k] = v 12916 } 12917 reqHeaders.Set("User-Agent", c.s.userAgent()) 12918 if c.ifNoneMatch_ != "" { 12919 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12920 } 12921 var body io.Reader = nil 12922 c.urlParams_.Set("alt", alt) 12923 c.urlParams_.Set("prettyPrint", "false") 12924 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations") 12925 urls += "?" + c.urlParams_.Encode() 12926 req, err := http.NewRequest("GET", urls, body) 12927 if err != nil { 12928 return nil, err 12929 } 12930 req.Header = reqHeaders 12931 googleapi.Expand(req.URL, map[string]string{ 12932 "studentId": c.studentId, 12933 }) 12934 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12935} 12936 12937// Do executes the "classroom.userProfiles.guardianInvitations.list" call. 12938// Exactly one of *ListGuardianInvitationsResponse or error will be 12939// non-nil. Any non-2xx status code is an error. Response headers are in 12940// either *ListGuardianInvitationsResponse.ServerResponse.Header or (if 12941// a response was returned at all) in error.(*googleapi.Error).Header. 12942// Use googleapi.IsNotModified to check whether the returned error was 12943// because http.StatusNotModified was returned. 12944func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) { 12945 gensupport.SetOptions(c.urlParams_, opts...) 12946 res, err := c.doRequest("json") 12947 if res != nil && res.StatusCode == http.StatusNotModified { 12948 if res.Body != nil { 12949 res.Body.Close() 12950 } 12951 return nil, &googleapi.Error{ 12952 Code: res.StatusCode, 12953 Header: res.Header, 12954 } 12955 } 12956 if err != nil { 12957 return nil, err 12958 } 12959 defer googleapi.CloseBody(res) 12960 if err := googleapi.CheckResponse(res); err != nil { 12961 return nil, err 12962 } 12963 ret := &ListGuardianInvitationsResponse{ 12964 ServerResponse: googleapi.ServerResponse{ 12965 Header: res.Header, 12966 HTTPStatusCode: res.StatusCode, 12967 }, 12968 } 12969 target := &ret 12970 if err := gensupport.DecodeResponse(target, res); err != nil { 12971 return nil, err 12972 } 12973 return ret, nil 12974 // { 12975 // "description": "Returns a list of guardian invitations that the requesting user is permitted to view, filtered by the parameters provided. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian invitations for that student, if `\"-\"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` or `state` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", 12976 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations", 12977 // "httpMethod": "GET", 12978 // "id": "classroom.userProfiles.guardianInvitations.list", 12979 // "parameterOrder": [ 12980 // "studentId" 12981 // ], 12982 // "parameters": { 12983 // "invitedEmailAddress": { 12984 // "description": "If specified, only results with the specified `invited_email_address` are returned.", 12985 // "location": "query", 12986 // "type": "string" 12987 // }, 12988 // "pageSize": { 12989 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 12990 // "format": "int32", 12991 // "location": "query", 12992 // "type": "integer" 12993 // }, 12994 // "pageToken": { 12995 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 12996 // "location": "query", 12997 // "type": "string" 12998 // }, 12999 // "states": { 13000 // "description": "If specified, only results with the specified `state` values are returned. Otherwise, results with a `state` of `PENDING` are returned.", 13001 // "enum": [ 13002 // "GUARDIAN_INVITATION_STATE_UNSPECIFIED", 13003 // "PENDING", 13004 // "COMPLETE" 13005 // ], 13006 // "enumDescriptions": [ 13007 // "Should never be returned.", 13008 // "The invitation is active and awaiting a response.", 13009 // "The invitation is no longer active. It may have been accepted, declined, withdrawn or it may have expired." 13010 // ], 13011 // "location": "query", 13012 // "repeated": true, 13013 // "type": "string" 13014 // }, 13015 // "studentId": { 13016 // "description": "The ID of the student whose guardian invitations are to be returned. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user * the string literal `\"-\"`, indicating that results should be returned for all students that the requesting user is permitted to view guardian invitations.", 13017 // "location": "path", 13018 // "required": true, 13019 // "type": "string" 13020 // } 13021 // }, 13022 // "path": "v1/userProfiles/{studentId}/guardianInvitations", 13023 // "response": { 13024 // "$ref": "ListGuardianInvitationsResponse" 13025 // }, 13026 // "scopes": [ 13027 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13028 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13029 // ] 13030 // } 13031 13032} 13033 13034// Pages invokes f for each page of results. 13035// A non-nil error returned from f will halt the iteration. 13036// The provided context supersedes any context provided to the Context method. 13037func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error { 13038 c.ctx_ = ctx 13039 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13040 for { 13041 x, err := c.Do() 13042 if err != nil { 13043 return err 13044 } 13045 if err := f(x); err != nil { 13046 return err 13047 } 13048 if x.NextPageToken == "" { 13049 return nil 13050 } 13051 c.PageToken(x.NextPageToken) 13052 } 13053} 13054 13055// method id "classroom.userProfiles.guardianInvitations.patch": 13056 13057type UserProfilesGuardianInvitationsPatchCall struct { 13058 s *Service 13059 studentId string 13060 invitationId string 13061 guardianinvitation *GuardianInvitation 13062 urlParams_ gensupport.URLParams 13063 ctx_ context.Context 13064 header_ http.Header 13065} 13066 13067// Patch: Modifies a guardian invitation. Currently, the only valid 13068// modification is to change the `state` from `PENDING` to `COMPLETE`. 13069// This has the effect of withdrawing the invitation. This method 13070// returns the following error codes: * `PERMISSION_DENIED` if the 13071// current user does not have permission to manage guardians, if 13072// guardians are not enabled for the domain in question or for other 13073// access errors. * `FAILED_PRECONDITION` if the guardian link is not in 13074// the `PENDING` state. * `INVALID_ARGUMENT` if the format of the 13075// student ID provided cannot be recognized (it is not an email address, 13076// nor a `user_id` from this API), or if the passed `GuardianInvitation` 13077// has a `state` other than `COMPLETE`, or if it modifies fields other 13078// than `state`. * `NOT_FOUND` if the student ID provided is a valid 13079// student ID, but Classroom has no record of that student, or if the 13080// `id` field does not refer to a guardian invitation known to 13081// Classroom. 13082// 13083// - invitationId: The `id` field of the `GuardianInvitation` to be 13084// modified. 13085// - studentId: The ID of the student whose guardian invitation is to be 13086// modified. 13087func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall { 13088 c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13089 c.studentId = studentId 13090 c.invitationId = invitationId 13091 c.guardianinvitation = guardianinvitation 13092 return c 13093} 13094 13095// UpdateMask sets the optional parameter "updateMask": Mask that 13096// identifies which fields on the course to update. This field is 13097// required to do an update. The update fails if invalid fields are 13098// specified. The following fields are valid: * `state` When set in a 13099// query parameter, this field should be specified as `updateMask=,,...` 13100func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall { 13101 c.urlParams_.Set("updateMask", updateMask) 13102 return c 13103} 13104 13105// Fields allows partial responses to be retrieved. See 13106// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13107// for more information. 13108func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall { 13109 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13110 return c 13111} 13112 13113// Context sets the context to be used in this call's Do method. Any 13114// pending HTTP request will be aborted if the provided context is 13115// canceled. 13116func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall { 13117 c.ctx_ = ctx 13118 return c 13119} 13120 13121// Header returns an http.Header that can be modified by the caller to 13122// add HTTP headers to the request. 13123func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header { 13124 if c.header_ == nil { 13125 c.header_ = make(http.Header) 13126 } 13127 return c.header_ 13128} 13129 13130func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) { 13131 reqHeaders := make(http.Header) 13132 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 13133 for k, v := range c.header_ { 13134 reqHeaders[k] = v 13135 } 13136 reqHeaders.Set("User-Agent", c.s.userAgent()) 13137 var body io.Reader = nil 13138 body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation) 13139 if err != nil { 13140 return nil, err 13141 } 13142 reqHeaders.Set("Content-Type", "application/json") 13143 c.urlParams_.Set("alt", alt) 13144 c.urlParams_.Set("prettyPrint", "false") 13145 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}") 13146 urls += "?" + c.urlParams_.Encode() 13147 req, err := http.NewRequest("PATCH", urls, body) 13148 if err != nil { 13149 return nil, err 13150 } 13151 req.Header = reqHeaders 13152 googleapi.Expand(req.URL, map[string]string{ 13153 "studentId": c.studentId, 13154 "invitationId": c.invitationId, 13155 }) 13156 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13157} 13158 13159// Do executes the "classroom.userProfiles.guardianInvitations.patch" call. 13160// Exactly one of *GuardianInvitation or error will be non-nil. Any 13161// non-2xx status code is an error. Response headers are in either 13162// *GuardianInvitation.ServerResponse.Header or (if a response was 13163// returned at all) in error.(*googleapi.Error).Header. Use 13164// googleapi.IsNotModified to check whether the returned error was 13165// because http.StatusNotModified was returned. 13166func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) { 13167 gensupport.SetOptions(c.urlParams_, opts...) 13168 res, err := c.doRequest("json") 13169 if res != nil && res.StatusCode == http.StatusNotModified { 13170 if res.Body != nil { 13171 res.Body.Close() 13172 } 13173 return nil, &googleapi.Error{ 13174 Code: res.StatusCode, 13175 Header: res.Header, 13176 } 13177 } 13178 if err != nil { 13179 return nil, err 13180 } 13181 defer googleapi.CloseBody(res) 13182 if err := googleapi.CheckResponse(res); err != nil { 13183 return nil, err 13184 } 13185 ret := &GuardianInvitation{ 13186 ServerResponse: googleapi.ServerResponse{ 13187 Header: res.Header, 13188 HTTPStatusCode: res.StatusCode, 13189 }, 13190 } 13191 target := &ret 13192 if err := gensupport.DecodeResponse(target, res); err != nil { 13193 return nil, err 13194 } 13195 return ret, nil 13196 // { 13197 // "description": "Modifies a guardian invitation. Currently, the only valid modification is to change the `state` from `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if guardians are not enabled for the domain in question or for other access errors. * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. * `INVALID_ARGUMENT` if the format of the student ID provided cannot be recognized (it is not an email address, nor a `user_id` from this API), or if the passed `GuardianInvitation` has a `state` other than `COMPLETE`, or if it modifies fields other than `state`. * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student, or if the `id` field does not refer to a guardian invitation known to Classroom.", 13198 // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 13199 // "httpMethod": "PATCH", 13200 // "id": "classroom.userProfiles.guardianInvitations.patch", 13201 // "parameterOrder": [ 13202 // "studentId", 13203 // "invitationId" 13204 // ], 13205 // "parameters": { 13206 // "invitationId": { 13207 // "description": "The `id` field of the `GuardianInvitation` to be modified.", 13208 // "location": "path", 13209 // "required": true, 13210 // "type": "string" 13211 // }, 13212 // "studentId": { 13213 // "description": "The ID of the student whose guardian invitation is to be modified.", 13214 // "location": "path", 13215 // "required": true, 13216 // "type": "string" 13217 // }, 13218 // "updateMask": { 13219 // "description": "Mask that identifies which fields on the course to update. This field is required to do an update. The update fails if invalid fields are specified. The following fields are valid: * `state` When set in a query parameter, this field should be specified as `updateMask=,,...`", 13220 // "format": "google-fieldmask", 13221 // "location": "query", 13222 // "type": "string" 13223 // } 13224 // }, 13225 // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}", 13226 // "request": { 13227 // "$ref": "GuardianInvitation" 13228 // }, 13229 // "response": { 13230 // "$ref": "GuardianInvitation" 13231 // }, 13232 // "scopes": [ 13233 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 13234 // ] 13235 // } 13236 13237} 13238 13239// method id "classroom.userProfiles.guardians.delete": 13240 13241type UserProfilesGuardiansDeleteCall struct { 13242 s *Service 13243 studentId string 13244 guardianId string 13245 urlParams_ gensupport.URLParams 13246 ctx_ context.Context 13247 header_ http.Header 13248} 13249 13250// Delete: Deletes a guardian. The guardian will no longer receive 13251// guardian notifications and the guardian will no longer be accessible 13252// via the API. This method returns the following error codes: * 13253// `PERMISSION_DENIED` if no user that matches the provided `student_id` 13254// is visible to the requesting user, if the requesting user is not 13255// permitted to manage guardians for the student identified by the 13256// `student_id`, if guardians are not enabled for the domain in 13257// question, or for other access errors. * `INVALID_ARGUMENT` if a 13258// `student_id` is specified, but its format cannot be recognized (it is 13259// not an email address, nor a `student_id` from the API). * `NOT_FOUND` 13260// if the requesting user is permitted to modify guardians for the 13261// requested `student_id`, but no `Guardian` record exists for that 13262// student with the provided `guardian_id`. 13263// 13264// - guardianId: The `id` field from a `Guardian`. 13265// - studentId: The student whose guardian is to be deleted. One of the 13266// following: * the numeric identifier for the user * the email 13267// address of the user * the string literal "me", indicating the 13268// requesting user. 13269func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall { 13270 c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13271 c.studentId = studentId 13272 c.guardianId = guardianId 13273 return c 13274} 13275 13276// Fields allows partial responses to be retrieved. See 13277// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13278// for more information. 13279func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall { 13280 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13281 return c 13282} 13283 13284// Context sets the context to be used in this call's Do method. Any 13285// pending HTTP request will be aborted if the provided context is 13286// canceled. 13287func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall { 13288 c.ctx_ = ctx 13289 return c 13290} 13291 13292// Header returns an http.Header that can be modified by the caller to 13293// add HTTP headers to the request. 13294func (c *UserProfilesGuardiansDeleteCall) Header() http.Header { 13295 if c.header_ == nil { 13296 c.header_ = make(http.Header) 13297 } 13298 return c.header_ 13299} 13300 13301func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) { 13302 reqHeaders := make(http.Header) 13303 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 13304 for k, v := range c.header_ { 13305 reqHeaders[k] = v 13306 } 13307 reqHeaders.Set("User-Agent", c.s.userAgent()) 13308 var body io.Reader = nil 13309 c.urlParams_.Set("alt", alt) 13310 c.urlParams_.Set("prettyPrint", "false") 13311 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13312 urls += "?" + c.urlParams_.Encode() 13313 req, err := http.NewRequest("DELETE", urls, body) 13314 if err != nil { 13315 return nil, err 13316 } 13317 req.Header = reqHeaders 13318 googleapi.Expand(req.URL, map[string]string{ 13319 "studentId": c.studentId, 13320 "guardianId": c.guardianId, 13321 }) 13322 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13323} 13324 13325// Do executes the "classroom.userProfiles.guardians.delete" call. 13326// Exactly one of *Empty or error will be non-nil. Any non-2xx status 13327// code is an error. Response headers are in either 13328// *Empty.ServerResponse.Header or (if a response was returned at all) 13329// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 13330// check whether the returned error was because http.StatusNotModified 13331// was returned. 13332func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 13333 gensupport.SetOptions(c.urlParams_, opts...) 13334 res, err := c.doRequest("json") 13335 if res != nil && res.StatusCode == http.StatusNotModified { 13336 if res.Body != nil { 13337 res.Body.Close() 13338 } 13339 return nil, &googleapi.Error{ 13340 Code: res.StatusCode, 13341 Header: res.Header, 13342 } 13343 } 13344 if err != nil { 13345 return nil, err 13346 } 13347 defer googleapi.CloseBody(res) 13348 if err := googleapi.CheckResponse(res); err != nil { 13349 return nil, err 13350 } 13351 ret := &Empty{ 13352 ServerResponse: googleapi.ServerResponse{ 13353 Header: res.Header, 13354 HTTPStatusCode: res.StatusCode, 13355 }, 13356 } 13357 target := &ret 13358 if err := gensupport.DecodeResponse(target, res); err != nil { 13359 return nil, err 13360 } 13361 return ret, nil 13362 // { 13363 // "description": "Deletes a guardian. The guardian will no longer receive guardian notifications and the guardian will no longer be accessible via the API. This method returns the following error codes: * `PERMISSION_DENIED` if no user that matches the provided `student_id` is visible to the requesting user, if the requesting user is not permitted to manage guardians for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API). * `NOT_FOUND` if the requesting user is permitted to modify guardians for the requested `student_id`, but no `Guardian` record exists for that student with the provided `guardian_id`.", 13364 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13365 // "httpMethod": "DELETE", 13366 // "id": "classroom.userProfiles.guardians.delete", 13367 // "parameterOrder": [ 13368 // "studentId", 13369 // "guardianId" 13370 // ], 13371 // "parameters": { 13372 // "guardianId": { 13373 // "description": "The `id` field from a `Guardian`.", 13374 // "location": "path", 13375 // "required": true, 13376 // "type": "string" 13377 // }, 13378 // "studentId": { 13379 // "description": "The student whose guardian is to be deleted. One of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 13380 // "location": "path", 13381 // "required": true, 13382 // "type": "string" 13383 // } 13384 // }, 13385 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13386 // "response": { 13387 // "$ref": "Empty" 13388 // }, 13389 // "scopes": [ 13390 // "https://www.googleapis.com/auth/classroom.guardianlinks.students" 13391 // ] 13392 // } 13393 13394} 13395 13396// method id "classroom.userProfiles.guardians.get": 13397 13398type UserProfilesGuardiansGetCall struct { 13399 s *Service 13400 studentId string 13401 guardianId string 13402 urlParams_ gensupport.URLParams 13403 ifNoneMatch_ string 13404 ctx_ context.Context 13405 header_ http.Header 13406} 13407 13408// Get: Returns a specific guardian. This method returns the following 13409// error codes: * `PERMISSION_DENIED` if no user that matches the 13410// provided `student_id` is visible to the requesting user, if the 13411// requesting user is not permitted to view guardian information for the 13412// student identified by the `student_id`, if guardians are not enabled 13413// for the domain in question, or for other access errors. * 13414// `INVALID_ARGUMENT` if a `student_id` is specified, but its format 13415// cannot be recognized (it is not an email address, nor a `student_id` 13416// from the API, nor the literal string `me`). * `NOT_FOUND` if the 13417// requesting user is permitted to view guardians for the requested 13418// `student_id`, but no `Guardian` record exists for that student that 13419// matches the provided `guardian_id`. 13420// 13421// - guardianId: The `id` field from a `Guardian`. 13422// - studentId: The student whose guardian is being requested. One of 13423// the following: * the numeric identifier for the user * the email 13424// address of the user * the string literal "me", indicating the 13425// requesting user. 13426func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall { 13427 c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13428 c.studentId = studentId 13429 c.guardianId = guardianId 13430 return c 13431} 13432 13433// Fields allows partial responses to be retrieved. See 13434// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13435// for more information. 13436func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall { 13437 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13438 return c 13439} 13440 13441// IfNoneMatch sets the optional parameter which makes the operation 13442// fail if the object's ETag matches the given value. This is useful for 13443// getting updates only after the object has changed since the last 13444// request. Use googleapi.IsNotModified to check whether the response 13445// error from Do is the result of In-None-Match. 13446func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall { 13447 c.ifNoneMatch_ = entityTag 13448 return c 13449} 13450 13451// Context sets the context to be used in this call's Do method. Any 13452// pending HTTP request will be aborted if the provided context is 13453// canceled. 13454func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall { 13455 c.ctx_ = ctx 13456 return c 13457} 13458 13459// Header returns an http.Header that can be modified by the caller to 13460// add HTTP headers to the request. 13461func (c *UserProfilesGuardiansGetCall) Header() http.Header { 13462 if c.header_ == nil { 13463 c.header_ = make(http.Header) 13464 } 13465 return c.header_ 13466} 13467 13468func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) { 13469 reqHeaders := make(http.Header) 13470 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 13471 for k, v := range c.header_ { 13472 reqHeaders[k] = v 13473 } 13474 reqHeaders.Set("User-Agent", c.s.userAgent()) 13475 if c.ifNoneMatch_ != "" { 13476 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13477 } 13478 var body io.Reader = nil 13479 c.urlParams_.Set("alt", alt) 13480 c.urlParams_.Set("prettyPrint", "false") 13481 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}") 13482 urls += "?" + c.urlParams_.Encode() 13483 req, err := http.NewRequest("GET", urls, body) 13484 if err != nil { 13485 return nil, err 13486 } 13487 req.Header = reqHeaders 13488 googleapi.Expand(req.URL, map[string]string{ 13489 "studentId": c.studentId, 13490 "guardianId": c.guardianId, 13491 }) 13492 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13493} 13494 13495// Do executes the "classroom.userProfiles.guardians.get" call. 13496// Exactly one of *Guardian or error will be non-nil. Any non-2xx status 13497// code is an error. Response headers are in either 13498// *Guardian.ServerResponse.Header or (if a response was returned at 13499// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13500// to check whether the returned error was because 13501// http.StatusNotModified was returned. 13502func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) { 13503 gensupport.SetOptions(c.urlParams_, opts...) 13504 res, err := c.doRequest("json") 13505 if res != nil && res.StatusCode == http.StatusNotModified { 13506 if res.Body != nil { 13507 res.Body.Close() 13508 } 13509 return nil, &googleapi.Error{ 13510 Code: res.StatusCode, 13511 Header: res.Header, 13512 } 13513 } 13514 if err != nil { 13515 return nil, err 13516 } 13517 defer googleapi.CloseBody(res) 13518 if err := googleapi.CheckResponse(res); err != nil { 13519 return nil, err 13520 } 13521 ret := &Guardian{ 13522 ServerResponse: googleapi.ServerResponse{ 13523 Header: res.Header, 13524 HTTPStatusCode: res.StatusCode, 13525 }, 13526 } 13527 target := &ret 13528 if err := gensupport.DecodeResponse(target, res); err != nil { 13529 return nil, err 13530 } 13531 return ret, nil 13532 // { 13533 // "description": "Returns a specific guardian. This method returns the following error codes: * `PERMISSION_DENIED` if no user that matches the provided `student_id` is visible to the requesting user, if the requesting user is not permitted to view guardian information for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). * `NOT_FOUND` if the requesting user is permitted to view guardians for the requested `student_id`, but no `Guardian` record exists for that student that matches the provided `guardian_id`.", 13534 // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13535 // "httpMethod": "GET", 13536 // "id": "classroom.userProfiles.guardians.get", 13537 // "parameterOrder": [ 13538 // "studentId", 13539 // "guardianId" 13540 // ], 13541 // "parameters": { 13542 // "guardianId": { 13543 // "description": "The `id` field from a `Guardian`.", 13544 // "location": "path", 13545 // "required": true, 13546 // "type": "string" 13547 // }, 13548 // "studentId": { 13549 // "description": "The student whose guardian is being requested. One of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user", 13550 // "location": "path", 13551 // "required": true, 13552 // "type": "string" 13553 // } 13554 // }, 13555 // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}", 13556 // "response": { 13557 // "$ref": "Guardian" 13558 // }, 13559 // "scopes": [ 13560 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13561 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13562 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13563 // ] 13564 // } 13565 13566} 13567 13568// method id "classroom.userProfiles.guardians.list": 13569 13570type UserProfilesGuardiansListCall struct { 13571 s *Service 13572 studentId string 13573 urlParams_ gensupport.URLParams 13574 ifNoneMatch_ string 13575 ctx_ context.Context 13576 header_ http.Header 13577} 13578 13579// List: Returns a list of guardians that the requesting user is 13580// permitted to view, restricted to those that match the request. To 13581// list guardians for any student that the requesting user may view 13582// guardians for, use the literal character `-` for the student ID. This 13583// method returns the following error codes: * `PERMISSION_DENIED` if a 13584// `student_id` is specified, and the requesting user is not permitted 13585// to view guardian information for that student, if "-" is specified 13586// as the `student_id` and the user is not a domain administrator, if 13587// guardians are not enabled for the domain in question, if the 13588// `invited_email_address` filter is set by a user who is not a domain 13589// administrator, or for other access errors. * `INVALID_ARGUMENT` if a 13590// `student_id` is specified, but its format cannot be recognized (it is 13591// not an email address, nor a `student_id` from the API, nor the 13592// literal string `me`). May also be returned if an invalid `page_token` 13593// is provided. * `NOT_FOUND` if a `student_id` is specified, and its 13594// format can be recognized, but Classroom has no record of that 13595// student. 13596// 13597// - studentId: Filter results by the student who the guardian is linked 13598// to. The identifier can be one of the following: * the numeric 13599// identifier for the user * the email address of the user * the 13600// string literal "me", indicating the requesting user * the string 13601// literal "-", indicating that results should be returned for all 13602// students that the requesting user has access to view. 13603func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall { 13604 c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13605 c.studentId = studentId 13606 return c 13607} 13608 13609// InvitedEmailAddress sets the optional parameter 13610// "invitedEmailAddress": Filter results by the email address that the 13611// original invitation was sent to, resulting in this guardian link. 13612// This filter can only be used by domain administrators. 13613func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall { 13614 c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress) 13615 return c 13616} 13617 13618// PageSize sets the optional parameter "pageSize": Maximum number of 13619// items to return. Zero or unspecified indicates that the server may 13620// assign a maximum. The server may return fewer than the specified 13621// number of results. 13622func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall { 13623 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 13624 return c 13625} 13626 13627// PageToken sets the optional parameter "pageToken": nextPageToken 13628// value returned from a previous list call, indicating that the 13629// subsequent page of results should be returned. The list request must 13630// be otherwise identical to the one that resulted in this token. 13631func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall { 13632 c.urlParams_.Set("pageToken", pageToken) 13633 return c 13634} 13635 13636// Fields allows partial responses to be retrieved. See 13637// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13638// for more information. 13639func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall { 13640 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13641 return c 13642} 13643 13644// IfNoneMatch sets the optional parameter which makes the operation 13645// fail if the object's ETag matches the given value. This is useful for 13646// getting updates only after the object has changed since the last 13647// request. Use googleapi.IsNotModified to check whether the response 13648// error from Do is the result of In-None-Match. 13649func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall { 13650 c.ifNoneMatch_ = entityTag 13651 return c 13652} 13653 13654// Context sets the context to be used in this call's Do method. Any 13655// pending HTTP request will be aborted if the provided context is 13656// canceled. 13657func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall { 13658 c.ctx_ = ctx 13659 return c 13660} 13661 13662// Header returns an http.Header that can be modified by the caller to 13663// add HTTP headers to the request. 13664func (c *UserProfilesGuardiansListCall) Header() http.Header { 13665 if c.header_ == nil { 13666 c.header_ = make(http.Header) 13667 } 13668 return c.header_ 13669} 13670 13671func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) { 13672 reqHeaders := make(http.Header) 13673 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 13674 for k, v := range c.header_ { 13675 reqHeaders[k] = v 13676 } 13677 reqHeaders.Set("User-Agent", c.s.userAgent()) 13678 if c.ifNoneMatch_ != "" { 13679 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13680 } 13681 var body io.Reader = nil 13682 c.urlParams_.Set("alt", alt) 13683 c.urlParams_.Set("prettyPrint", "false") 13684 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians") 13685 urls += "?" + c.urlParams_.Encode() 13686 req, err := http.NewRequest("GET", urls, body) 13687 if err != nil { 13688 return nil, err 13689 } 13690 req.Header = reqHeaders 13691 googleapi.Expand(req.URL, map[string]string{ 13692 "studentId": c.studentId, 13693 }) 13694 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13695} 13696 13697// Do executes the "classroom.userProfiles.guardians.list" call. 13698// Exactly one of *ListGuardiansResponse or error will be non-nil. Any 13699// non-2xx status code is an error. Response headers are in either 13700// *ListGuardiansResponse.ServerResponse.Header or (if a response was 13701// returned at all) in error.(*googleapi.Error).Header. Use 13702// googleapi.IsNotModified to check whether the returned error was 13703// because http.StatusNotModified was returned. 13704func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) { 13705 gensupport.SetOptions(c.urlParams_, opts...) 13706 res, err := c.doRequest("json") 13707 if res != nil && res.StatusCode == http.StatusNotModified { 13708 if res.Body != nil { 13709 res.Body.Close() 13710 } 13711 return nil, &googleapi.Error{ 13712 Code: res.StatusCode, 13713 Header: res.Header, 13714 } 13715 } 13716 if err != nil { 13717 return nil, err 13718 } 13719 defer googleapi.CloseBody(res) 13720 if err := googleapi.CheckResponse(res); err != nil { 13721 return nil, err 13722 } 13723 ret := &ListGuardiansResponse{ 13724 ServerResponse: googleapi.ServerResponse{ 13725 Header: res.Header, 13726 HTTPStatusCode: res.StatusCode, 13727 }, 13728 } 13729 target := &ret 13730 if err := gensupport.DecodeResponse(target, res); err != nil { 13731 return nil, err 13732 } 13733 return ret, nil 13734 // { 13735 // "description": "Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `\"-\"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.", 13736 // "flatPath": "v1/userProfiles/{studentId}/guardians", 13737 // "httpMethod": "GET", 13738 // "id": "classroom.userProfiles.guardians.list", 13739 // "parameterOrder": [ 13740 // "studentId" 13741 // ], 13742 // "parameters": { 13743 // "invitedEmailAddress": { 13744 // "description": "Filter results by the email address that the original invitation was sent to, resulting in this guardian link. This filter can only be used by domain administrators.", 13745 // "location": "query", 13746 // "type": "string" 13747 // }, 13748 // "pageSize": { 13749 // "description": "Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.", 13750 // "format": "int32", 13751 // "location": "query", 13752 // "type": "integer" 13753 // }, 13754 // "pageToken": { 13755 // "description": "nextPageToken value returned from a previous list call, indicating that the subsequent page of results should be returned. The list request must be otherwise identical to the one that resulted in this token.", 13756 // "location": "query", 13757 // "type": "string" 13758 // }, 13759 // "studentId": { 13760 // "description": "Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `\"me\"`, indicating the requesting user * the string literal `\"-\"`, indicating that results should be returned for all students that the requesting user has access to view.", 13761 // "location": "path", 13762 // "required": true, 13763 // "type": "string" 13764 // } 13765 // }, 13766 // "path": "v1/userProfiles/{studentId}/guardians", 13767 // "response": { 13768 // "$ref": "ListGuardiansResponse" 13769 // }, 13770 // "scopes": [ 13771 // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly", 13772 // "https://www.googleapis.com/auth/classroom.guardianlinks.students", 13773 // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly" 13774 // ] 13775 // } 13776 13777} 13778 13779// Pages invokes f for each page of results. 13780// A non-nil error returned from f will halt the iteration. 13781// The provided context supersedes any context provided to the Context method. 13782func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error { 13783 c.ctx_ = ctx 13784 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13785 for { 13786 x, err := c.Do() 13787 if err != nil { 13788 return err 13789 } 13790 if err := f(x); err != nil { 13791 return err 13792 } 13793 if x.NextPageToken == "" { 13794 return nil 13795 } 13796 c.PageToken(x.NextPageToken) 13797 } 13798} 13799