Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

11984 рядки
433 KiB

  1. // Package classroom provides access to the Google Classroom API.
  2. //
  3. // See https://developers.google.com/classroom/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/classroom/v1"
  8. // ...
  9. // classroomService, err := classroom.New(oauthHttpClient)
  10. package classroom // import "google.golang.org/api/classroom/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "classroom:v1"
  41. const apiName = "classroom"
  42. const apiVersion = "v1"
  43. const basePath = "https://classroom.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage announcements in Google Classroom
  47. ClassroomAnnouncementsScope = "https://www.googleapis.com/auth/classroom.announcements"
  48. // View announcements in Google Classroom
  49. ClassroomAnnouncementsReadonlyScope = "https://www.googleapis.com/auth/classroom.announcements.readonly"
  50. // Manage your Google Classroom classes
  51. ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses"
  52. // View your Google Classroom classes
  53. ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly"
  54. // Manage your course work and view your grades in Google Classroom
  55. ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me"
  56. // View your course work and grades in Google Classroom
  57. ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly"
  58. // Manage course work and grades for students in the Google Classroom
  59. // classes you teach and view the course work and grades for classes you
  60. // administer
  61. ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students"
  62. // View course work and grades for students in the Google Classroom
  63. // classes you teach or administer
  64. ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly"
  65. // View your Google Classroom guardians
  66. ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly"
  67. // View and manage guardians for students in your Google Classroom
  68. // classes
  69. ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  70. // View guardians for students in your Google Classroom classes
  71. ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  72. // View the email addresses of people in your classes
  73. ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails"
  74. // View the profile photos of people in your classes
  75. ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos"
  76. // Receive notifications about your Google Classroom data
  77. ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications"
  78. // Manage your Google Classroom class rosters
  79. ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters"
  80. // View your Google Classroom class rosters
  81. ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly"
  82. // View your course work and grades in Google Classroom
  83. ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly"
  84. // View course work and grades for students in the Google Classroom
  85. // classes you teach or administer
  86. ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly"
  87. )
  88. func New(client *http.Client) (*Service, error) {
  89. if client == nil {
  90. return nil, errors.New("client is nil")
  91. }
  92. s := &Service{client: client, BasePath: basePath}
  93. s.Courses = NewCoursesService(s)
  94. s.Invitations = NewInvitationsService(s)
  95. s.Registrations = NewRegistrationsService(s)
  96. s.UserProfiles = NewUserProfilesService(s)
  97. return s, nil
  98. }
  99. type Service struct {
  100. client *http.Client
  101. BasePath string // API endpoint base URL
  102. UserAgent string // optional additional User-Agent fragment
  103. Courses *CoursesService
  104. Invitations *InvitationsService
  105. Registrations *RegistrationsService
  106. UserProfiles *UserProfilesService
  107. }
  108. func (s *Service) userAgent() string {
  109. if s.UserAgent == "" {
  110. return googleapi.UserAgent
  111. }
  112. return googleapi.UserAgent + " " + s.UserAgent
  113. }
  114. func NewCoursesService(s *Service) *CoursesService {
  115. rs := &CoursesService{s: s}
  116. rs.Aliases = NewCoursesAliasesService(s)
  117. rs.Announcements = NewCoursesAnnouncementsService(s)
  118. rs.CourseWork = NewCoursesCourseWorkService(s)
  119. rs.Students = NewCoursesStudentsService(s)
  120. rs.Teachers = NewCoursesTeachersService(s)
  121. return rs
  122. }
  123. type CoursesService struct {
  124. s *Service
  125. Aliases *CoursesAliasesService
  126. Announcements *CoursesAnnouncementsService
  127. CourseWork *CoursesCourseWorkService
  128. Students *CoursesStudentsService
  129. Teachers *CoursesTeachersService
  130. }
  131. func NewCoursesAliasesService(s *Service) *CoursesAliasesService {
  132. rs := &CoursesAliasesService{s: s}
  133. return rs
  134. }
  135. type CoursesAliasesService struct {
  136. s *Service
  137. }
  138. func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService {
  139. rs := &CoursesAnnouncementsService{s: s}
  140. return rs
  141. }
  142. type CoursesAnnouncementsService struct {
  143. s *Service
  144. }
  145. func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService {
  146. rs := &CoursesCourseWorkService{s: s}
  147. rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s)
  148. return rs
  149. }
  150. type CoursesCourseWorkService struct {
  151. s *Service
  152. StudentSubmissions *CoursesCourseWorkStudentSubmissionsService
  153. }
  154. func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService {
  155. rs := &CoursesCourseWorkStudentSubmissionsService{s: s}
  156. return rs
  157. }
  158. type CoursesCourseWorkStudentSubmissionsService struct {
  159. s *Service
  160. }
  161. func NewCoursesStudentsService(s *Service) *CoursesStudentsService {
  162. rs := &CoursesStudentsService{s: s}
  163. return rs
  164. }
  165. type CoursesStudentsService struct {
  166. s *Service
  167. }
  168. func NewCoursesTeachersService(s *Service) *CoursesTeachersService {
  169. rs := &CoursesTeachersService{s: s}
  170. return rs
  171. }
  172. type CoursesTeachersService struct {
  173. s *Service
  174. }
  175. func NewInvitationsService(s *Service) *InvitationsService {
  176. rs := &InvitationsService{s: s}
  177. return rs
  178. }
  179. type InvitationsService struct {
  180. s *Service
  181. }
  182. func NewRegistrationsService(s *Service) *RegistrationsService {
  183. rs := &RegistrationsService{s: s}
  184. return rs
  185. }
  186. type RegistrationsService struct {
  187. s *Service
  188. }
  189. func NewUserProfilesService(s *Service) *UserProfilesService {
  190. rs := &UserProfilesService{s: s}
  191. rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s)
  192. rs.Guardians = NewUserProfilesGuardiansService(s)
  193. return rs
  194. }
  195. type UserProfilesService struct {
  196. s *Service
  197. GuardianInvitations *UserProfilesGuardianInvitationsService
  198. Guardians *UserProfilesGuardiansService
  199. }
  200. func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService {
  201. rs := &UserProfilesGuardianInvitationsService{s: s}
  202. return rs
  203. }
  204. type UserProfilesGuardianInvitationsService struct {
  205. s *Service
  206. }
  207. func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService {
  208. rs := &UserProfilesGuardiansService{s: s}
  209. return rs
  210. }
  211. type UserProfilesGuardiansService struct {
  212. s *Service
  213. }
  214. // Announcement: Announcement created by a teacher for students of the
  215. // course
  216. type Announcement struct {
  217. // AlternateLink: Absolute link to this announcement in the Classroom
  218. // web UI.
  219. // This is only populated if `state` is `PUBLISHED`.
  220. //
  221. // Read-only.
  222. AlternateLink string `json:"alternateLink,omitempty"`
  223. // AssigneeMode: Assignee mode of the announcement.
  224. // If unspecified, the default value is `ALL_STUDENTS`.
  225. //
  226. // Possible values:
  227. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  228. // returned.
  229. // "ALL_STUDENTS" - All students can see the item.
  230. // This is the default state.
  231. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  232. AssigneeMode string `json:"assigneeMode,omitempty"`
  233. // CourseId: Identifier of the course.
  234. //
  235. // Read-only.
  236. CourseId string `json:"courseId,omitempty"`
  237. // CreationTime: Timestamp when this announcement was
  238. // created.
  239. //
  240. // Read-only.
  241. CreationTime string `json:"creationTime,omitempty"`
  242. // CreatorUserId: Identifier for the user that created the
  243. // announcement.
  244. //
  245. // Read-only.
  246. CreatorUserId string `json:"creatorUserId,omitempty"`
  247. // Id: Classroom-assigned identifier of this announcement, unique per
  248. // course.
  249. //
  250. // Read-only.
  251. Id string `json:"id,omitempty"`
  252. // IndividualStudentsOptions: Identifiers of students with access to the
  253. // announcement.
  254. // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  255. // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only students
  256. // specified in this
  257. // field will be able to see the announcement.
  258. IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"`
  259. // Materials: Additional materials.
  260. //
  261. // Announcements must have no more than 20 material items.
  262. Materials []*Material `json:"materials,omitempty"`
  263. // ScheduledTime: Optional timestamp when this announcement is scheduled
  264. // to be published.
  265. ScheduledTime string `json:"scheduledTime,omitempty"`
  266. // State: Status of this announcement.
  267. // If unspecified, the default state is `DRAFT`.
  268. //
  269. // Possible values:
  270. // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is
  271. // never returned.
  272. // "PUBLISHED" - Status for announcement that has been published.
  273. // This is the default state.
  274. // "DRAFT" - Status for an announcement that is not yet
  275. // published.
  276. // Announcement in this state is visible only to course teachers and
  277. // domain
  278. // administrators.
  279. // "DELETED" - Status for announcement that was published but is now
  280. // deleted.
  281. // Announcement in this state is visible only to course teachers and
  282. // domain
  283. // administrators.
  284. // Announcement in this state is deleted after some time.
  285. State string `json:"state,omitempty"`
  286. // Text: Description of this announcement.
  287. // The text must be a valid UTF-8 string containing no more
  288. // than 30,000 characters.
  289. Text string `json:"text,omitempty"`
  290. // UpdateTime: Timestamp of the most recent change to this
  291. // announcement.
  292. //
  293. // Read-only.
  294. UpdateTime string `json:"updateTime,omitempty"`
  295. // ServerResponse contains the HTTP response code and headers from the
  296. // server.
  297. googleapi.ServerResponse `json:"-"`
  298. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  299. // unconditionally include in API requests. By default, fields with
  300. // empty values are omitted from API requests. However, any non-pointer,
  301. // non-interface field appearing in ForceSendFields will be sent to the
  302. // server regardless of whether the field is empty or not. This may be
  303. // used to include empty fields in Patch requests.
  304. ForceSendFields []string `json:"-"`
  305. // NullFields is a list of field names (e.g. "AlternateLink") to include
  306. // in API requests with the JSON null value. By default, fields with
  307. // empty values are omitted from API requests. However, any field with
  308. // an empty value appearing in NullFields will be sent to the server as
  309. // null. It is an error if a field in this list has a non-empty value.
  310. // This may be used to include null fields in Patch requests.
  311. NullFields []string `json:"-"`
  312. }
  313. func (s *Announcement) MarshalJSON() ([]byte, error) {
  314. type NoMethod Announcement
  315. raw := NoMethod(*s)
  316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  317. }
  318. // Assignment: Additional details for assignments.
  319. type Assignment struct {
  320. // StudentWorkFolder: Drive folder where attachments from student
  321. // submissions are placed.
  322. // This is only populated for course teachers and administrators.
  323. StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"`
  324. // ForceSendFields is a list of field names (e.g. "StudentWorkFolder")
  325. // to unconditionally include in API requests. By default, fields with
  326. // empty values are omitted from API requests. However, any non-pointer,
  327. // non-interface field appearing in ForceSendFields will be sent to the
  328. // server regardless of whether the field is empty or not. This may be
  329. // used to include empty fields in Patch requests.
  330. ForceSendFields []string `json:"-"`
  331. // NullFields is a list of field names (e.g. "StudentWorkFolder") to
  332. // include in API requests with the JSON null value. By default, fields
  333. // with empty values are omitted from API requests. However, any field
  334. // with an empty value appearing in NullFields will be sent to the
  335. // server as null. It is an error if a field in this list has a
  336. // non-empty value. This may be used to include null fields in Patch
  337. // requests.
  338. NullFields []string `json:"-"`
  339. }
  340. func (s *Assignment) MarshalJSON() ([]byte, error) {
  341. type NoMethod Assignment
  342. raw := NoMethod(*s)
  343. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  344. }
  345. // AssignmentSubmission: Student work for an assignment.
  346. type AssignmentSubmission struct {
  347. // Attachments: Attachments added by the student.
  348. // Drive files that correspond to materials with a share mode
  349. // of
  350. // STUDENT_COPY may not exist yet if the student has not accessed
  351. // the
  352. // assignment in Classroom.
  353. //
  354. // Some attachment metadata is only populated if the requesting user
  355. // has
  356. // permission to access it. Identifier and alternate_link fields are
  357. // always
  358. // available, but others (e.g. title) may not be.
  359. Attachments []*Attachment `json:"attachments,omitempty"`
  360. // ForceSendFields is a list of field names (e.g. "Attachments") to
  361. // unconditionally include in API requests. By default, fields with
  362. // empty values are omitted from API requests. However, any non-pointer,
  363. // non-interface field appearing in ForceSendFields will be sent to the
  364. // server regardless of whether the field is empty or not. This may be
  365. // used to include empty fields in Patch requests.
  366. ForceSendFields []string `json:"-"`
  367. // NullFields is a list of field names (e.g. "Attachments") to include
  368. // in API requests with the JSON null value. By default, fields with
  369. // empty values are omitted from API requests. However, any field with
  370. // an empty value appearing in NullFields will be sent to the server as
  371. // null. It is an error if a field in this list has a non-empty value.
  372. // This may be used to include null fields in Patch requests.
  373. NullFields []string `json:"-"`
  374. }
  375. func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) {
  376. type NoMethod AssignmentSubmission
  377. raw := NoMethod(*s)
  378. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  379. }
  380. // Attachment: Attachment added to student assignment work.
  381. //
  382. // When creating attachments, setting the `form` field is not supported.
  383. type Attachment struct {
  384. // DriveFile: Google Drive file attachment.
  385. DriveFile *DriveFile `json:"driveFile,omitempty"`
  386. // Form: Google Forms attachment.
  387. Form *Form `json:"form,omitempty"`
  388. // Link: Link attachment.
  389. Link *Link `json:"link,omitempty"`
  390. // YouTubeVideo: Youtube video attachment.
  391. YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"`
  392. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  393. // unconditionally include in API requests. By default, fields with
  394. // empty values are omitted from API requests. However, any non-pointer,
  395. // non-interface field appearing in ForceSendFields will be sent to the
  396. // server regardless of whether the field is empty or not. This may be
  397. // used to include empty fields in Patch requests.
  398. ForceSendFields []string `json:"-"`
  399. // NullFields is a list of field names (e.g. "DriveFile") to include in
  400. // API requests with the JSON null value. By default, fields with empty
  401. // values are omitted from API requests. However, any field with an
  402. // empty value appearing in NullFields will be sent to the server as
  403. // null. It is an error if a field in this list has a non-empty value.
  404. // This may be used to include null fields in Patch requests.
  405. NullFields []string `json:"-"`
  406. }
  407. func (s *Attachment) MarshalJSON() ([]byte, error) {
  408. type NoMethod Attachment
  409. raw := NoMethod(*s)
  410. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  411. }
  412. // CloudPubsubTopic: A reference to a Cloud Pub/Sub topic.
  413. //
  414. // To register for notifications, the owner of the topic must
  415. // grant
  416. // `classroom-notifications@system.gserviceaccount.com` the
  417. // `projects.topics.publish` permission.
  418. type CloudPubsubTopic struct {
  419. // TopicName: The `name` field of a Cloud
  420. // Pub/Sub
  421. // [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1
  422. // /projects.topics#Topic).
  423. TopicName string `json:"topicName,omitempty"`
  424. // ForceSendFields is a list of field names (e.g. "TopicName") to
  425. // unconditionally include in API requests. By default, fields with
  426. // empty values are omitted from API requests. However, any non-pointer,
  427. // non-interface field appearing in ForceSendFields will be sent to the
  428. // server regardless of whether the field is empty or not. This may be
  429. // used to include empty fields in Patch requests.
  430. ForceSendFields []string `json:"-"`
  431. // NullFields is a list of field names (e.g. "TopicName") to include in
  432. // API requests with the JSON null value. By default, fields with empty
  433. // values are omitted from API requests. However, any field with an
  434. // empty value appearing in NullFields will be sent to the server as
  435. // null. It is an error if a field in this list has a non-empty value.
  436. // This may be used to include null fields in Patch requests.
  437. NullFields []string `json:"-"`
  438. }
  439. func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) {
  440. type NoMethod CloudPubsubTopic
  441. raw := NoMethod(*s)
  442. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  443. }
  444. // Course: A Course in Classroom.
  445. type Course struct {
  446. // AlternateLink: Absolute link to this course in the Classroom web
  447. // UI.
  448. //
  449. // Read-only.
  450. AlternateLink string `json:"alternateLink,omitempty"`
  451. // CalendarId: The Calendar ID for a calendar that all course members
  452. // can see, to which
  453. // Classroom adds events for course work and announcements in the
  454. // course.
  455. //
  456. // Read-only.
  457. CalendarId string `json:"calendarId,omitempty"`
  458. // CourseGroupEmail: The email address of a Google group containing all
  459. // members of the course.
  460. // This group does not accept email and can only be used for
  461. // permissions.
  462. //
  463. // Read-only.
  464. CourseGroupEmail string `json:"courseGroupEmail,omitempty"`
  465. // CourseMaterialSets: Sets of materials that appear on the "about" page
  466. // of this course.
  467. //
  468. // Read-only.
  469. CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"`
  470. // CourseState: State of the course.
  471. // If unspecified, the default state is `PROVISIONED`.
  472. //
  473. // Possible values:
  474. // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course
  475. // message will use this value.
  476. // "ACTIVE" - The course is active.
  477. // "ARCHIVED" - The course has been archived. You cannot modify it
  478. // except to change it
  479. // to a different state.
  480. // "PROVISIONED" - The course has been created, but not yet activated.
  481. // It is accessible by
  482. // the primary teacher and domain administrators, who may modify it
  483. // or
  484. // change it to the `ACTIVE` or `DECLINED` states.
  485. // A course may only be changed to `PROVISIONED` if it is in the
  486. // `DECLINED`
  487. // state.
  488. // "DECLINED" - The course has been created, but declined. It is
  489. // accessible by the
  490. // course owner and domain administrators, though it will not
  491. // be
  492. // displayed in the web UI. You cannot modify the course except to
  493. // change it
  494. // to the `PROVISIONED` state.
  495. // A course may only be changed to `DECLINED` if it is in the
  496. // `PROVISIONED`
  497. // state.
  498. // "SUSPENDED" - The course has been suspended. You cannot modify the
  499. // course, and only the
  500. // user identified by the `owner_id` can view the course.
  501. // A course may be placed in this state if it potentially violates
  502. // the
  503. // Terms of Service.
  504. CourseState string `json:"courseState,omitempty"`
  505. // CreationTime: Creation time of the course.
  506. // Specifying this field in a course update mask results in an
  507. // error.
  508. //
  509. // Read-only.
  510. CreationTime string `json:"creationTime,omitempty"`
  511. // Description: Optional description.
  512. // For example, "We'll be learning about the structure of
  513. // living
  514. // creatures from a combination of textbooks, guest lectures, and lab
  515. // work.
  516. // Expect to be excited!"
  517. // If set, this field must be a valid UTF-8 string and no longer than
  518. // 30,000
  519. // characters.
  520. Description string `json:"description,omitempty"`
  521. // DescriptionHeading: Optional heading for the description.
  522. // For example, "Welcome to 10th Grade Biology."
  523. // If set, this field must be a valid UTF-8 string and no longer than
  524. // 3600
  525. // characters.
  526. DescriptionHeading string `json:"descriptionHeading,omitempty"`
  527. // EnrollmentCode: Enrollment code to use when joining this
  528. // course.
  529. // Specifying this field in a course update mask results in an
  530. // error.
  531. //
  532. // Read-only.
  533. EnrollmentCode string `json:"enrollmentCode,omitempty"`
  534. // GuardiansEnabled: Whether or not guardian notifications are enabled
  535. // for this course.
  536. //
  537. // Read-only.
  538. GuardiansEnabled bool `json:"guardiansEnabled,omitempty"`
  539. // Id: Identifier for this course assigned by Classroom.
  540. //
  541. // When
  542. // creating a course,
  543. // you may optionally set this identifier to an
  544. // alias string in the
  545. // request to create a corresponding alias. The `id` is still assigned
  546. // by
  547. // Classroom and cannot be updated after the course is
  548. // created.
  549. //
  550. // Specifying this field in a course update mask results in an error.
  551. Id string `json:"id,omitempty"`
  552. // Name: Name of the course.
  553. // For example, "10th Grade Biology".
  554. // The name is required. It must be between 1 and 750 characters and a
  555. // valid
  556. // UTF-8 string.
  557. Name string `json:"name,omitempty"`
  558. // OwnerId: The identifier of the owner of a course.
  559. //
  560. // When specified as a parameter of a
  561. // create course request, this
  562. // field is required.
  563. // The identifier can be one of the following:
  564. //
  565. // * the numeric identifier for the user
  566. // * the email address of the user
  567. // * the string literal "me", indicating the requesting user
  568. //
  569. // This must be set in a create request. Admins can also specify this
  570. // field
  571. // in a patch course request to
  572. // transfer ownership. In other contexts, it is read-only.
  573. OwnerId string `json:"ownerId,omitempty"`
  574. // Room: Optional room location.
  575. // For example, "301".
  576. // If set, this field must be a valid UTF-8 string and no longer than
  577. // 650
  578. // characters.
  579. Room string `json:"room,omitempty"`
  580. // Section: Section of the course.
  581. // For example, "Period 2".
  582. // If set, this field must be a valid UTF-8 string and no longer than
  583. // 2800
  584. // characters.
  585. Section string `json:"section,omitempty"`
  586. // TeacherFolder: Information about a Drive Folder that is shared with
  587. // all teachers of the
  588. // course.
  589. //
  590. // This field will only be set for teachers of the course and domain
  591. // administrators.
  592. //
  593. // Read-only.
  594. TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"`
  595. // TeacherGroupEmail: The email address of a Google group containing all
  596. // teachers of the course.
  597. // This group does not accept email and can only be used for
  598. // permissions.
  599. //
  600. // Read-only.
  601. TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"`
  602. // UpdateTime: Time of the most recent update to this course.
  603. // Specifying this field in a course update mask results in an
  604. // error.
  605. //
  606. // Read-only.
  607. UpdateTime string `json:"updateTime,omitempty"`
  608. // ServerResponse contains the HTTP response code and headers from the
  609. // server.
  610. googleapi.ServerResponse `json:"-"`
  611. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  612. // unconditionally include in API requests. By default, fields with
  613. // empty values are omitted from API requests. However, any non-pointer,
  614. // non-interface field appearing in ForceSendFields will be sent to the
  615. // server regardless of whether the field is empty or not. This may be
  616. // used to include empty fields in Patch requests.
  617. ForceSendFields []string `json:"-"`
  618. // NullFields is a list of field names (e.g. "AlternateLink") to include
  619. // in API requests with the JSON null value. By default, fields with
  620. // empty values are omitted from API requests. However, any field with
  621. // an 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. func (s *Course) MarshalJSON() ([]byte, error) {
  627. type NoMethod Course
  628. raw := NoMethod(*s)
  629. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  630. }
  631. // CourseAlias: Alternative identifier for a course.
  632. //
  633. // An alias uniquely identifies a course. It must be unique within one
  634. // of the
  635. // following scopes:
  636. //
  637. // * domain: A domain-scoped alias is visible to all users within the
  638. // alias
  639. // creator's domain and can be created only by a domain admin. A
  640. // domain-scoped
  641. // alias is often used when a course has an identifier external to
  642. // Classroom.
  643. //
  644. // * project: A project-scoped alias is visible to any request from
  645. // an
  646. // application using the Developer Console project ID that created the
  647. // alias
  648. // and can be created by any project. A project-scoped alias is often
  649. // used when
  650. // an application has alternative identifiers. A random value can also
  651. // be used
  652. // to avoid duplicate courses in the event of transmission failures, as
  653. // retrying
  654. // a request will return `ALREADY_EXISTS` if a previous one has
  655. // succeeded.
  656. type CourseAlias struct {
  657. // Alias: Alias string. The format of the string indicates the desired
  658. // alias scoping.
  659. //
  660. // * `d:<name>` indicates a domain-scoped alias.
  661. // Example: `d:math_101`
  662. // * `p:<name>` indicates a project-scoped alias.
  663. // Example: `p:abc123`
  664. //
  665. // This field has a maximum length of 256 characters.
  666. Alias string `json:"alias,omitempty"`
  667. // ServerResponse contains the HTTP response code and headers from the
  668. // server.
  669. googleapi.ServerResponse `json:"-"`
  670. // ForceSendFields is a list of field names (e.g. "Alias") to
  671. // unconditionally include in API requests. By default, fields with
  672. // empty values are omitted from API requests. However, any non-pointer,
  673. // non-interface field appearing in ForceSendFields will be sent to the
  674. // server regardless of whether the field is empty or not. This may be
  675. // used to include empty fields in Patch requests.
  676. ForceSendFields []string `json:"-"`
  677. // NullFields is a list of field names (e.g. "Alias") to include in API
  678. // requests with the JSON null value. By default, fields with empty
  679. // values are omitted from API requests. However, any field with an
  680. // empty value appearing in NullFields will be sent to the server as
  681. // null. It is an error if a field in this list has a non-empty value.
  682. // This may be used to include null fields in Patch requests.
  683. NullFields []string `json:"-"`
  684. }
  685. func (s *CourseAlias) MarshalJSON() ([]byte, error) {
  686. type NoMethod CourseAlias
  687. raw := NoMethod(*s)
  688. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  689. }
  690. // CourseMaterial: A material attached to a course as part of a material
  691. // set.
  692. type CourseMaterial struct {
  693. // DriveFile: Google Drive file attachment.
  694. DriveFile *DriveFile `json:"driveFile,omitempty"`
  695. // Form: Google Forms attachment.
  696. Form *Form `json:"form,omitempty"`
  697. // Link: Link atatchment.
  698. Link *Link `json:"link,omitempty"`
  699. // YouTubeVideo: Youtube video attachment.
  700. YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"`
  701. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  702. // unconditionally include in API requests. By default, fields with
  703. // empty values are omitted from API requests. However, any non-pointer,
  704. // non-interface field appearing in ForceSendFields will be sent to the
  705. // server regardless of whether the field is empty or not. This may be
  706. // used to include empty fields in Patch requests.
  707. ForceSendFields []string `json:"-"`
  708. // NullFields is a list of field names (e.g. "DriveFile") to include in
  709. // API requests with the JSON null value. By default, fields with empty
  710. // values are omitted from API requests. However, any field with an
  711. // empty value appearing in NullFields will be sent to the server as
  712. // null. It is an error if a field in this list has a non-empty value.
  713. // This may be used to include null fields in Patch requests.
  714. NullFields []string `json:"-"`
  715. }
  716. func (s *CourseMaterial) MarshalJSON() ([]byte, error) {
  717. type NoMethod CourseMaterial
  718. raw := NoMethod(*s)
  719. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  720. }
  721. // CourseMaterialSet: A set of materials that appears on the "About"
  722. // page of the course.
  723. // These materials might include a syllabus, schedule, or other
  724. // background
  725. // information relating to the course as a whole.
  726. type CourseMaterialSet struct {
  727. // Materials: Materials attached to this set.
  728. Materials []*CourseMaterial `json:"materials,omitempty"`
  729. // Title: Title for this set.
  730. Title string `json:"title,omitempty"`
  731. // ForceSendFields is a list of field names (e.g. "Materials") to
  732. // unconditionally include in API requests. By default, fields with
  733. // empty values are omitted from API requests. However, any non-pointer,
  734. // non-interface field appearing in ForceSendFields will be sent to the
  735. // server regardless of whether the field is empty or not. This may be
  736. // used to include empty fields in Patch requests.
  737. ForceSendFields []string `json:"-"`
  738. // NullFields is a list of field names (e.g. "Materials") to include in
  739. // API requests with the JSON null value. By default, fields with empty
  740. // values are omitted from API requests. However, any field with an
  741. // empty value appearing in NullFields will be sent to the server as
  742. // null. It is an error if a field in this list has a non-empty value.
  743. // This may be used to include null fields in Patch requests.
  744. NullFields []string `json:"-"`
  745. }
  746. func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) {
  747. type NoMethod CourseMaterialSet
  748. raw := NoMethod(*s)
  749. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  750. }
  751. // CourseRosterChangesInfo: Information about a `Feed` with a
  752. // `feed_type` of `COURSE_ROSTER_CHANGES`.
  753. type CourseRosterChangesInfo struct {
  754. // CourseId: The `course_id` of the course to subscribe to roster
  755. // changes for.
  756. CourseId string `json:"courseId,omitempty"`
  757. // ForceSendFields is a list of field names (e.g. "CourseId") to
  758. // unconditionally include in API requests. By default, fields with
  759. // empty values are omitted from API requests. However, any non-pointer,
  760. // non-interface field appearing in ForceSendFields will be sent to the
  761. // server regardless of whether the field is empty or not. This may be
  762. // used to include empty fields in Patch requests.
  763. ForceSendFields []string `json:"-"`
  764. // NullFields is a list of field names (e.g. "CourseId") to include in
  765. // API requests with the JSON null value. By default, fields with empty
  766. // values are omitted from API requests. However, any field with an
  767. // empty value appearing in NullFields will be sent to the server as
  768. // null. It is an error if a field in this list has a non-empty value.
  769. // This may be used to include null fields in Patch requests.
  770. NullFields []string `json:"-"`
  771. }
  772. func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) {
  773. type NoMethod CourseRosterChangesInfo
  774. raw := NoMethod(*s)
  775. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  776. }
  777. // CourseWork: Course work created by a teacher for students of the
  778. // course.
  779. type CourseWork struct {
  780. // AlternateLink: Absolute link to this course work in the Classroom web
  781. // UI.
  782. // This is only populated if `state` is `PUBLISHED`.
  783. //
  784. // Read-only.
  785. AlternateLink string `json:"alternateLink,omitempty"`
  786. // AssigneeMode: Assignee mode of the coursework.
  787. // If unspecified, the default value is `ALL_STUDENTS`.
  788. //
  789. // Possible values:
  790. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  791. // returned.
  792. // "ALL_STUDENTS" - All students can see the item.
  793. // This is the default state.
  794. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  795. AssigneeMode string `json:"assigneeMode,omitempty"`
  796. // Assignment: Assignment details.
  797. // This is populated only when `work_type` is `ASSIGNMENT`.
  798. //
  799. // Read-only.
  800. Assignment *Assignment `json:"assignment,omitempty"`
  801. // AssociatedWithDeveloper: Whether this course work item is associated
  802. // with the Developer Console
  803. // project making the request.
  804. //
  805. // See google.classroom.Work.CreateCourseWork for
  806. // more
  807. // details.
  808. //
  809. // Read-only.
  810. AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"`
  811. // CourseId: Identifier of the course.
  812. //
  813. // Read-only.
  814. CourseId string `json:"courseId,omitempty"`
  815. // CreationTime: Timestamp when this course work was
  816. // created.
  817. //
  818. // Read-only.
  819. CreationTime string `json:"creationTime,omitempty"`
  820. // CreatorUserId: Identifier for the user that created the
  821. // coursework.
  822. //
  823. // Read-only.
  824. CreatorUserId string `json:"creatorUserId,omitempty"`
  825. // Description: Optional description of this course work.
  826. // If set, the description must be a valid UTF-8 string containing no
  827. // more
  828. // than 30,000 characters.
  829. Description string `json:"description,omitempty"`
  830. // DueDate: Optional date, in UTC, that submissions for this this course
  831. // work are due.
  832. // This must be specified if `due_time` is specified.
  833. DueDate *Date `json:"dueDate,omitempty"`
  834. // DueTime: Optional time of day, in UTC, that submissions for this this
  835. // course work
  836. // are due.
  837. // This must be specified if `due_date` is specified.
  838. DueTime *TimeOfDay `json:"dueTime,omitempty"`
  839. // Id: Classroom-assigned identifier of this course work, unique per
  840. // course.
  841. //
  842. // Read-only.
  843. Id string `json:"id,omitempty"`
  844. // IndividualStudentsOptions: Identifiers of students with access to the
  845. // coursework.
  846. // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  847. // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only
  848. // students
  849. // specified in this field will be assigned the coursework.
  850. IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"`
  851. // Materials: Additional materials.
  852. //
  853. // CourseWork must have no more than 20 material items.
  854. Materials []*Material `json:"materials,omitempty"`
  855. // MaxPoints: Maximum grade for this course work.
  856. // If zero or unspecified, this assignment is considered ungraded.
  857. // This must be a non-negative integer value.
  858. MaxPoints float64 `json:"maxPoints,omitempty"`
  859. // MultipleChoiceQuestion: Multiple choice question details.
  860. // For read operations, this field is populated only when `work_type`
  861. // is
  862. // `MULTIPLE_CHOICE_QUESTION`.
  863. // For write operations, this field must be specified when creating
  864. // course
  865. // work with a `work_type` of `MULTIPLE_CHOICE_QUESTION`, and it must
  866. // not be
  867. // set otherwise.
  868. MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"`
  869. // ScheduledTime: Optional timestamp when this course work is scheduled
  870. // to be published.
  871. ScheduledTime string `json:"scheduledTime,omitempty"`
  872. // State: Status of this course work.
  873. // If unspecified, the default state is `DRAFT`.
  874. //
  875. // Possible values:
  876. // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never
  877. // returned.
  878. // "PUBLISHED" - Status for work that has been published.
  879. // This is the default state.
  880. // "DRAFT" - Status for work that is not yet published.
  881. // Work in this state is visible only to course teachers and
  882. // domain
  883. // administrators.
  884. // "DELETED" - Status for work that was published but is now
  885. // deleted.
  886. // Work in this state is visible only to course teachers and
  887. // domain
  888. // administrators.
  889. // Work in this state is deleted after some time.
  890. State string `json:"state,omitempty"`
  891. // SubmissionModificationMode: Setting to determine when students are
  892. // allowed to modify submissions.
  893. // If unspecified, the default value is `MODIFIABLE_UNTIL_TURNED_IN`.
  894. //
  895. // Possible values:
  896. // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode
  897. // specified. This is never returned.
  898. // "MODIFIABLE_UNTIL_TURNED_IN" - Submisisons can be modified before
  899. // being turned in.
  900. // "MODIFIABLE" - Submisisons can be modified at any time.
  901. SubmissionModificationMode string `json:"submissionModificationMode,omitempty"`
  902. // Title: Title of this course work.
  903. // The title must be a valid UTF-8 string containing between 1 and
  904. // 3000
  905. // characters.
  906. Title string `json:"title,omitempty"`
  907. // UpdateTime: Timestamp of the most recent change to this course
  908. // work.
  909. //
  910. // Read-only.
  911. UpdateTime string `json:"updateTime,omitempty"`
  912. // WorkType: Type of this course work.
  913. //
  914. // The type is set when the course work is created and cannot be
  915. // changed.
  916. //
  917. // Possible values:
  918. // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is
  919. // never returned.
  920. // "ASSIGNMENT" - An assignment.
  921. // "SHORT_ANSWER_QUESTION" - A short answer question.
  922. // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question.
  923. WorkType string `json:"workType,omitempty"`
  924. // ServerResponse contains the HTTP response code and headers from the
  925. // server.
  926. googleapi.ServerResponse `json:"-"`
  927. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  928. // unconditionally include in API requests. By default, fields with
  929. // empty values are omitted from API requests. However, any non-pointer,
  930. // non-interface field appearing in ForceSendFields will be sent to the
  931. // server regardless of whether the field is empty or not. This may be
  932. // used to include empty fields in Patch requests.
  933. ForceSendFields []string `json:"-"`
  934. // NullFields is a list of field names (e.g. "AlternateLink") to include
  935. // in API requests with the JSON null value. By default, fields with
  936. // empty values are omitted from API requests. However, any field with
  937. // an empty value appearing in NullFields will be sent to the server as
  938. // null. It is an error if a field in this list has a non-empty value.
  939. // This may be used to include null fields in Patch requests.
  940. NullFields []string `json:"-"`
  941. }
  942. func (s *CourseWork) MarshalJSON() ([]byte, error) {
  943. type NoMethod CourseWork
  944. raw := NoMethod(*s)
  945. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  946. }
  947. func (s *CourseWork) UnmarshalJSON(data []byte) error {
  948. type NoMethod CourseWork
  949. var s1 struct {
  950. MaxPoints gensupport.JSONFloat64 `json:"maxPoints"`
  951. *NoMethod
  952. }
  953. s1.NoMethod = (*NoMethod)(s)
  954. if err := json.Unmarshal(data, &s1); err != nil {
  955. return err
  956. }
  957. s.MaxPoints = float64(s1.MaxPoints)
  958. return nil
  959. }
  960. // Date: Represents a whole calendar date, e.g. date of birth. The time
  961. // of day and
  962. // time zone are either specified elsewhere or are not significant. The
  963. // date
  964. // is relative to the Proleptic Gregorian Calendar. The day may be 0
  965. // to
  966. // represent a year and month where the day is not significant, e.g.
  967. // credit card
  968. // expiration date. The year may be 0 to represent a month and day
  969. // independent
  970. // of year, e.g. anniversary date. Related types are
  971. // google.type.TimeOfDay
  972. // and `google.protobuf.Timestamp`.
  973. type Date struct {
  974. // Day: Day of month. Must be from 1 to 31 and valid for the year and
  975. // month, or 0
  976. // if specifying a year/month where the day is not significant.
  977. Day int64 `json:"day,omitempty"`
  978. // Month: Month of year. Must be from 1 to 12, or 0 if specifying a date
  979. // without a
  980. // month.
  981. Month int64 `json:"month,omitempty"`
  982. // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date
  983. // without
  984. // a year.
  985. Year int64 `json:"year,omitempty"`
  986. // ForceSendFields is a list of field names (e.g. "Day") to
  987. // unconditionally include in API requests. By default, fields with
  988. // empty values are omitted from API requests. However, any non-pointer,
  989. // non-interface field appearing in ForceSendFields will be sent to the
  990. // server regardless of whether the field is empty or not. This may be
  991. // used to include empty fields in Patch requests.
  992. ForceSendFields []string `json:"-"`
  993. // NullFields is a list of field names (e.g. "Day") to include in API
  994. // requests with the JSON null value. By default, fields with empty
  995. // values are omitted from API requests. However, any field with an
  996. // empty value appearing in NullFields will be sent to the server as
  997. // null. It is an error if a field in this list has a non-empty value.
  998. // This may be used to include null fields in Patch requests.
  999. NullFields []string `json:"-"`
  1000. }
  1001. func (s *Date) MarshalJSON() ([]byte, error) {
  1002. type NoMethod Date
  1003. raw := NoMethod(*s)
  1004. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1005. }
  1006. // DriveFile: Representation of a Google Drive file.
  1007. type DriveFile struct {
  1008. // AlternateLink: URL that can be used to access the Drive
  1009. // item.
  1010. //
  1011. // Read-only.
  1012. AlternateLink string `json:"alternateLink,omitempty"`
  1013. // Id: Drive API resource ID.
  1014. Id string `json:"id,omitempty"`
  1015. // ThumbnailUrl: URL of a thumbnail image of the Drive item.
  1016. //
  1017. // Read-only.
  1018. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  1019. // Title: Title of the Drive item.
  1020. //
  1021. // Read-only.
  1022. Title string `json:"title,omitempty"`
  1023. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1024. // unconditionally include in API requests. By default, fields with
  1025. // empty values are omitted from API requests. However, any non-pointer,
  1026. // non-interface field appearing in ForceSendFields will be sent to the
  1027. // server regardless of whether the field is empty or not. This may be
  1028. // used to include empty fields in Patch requests.
  1029. ForceSendFields []string `json:"-"`
  1030. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1031. // in API requests with the JSON null value. By default, fields with
  1032. // empty values are omitted from API requests. However, any field with
  1033. // an empty value appearing in NullFields will be sent to the server as
  1034. // null. It is an error if a field in this list has a non-empty value.
  1035. // This may be used to include null fields in Patch requests.
  1036. NullFields []string `json:"-"`
  1037. }
  1038. func (s *DriveFile) MarshalJSON() ([]byte, error) {
  1039. type NoMethod DriveFile
  1040. raw := NoMethod(*s)
  1041. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1042. }
  1043. // DriveFolder: Representation of a Google Drive folder.
  1044. type DriveFolder struct {
  1045. // AlternateLink: URL that can be used to access the Drive
  1046. // folder.
  1047. //
  1048. // Read-only.
  1049. AlternateLink string `json:"alternateLink,omitempty"`
  1050. // Id: Drive API resource ID.
  1051. Id string `json:"id,omitempty"`
  1052. // Title: Title of the Drive folder.
  1053. //
  1054. // Read-only.
  1055. Title string `json:"title,omitempty"`
  1056. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1057. // unconditionally include in API requests. By default, fields with
  1058. // empty values are omitted from API requests. However, any non-pointer,
  1059. // non-interface field appearing in ForceSendFields will be sent to the
  1060. // server regardless of whether the field is empty or not. This may be
  1061. // used to include empty fields in Patch requests.
  1062. ForceSendFields []string `json:"-"`
  1063. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1064. // in API requests with the JSON null value. By default, fields with
  1065. // empty values are omitted from API requests. However, any field with
  1066. // an empty value appearing in NullFields will be sent to the server as
  1067. // null. It is an error if a field in this list has a non-empty value.
  1068. // This may be used to include null fields in Patch requests.
  1069. NullFields []string `json:"-"`
  1070. }
  1071. func (s *DriveFolder) MarshalJSON() ([]byte, error) {
  1072. type NoMethod DriveFolder
  1073. raw := NoMethod(*s)
  1074. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1075. }
  1076. // Empty: A generic empty message that you can re-use to avoid defining
  1077. // duplicated
  1078. // empty messages in your APIs. A typical example is to use it as the
  1079. // request
  1080. // or the response type of an API method. For instance:
  1081. //
  1082. // service Foo {
  1083. // rpc Bar(google.protobuf.Empty) returns
  1084. // (google.protobuf.Empty);
  1085. // }
  1086. //
  1087. // The JSON representation for `Empty` is empty JSON object `{}`.
  1088. type Empty struct {
  1089. // ServerResponse contains the HTTP response code and headers from the
  1090. // server.
  1091. googleapi.ServerResponse `json:"-"`
  1092. }
  1093. // Feed: A class of notifications that an application can register to
  1094. // receive.
  1095. // For example: "all roster changes for a domain".
  1096. type Feed struct {
  1097. // CourseRosterChangesInfo: Information about a `Feed` with a
  1098. // `feed_type` of `COURSE_ROSTER_CHANGES`.
  1099. // This field must be specified if `feed_type` is
  1100. // `COURSE_ROSTER_CHANGES`.
  1101. CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"`
  1102. // FeedType: The type of feed.
  1103. //
  1104. // Possible values:
  1105. // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided.
  1106. // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular
  1107. // domain.
  1108. //
  1109. // Notifications will be generated whenever a user joins or leaves a
  1110. // course.
  1111. //
  1112. // No notifications will be generated when an invitation is created
  1113. // or
  1114. // deleted, but notifications will be generated when a user joins a
  1115. // course
  1116. // by accepting an invitation.
  1117. // "COURSE_ROSTER_CHANGES" - All roster changes for a particular
  1118. // course.
  1119. //
  1120. // Notifications will be generated whenever a user joins or leaves a
  1121. // course.
  1122. //
  1123. // No notifications will be generated when an invitation is created
  1124. // or
  1125. // deleted, but notifications will be generated when a user joins a
  1126. // course
  1127. // by accepting an invitation.
  1128. FeedType string `json:"feedType,omitempty"`
  1129. // ForceSendFields is a list of field names (e.g.
  1130. // "CourseRosterChangesInfo") to unconditionally include in API
  1131. // requests. By default, fields with empty values are omitted from API
  1132. // requests. However, any non-pointer, non-interface field appearing in
  1133. // ForceSendFields will be sent to the server regardless of whether the
  1134. // field is empty or not. This may be used to include empty fields in
  1135. // Patch requests.
  1136. ForceSendFields []string `json:"-"`
  1137. // NullFields is a list of field names (e.g. "CourseRosterChangesInfo")
  1138. // to include in API requests with the JSON null value. By default,
  1139. // fields with empty values are omitted from API requests. However, any
  1140. // field with an empty value appearing in NullFields will be sent to the
  1141. // server as null. It is an error if a field in this list has a
  1142. // non-empty value. This may be used to include null fields in Patch
  1143. // requests.
  1144. NullFields []string `json:"-"`
  1145. }
  1146. func (s *Feed) MarshalJSON() ([]byte, error) {
  1147. type NoMethod Feed
  1148. raw := NoMethod(*s)
  1149. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1150. }
  1151. // Form: Google Forms item.
  1152. type Form struct {
  1153. // FormUrl: URL of the form.
  1154. FormUrl string `json:"formUrl,omitempty"`
  1155. // ResponseUrl: URL of the form responses document.
  1156. // Only set if respsonses have been recorded and only when
  1157. // the
  1158. // requesting user is an editor of the form.
  1159. //
  1160. // Read-only.
  1161. ResponseUrl string `json:"responseUrl,omitempty"`
  1162. // ThumbnailUrl: URL of a thumbnail image of the Form.
  1163. //
  1164. // Read-only.
  1165. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  1166. // Title: Title of the Form.
  1167. //
  1168. // Read-only.
  1169. Title string `json:"title,omitempty"`
  1170. // ForceSendFields is a list of field names (e.g. "FormUrl") to
  1171. // unconditionally include in API requests. By default, fields with
  1172. // empty values are omitted from API requests. However, any non-pointer,
  1173. // non-interface field appearing in ForceSendFields will be sent to the
  1174. // server regardless of whether the field is empty or not. This may be
  1175. // used to include empty fields in Patch requests.
  1176. ForceSendFields []string `json:"-"`
  1177. // NullFields is a list of field names (e.g. "FormUrl") to include in
  1178. // API requests with the JSON null value. By default, fields with empty
  1179. // values are omitted from API requests. However, any field with an
  1180. // empty value appearing in NullFields will be sent to the server as
  1181. // null. It is an error if a field in this list has a non-empty value.
  1182. // This may be used to include null fields in Patch requests.
  1183. NullFields []string `json:"-"`
  1184. }
  1185. func (s *Form) MarshalJSON() ([]byte, error) {
  1186. type NoMethod Form
  1187. raw := NoMethod(*s)
  1188. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1189. }
  1190. // GlobalPermission: Global user permission description.
  1191. type GlobalPermission struct {
  1192. // Permission: Permission value.
  1193. //
  1194. // Possible values:
  1195. // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not
  1196. // returned and is not a
  1197. // valid value.
  1198. // "CREATE_COURSE" - User is permitted to create a course.
  1199. Permission string `json:"permission,omitempty"`
  1200. // ForceSendFields is a list of field names (e.g. "Permission") to
  1201. // unconditionally include in API requests. By default, fields with
  1202. // empty values are omitted from API requests. However, any non-pointer,
  1203. // non-interface field appearing in ForceSendFields will be sent to the
  1204. // server regardless of whether the field is empty or not. This may be
  1205. // used to include empty fields in Patch requests.
  1206. ForceSendFields []string `json:"-"`
  1207. // NullFields is a list of field names (e.g. "Permission") to include in
  1208. // API requests with the JSON null value. By default, fields with empty
  1209. // values are omitted from API requests. However, any field with an
  1210. // empty value appearing in NullFields will be sent to the server as
  1211. // null. It is an error if a field in this list has a non-empty value.
  1212. // This may be used to include null fields in Patch requests.
  1213. NullFields []string `json:"-"`
  1214. }
  1215. func (s *GlobalPermission) MarshalJSON() ([]byte, error) {
  1216. type NoMethod GlobalPermission
  1217. raw := NoMethod(*s)
  1218. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1219. }
  1220. // GradeHistory: The history of each grade on this submission.
  1221. type GradeHistory struct {
  1222. // ActorUserId: The teacher who made the grade change.
  1223. ActorUserId string `json:"actorUserId,omitempty"`
  1224. // GradeChangeType: The type of grade change at this time in the
  1225. // submission grade history.
  1226. //
  1227. // Possible values:
  1228. // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This
  1229. // should never be returned.
  1230. // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of
  1231. // the draft grade.
  1232. // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator
  1233. // of the assigned grade.
  1234. // "MAX_POINTS_CHANGE" - A change in the denominator of the grade.
  1235. GradeChangeType string `json:"gradeChangeType,omitempty"`
  1236. // GradeTimestamp: When the grade of the submission was changed.
  1237. GradeTimestamp string `json:"gradeTimestamp,omitempty"`
  1238. // MaxPoints: The denominator of the grade at this time in the
  1239. // submission grade
  1240. // history.
  1241. MaxPoints float64 `json:"maxPoints,omitempty"`
  1242. // PointsEarned: The numerator of the grade at this time in the
  1243. // submission grade history.
  1244. PointsEarned float64 `json:"pointsEarned,omitempty"`
  1245. // ForceSendFields is a list of field names (e.g. "ActorUserId") to
  1246. // unconditionally include in API requests. By default, fields with
  1247. // empty values are omitted from API requests. However, any non-pointer,
  1248. // non-interface field appearing in ForceSendFields will be sent to the
  1249. // server regardless of whether the field is empty or not. This may be
  1250. // used to include empty fields in Patch requests.
  1251. ForceSendFields []string `json:"-"`
  1252. // NullFields is a list of field names (e.g. "ActorUserId") to include
  1253. // in API requests with the JSON null value. By default, fields with
  1254. // empty values are omitted from API requests. However, any field with
  1255. // an empty value appearing in NullFields will be sent to the server as
  1256. // null. It is an error if a field in this list has a non-empty value.
  1257. // This may be used to include null fields in Patch requests.
  1258. NullFields []string `json:"-"`
  1259. }
  1260. func (s *GradeHistory) MarshalJSON() ([]byte, error) {
  1261. type NoMethod GradeHistory
  1262. raw := NoMethod(*s)
  1263. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1264. }
  1265. func (s *GradeHistory) UnmarshalJSON(data []byte) error {
  1266. type NoMethod GradeHistory
  1267. var s1 struct {
  1268. MaxPoints gensupport.JSONFloat64 `json:"maxPoints"`
  1269. PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"`
  1270. *NoMethod
  1271. }
  1272. s1.NoMethod = (*NoMethod)(s)
  1273. if err := json.Unmarshal(data, &s1); err != nil {
  1274. return err
  1275. }
  1276. s.MaxPoints = float64(s1.MaxPoints)
  1277. s.PointsEarned = float64(s1.PointsEarned)
  1278. return nil
  1279. }
  1280. // Guardian: Association between a student and a guardian of that
  1281. // student. The guardian
  1282. // may receive information about the student's course work.
  1283. type Guardian struct {
  1284. // GuardianId: Identifier for the guardian.
  1285. GuardianId string `json:"guardianId,omitempty"`
  1286. // GuardianProfile: User profile for the guardian.
  1287. GuardianProfile *UserProfile `json:"guardianProfile,omitempty"`
  1288. // InvitedEmailAddress: The email address to which the initial guardian
  1289. // invitation was sent.
  1290. // This field is only visible to domain administrators.
  1291. InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"`
  1292. // StudentId: Identifier for the student to whom the guardian
  1293. // relationship applies.
  1294. StudentId string `json:"studentId,omitempty"`
  1295. // ServerResponse contains the HTTP response code and headers from the
  1296. // server.
  1297. googleapi.ServerResponse `json:"-"`
  1298. // ForceSendFields is a list of field names (e.g. "GuardianId") to
  1299. // unconditionally include in API requests. By default, fields with
  1300. // empty values are omitted from API requests. However, any non-pointer,
  1301. // non-interface field appearing in ForceSendFields will be sent to the
  1302. // server regardless of whether the field is empty or not. This may be
  1303. // used to include empty fields in Patch requests.
  1304. ForceSendFields []string `json:"-"`
  1305. // NullFields is a list of field names (e.g. "GuardianId") to include in
  1306. // API requests with the JSON null value. By default, fields with empty
  1307. // values are omitted from API requests. However, any field with an
  1308. // empty value appearing in NullFields will be sent to the server as
  1309. // null. It is an error if a field in this list has a non-empty value.
  1310. // This may be used to include null fields in Patch requests.
  1311. NullFields []string `json:"-"`
  1312. }
  1313. func (s *Guardian) MarshalJSON() ([]byte, error) {
  1314. type NoMethod Guardian
  1315. raw := NoMethod(*s)
  1316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1317. }
  1318. // GuardianInvitation: An invitation to become the guardian of a
  1319. // specified user, sent to a specified
  1320. // email address.
  1321. type GuardianInvitation struct {
  1322. // CreationTime: The time that this invitation was created.
  1323. //
  1324. // Read-only.
  1325. CreationTime string `json:"creationTime,omitempty"`
  1326. // InvitationId: Unique identifier for this invitation.
  1327. //
  1328. // Read-only.
  1329. InvitationId string `json:"invitationId,omitempty"`
  1330. // InvitedEmailAddress: Email address that the invitation was sent
  1331. // to.
  1332. // This field is only visible to domain administrators.
  1333. InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"`
  1334. // State: The state that this invitation is in.
  1335. //
  1336. // Possible values:
  1337. // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned.
  1338. // "PENDING" - The invitation is active and awaiting a response.
  1339. // "COMPLETE" - The invitation is no longer active. It may have been
  1340. // accepted, declined,
  1341. // withdrawn or it may have expired.
  1342. State string `json:"state,omitempty"`
  1343. // StudentId: ID of the student (in standard format)
  1344. StudentId string `json:"studentId,omitempty"`
  1345. // ServerResponse contains the HTTP response code and headers from the
  1346. // server.
  1347. googleapi.ServerResponse `json:"-"`
  1348. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1349. // unconditionally include in API requests. By default, fields with
  1350. // empty values are omitted from API requests. However, any non-pointer,
  1351. // non-interface field appearing in ForceSendFields will be sent to the
  1352. // server regardless of whether the field is empty or not. This may be
  1353. // used to include empty fields in Patch requests.
  1354. ForceSendFields []string `json:"-"`
  1355. // NullFields is a list of field names (e.g. "CreationTime") to include
  1356. // in API requests with the JSON null value. By default, fields with
  1357. // empty values are omitted from API requests. However, any field with
  1358. // an empty value appearing in NullFields will be sent to the server as
  1359. // null. It is an error if a field in this list has a non-empty value.
  1360. // This may be used to include null fields in Patch requests.
  1361. NullFields []string `json:"-"`
  1362. }
  1363. func (s *GuardianInvitation) MarshalJSON() ([]byte, error) {
  1364. type NoMethod GuardianInvitation
  1365. raw := NoMethod(*s)
  1366. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1367. }
  1368. // IndividualStudentsOptions: Assignee details about a
  1369. // coursework/announcement.
  1370. // This field is set if and only if `assigneeMode` is
  1371. // `INDIVIDUAL_STUDENTS`.
  1372. type IndividualStudentsOptions struct {
  1373. // StudentIds: Identifiers for the students that have access to
  1374. // the
  1375. // coursework/announcement.
  1376. StudentIds []string `json:"studentIds,omitempty"`
  1377. // ForceSendFields is a list of field names (e.g. "StudentIds") to
  1378. // unconditionally include in API requests. By default, fields with
  1379. // empty values are omitted from API requests. However, any non-pointer,
  1380. // non-interface field appearing in ForceSendFields will be sent to the
  1381. // server regardless of whether the field is empty or not. This may be
  1382. // used to include empty fields in Patch requests.
  1383. ForceSendFields []string `json:"-"`
  1384. // NullFields is a list of field names (e.g. "StudentIds") to include in
  1385. // API requests with the JSON null value. By default, fields with empty
  1386. // values are omitted from API requests. However, any field with an
  1387. // empty value appearing in NullFields will be sent to the server as
  1388. // null. It is an error if a field in this list has a non-empty value.
  1389. // This may be used to include null fields in Patch requests.
  1390. NullFields []string `json:"-"`
  1391. }
  1392. func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) {
  1393. type NoMethod IndividualStudentsOptions
  1394. raw := NoMethod(*s)
  1395. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1396. }
  1397. // Invitation: An invitation to join a course.
  1398. type Invitation struct {
  1399. // CourseId: Identifier of the course to invite the user to.
  1400. CourseId string `json:"courseId,omitempty"`
  1401. // Id: Identifier assigned by Classroom.
  1402. //
  1403. // Read-only.
  1404. Id string `json:"id,omitempty"`
  1405. // Role: Role to invite the user to have.
  1406. // Must not be `COURSE_ROLE_UNSPECIFIED`.
  1407. //
  1408. // Possible values:
  1409. // "COURSE_ROLE_UNSPECIFIED" - No course role.
  1410. // "STUDENT" - Student in the course.
  1411. // "TEACHER" - Teacher of the course.
  1412. // "OWNER" - Owner of the course.
  1413. Role string `json:"role,omitempty"`
  1414. // UserId: Identifier of the invited user.
  1415. //
  1416. // When specified as a parameter of a request, this identifier can be
  1417. // set to
  1418. // one of the following:
  1419. //
  1420. // * the numeric identifier for the user
  1421. // * the email address of the user
  1422. // * the string literal "me", indicating the requesting user
  1423. UserId string `json:"userId,omitempty"`
  1424. // ServerResponse contains the HTTP response code and headers from the
  1425. // server.
  1426. googleapi.ServerResponse `json:"-"`
  1427. // ForceSendFields is a list of field names (e.g. "CourseId") to
  1428. // unconditionally include in API requests. By default, fields with
  1429. // empty values are omitted from API requests. However, any non-pointer,
  1430. // non-interface field appearing in ForceSendFields will be sent to the
  1431. // server regardless of whether the field is empty or not. This may be
  1432. // used to include empty fields in Patch requests.
  1433. ForceSendFields []string `json:"-"`
  1434. // NullFields is a list of field names (e.g. "CourseId") to include in
  1435. // API requests with the JSON null value. By default, fields with empty
  1436. // values are omitted from API requests. However, any field with an
  1437. // empty value appearing in NullFields will be sent to the server as
  1438. // null. It is an error if a field in this list has a non-empty value.
  1439. // This may be used to include null fields in Patch requests.
  1440. NullFields []string `json:"-"`
  1441. }
  1442. func (s *Invitation) MarshalJSON() ([]byte, error) {
  1443. type NoMethod Invitation
  1444. raw := NoMethod(*s)
  1445. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1446. }
  1447. // Link: URL item.
  1448. type Link struct {
  1449. // ThumbnailUrl: URL of a thumbnail image of the target URL.
  1450. //
  1451. // Read-only.
  1452. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  1453. // Title: Title of the target of the URL.
  1454. //
  1455. // Read-only.
  1456. Title string `json:"title,omitempty"`
  1457. // Url: URL to link to.
  1458. // This must be a valid UTF-8 string containing between 1 and 2024
  1459. // characters.
  1460. Url string `json:"url,omitempty"`
  1461. // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to
  1462. // unconditionally include in API requests. By default, fields with
  1463. // empty values are omitted from API requests. However, any non-pointer,
  1464. // non-interface field appearing in ForceSendFields will be sent to the
  1465. // server regardless of whether the field is empty or not. This may be
  1466. // used to include empty fields in Patch requests.
  1467. ForceSendFields []string `json:"-"`
  1468. // NullFields is a list of field names (e.g. "ThumbnailUrl") to include
  1469. // in API requests with the JSON null value. By default, fields with
  1470. // empty values are omitted from API requests. However, any field with
  1471. // an empty value appearing in NullFields will be sent to the server as
  1472. // null. It is an error if a field in this list has a non-empty value.
  1473. // This may be used to include null fields in Patch requests.
  1474. NullFields []string `json:"-"`
  1475. }
  1476. func (s *Link) MarshalJSON() ([]byte, error) {
  1477. type NoMethod Link
  1478. raw := NoMethod(*s)
  1479. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1480. }
  1481. // ListAnnouncementsResponse: Response when listing course work.
  1482. type ListAnnouncementsResponse struct {
  1483. // Announcements: Announcement items that match the request.
  1484. Announcements []*Announcement `json:"announcements,omitempty"`
  1485. // NextPageToken: Token identifying the next page of results to return.
  1486. // If empty, no further
  1487. // results are available.
  1488. NextPageToken string `json:"nextPageToken,omitempty"`
  1489. // ServerResponse contains the HTTP response code and headers from the
  1490. // server.
  1491. googleapi.ServerResponse `json:"-"`
  1492. // ForceSendFields is a list of field names (e.g. "Announcements") to
  1493. // unconditionally include in API requests. By default, fields with
  1494. // empty values are omitted from API requests. However, any non-pointer,
  1495. // non-interface field appearing in ForceSendFields will be sent to the
  1496. // server regardless of whether the field is empty or not. This may be
  1497. // used to include empty fields in Patch requests.
  1498. ForceSendFields []string `json:"-"`
  1499. // NullFields is a list of field names (e.g. "Announcements") to include
  1500. // in API requests with the JSON null value. By default, fields with
  1501. // empty values are omitted from API requests. However, any field with
  1502. // an empty value appearing in NullFields will be sent to the server as
  1503. // null. It is an error if a field in this list has a non-empty value.
  1504. // This may be used to include null fields in Patch requests.
  1505. NullFields []string `json:"-"`
  1506. }
  1507. func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) {
  1508. type NoMethod ListAnnouncementsResponse
  1509. raw := NoMethod(*s)
  1510. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1511. }
  1512. // ListCourseAliasesResponse: Response when listing course aliases.
  1513. type ListCourseAliasesResponse struct {
  1514. // Aliases: The course aliases.
  1515. Aliases []*CourseAlias `json:"aliases,omitempty"`
  1516. // NextPageToken: Token identifying the next page of results to return.
  1517. // If empty, no further
  1518. // results are available.
  1519. NextPageToken string `json:"nextPageToken,omitempty"`
  1520. // ServerResponse contains the HTTP response code and headers from the
  1521. // server.
  1522. googleapi.ServerResponse `json:"-"`
  1523. // ForceSendFields is a list of field names (e.g. "Aliases") to
  1524. // unconditionally include in API requests. By default, fields with
  1525. // empty values are omitted from API requests. However, any non-pointer,
  1526. // non-interface field appearing in ForceSendFields will be sent to the
  1527. // server regardless of whether the field is empty or not. This may be
  1528. // used to include empty fields in Patch requests.
  1529. ForceSendFields []string `json:"-"`
  1530. // NullFields is a list of field names (e.g. "Aliases") to include in
  1531. // API requests with the JSON null value. By default, fields with empty
  1532. // values are omitted from API requests. However, any field with an
  1533. // empty value appearing in NullFields will be sent to the server as
  1534. // null. It is an error if a field in this list has a non-empty value.
  1535. // This may be used to include null fields in Patch requests.
  1536. NullFields []string `json:"-"`
  1537. }
  1538. func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) {
  1539. type NoMethod ListCourseAliasesResponse
  1540. raw := NoMethod(*s)
  1541. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1542. }
  1543. // ListCourseWorkResponse: Response when listing course work.
  1544. type ListCourseWorkResponse struct {
  1545. // CourseWork: Course work items that match the request.
  1546. CourseWork []*CourseWork `json:"courseWork,omitempty"`
  1547. // NextPageToken: Token identifying the next page of results to return.
  1548. // If empty, no further
  1549. // results are available.
  1550. NextPageToken string `json:"nextPageToken,omitempty"`
  1551. // ServerResponse contains the HTTP response code and headers from the
  1552. // server.
  1553. googleapi.ServerResponse `json:"-"`
  1554. // ForceSendFields is a list of field names (e.g. "CourseWork") to
  1555. // unconditionally include in API requests. By default, fields with
  1556. // empty values are omitted from API requests. However, any non-pointer,
  1557. // non-interface field appearing in ForceSendFields will be sent to the
  1558. // server regardless of whether the field is empty or not. This may be
  1559. // used to include empty fields in Patch requests.
  1560. ForceSendFields []string `json:"-"`
  1561. // NullFields is a list of field names (e.g. "CourseWork") to include in
  1562. // API requests with the JSON null value. By default, fields with empty
  1563. // values are omitted from API requests. However, any field with an
  1564. // empty value appearing in NullFields will be sent to the server as
  1565. // null. It is an error if a field in this list has a non-empty value.
  1566. // This may be used to include null fields in Patch requests.
  1567. NullFields []string `json:"-"`
  1568. }
  1569. func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) {
  1570. type NoMethod ListCourseWorkResponse
  1571. raw := NoMethod(*s)
  1572. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1573. }
  1574. // ListCoursesResponse: Response when listing courses.
  1575. type ListCoursesResponse struct {
  1576. // Courses: Courses that match the list request.
  1577. Courses []*Course `json:"courses,omitempty"`
  1578. // NextPageToken: Token identifying the next page of results to return.
  1579. // If empty, no further
  1580. // results are available.
  1581. NextPageToken string `json:"nextPageToken,omitempty"`
  1582. // ServerResponse contains the HTTP response code and headers from the
  1583. // server.
  1584. googleapi.ServerResponse `json:"-"`
  1585. // ForceSendFields is a list of field names (e.g. "Courses") to
  1586. // unconditionally include in API requests. By default, fields with
  1587. // empty values are omitted from API requests. However, any non-pointer,
  1588. // non-interface field appearing in ForceSendFields will be sent to the
  1589. // server regardless of whether the field is empty or not. This may be
  1590. // used to include empty fields in Patch requests.
  1591. ForceSendFields []string `json:"-"`
  1592. // NullFields is a list of field names (e.g. "Courses") to include in
  1593. // API requests with the JSON null value. By default, fields with empty
  1594. // values are omitted from API requests. However, any field with an
  1595. // empty value appearing in NullFields will be sent to the server as
  1596. // null. It is an error if a field in this list has a non-empty value.
  1597. // This may be used to include null fields in Patch requests.
  1598. NullFields []string `json:"-"`
  1599. }
  1600. func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) {
  1601. type NoMethod ListCoursesResponse
  1602. raw := NoMethod(*s)
  1603. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1604. }
  1605. // ListGuardianInvitationsResponse: Response when listing guardian
  1606. // invitations.
  1607. type ListGuardianInvitationsResponse struct {
  1608. // GuardianInvitations: Guardian invitations that matched the list
  1609. // request.
  1610. GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"`
  1611. // NextPageToken: Token identifying the next page of results to return.
  1612. // If empty, no further
  1613. // results are available.
  1614. NextPageToken string `json:"nextPageToken,omitempty"`
  1615. // ServerResponse contains the HTTP response code and headers from the
  1616. // server.
  1617. googleapi.ServerResponse `json:"-"`
  1618. // ForceSendFields is a list of field names (e.g. "GuardianInvitations")
  1619. // to unconditionally include in API requests. By default, fields with
  1620. // empty values are omitted from API requests. However, any non-pointer,
  1621. // non-interface field appearing in ForceSendFields will be sent to the
  1622. // server regardless of whether the field is empty or not. This may be
  1623. // used to include empty fields in Patch requests.
  1624. ForceSendFields []string `json:"-"`
  1625. // NullFields is a list of field names (e.g. "GuardianInvitations") to
  1626. // include in API requests with the JSON null value. By default, fields
  1627. // with empty values are omitted from API requests. However, any field
  1628. // with an empty value appearing in NullFields will be sent to the
  1629. // server as null. It is an error if a field in this list has a
  1630. // non-empty value. This may be used to include null fields in Patch
  1631. // requests.
  1632. NullFields []string `json:"-"`
  1633. }
  1634. func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) {
  1635. type NoMethod ListGuardianInvitationsResponse
  1636. raw := NoMethod(*s)
  1637. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1638. }
  1639. // ListGuardiansResponse: Response when listing guardians.
  1640. type ListGuardiansResponse struct {
  1641. // Guardians: Guardians on this page of results that met the criteria
  1642. // specified in
  1643. // the request.
  1644. Guardians []*Guardian `json:"guardians,omitempty"`
  1645. // NextPageToken: Token identifying the next page of results to return.
  1646. // If empty, no further
  1647. // results are available.
  1648. NextPageToken string `json:"nextPageToken,omitempty"`
  1649. // ServerResponse contains the HTTP response code and headers from the
  1650. // server.
  1651. googleapi.ServerResponse `json:"-"`
  1652. // ForceSendFields is a list of field names (e.g. "Guardians") to
  1653. // unconditionally include in API requests. By default, fields with
  1654. // empty values are omitted from API requests. However, any non-pointer,
  1655. // non-interface field appearing in ForceSendFields will be sent to the
  1656. // server regardless of whether the field is empty or not. This may be
  1657. // used to include empty fields in Patch requests.
  1658. ForceSendFields []string `json:"-"`
  1659. // NullFields is a list of field names (e.g. "Guardians") to include in
  1660. // API requests with the JSON null value. By default, fields with empty
  1661. // values are omitted from API requests. However, any field with an
  1662. // empty value appearing in NullFields will be sent to the server as
  1663. // null. It is an error if a field in this list has a non-empty value.
  1664. // This may be used to include null fields in Patch requests.
  1665. NullFields []string `json:"-"`
  1666. }
  1667. func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) {
  1668. type NoMethod ListGuardiansResponse
  1669. raw := NoMethod(*s)
  1670. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1671. }
  1672. // ListInvitationsResponse: Response when listing invitations.
  1673. type ListInvitationsResponse struct {
  1674. // Invitations: Invitations that match the list request.
  1675. Invitations []*Invitation `json:"invitations,omitempty"`
  1676. // NextPageToken: Token identifying the next page of results to return.
  1677. // If empty, no further
  1678. // results are available.
  1679. NextPageToken string `json:"nextPageToken,omitempty"`
  1680. // ServerResponse contains the HTTP response code and headers from the
  1681. // server.
  1682. googleapi.ServerResponse `json:"-"`
  1683. // ForceSendFields is a list of field names (e.g. "Invitations") to
  1684. // unconditionally include in API requests. By default, fields with
  1685. // empty values are omitted from API requests. However, any non-pointer,
  1686. // non-interface field appearing in ForceSendFields will be sent to the
  1687. // server regardless of whether the field is empty or not. This may be
  1688. // used to include empty fields in Patch requests.
  1689. ForceSendFields []string `json:"-"`
  1690. // NullFields is a list of field names (e.g. "Invitations") to include
  1691. // in API requests with the JSON null value. By default, fields with
  1692. // empty values are omitted from API requests. However, any field with
  1693. // an empty value appearing in NullFields will be sent to the server as
  1694. // null. It is an error if a field in this list has a non-empty value.
  1695. // This may be used to include null fields in Patch requests.
  1696. NullFields []string `json:"-"`
  1697. }
  1698. func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) {
  1699. type NoMethod ListInvitationsResponse
  1700. raw := NoMethod(*s)
  1701. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1702. }
  1703. // ListStudentSubmissionsResponse: Response when listing student
  1704. // submissions.
  1705. type ListStudentSubmissionsResponse struct {
  1706. // NextPageToken: Token identifying the next page of results to return.
  1707. // If empty, no further
  1708. // results are available.
  1709. NextPageToken string `json:"nextPageToken,omitempty"`
  1710. // StudentSubmissions: Student work that matches the request.
  1711. StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"`
  1712. // ServerResponse contains the HTTP response code and headers from the
  1713. // server.
  1714. googleapi.ServerResponse `json:"-"`
  1715. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1716. // unconditionally include in API requests. By default, fields with
  1717. // empty values are omitted from API requests. However, any non-pointer,
  1718. // non-interface field appearing in ForceSendFields will be sent to the
  1719. // server regardless of whether the field is empty or not. This may be
  1720. // used to include empty fields in Patch requests.
  1721. ForceSendFields []string `json:"-"`
  1722. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1723. // in API requests with the JSON null value. By default, fields with
  1724. // empty values are omitted from API requests. However, any field with
  1725. // an empty value appearing in NullFields will be sent to the server as
  1726. // null. It is an error if a field in this list has a non-empty value.
  1727. // This may be used to include null fields in Patch requests.
  1728. NullFields []string `json:"-"`
  1729. }
  1730. func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) {
  1731. type NoMethod ListStudentSubmissionsResponse
  1732. raw := NoMethod(*s)
  1733. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1734. }
  1735. // ListStudentsResponse: Response when listing students.
  1736. type ListStudentsResponse struct {
  1737. // NextPageToken: Token identifying the next page of results to return.
  1738. // If empty, no further
  1739. // results are available.
  1740. NextPageToken string `json:"nextPageToken,omitempty"`
  1741. // Students: Students who match the list request.
  1742. Students []*Student `json:"students,omitempty"`
  1743. // ServerResponse contains the HTTP response code and headers from the
  1744. // server.
  1745. googleapi.ServerResponse `json:"-"`
  1746. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1747. // unconditionally include in API requests. By default, fields with
  1748. // empty values are omitted from API requests. However, any non-pointer,
  1749. // non-interface field appearing in ForceSendFields will be sent to the
  1750. // server regardless of whether the field is empty or not. This may be
  1751. // used to include empty fields in Patch requests.
  1752. ForceSendFields []string `json:"-"`
  1753. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1754. // in API requests with the JSON null value. By default, fields with
  1755. // empty values are omitted from API requests. However, any field with
  1756. // an empty value appearing in NullFields will be sent to the server as
  1757. // null. It is an error if a field in this list has a non-empty value.
  1758. // This may be used to include null fields in Patch requests.
  1759. NullFields []string `json:"-"`
  1760. }
  1761. func (s *ListStudentsResponse) MarshalJSON() ([]byte, error) {
  1762. type NoMethod ListStudentsResponse
  1763. raw := NoMethod(*s)
  1764. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1765. }
  1766. // ListTeachersResponse: Response when listing teachers.
  1767. type ListTeachersResponse struct {
  1768. // NextPageToken: Token identifying the next page of results to return.
  1769. // If empty, no further
  1770. // results are available.
  1771. NextPageToken string `json:"nextPageToken,omitempty"`
  1772. // Teachers: Teachers who match the list request.
  1773. Teachers []*Teacher `json:"teachers,omitempty"`
  1774. // ServerResponse contains the HTTP response code and headers from the
  1775. // server.
  1776. googleapi.ServerResponse `json:"-"`
  1777. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1778. // unconditionally include in API requests. By default, fields with
  1779. // empty values are omitted from API requests. However, any non-pointer,
  1780. // non-interface field appearing in ForceSendFields will be sent to the
  1781. // server regardless of whether the field is empty or not. This may be
  1782. // used to include empty fields in Patch requests.
  1783. ForceSendFields []string `json:"-"`
  1784. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1785. // in API requests with the JSON null value. By default, fields with
  1786. // empty values are omitted from API requests. However, any field with
  1787. // an empty value appearing in NullFields will be sent to the server as
  1788. // null. It is an error if a field in this list has a non-empty value.
  1789. // This may be used to include null fields in Patch requests.
  1790. NullFields []string `json:"-"`
  1791. }
  1792. func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) {
  1793. type NoMethod ListTeachersResponse
  1794. raw := NoMethod(*s)
  1795. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1796. }
  1797. // Material: Material attached to course work.
  1798. //
  1799. // When creating attachments, setting the `form` field is not supported.
  1800. type Material struct {
  1801. // DriveFile: Google Drive file material.
  1802. DriveFile *SharedDriveFile `json:"driveFile,omitempty"`
  1803. // Form: Google Forms material.
  1804. Form *Form `json:"form,omitempty"`
  1805. // Link: Link material. On creation, will be upgraded to a more
  1806. // appropriate type
  1807. // if possible, and this will be reflected in the response.
  1808. Link *Link `json:"link,omitempty"`
  1809. // YoutubeVideo: YouTube video material.
  1810. YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"`
  1811. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  1812. // unconditionally include in API requests. By default, fields with
  1813. // empty values are omitted from API requests. However, any non-pointer,
  1814. // non-interface field appearing in ForceSendFields will be sent to the
  1815. // server regardless of whether the field is empty or not. This may be
  1816. // used to include empty fields in Patch requests.
  1817. ForceSendFields []string `json:"-"`
  1818. // NullFields is a list of field names (e.g. "DriveFile") to include in
  1819. // API requests with the JSON null value. By default, fields with empty
  1820. // values are omitted from API requests. However, any field with an
  1821. // empty value appearing in NullFields will be sent to the server as
  1822. // null. It is an error if a field in this list has a non-empty value.
  1823. // This may be used to include null fields in Patch requests.
  1824. NullFields []string `json:"-"`
  1825. }
  1826. func (s *Material) MarshalJSON() ([]byte, error) {
  1827. type NoMethod Material
  1828. raw := NoMethod(*s)
  1829. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1830. }
  1831. // ModifyAnnouncementAssigneesRequest: Request to modify assignee mode
  1832. // and options of an announcement.
  1833. type ModifyAnnouncementAssigneesRequest struct {
  1834. // AssigneeMode: Mode of the announcement describing whether it will be
  1835. // accessible by all
  1836. // students or specified individual students.
  1837. //
  1838. // Possible values:
  1839. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  1840. // returned.
  1841. // "ALL_STUDENTS" - All students can see the item.
  1842. // This is the default state.
  1843. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  1844. AssigneeMode string `json:"assigneeMode,omitempty"`
  1845. // ModifyIndividualStudentsOptions: Set which students can view or
  1846. // cannot view the announcement.
  1847. // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  1848. ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"`
  1849. // ForceSendFields is a list of field names (e.g. "AssigneeMode") to
  1850. // unconditionally include in API requests. By default, fields with
  1851. // empty values are omitted from API requests. However, any non-pointer,
  1852. // non-interface field appearing in ForceSendFields will be sent to the
  1853. // server regardless of whether the field is empty or not. This may be
  1854. // used to include empty fields in Patch requests.
  1855. ForceSendFields []string `json:"-"`
  1856. // NullFields is a list of field names (e.g. "AssigneeMode") to include
  1857. // in API requests with the JSON null value. By default, fields with
  1858. // empty values are omitted from API requests. However, any field with
  1859. // an empty value appearing in NullFields will be sent to the server as
  1860. // null. It is an error if a field in this list has a non-empty value.
  1861. // This may be used to include null fields in Patch requests.
  1862. NullFields []string `json:"-"`
  1863. }
  1864. func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) {
  1865. type NoMethod ModifyAnnouncementAssigneesRequest
  1866. raw := NoMethod(*s)
  1867. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1868. }
  1869. // ModifyAttachmentsRequest: Request to modify the attachments of a
  1870. // student submission.
  1871. type ModifyAttachmentsRequest struct {
  1872. // AddAttachments: Attachments to add.
  1873. // A student submission may not have more than 20 attachments.
  1874. //
  1875. // Form attachments are not supported.
  1876. AddAttachments []*Attachment `json:"addAttachments,omitempty"`
  1877. // ForceSendFields is a list of field names (e.g. "AddAttachments") to
  1878. // unconditionally include in API requests. By default, fields with
  1879. // empty values are omitted from API requests. However, any non-pointer,
  1880. // non-interface field appearing in ForceSendFields will be sent to the
  1881. // server regardless of whether the field is empty or not. This may be
  1882. // used to include empty fields in Patch requests.
  1883. ForceSendFields []string `json:"-"`
  1884. // NullFields is a list of field names (e.g. "AddAttachments") to
  1885. // include in API requests with the JSON null value. By default, fields
  1886. // with empty values are omitted from API requests. However, any field
  1887. // with an empty value appearing in NullFields will be sent to the
  1888. // server as null. It is an error if a field in this list has a
  1889. // non-empty value. This may be used to include null fields in Patch
  1890. // requests.
  1891. NullFields []string `json:"-"`
  1892. }
  1893. func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) {
  1894. type NoMethod ModifyAttachmentsRequest
  1895. raw := NoMethod(*s)
  1896. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1897. }
  1898. // ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and
  1899. // options of a coursework.
  1900. type ModifyCourseWorkAssigneesRequest struct {
  1901. // AssigneeMode: Mode of the coursework describing whether it will be
  1902. // assigned to all
  1903. // students or specified individual students.
  1904. //
  1905. // Possible values:
  1906. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  1907. // returned.
  1908. // "ALL_STUDENTS" - All students can see the item.
  1909. // This is the default state.
  1910. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  1911. AssigneeMode string `json:"assigneeMode,omitempty"`
  1912. // ModifyIndividualStudentsOptions: Set which students are assigned or
  1913. // not assigned to the coursework.
  1914. // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  1915. ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"`
  1916. // ForceSendFields is a list of field names (e.g. "AssigneeMode") to
  1917. // unconditionally include in API requests. By default, fields with
  1918. // empty values are omitted from API requests. However, any non-pointer,
  1919. // non-interface field appearing in ForceSendFields will be sent to the
  1920. // server regardless of whether the field is empty or not. This may be
  1921. // used to include empty fields in Patch requests.
  1922. ForceSendFields []string `json:"-"`
  1923. // NullFields is a list of field names (e.g. "AssigneeMode") to include
  1924. // in API requests with the JSON null value. By default, fields with
  1925. // empty values are omitted from API requests. However, any field with
  1926. // an empty value appearing in NullFields will be sent to the server as
  1927. // null. It is an error if a field in this list has a non-empty value.
  1928. // This may be used to include null fields in Patch requests.
  1929. NullFields []string `json:"-"`
  1930. }
  1931. func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) {
  1932. type NoMethod ModifyCourseWorkAssigneesRequest
  1933. raw := NoMethod(*s)
  1934. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1935. }
  1936. // ModifyIndividualStudentsOptions: Contains fields to add or remove
  1937. // students from a course work or announcement
  1938. // where the `assigneeMode` is set to `INDIVIDUAL_STUDENTS`.
  1939. type ModifyIndividualStudentsOptions struct {
  1940. // AddStudentIds: Ids of students to be added as having access to
  1941. // this
  1942. // coursework/announcement.
  1943. AddStudentIds []string `json:"addStudentIds,omitempty"`
  1944. // RemoveStudentIds: Ids of students to be removed from having access to
  1945. // this
  1946. // coursework/announcement.
  1947. RemoveStudentIds []string `json:"removeStudentIds,omitempty"`
  1948. // ForceSendFields is a list of field names (e.g. "AddStudentIds") to
  1949. // unconditionally include in API requests. By default, fields with
  1950. // empty values are omitted from API requests. However, any non-pointer,
  1951. // non-interface field appearing in ForceSendFields will be sent to the
  1952. // server regardless of whether the field is empty or not. This may be
  1953. // used to include empty fields in Patch requests.
  1954. ForceSendFields []string `json:"-"`
  1955. // NullFields is a list of field names (e.g. "AddStudentIds") to include
  1956. // in API requests with the JSON null value. By default, fields with
  1957. // empty values are omitted from API requests. However, any field with
  1958. // an empty value appearing in NullFields will be sent to the server as
  1959. // null. It is an error if a field in this list has a non-empty value.
  1960. // This may be used to include null fields in Patch requests.
  1961. NullFields []string `json:"-"`
  1962. }
  1963. func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) {
  1964. type NoMethod ModifyIndividualStudentsOptions
  1965. raw := NoMethod(*s)
  1966. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1967. }
  1968. // MultipleChoiceQuestion: Additional details for multiple-choice
  1969. // questions.
  1970. type MultipleChoiceQuestion struct {
  1971. // Choices: Possible choices.
  1972. Choices []string `json:"choices,omitempty"`
  1973. // ForceSendFields is a list of field names (e.g. "Choices") to
  1974. // unconditionally include in API requests. By default, fields with
  1975. // empty values are omitted from API requests. However, any non-pointer,
  1976. // non-interface field appearing in ForceSendFields will be sent to the
  1977. // server regardless of whether the field is empty or not. This may be
  1978. // used to include empty fields in Patch requests.
  1979. ForceSendFields []string `json:"-"`
  1980. // NullFields is a list of field names (e.g. "Choices") to include in
  1981. // API requests with the JSON null value. By default, fields with empty
  1982. // values are omitted from API requests. However, any field with an
  1983. // empty value appearing in NullFields will be sent to the server as
  1984. // null. It is an error if a field in this list has a non-empty value.
  1985. // This may be used to include null fields in Patch requests.
  1986. NullFields []string `json:"-"`
  1987. }
  1988. func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) {
  1989. type NoMethod MultipleChoiceQuestion
  1990. raw := NoMethod(*s)
  1991. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1992. }
  1993. // MultipleChoiceSubmission: Student work for a multiple-choice
  1994. // question.
  1995. type MultipleChoiceSubmission struct {
  1996. // Answer: Student's select choice.
  1997. Answer string `json:"answer,omitempty"`
  1998. // ForceSendFields is a list of field names (e.g. "Answer") to
  1999. // unconditionally include in API requests. By default, fields with
  2000. // empty values are omitted from API requests. However, any non-pointer,
  2001. // non-interface field appearing in ForceSendFields will be sent to the
  2002. // server regardless of whether the field is empty or not. This may be
  2003. // used to include empty fields in Patch requests.
  2004. ForceSendFields []string `json:"-"`
  2005. // NullFields is a list of field names (e.g. "Answer") to include in API
  2006. // requests with the JSON null value. By default, fields with empty
  2007. // values are omitted from API requests. However, any field with an
  2008. // empty value appearing in NullFields will be sent to the server as
  2009. // null. It is an error if a field in this list has a non-empty value.
  2010. // This may be used to include null fields in Patch requests.
  2011. NullFields []string `json:"-"`
  2012. }
  2013. func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) {
  2014. type NoMethod MultipleChoiceSubmission
  2015. raw := NoMethod(*s)
  2016. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2017. }
  2018. // Name: Details of the user's name.
  2019. type Name struct {
  2020. // FamilyName: The user's last name.
  2021. //
  2022. // Read-only.
  2023. FamilyName string `json:"familyName,omitempty"`
  2024. // FullName: The user's full name formed by concatenating the first and
  2025. // last name
  2026. // values.
  2027. //
  2028. // Read-only.
  2029. FullName string `json:"fullName,omitempty"`
  2030. // GivenName: The user's first name.
  2031. //
  2032. // Read-only.
  2033. GivenName string `json:"givenName,omitempty"`
  2034. // ForceSendFields is a list of field names (e.g. "FamilyName") to
  2035. // unconditionally include in API requests. By default, fields with
  2036. // empty values are omitted from API requests. However, any non-pointer,
  2037. // non-interface field appearing in ForceSendFields will be sent to the
  2038. // server regardless of whether the field is empty or not. This may be
  2039. // used to include empty fields in Patch requests.
  2040. ForceSendFields []string `json:"-"`
  2041. // NullFields is a list of field names (e.g. "FamilyName") to include in
  2042. // API requests with the JSON null value. By default, fields with empty
  2043. // values are omitted from API requests. However, any field with an
  2044. // empty value appearing in NullFields will be sent to the server as
  2045. // null. It is an error if a field in this list has a non-empty value.
  2046. // This may be used to include null fields in Patch requests.
  2047. NullFields []string `json:"-"`
  2048. }
  2049. func (s *Name) MarshalJSON() ([]byte, error) {
  2050. type NoMethod Name
  2051. raw := NoMethod(*s)
  2052. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2053. }
  2054. // ReclaimStudentSubmissionRequest: Request to reclaim a student
  2055. // submission.
  2056. type ReclaimStudentSubmissionRequest struct {
  2057. }
  2058. // Registration: An instruction to Classroom to send notifications from
  2059. // the `feed` to the
  2060. // provided destination.
  2061. type Registration struct {
  2062. // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to
  2063. // be sent to.
  2064. CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"`
  2065. // ExpiryTime: The time until which the `Registration` is
  2066. // effective.
  2067. //
  2068. // This is a read-only field assigned by the server.
  2069. ExpiryTime string `json:"expiryTime,omitempty"`
  2070. // Feed: Specification for the class of notifications that Classroom
  2071. // should deliver
  2072. // to the destination.
  2073. Feed *Feed `json:"feed,omitempty"`
  2074. // RegistrationId: A server-generated unique identifier for this
  2075. // `Registration`.
  2076. //
  2077. // Read-only.
  2078. RegistrationId string `json:"registrationId,omitempty"`
  2079. // ServerResponse contains the HTTP response code and headers from the
  2080. // server.
  2081. googleapi.ServerResponse `json:"-"`
  2082. // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to
  2083. // unconditionally include in API requests. By default, fields with
  2084. // empty values are omitted from API requests. However, any non-pointer,
  2085. // non-interface field appearing in ForceSendFields will be sent to the
  2086. // server regardless of whether the field is empty or not. This may be
  2087. // used to include empty fields in Patch requests.
  2088. ForceSendFields []string `json:"-"`
  2089. // NullFields is a list of field names (e.g. "CloudPubsubTopic") to
  2090. // include in API requests with the JSON null value. By default, fields
  2091. // with empty values are omitted from API requests. However, any field
  2092. // with an empty value appearing in NullFields will be sent to the
  2093. // server as null. It is an error if a field in this list has a
  2094. // non-empty value. This may be used to include null fields in Patch
  2095. // requests.
  2096. NullFields []string `json:"-"`
  2097. }
  2098. func (s *Registration) MarshalJSON() ([]byte, error) {
  2099. type NoMethod Registration
  2100. raw := NoMethod(*s)
  2101. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2102. }
  2103. // ReturnStudentSubmissionRequest: Request to return a student
  2104. // submission.
  2105. type ReturnStudentSubmissionRequest struct {
  2106. }
  2107. // SharedDriveFile: Drive file that is used as material for course work.
  2108. type SharedDriveFile struct {
  2109. // DriveFile: Drive file details.
  2110. DriveFile *DriveFile `json:"driveFile,omitempty"`
  2111. // ShareMode: Mechanism by which students access the Drive item.
  2112. //
  2113. // Possible values:
  2114. // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never
  2115. // be returned.
  2116. // "VIEW" - Students can view the shared file.
  2117. // "EDIT" - Students can edit the shared file.
  2118. // "STUDENT_COPY" - Students have a personal copy of the shared file.
  2119. ShareMode string `json:"shareMode,omitempty"`
  2120. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  2121. // unconditionally include in API requests. By default, fields with
  2122. // empty values are omitted from API requests. However, any non-pointer,
  2123. // non-interface field appearing in ForceSendFields will be sent to the
  2124. // server regardless of whether the field is empty or not. This may be
  2125. // used to include empty fields in Patch requests.
  2126. ForceSendFields []string `json:"-"`
  2127. // NullFields is a list of field names (e.g. "DriveFile") to include in
  2128. // API requests with the JSON null value. By default, fields with empty
  2129. // values are omitted from API requests. However, any field with an
  2130. // empty value appearing in NullFields will be sent to the server as
  2131. // null. It is an error if a field in this list has a non-empty value.
  2132. // This may be used to include null fields in Patch requests.
  2133. NullFields []string `json:"-"`
  2134. }
  2135. func (s *SharedDriveFile) MarshalJSON() ([]byte, error) {
  2136. type NoMethod SharedDriveFile
  2137. raw := NoMethod(*s)
  2138. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2139. }
  2140. // ShortAnswerSubmission: Student work for a short answer question.
  2141. type ShortAnswerSubmission struct {
  2142. // Answer: Student response to a short-answer question.
  2143. Answer string `json:"answer,omitempty"`
  2144. // ForceSendFields is a list of field names (e.g. "Answer") to
  2145. // unconditionally include in API requests. By default, fields with
  2146. // empty values are omitted from API requests. However, any non-pointer,
  2147. // non-interface field appearing in ForceSendFields will be sent to the
  2148. // server regardless of whether the field is empty or not. This may be
  2149. // used to include empty fields in Patch requests.
  2150. ForceSendFields []string `json:"-"`
  2151. // NullFields is a list of field names (e.g. "Answer") to include in API
  2152. // requests with the JSON null value. By default, fields with empty
  2153. // values are omitted from API requests. However, any field with an
  2154. // empty value appearing in NullFields will be sent to the server as
  2155. // null. It is an error if a field in this list has a non-empty value.
  2156. // This may be used to include null fields in Patch requests.
  2157. NullFields []string `json:"-"`
  2158. }
  2159. func (s *ShortAnswerSubmission) MarshalJSON() ([]byte, error) {
  2160. type NoMethod ShortAnswerSubmission
  2161. raw := NoMethod(*s)
  2162. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2163. }
  2164. // StateHistory: The history of each state this submission has been in.
  2165. type StateHistory struct {
  2166. // ActorUserId: The teacher or student who made the change
  2167. ActorUserId string `json:"actorUserId,omitempty"`
  2168. // State: The workflow pipeline stage.
  2169. //
  2170. // Possible values:
  2171. // "STATE_UNSPECIFIED" - No state specified. This should never be
  2172. // returned.
  2173. // "CREATED" - The Submission has been created.
  2174. // "TURNED_IN" - The student has turned in an assigned document, which
  2175. // may or may not be
  2176. // a template.
  2177. // "RETURNED" - The teacher has returned the assigned document to the
  2178. // student.
  2179. // "RECLAIMED_BY_STUDENT" - The student turned in the assigned
  2180. // document, and then chose to
  2181. // "unsubmit" the assignment, giving the student control again as
  2182. // the
  2183. // owner.
  2184. // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their
  2185. // submission after turning it in. Currently,
  2186. // only used by Questions, when the student edits their answer.
  2187. State string `json:"state,omitempty"`
  2188. // StateTimestamp: When the submission entered this state.
  2189. StateTimestamp string `json:"stateTimestamp,omitempty"`
  2190. // ForceSendFields is a list of field names (e.g. "ActorUserId") to
  2191. // unconditionally include in API requests. By default, fields with
  2192. // empty values are omitted from API requests. However, any non-pointer,
  2193. // non-interface field appearing in ForceSendFields will be sent to the
  2194. // server regardless of whether the field is empty or not. This may be
  2195. // used to include empty fields in Patch requests.
  2196. ForceSendFields []string `json:"-"`
  2197. // NullFields is a list of field names (e.g. "ActorUserId") to include
  2198. // in API requests with the JSON null value. By default, fields with
  2199. // empty values are omitted from API requests. However, any field with
  2200. // an empty value appearing in NullFields will be sent to the server as
  2201. // null. It is an error if a field in this list has a non-empty value.
  2202. // This may be used to include null fields in Patch requests.
  2203. NullFields []string `json:"-"`
  2204. }
  2205. func (s *StateHistory) MarshalJSON() ([]byte, error) {
  2206. type NoMethod StateHistory
  2207. raw := NoMethod(*s)
  2208. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2209. }
  2210. // Student: Student in a course.
  2211. type Student struct {
  2212. // CourseId: Identifier of the course.
  2213. //
  2214. // Read-only.
  2215. CourseId string `json:"courseId,omitempty"`
  2216. // Profile: Global user information for the student.
  2217. //
  2218. // Read-only.
  2219. Profile *UserProfile `json:"profile,omitempty"`
  2220. // StudentWorkFolder: Information about a Drive Folder for this
  2221. // student's work in this course.
  2222. // Only visible to the student and domain administrators.
  2223. //
  2224. // Read-only.
  2225. StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"`
  2226. // UserId: Identifier of the user.
  2227. //
  2228. // When specified as a parameter of a request, this identifier can be
  2229. // one of
  2230. // the following:
  2231. //
  2232. // * the numeric identifier for the user
  2233. // * the email address of the user
  2234. // * the string literal "me", indicating the requesting user
  2235. UserId string `json:"userId,omitempty"`
  2236. // ServerResponse contains the HTTP response code and headers from the
  2237. // server.
  2238. googleapi.ServerResponse `json:"-"`
  2239. // ForceSendFields is a list of field names (e.g. "CourseId") to
  2240. // unconditionally include in API requests. By default, fields with
  2241. // empty values are omitted from API requests. However, any non-pointer,
  2242. // non-interface field appearing in ForceSendFields will be sent to the
  2243. // server regardless of whether the field is empty or not. This may be
  2244. // used to include empty fields in Patch requests.
  2245. ForceSendFields []string `json:"-"`
  2246. // NullFields is a list of field names (e.g. "CourseId") to include in
  2247. // API requests with the JSON null value. By default, fields with empty
  2248. // values are omitted from API requests. However, any field with an
  2249. // empty value appearing in NullFields will be sent to the server as
  2250. // null. It is an error if a field in this list has a non-empty value.
  2251. // This may be used to include null fields in Patch requests.
  2252. NullFields []string `json:"-"`
  2253. }
  2254. func (s *Student) MarshalJSON() ([]byte, error) {
  2255. type NoMethod Student
  2256. raw := NoMethod(*s)
  2257. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2258. }
  2259. // StudentSubmission: Student submission for course
  2260. // work.
  2261. //
  2262. // StudentSubmission items are generated when a CourseWork item is
  2263. // created.
  2264. //
  2265. // StudentSubmissions that have never been accessed (i.e. with `state` =
  2266. // NEW)
  2267. // may not have a creation time or update time.
  2268. type StudentSubmission struct {
  2269. // AlternateLink: Absolute link to the submission in the Classroom web
  2270. // UI.
  2271. //
  2272. // Read-only.
  2273. AlternateLink string `json:"alternateLink,omitempty"`
  2274. // AssignedGrade: Optional grade. If unset, no grade was set.
  2275. // This value must be non-negative. Decimal (i.e. non-integer) values
  2276. // are
  2277. // allowed, but will be rounded to two decimal places.
  2278. //
  2279. // This may be modified only by course teachers.
  2280. AssignedGrade float64 `json:"assignedGrade,omitempty"`
  2281. // AssignmentSubmission: Submission content when course_work_type is
  2282. // ASSIGNMENT.
  2283. //
  2284. // Students can modify this content
  2285. // using
  2286. // google.classroom.Work.ModifyAttachments.
  2287. AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"`
  2288. // AssociatedWithDeveloper: Whether this student submission is
  2289. // associated with the Developer Console
  2290. // project making the request.
  2291. //
  2292. // See google.classroom.Work.CreateCourseWork for
  2293. // more
  2294. // details.
  2295. //
  2296. // Read-only.
  2297. AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"`
  2298. // CourseId: Identifier of the course.
  2299. //
  2300. // Read-only.
  2301. CourseId string `json:"courseId,omitempty"`
  2302. // CourseWorkId: Identifier for the course work this corresponds
  2303. // to.
  2304. //
  2305. // Read-only.
  2306. CourseWorkId string `json:"courseWorkId,omitempty"`
  2307. // CourseWorkType: Type of course work this submission is
  2308. // for.
  2309. //
  2310. // Read-only.
  2311. //
  2312. // Possible values:
  2313. // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is
  2314. // never returned.
  2315. // "ASSIGNMENT" - An assignment.
  2316. // "SHORT_ANSWER_QUESTION" - A short answer question.
  2317. // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question.
  2318. CourseWorkType string `json:"courseWorkType,omitempty"`
  2319. // CreationTime: Creation time of this submission.
  2320. // This may be unset if the student has not accessed this
  2321. // item.
  2322. //
  2323. // Read-only.
  2324. CreationTime string `json:"creationTime,omitempty"`
  2325. // DraftGrade: Optional pending grade. If unset, no grade was set.
  2326. // This value must be non-negative. Decimal (i.e. non-integer) values
  2327. // are
  2328. // allowed, but will be rounded to two decimal places.
  2329. //
  2330. // This is only visible to and modifiable by course teachers.
  2331. DraftGrade float64 `json:"draftGrade,omitempty"`
  2332. // Id: Classroom-assigned Identifier for the student submission.
  2333. // This is unique among submissions for the relevant course
  2334. // work.
  2335. //
  2336. // Read-only.
  2337. Id string `json:"id,omitempty"`
  2338. // Late: Whether this submission is late.
  2339. //
  2340. // Read-only.
  2341. Late bool `json:"late,omitempty"`
  2342. // MultipleChoiceSubmission: Submission content when course_work_type is
  2343. // MULTIPLE_CHOICE_QUESTION.
  2344. MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"`
  2345. // ShortAnswerSubmission: Submission content when course_work_type is
  2346. // SHORT_ANSWER_QUESTION.
  2347. ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"`
  2348. // State: State of this submission.
  2349. //
  2350. // Read-only.
  2351. //
  2352. // Possible values:
  2353. // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should
  2354. // never be returned.
  2355. // "NEW" - The student has never accessed this submission. Attachments
  2356. // are not
  2357. // returned and timestamps is not set.
  2358. // "CREATED" - Has been created.
  2359. // "TURNED_IN" - Has been turned in to the teacher.
  2360. // "RETURNED" - Has been returned to the student.
  2361. // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the
  2362. // assignment.
  2363. State string `json:"state,omitempty"`
  2364. // SubmissionHistory: The history of the submission (includes state and
  2365. // grade histories).
  2366. //
  2367. // Read-only.
  2368. SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"`
  2369. // UpdateTime: Last update time of this submission.
  2370. // This may be unset if the student has not accessed this
  2371. // item.
  2372. //
  2373. // Read-only.
  2374. UpdateTime string `json:"updateTime,omitempty"`
  2375. // UserId: Identifier for the student that owns this
  2376. // submission.
  2377. //
  2378. // Read-only.
  2379. UserId string `json:"userId,omitempty"`
  2380. // ServerResponse contains the HTTP response code and headers from the
  2381. // server.
  2382. googleapi.ServerResponse `json:"-"`
  2383. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  2384. // unconditionally include in API requests. By default, fields with
  2385. // empty values are omitted from API requests. However, any non-pointer,
  2386. // non-interface field appearing in ForceSendFields will be sent to the
  2387. // server regardless of whether the field is empty or not. This may be
  2388. // used to include empty fields in Patch requests.
  2389. ForceSendFields []string `json:"-"`
  2390. // NullFields is a list of field names (e.g. "AlternateLink") to include
  2391. // in API requests with the JSON null value. By default, fields with
  2392. // empty values are omitted from API requests. However, any field with
  2393. // an empty value appearing in NullFields will be sent to the server as
  2394. // null. It is an error if a field in this list has a non-empty value.
  2395. // This may be used to include null fields in Patch requests.
  2396. NullFields []string `json:"-"`
  2397. }
  2398. func (s *StudentSubmission) MarshalJSON() ([]byte, error) {
  2399. type NoMethod StudentSubmission
  2400. raw := NoMethod(*s)
  2401. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2402. }
  2403. func (s *StudentSubmission) UnmarshalJSON(data []byte) error {
  2404. type NoMethod StudentSubmission
  2405. var s1 struct {
  2406. AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"`
  2407. DraftGrade gensupport.JSONFloat64 `json:"draftGrade"`
  2408. *NoMethod
  2409. }
  2410. s1.NoMethod = (*NoMethod)(s)
  2411. if err := json.Unmarshal(data, &s1); err != nil {
  2412. return err
  2413. }
  2414. s.AssignedGrade = float64(s1.AssignedGrade)
  2415. s.DraftGrade = float64(s1.DraftGrade)
  2416. return nil
  2417. }
  2418. // SubmissionHistory: The history of the submission. This currently
  2419. // includes state and grade
  2420. // histories.
  2421. type SubmissionHistory struct {
  2422. // GradeHistory: The grade history information of the submission, if
  2423. // present.
  2424. GradeHistory *GradeHistory `json:"gradeHistory,omitempty"`
  2425. // StateHistory: The state history information of the submission, if
  2426. // present.
  2427. StateHistory *StateHistory `json:"stateHistory,omitempty"`
  2428. // ForceSendFields is a list of field names (e.g. "GradeHistory") to
  2429. // unconditionally include in API requests. By default, fields with
  2430. // empty values are omitted from API requests. However, any non-pointer,
  2431. // non-interface field appearing in ForceSendFields will be sent to the
  2432. // server regardless of whether the field is empty or not. This may be
  2433. // used to include empty fields in Patch requests.
  2434. ForceSendFields []string `json:"-"`
  2435. // NullFields is a list of field names (e.g. "GradeHistory") to include
  2436. // in API requests with the JSON null value. By default, fields with
  2437. // empty values are omitted from API requests. However, any field with
  2438. // an empty value appearing in NullFields will be sent to the server as
  2439. // null. It is an error if a field in this list has a non-empty value.
  2440. // This may be used to include null fields in Patch requests.
  2441. NullFields []string `json:"-"`
  2442. }
  2443. func (s *SubmissionHistory) MarshalJSON() ([]byte, error) {
  2444. type NoMethod SubmissionHistory
  2445. raw := NoMethod(*s)
  2446. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2447. }
  2448. // Teacher: Teacher of a course.
  2449. type Teacher struct {
  2450. // CourseId: Identifier of the course.
  2451. //
  2452. // Read-only.
  2453. CourseId string `json:"courseId,omitempty"`
  2454. // Profile: Global user information for the teacher.
  2455. //
  2456. // Read-only.
  2457. Profile *UserProfile `json:"profile,omitempty"`
  2458. // UserId: Identifier of the user.
  2459. //
  2460. // When specified as a parameter of a request, this identifier can be
  2461. // one of
  2462. // the following:
  2463. //
  2464. // * the numeric identifier for the user
  2465. // * the email address of the user
  2466. // * the string literal "me", indicating the requesting user
  2467. UserId string `json:"userId,omitempty"`
  2468. // ServerResponse contains the HTTP response code and headers from the
  2469. // server.
  2470. googleapi.ServerResponse `json:"-"`
  2471. // ForceSendFields is a list of field names (e.g. "CourseId") to
  2472. // unconditionally include in API requests. By default, fields with
  2473. // empty values are omitted from API requests. However, any non-pointer,
  2474. // non-interface field appearing in ForceSendFields will be sent to the
  2475. // server regardless of whether the field is empty or not. This may be
  2476. // used to include empty fields in Patch requests.
  2477. ForceSendFields []string `json:"-"`
  2478. // NullFields is a list of field names (e.g. "CourseId") to include in
  2479. // API requests with the JSON null value. By default, fields with empty
  2480. // values are omitted from API requests. However, any field with an
  2481. // empty value appearing in NullFields will be sent to the server as
  2482. // null. It is an error if a field in this list has a non-empty value.
  2483. // This may be used to include null fields in Patch requests.
  2484. NullFields []string `json:"-"`
  2485. }
  2486. func (s *Teacher) MarshalJSON() ([]byte, error) {
  2487. type NoMethod Teacher
  2488. raw := NoMethod(*s)
  2489. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2490. }
  2491. // TimeOfDay: Represents a time of day. The date and time zone are
  2492. // either not significant
  2493. // or are specified elsewhere. An API may choose to allow leap seconds.
  2494. // Related
  2495. // types are google.type.Date and `google.protobuf.Timestamp`.
  2496. type TimeOfDay struct {
  2497. // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API
  2498. // may choose
  2499. // to allow the value "24:00:00" for scenarios like business closing
  2500. // time.
  2501. Hours int64 `json:"hours,omitempty"`
  2502. // Minutes: Minutes of hour of day. Must be from 0 to 59.
  2503. Minutes int64 `json:"minutes,omitempty"`
  2504. // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to
  2505. // 999,999,999.
  2506. Nanos int64 `json:"nanos,omitempty"`
  2507. // Seconds: Seconds of minutes of the time. Must normally be from 0 to
  2508. // 59. An API may
  2509. // allow the value 60 if it allows leap-seconds.
  2510. Seconds int64 `json:"seconds,omitempty"`
  2511. // ForceSendFields is a list of field names (e.g. "Hours") to
  2512. // unconditionally include in API requests. By default, fields with
  2513. // empty values are omitted from API requests. However, any non-pointer,
  2514. // non-interface field appearing in ForceSendFields will be sent to the
  2515. // server regardless of whether the field is empty or not. This may be
  2516. // used to include empty fields in Patch requests.
  2517. ForceSendFields []string `json:"-"`
  2518. // NullFields is a list of field names (e.g. "Hours") to include in API
  2519. // requests with the JSON null value. By default, fields with empty
  2520. // values are omitted from API requests. However, any field with an
  2521. // empty value appearing in NullFields will be sent to the server as
  2522. // null. It is an error if a field in this list has a non-empty value.
  2523. // This may be used to include null fields in Patch requests.
  2524. NullFields []string `json:"-"`
  2525. }
  2526. func (s *TimeOfDay) MarshalJSON() ([]byte, error) {
  2527. type NoMethod TimeOfDay
  2528. raw := NoMethod(*s)
  2529. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2530. }
  2531. // TurnInStudentSubmissionRequest: Request to turn in a student
  2532. // submission.
  2533. type TurnInStudentSubmissionRequest struct {
  2534. }
  2535. // UserProfile: Global information for a user.
  2536. type UserProfile struct {
  2537. // EmailAddress: Email address of the user.
  2538. //
  2539. // Read-only.
  2540. EmailAddress string `json:"emailAddress,omitempty"`
  2541. // Id: Identifier of the user.
  2542. //
  2543. // Read-only.
  2544. Id string `json:"id,omitempty"`
  2545. // Name: Name of the user.
  2546. //
  2547. // Read-only.
  2548. Name *Name `json:"name,omitempty"`
  2549. // Permissions: Global permissions of the user.
  2550. //
  2551. // Read-only.
  2552. Permissions []*GlobalPermission `json:"permissions,omitempty"`
  2553. // PhotoUrl: URL of user's profile photo.
  2554. //
  2555. // Read-only.
  2556. PhotoUrl string `json:"photoUrl,omitempty"`
  2557. // VerifiedTeacher: Represents whether a G Suite for Education user's
  2558. // domain administrator has
  2559. // explicitly verified them as being a teacher. If the user is not a
  2560. // member of
  2561. // a G Suite for Education domain, than this field will always be
  2562. // false.
  2563. //
  2564. // Read-only
  2565. VerifiedTeacher bool `json:"verifiedTeacher,omitempty"`
  2566. // ServerResponse contains the HTTP response code and headers from the
  2567. // server.
  2568. googleapi.ServerResponse `json:"-"`
  2569. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  2570. // unconditionally include in API requests. By default, fields with
  2571. // empty values are omitted from API requests. However, any non-pointer,
  2572. // non-interface field appearing in ForceSendFields will be sent to the
  2573. // server regardless of whether the field is empty or not. This may be
  2574. // used to include empty fields in Patch requests.
  2575. ForceSendFields []string `json:"-"`
  2576. // NullFields is a list of field names (e.g. "EmailAddress") to include
  2577. // in API requests with the JSON null value. By default, fields with
  2578. // empty values are omitted from API requests. However, any field with
  2579. // an empty value appearing in NullFields will be sent to the server as
  2580. // null. It is an error if a field in this list has a non-empty value.
  2581. // This may be used to include null fields in Patch requests.
  2582. NullFields []string `json:"-"`
  2583. }
  2584. func (s *UserProfile) MarshalJSON() ([]byte, error) {
  2585. type NoMethod UserProfile
  2586. raw := NoMethod(*s)
  2587. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2588. }
  2589. // YouTubeVideo: YouTube video item.
  2590. type YouTubeVideo struct {
  2591. // AlternateLink: URL that can be used to view the YouTube
  2592. // video.
  2593. //
  2594. // Read-only.
  2595. AlternateLink string `json:"alternateLink,omitempty"`
  2596. // Id: YouTube API resource ID.
  2597. Id string `json:"id,omitempty"`
  2598. // ThumbnailUrl: URL of a thumbnail image of the YouTube
  2599. // video.
  2600. //
  2601. // Read-only.
  2602. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  2603. // Title: Title of the YouTube video.
  2604. //
  2605. // Read-only.
  2606. Title string `json:"title,omitempty"`
  2607. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  2608. // unconditionally include in API requests. By default, fields with
  2609. // empty values are omitted from API requests. However, any non-pointer,
  2610. // non-interface field appearing in ForceSendFields will be sent to the
  2611. // server regardless of whether the field is empty or not. This may be
  2612. // used to include empty fields in Patch requests.
  2613. ForceSendFields []string `json:"-"`
  2614. // NullFields is a list of field names (e.g. "AlternateLink") to include
  2615. // in API requests with the JSON null value. By default, fields with
  2616. // empty values are omitted from API requests. However, any field with
  2617. // an 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. func (s *YouTubeVideo) MarshalJSON() ([]byte, error) {
  2623. type NoMethod YouTubeVideo
  2624. raw := NoMethod(*s)
  2625. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2626. }
  2627. // method id "classroom.courses.create":
  2628. type CoursesCreateCall struct {
  2629. s *Service
  2630. course *Course
  2631. urlParams_ gensupport.URLParams
  2632. ctx_ context.Context
  2633. header_ http.Header
  2634. }
  2635. // Create: Creates a course.
  2636. //
  2637. // The user specified in `ownerId` is the owner of the created
  2638. // course
  2639. // and added as a teacher.
  2640. //
  2641. // This method returns the following error codes:
  2642. //
  2643. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  2644. // create
  2645. // courses or for access errors.
  2646. // * `NOT_FOUND` if the primary teacher is not a valid user.
  2647. // * `FAILED_PRECONDITION` if the course owner's account is disabled or
  2648. // for
  2649. // the following request errors:
  2650. // * UserGroupsMembershipLimitReached
  2651. // * `ALREADY_EXISTS` if an alias was specified in the `id` and
  2652. // already exists.
  2653. func (r *CoursesService) Create(course *Course) *CoursesCreateCall {
  2654. c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2655. c.course = course
  2656. return c
  2657. }
  2658. // Fields allows partial responses to be retrieved. See
  2659. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2660. // for more information.
  2661. func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall {
  2662. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2663. return c
  2664. }
  2665. // Context sets the context to be used in this call's Do method. Any
  2666. // pending HTTP request will be aborted if the provided context is
  2667. // canceled.
  2668. func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall {
  2669. c.ctx_ = ctx
  2670. return c
  2671. }
  2672. // Header returns an http.Header that can be modified by the caller to
  2673. // add HTTP headers to the request.
  2674. func (c *CoursesCreateCall) Header() http.Header {
  2675. if c.header_ == nil {
  2676. c.header_ = make(http.Header)
  2677. }
  2678. return c.header_
  2679. }
  2680. func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) {
  2681. reqHeaders := make(http.Header)
  2682. for k, v := range c.header_ {
  2683. reqHeaders[k] = v
  2684. }
  2685. reqHeaders.Set("User-Agent", c.s.userAgent())
  2686. var body io.Reader = nil
  2687. body, err := googleapi.WithoutDataWrapper.JSONReader(c.course)
  2688. if err != nil {
  2689. return nil, err
  2690. }
  2691. reqHeaders.Set("Content-Type", "application/json")
  2692. c.urlParams_.Set("alt", alt)
  2693. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses")
  2694. urls += "?" + c.urlParams_.Encode()
  2695. req, _ := http.NewRequest("POST", urls, body)
  2696. req.Header = reqHeaders
  2697. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2698. }
  2699. // Do executes the "classroom.courses.create" call.
  2700. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  2701. // code is an error. Response headers are in either
  2702. // *Course.ServerResponse.Header or (if a response was returned at all)
  2703. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2704. // check whether the returned error was because http.StatusNotModified
  2705. // was returned.
  2706. func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  2707. gensupport.SetOptions(c.urlParams_, opts...)
  2708. res, err := c.doRequest("json")
  2709. if res != nil && res.StatusCode == http.StatusNotModified {
  2710. if res.Body != nil {
  2711. res.Body.Close()
  2712. }
  2713. return nil, &googleapi.Error{
  2714. Code: res.StatusCode,
  2715. Header: res.Header,
  2716. }
  2717. }
  2718. if err != nil {
  2719. return nil, err
  2720. }
  2721. defer googleapi.CloseBody(res)
  2722. if err := googleapi.CheckResponse(res); err != nil {
  2723. return nil, err
  2724. }
  2725. ret := &Course{
  2726. ServerResponse: googleapi.ServerResponse{
  2727. Header: res.Header,
  2728. HTTPStatusCode: res.StatusCode,
  2729. },
  2730. }
  2731. target := &ret
  2732. if err := gensupport.DecodeResponse(target, res); err != nil {
  2733. return nil, err
  2734. }
  2735. return ret, nil
  2736. // {
  2737. // "description": "Creates a course.\n\nThe user specified in `ownerId` is the owner of the created course\nand added as a teacher.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\ncourses or for access errors.\n* `NOT_FOUND` if the primary teacher is not a valid user.\n* `FAILED_PRECONDITION` if the course owner's account is disabled or for\nthe following request errors:\n * UserGroupsMembershipLimitReached\n* `ALREADY_EXISTS` if an alias was specified in the `id` and\nalready exists.",
  2738. // "flatPath": "v1/courses",
  2739. // "httpMethod": "POST",
  2740. // "id": "classroom.courses.create",
  2741. // "parameterOrder": [],
  2742. // "parameters": {},
  2743. // "path": "v1/courses",
  2744. // "request": {
  2745. // "$ref": "Course"
  2746. // },
  2747. // "response": {
  2748. // "$ref": "Course"
  2749. // },
  2750. // "scopes": [
  2751. // "https://www.googleapis.com/auth/classroom.courses"
  2752. // ]
  2753. // }
  2754. }
  2755. // method id "classroom.courses.delete":
  2756. type CoursesDeleteCall struct {
  2757. s *Service
  2758. id string
  2759. urlParams_ gensupport.URLParams
  2760. ctx_ context.Context
  2761. header_ http.Header
  2762. }
  2763. // Delete: Deletes a course.
  2764. //
  2765. // This method returns the following error codes:
  2766. //
  2767. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  2768. // delete the
  2769. // requested course or for access errors.
  2770. // * `NOT_FOUND` if no course exists with the requested ID.
  2771. func (r *CoursesService) Delete(id string) *CoursesDeleteCall {
  2772. c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2773. c.id = id
  2774. return c
  2775. }
  2776. // Fields allows partial responses to be retrieved. See
  2777. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2778. // for more information.
  2779. func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall {
  2780. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2781. return c
  2782. }
  2783. // Context sets the context to be used in this call's Do method. Any
  2784. // pending HTTP request will be aborted if the provided context is
  2785. // canceled.
  2786. func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall {
  2787. c.ctx_ = ctx
  2788. return c
  2789. }
  2790. // Header returns an http.Header that can be modified by the caller to
  2791. // add HTTP headers to the request.
  2792. func (c *CoursesDeleteCall) Header() http.Header {
  2793. if c.header_ == nil {
  2794. c.header_ = make(http.Header)
  2795. }
  2796. return c.header_
  2797. }
  2798. func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2799. reqHeaders := make(http.Header)
  2800. for k, v := range c.header_ {
  2801. reqHeaders[k] = v
  2802. }
  2803. reqHeaders.Set("User-Agent", c.s.userAgent())
  2804. var body io.Reader = nil
  2805. c.urlParams_.Set("alt", alt)
  2806. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  2807. urls += "?" + c.urlParams_.Encode()
  2808. req, _ := http.NewRequest("DELETE", urls, body)
  2809. req.Header = reqHeaders
  2810. googleapi.Expand(req.URL, map[string]string{
  2811. "id": c.id,
  2812. })
  2813. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2814. }
  2815. // Do executes the "classroom.courses.delete" call.
  2816. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2817. // code is an error. Response headers are in either
  2818. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2819. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2820. // check whether the returned error was because http.StatusNotModified
  2821. // was returned.
  2822. func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2823. gensupport.SetOptions(c.urlParams_, opts...)
  2824. res, err := c.doRequest("json")
  2825. if res != nil && res.StatusCode == http.StatusNotModified {
  2826. if res.Body != nil {
  2827. res.Body.Close()
  2828. }
  2829. return nil, &googleapi.Error{
  2830. Code: res.StatusCode,
  2831. Header: res.Header,
  2832. }
  2833. }
  2834. if err != nil {
  2835. return nil, err
  2836. }
  2837. defer googleapi.CloseBody(res)
  2838. if err := googleapi.CheckResponse(res); err != nil {
  2839. return nil, err
  2840. }
  2841. ret := &Empty{
  2842. ServerResponse: googleapi.ServerResponse{
  2843. Header: res.Header,
  2844. HTTPStatusCode: res.StatusCode,
  2845. },
  2846. }
  2847. target := &ret
  2848. if err := gensupport.DecodeResponse(target, res); err != nil {
  2849. return nil, err
  2850. }
  2851. return ret, nil
  2852. // {
  2853. // "description": "Deletes a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.",
  2854. // "flatPath": "v1/courses/{id}",
  2855. // "httpMethod": "DELETE",
  2856. // "id": "classroom.courses.delete",
  2857. // "parameterOrder": [
  2858. // "id"
  2859. // ],
  2860. // "parameters": {
  2861. // "id": {
  2862. // "description": "Identifier of the course to delete.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  2863. // "location": "path",
  2864. // "required": true,
  2865. // "type": "string"
  2866. // }
  2867. // },
  2868. // "path": "v1/courses/{id}",
  2869. // "response": {
  2870. // "$ref": "Empty"
  2871. // },
  2872. // "scopes": [
  2873. // "https://www.googleapis.com/auth/classroom.courses"
  2874. // ]
  2875. // }
  2876. }
  2877. // method id "classroom.courses.get":
  2878. type CoursesGetCall struct {
  2879. s *Service
  2880. id string
  2881. urlParams_ gensupport.URLParams
  2882. ifNoneMatch_ string
  2883. ctx_ context.Context
  2884. header_ http.Header
  2885. }
  2886. // Get: Returns a course.
  2887. //
  2888. // This method returns the following error codes:
  2889. //
  2890. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  2891. // access the
  2892. // requested course or for access errors.
  2893. // * `NOT_FOUND` if no course exists with the requested ID.
  2894. func (r *CoursesService) Get(id string) *CoursesGetCall {
  2895. c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2896. c.id = id
  2897. return c
  2898. }
  2899. // Fields allows partial responses to be retrieved. See
  2900. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2901. // for more information.
  2902. func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall {
  2903. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2904. return c
  2905. }
  2906. // IfNoneMatch sets the optional parameter which makes the operation
  2907. // fail if the object's ETag matches the given value. This is useful for
  2908. // getting updates only after the object has changed since the last
  2909. // request. Use googleapi.IsNotModified to check whether the response
  2910. // error from Do is the result of In-None-Match.
  2911. func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall {
  2912. c.ifNoneMatch_ = entityTag
  2913. return c
  2914. }
  2915. // Context sets the context to be used in this call's Do method. Any
  2916. // pending HTTP request will be aborted if the provided context is
  2917. // canceled.
  2918. func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall {
  2919. c.ctx_ = ctx
  2920. return c
  2921. }
  2922. // Header returns an http.Header that can be modified by the caller to
  2923. // add HTTP headers to the request.
  2924. func (c *CoursesGetCall) Header() http.Header {
  2925. if c.header_ == nil {
  2926. c.header_ = make(http.Header)
  2927. }
  2928. return c.header_
  2929. }
  2930. func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) {
  2931. reqHeaders := make(http.Header)
  2932. for k, v := range c.header_ {
  2933. reqHeaders[k] = v
  2934. }
  2935. reqHeaders.Set("User-Agent", c.s.userAgent())
  2936. if c.ifNoneMatch_ != "" {
  2937. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2938. }
  2939. var body io.Reader = nil
  2940. c.urlParams_.Set("alt", alt)
  2941. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  2942. urls += "?" + c.urlParams_.Encode()
  2943. req, _ := http.NewRequest("GET", urls, body)
  2944. req.Header = reqHeaders
  2945. googleapi.Expand(req.URL, map[string]string{
  2946. "id": c.id,
  2947. })
  2948. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2949. }
  2950. // Do executes the "classroom.courses.get" call.
  2951. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  2952. // code is an error. Response headers are in either
  2953. // *Course.ServerResponse.Header or (if a response was returned at all)
  2954. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2955. // check whether the returned error was because http.StatusNotModified
  2956. // was returned.
  2957. func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  2958. gensupport.SetOptions(c.urlParams_, opts...)
  2959. res, err := c.doRequest("json")
  2960. if res != nil && res.StatusCode == http.StatusNotModified {
  2961. if res.Body != nil {
  2962. res.Body.Close()
  2963. }
  2964. return nil, &googleapi.Error{
  2965. Code: res.StatusCode,
  2966. Header: res.Header,
  2967. }
  2968. }
  2969. if err != nil {
  2970. return nil, err
  2971. }
  2972. defer googleapi.CloseBody(res)
  2973. if err := googleapi.CheckResponse(res); err != nil {
  2974. return nil, err
  2975. }
  2976. ret := &Course{
  2977. ServerResponse: googleapi.ServerResponse{
  2978. Header: res.Header,
  2979. HTTPStatusCode: res.StatusCode,
  2980. },
  2981. }
  2982. target := &ret
  2983. if err := gensupport.DecodeResponse(target, res); err != nil {
  2984. return nil, err
  2985. }
  2986. return ret, nil
  2987. // {
  2988. // "description": "Returns a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.",
  2989. // "flatPath": "v1/courses/{id}",
  2990. // "httpMethod": "GET",
  2991. // "id": "classroom.courses.get",
  2992. // "parameterOrder": [
  2993. // "id"
  2994. // ],
  2995. // "parameters": {
  2996. // "id": {
  2997. // "description": "Identifier of the course to return.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  2998. // "location": "path",
  2999. // "required": true,
  3000. // "type": "string"
  3001. // }
  3002. // },
  3003. // "path": "v1/courses/{id}",
  3004. // "response": {
  3005. // "$ref": "Course"
  3006. // },
  3007. // "scopes": [
  3008. // "https://www.googleapis.com/auth/classroom.courses",
  3009. // "https://www.googleapis.com/auth/classroom.courses.readonly"
  3010. // ]
  3011. // }
  3012. }
  3013. // method id "classroom.courses.list":
  3014. type CoursesListCall struct {
  3015. s *Service
  3016. urlParams_ gensupport.URLParams
  3017. ifNoneMatch_ string
  3018. ctx_ context.Context
  3019. header_ http.Header
  3020. }
  3021. // List: Returns a list of courses that the requesting user is permitted
  3022. // to view,
  3023. // restricted to those that match the request. Returned courses are
  3024. // ordered by
  3025. // creation time, with the most recently created coming first.
  3026. //
  3027. // This method returns the following error codes:
  3028. //
  3029. // * `PERMISSION_DENIED` for access errors.
  3030. // * `INVALID_ARGUMENT` if the query argument is malformed.
  3031. // * `NOT_FOUND` if any users specified in the query arguments do not
  3032. // exist.
  3033. func (r *CoursesService) List() *CoursesListCall {
  3034. c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3035. return c
  3036. }
  3037. // CourseStates sets the optional parameter "courseStates": Restricts
  3038. // returned courses to those in one of the specified states
  3039. // The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.
  3040. //
  3041. // Possible values:
  3042. // "COURSE_STATE_UNSPECIFIED"
  3043. // "ACTIVE"
  3044. // "ARCHIVED"
  3045. // "PROVISIONED"
  3046. // "DECLINED"
  3047. // "SUSPENDED"
  3048. func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall {
  3049. c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...))
  3050. return c
  3051. }
  3052. // PageSize sets the optional parameter "pageSize": Maximum number of
  3053. // items to return. Zero or unspecified indicates that the
  3054. // server may assign a maximum.
  3055. //
  3056. // The server may return fewer than the specified number of results.
  3057. func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall {
  3058. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3059. return c
  3060. }
  3061. // PageToken sets the optional parameter "pageToken":
  3062. // nextPageToken
  3063. // value returned from a previous
  3064. // list call,
  3065. // indicating that the subsequent page of results should be
  3066. // returned.
  3067. //
  3068. // The list request must be
  3069. // otherwise identical to the one that resulted in this token.
  3070. func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall {
  3071. c.urlParams_.Set("pageToken", pageToken)
  3072. return c
  3073. }
  3074. // StudentId sets the optional parameter "studentId": Restricts returned
  3075. // courses to those having a student with the specified
  3076. // identifier. The identifier can be one of the following:
  3077. //
  3078. // * the numeric identifier for the user
  3079. // * the email address of the user
  3080. // * the string literal "me", indicating the requesting user
  3081. func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall {
  3082. c.urlParams_.Set("studentId", studentId)
  3083. return c
  3084. }
  3085. // TeacherId sets the optional parameter "teacherId": Restricts returned
  3086. // courses to those having a teacher with the specified
  3087. // identifier. The identifier can be one of the following:
  3088. //
  3089. // * the numeric identifier for the user
  3090. // * the email address of the user
  3091. // * the string literal "me", indicating the requesting user
  3092. func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall {
  3093. c.urlParams_.Set("teacherId", teacherId)
  3094. return c
  3095. }
  3096. // Fields allows partial responses to be retrieved. See
  3097. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3098. // for more information.
  3099. func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall {
  3100. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3101. return c
  3102. }
  3103. // IfNoneMatch sets the optional parameter which makes the operation
  3104. // fail if the object's ETag matches the given value. This is useful for
  3105. // getting updates only after the object has changed since the last
  3106. // request. Use googleapi.IsNotModified to check whether the response
  3107. // error from Do is the result of In-None-Match.
  3108. func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall {
  3109. c.ifNoneMatch_ = entityTag
  3110. return c
  3111. }
  3112. // Context sets the context to be used in this call's Do method. Any
  3113. // pending HTTP request will be aborted if the provided context is
  3114. // canceled.
  3115. func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall {
  3116. c.ctx_ = ctx
  3117. return c
  3118. }
  3119. // Header returns an http.Header that can be modified by the caller to
  3120. // add HTTP headers to the request.
  3121. func (c *CoursesListCall) Header() http.Header {
  3122. if c.header_ == nil {
  3123. c.header_ = make(http.Header)
  3124. }
  3125. return c.header_
  3126. }
  3127. func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) {
  3128. reqHeaders := make(http.Header)
  3129. for k, v := range c.header_ {
  3130. reqHeaders[k] = v
  3131. }
  3132. reqHeaders.Set("User-Agent", c.s.userAgent())
  3133. if c.ifNoneMatch_ != "" {
  3134. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3135. }
  3136. var body io.Reader = nil
  3137. c.urlParams_.Set("alt", alt)
  3138. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses")
  3139. urls += "?" + c.urlParams_.Encode()
  3140. req, _ := http.NewRequest("GET", urls, body)
  3141. req.Header = reqHeaders
  3142. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3143. }
  3144. // Do executes the "classroom.courses.list" call.
  3145. // Exactly one of *ListCoursesResponse or error will be non-nil. Any
  3146. // non-2xx status code is an error. Response headers are in either
  3147. // *ListCoursesResponse.ServerResponse.Header or (if a response was
  3148. // returned at all) in error.(*googleapi.Error).Header. Use
  3149. // googleapi.IsNotModified to check whether the returned error was
  3150. // because http.StatusNotModified was returned.
  3151. func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) {
  3152. gensupport.SetOptions(c.urlParams_, opts...)
  3153. res, err := c.doRequest("json")
  3154. if res != nil && res.StatusCode == http.StatusNotModified {
  3155. if res.Body != nil {
  3156. res.Body.Close()
  3157. }
  3158. return nil, &googleapi.Error{
  3159. Code: res.StatusCode,
  3160. Header: res.Header,
  3161. }
  3162. }
  3163. if err != nil {
  3164. return nil, err
  3165. }
  3166. defer googleapi.CloseBody(res)
  3167. if err := googleapi.CheckResponse(res); err != nil {
  3168. return nil, err
  3169. }
  3170. ret := &ListCoursesResponse{
  3171. ServerResponse: googleapi.ServerResponse{
  3172. Header: res.Header,
  3173. HTTPStatusCode: res.StatusCode,
  3174. },
  3175. }
  3176. target := &ret
  3177. if err := gensupport.DecodeResponse(target, res); err != nil {
  3178. return nil, err
  3179. }
  3180. return ret, nil
  3181. // {
  3182. // "description": "Returns a list of courses that the requesting user is permitted to view,\nrestricted to those that match the request. Returned courses are ordered by\ncreation time, with the most recently created coming first.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` for access errors.\n* `INVALID_ARGUMENT` if the query argument is malformed.\n* `NOT_FOUND` if any users specified in the query arguments do not exist.",
  3183. // "flatPath": "v1/courses",
  3184. // "httpMethod": "GET",
  3185. // "id": "classroom.courses.list",
  3186. // "parameterOrder": [],
  3187. // "parameters": {
  3188. // "courseStates": {
  3189. // "description": "Restricts returned courses to those in one of the specified states\nThe default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.",
  3190. // "enum": [
  3191. // "COURSE_STATE_UNSPECIFIED",
  3192. // "ACTIVE",
  3193. // "ARCHIVED",
  3194. // "PROVISIONED",
  3195. // "DECLINED",
  3196. // "SUSPENDED"
  3197. // ],
  3198. // "location": "query",
  3199. // "repeated": true,
  3200. // "type": "string"
  3201. // },
  3202. // "pageSize": {
  3203. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  3204. // "format": "int32",
  3205. // "location": "query",
  3206. // "type": "integer"
  3207. // },
  3208. // "pageToken": {
  3209. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.",
  3210. // "location": "query",
  3211. // "type": "string"
  3212. // },
  3213. // "studentId": {
  3214. // "description": "Restricts returned courses to those having a student with the specified\nidentifier. The identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  3215. // "location": "query",
  3216. // "type": "string"
  3217. // },
  3218. // "teacherId": {
  3219. // "description": "Restricts returned courses to those having a teacher with the specified\nidentifier. The identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  3220. // "location": "query",
  3221. // "type": "string"
  3222. // }
  3223. // },
  3224. // "path": "v1/courses",
  3225. // "response": {
  3226. // "$ref": "ListCoursesResponse"
  3227. // },
  3228. // "scopes": [
  3229. // "https://www.googleapis.com/auth/classroom.courses",
  3230. // "https://www.googleapis.com/auth/classroom.courses.readonly"
  3231. // ]
  3232. // }
  3233. }
  3234. // Pages invokes f for each page of results.
  3235. // A non-nil error returned from f will halt the iteration.
  3236. // The provided context supersedes any context provided to the Context method.
  3237. func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error {
  3238. c.ctx_ = ctx
  3239. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3240. for {
  3241. x, err := c.Do()
  3242. if err != nil {
  3243. return err
  3244. }
  3245. if err := f(x); err != nil {
  3246. return err
  3247. }
  3248. if x.NextPageToken == "" {
  3249. return nil
  3250. }
  3251. c.PageToken(x.NextPageToken)
  3252. }
  3253. }
  3254. // method id "classroom.courses.patch":
  3255. type CoursesPatchCall struct {
  3256. s *Service
  3257. id string
  3258. course *Course
  3259. urlParams_ gensupport.URLParams
  3260. ctx_ context.Context
  3261. header_ http.Header
  3262. }
  3263. // Patch: Updates one or more fields in a course.
  3264. //
  3265. // This method returns the following error codes:
  3266. //
  3267. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3268. // modify the
  3269. // requested course or for access errors.
  3270. // * `NOT_FOUND` if no course exists with the requested ID.
  3271. // * `INVALID_ARGUMENT` if invalid fields are specified in the update
  3272. // mask or
  3273. // if no update mask is supplied.
  3274. // * `FAILED_PRECONDITION` for the following request errors:
  3275. // * CourseNotModifiable
  3276. func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall {
  3277. c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3278. c.id = id
  3279. c.course = course
  3280. return c
  3281. }
  3282. // UpdateMask sets the optional parameter "updateMask": Mask that
  3283. // identifies which fields on the course to update.
  3284. // This field is required to do an update. The update will fail if
  3285. // invalid
  3286. // fields are specified. The following fields are valid:
  3287. //
  3288. // * `name`
  3289. // * `section`
  3290. // * `descriptionHeading`
  3291. // * `description`
  3292. // * `room`
  3293. // * `courseState`
  3294. // * `ownerId`
  3295. //
  3296. // Note: patches to ownerId are treated as being effective immediately,
  3297. // but in
  3298. // practice it may take some time for the ownership transfer of all
  3299. // affected
  3300. // resources to complete.
  3301. //
  3302. // When set in a query parameter, this field should be specified
  3303. // as
  3304. //
  3305. // `updateMask=<field1>,<field2>,...`
  3306. func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall {
  3307. c.urlParams_.Set("updateMask", updateMask)
  3308. return c
  3309. }
  3310. // Fields allows partial responses to be retrieved. See
  3311. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3312. // for more information.
  3313. func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall {
  3314. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3315. return c
  3316. }
  3317. // Context sets the context to be used in this call's Do method. Any
  3318. // pending HTTP request will be aborted if the provided context is
  3319. // canceled.
  3320. func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall {
  3321. c.ctx_ = ctx
  3322. return c
  3323. }
  3324. // Header returns an http.Header that can be modified by the caller to
  3325. // add HTTP headers to the request.
  3326. func (c *CoursesPatchCall) Header() http.Header {
  3327. if c.header_ == nil {
  3328. c.header_ = make(http.Header)
  3329. }
  3330. return c.header_
  3331. }
  3332. func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) {
  3333. reqHeaders := make(http.Header)
  3334. for k, v := range c.header_ {
  3335. reqHeaders[k] = v
  3336. }
  3337. reqHeaders.Set("User-Agent", c.s.userAgent())
  3338. var body io.Reader = nil
  3339. body, err := googleapi.WithoutDataWrapper.JSONReader(c.course)
  3340. if err != nil {
  3341. return nil, err
  3342. }
  3343. reqHeaders.Set("Content-Type", "application/json")
  3344. c.urlParams_.Set("alt", alt)
  3345. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  3346. urls += "?" + c.urlParams_.Encode()
  3347. req, _ := http.NewRequest("PATCH", urls, body)
  3348. req.Header = reqHeaders
  3349. googleapi.Expand(req.URL, map[string]string{
  3350. "id": c.id,
  3351. })
  3352. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3353. }
  3354. // Do executes the "classroom.courses.patch" call.
  3355. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  3356. // code is an error. Response headers are in either
  3357. // *Course.ServerResponse.Header or (if a response was returned at all)
  3358. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3359. // check whether the returned error was because http.StatusNotModified
  3360. // was returned.
  3361. func (c *CoursesPatchCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  3362. gensupport.SetOptions(c.urlParams_, opts...)
  3363. res, err := c.doRequest("json")
  3364. if res != nil && res.StatusCode == http.StatusNotModified {
  3365. if res.Body != nil {
  3366. res.Body.Close()
  3367. }
  3368. return nil, &googleapi.Error{
  3369. Code: res.StatusCode,
  3370. Header: res.Header,
  3371. }
  3372. }
  3373. if err != nil {
  3374. return nil, err
  3375. }
  3376. defer googleapi.CloseBody(res)
  3377. if err := googleapi.CheckResponse(res); err != nil {
  3378. return nil, err
  3379. }
  3380. ret := &Course{
  3381. ServerResponse: googleapi.ServerResponse{
  3382. Header: res.Header,
  3383. HTTPStatusCode: res.StatusCode,
  3384. },
  3385. }
  3386. target := &ret
  3387. if err := gensupport.DecodeResponse(target, res); err != nil {
  3388. return nil, err
  3389. }
  3390. return ret, nil
  3391. // {
  3392. // "description": "Updates one or more fields in a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to modify the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.\n* `INVALID_ARGUMENT` if invalid fields are specified in the update mask or\nif no update mask is supplied.\n* `FAILED_PRECONDITION` for the following request errors:\n * CourseNotModifiable",
  3393. // "flatPath": "v1/courses/{id}",
  3394. // "httpMethod": "PATCH",
  3395. // "id": "classroom.courses.patch",
  3396. // "parameterOrder": [
  3397. // "id"
  3398. // ],
  3399. // "parameters": {
  3400. // "id": {
  3401. // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3402. // "location": "path",
  3403. // "required": true,
  3404. // "type": "string"
  3405. // },
  3406. // "updateMask": {
  3407. // "description": "Mask that identifies which fields on the course to update.\nThis field is required to do an update. The update will fail if invalid\nfields are specified. The following fields are valid:\n\n* `name`\n* `section`\n* `descriptionHeading`\n* `description`\n* `room`\n* `courseState`\n* `ownerId`\n\nNote: patches to ownerId are treated as being effective immediately, but in\npractice it may take some time for the ownership transfer of all affected\nresources to complete.\n\nWhen set in a query parameter, this field should be specified as\n\n`updateMask=\u003cfield1\u003e,\u003cfield2\u003e,...`",
  3408. // "format": "google-fieldmask",
  3409. // "location": "query",
  3410. // "type": "string"
  3411. // }
  3412. // },
  3413. // "path": "v1/courses/{id}",
  3414. // "request": {
  3415. // "$ref": "Course"
  3416. // },
  3417. // "response": {
  3418. // "$ref": "Course"
  3419. // },
  3420. // "scopes": [
  3421. // "https://www.googleapis.com/auth/classroom.courses"
  3422. // ]
  3423. // }
  3424. }
  3425. // method id "classroom.courses.update":
  3426. type CoursesUpdateCall struct {
  3427. s *Service
  3428. id string
  3429. course *Course
  3430. urlParams_ gensupport.URLParams
  3431. ctx_ context.Context
  3432. header_ http.Header
  3433. }
  3434. // Update: Updates a course.
  3435. //
  3436. // This method returns the following error codes:
  3437. //
  3438. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3439. // modify the
  3440. // requested course or for access errors.
  3441. // * `NOT_FOUND` if no course exists with the requested ID.
  3442. // * `FAILED_PRECONDITION` for the following request errors:
  3443. // * CourseNotModifiable
  3444. func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall {
  3445. c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3446. c.id = id
  3447. c.course = course
  3448. return c
  3449. }
  3450. // Fields allows partial responses to be retrieved. See
  3451. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3452. // for more information.
  3453. func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall {
  3454. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3455. return c
  3456. }
  3457. // Context sets the context to be used in this call's Do method. Any
  3458. // pending HTTP request will be aborted if the provided context is
  3459. // canceled.
  3460. func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall {
  3461. c.ctx_ = ctx
  3462. return c
  3463. }
  3464. // Header returns an http.Header that can be modified by the caller to
  3465. // add HTTP headers to the request.
  3466. func (c *CoursesUpdateCall) Header() http.Header {
  3467. if c.header_ == nil {
  3468. c.header_ = make(http.Header)
  3469. }
  3470. return c.header_
  3471. }
  3472. func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) {
  3473. reqHeaders := make(http.Header)
  3474. for k, v := range c.header_ {
  3475. reqHeaders[k] = v
  3476. }
  3477. reqHeaders.Set("User-Agent", c.s.userAgent())
  3478. var body io.Reader = nil
  3479. body, err := googleapi.WithoutDataWrapper.JSONReader(c.course)
  3480. if err != nil {
  3481. return nil, err
  3482. }
  3483. reqHeaders.Set("Content-Type", "application/json")
  3484. c.urlParams_.Set("alt", alt)
  3485. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  3486. urls += "?" + c.urlParams_.Encode()
  3487. req, _ := http.NewRequest("PUT", urls, body)
  3488. req.Header = reqHeaders
  3489. googleapi.Expand(req.URL, map[string]string{
  3490. "id": c.id,
  3491. })
  3492. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3493. }
  3494. // Do executes the "classroom.courses.update" call.
  3495. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  3496. // code is an error. Response headers are in either
  3497. // *Course.ServerResponse.Header or (if a response was returned at all)
  3498. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3499. // check whether the returned error was because http.StatusNotModified
  3500. // was returned.
  3501. func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  3502. gensupport.SetOptions(c.urlParams_, opts...)
  3503. res, err := c.doRequest("json")
  3504. if res != nil && res.StatusCode == http.StatusNotModified {
  3505. if res.Body != nil {
  3506. res.Body.Close()
  3507. }
  3508. return nil, &googleapi.Error{
  3509. Code: res.StatusCode,
  3510. Header: res.Header,
  3511. }
  3512. }
  3513. if err != nil {
  3514. return nil, err
  3515. }
  3516. defer googleapi.CloseBody(res)
  3517. if err := googleapi.CheckResponse(res); err != nil {
  3518. return nil, err
  3519. }
  3520. ret := &Course{
  3521. ServerResponse: googleapi.ServerResponse{
  3522. Header: res.Header,
  3523. HTTPStatusCode: res.StatusCode,
  3524. },
  3525. }
  3526. target := &ret
  3527. if err := gensupport.DecodeResponse(target, res); err != nil {
  3528. return nil, err
  3529. }
  3530. return ret, nil
  3531. // {
  3532. // "description": "Updates a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to modify the\nrequested course or for access errors.\n* `NOT_FOUND` if no course exists with the requested ID.\n* `FAILED_PRECONDITION` for the following request errors:\n * CourseNotModifiable",
  3533. // "flatPath": "v1/courses/{id}",
  3534. // "httpMethod": "PUT",
  3535. // "id": "classroom.courses.update",
  3536. // "parameterOrder": [
  3537. // "id"
  3538. // ],
  3539. // "parameters": {
  3540. // "id": {
  3541. // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3542. // "location": "path",
  3543. // "required": true,
  3544. // "type": "string"
  3545. // }
  3546. // },
  3547. // "path": "v1/courses/{id}",
  3548. // "request": {
  3549. // "$ref": "Course"
  3550. // },
  3551. // "response": {
  3552. // "$ref": "Course"
  3553. // },
  3554. // "scopes": [
  3555. // "https://www.googleapis.com/auth/classroom.courses"
  3556. // ]
  3557. // }
  3558. }
  3559. // method id "classroom.courses.aliases.create":
  3560. type CoursesAliasesCreateCall struct {
  3561. s *Service
  3562. courseId string
  3563. coursealias *CourseAlias
  3564. urlParams_ gensupport.URLParams
  3565. ctx_ context.Context
  3566. header_ http.Header
  3567. }
  3568. // Create: Creates an alias for a course.
  3569. //
  3570. // This method returns the following error codes:
  3571. //
  3572. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3573. // create the
  3574. // alias or for access errors.
  3575. // * `NOT_FOUND` if the course does not exist.
  3576. // * `ALREADY_EXISTS` if the alias already exists.
  3577. // * `FAILED_PRECONDITION` if the alias requested does not make sense
  3578. // for the
  3579. // requesting user or course (for example, if a user not in a domain
  3580. // attempts to access a domain-scoped alias).
  3581. func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall {
  3582. c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3583. c.courseId = courseId
  3584. c.coursealias = coursealias
  3585. return c
  3586. }
  3587. // Fields allows partial responses to be retrieved. See
  3588. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3589. // for more information.
  3590. func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall {
  3591. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3592. return c
  3593. }
  3594. // Context sets the context to be used in this call's Do method. Any
  3595. // pending HTTP request will be aborted if the provided context is
  3596. // canceled.
  3597. func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall {
  3598. c.ctx_ = ctx
  3599. return c
  3600. }
  3601. // Header returns an http.Header that can be modified by the caller to
  3602. // add HTTP headers to the request.
  3603. func (c *CoursesAliasesCreateCall) Header() http.Header {
  3604. if c.header_ == nil {
  3605. c.header_ = make(http.Header)
  3606. }
  3607. return c.header_
  3608. }
  3609. func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) {
  3610. reqHeaders := make(http.Header)
  3611. for k, v := range c.header_ {
  3612. reqHeaders[k] = v
  3613. }
  3614. reqHeaders.Set("User-Agent", c.s.userAgent())
  3615. var body io.Reader = nil
  3616. body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias)
  3617. if err != nil {
  3618. return nil, err
  3619. }
  3620. reqHeaders.Set("Content-Type", "application/json")
  3621. c.urlParams_.Set("alt", alt)
  3622. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases")
  3623. urls += "?" + c.urlParams_.Encode()
  3624. req, _ := http.NewRequest("POST", urls, body)
  3625. req.Header = reqHeaders
  3626. googleapi.Expand(req.URL, map[string]string{
  3627. "courseId": c.courseId,
  3628. })
  3629. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3630. }
  3631. // Do executes the "classroom.courses.aliases.create" call.
  3632. // Exactly one of *CourseAlias or error will be non-nil. Any non-2xx
  3633. // status code is an error. Response headers are in either
  3634. // *CourseAlias.ServerResponse.Header or (if a response was returned at
  3635. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3636. // to check whether the returned error was because
  3637. // http.StatusNotModified was returned.
  3638. func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) {
  3639. gensupport.SetOptions(c.urlParams_, opts...)
  3640. res, err := c.doRequest("json")
  3641. if res != nil && res.StatusCode == http.StatusNotModified {
  3642. if res.Body != nil {
  3643. res.Body.Close()
  3644. }
  3645. return nil, &googleapi.Error{
  3646. Code: res.StatusCode,
  3647. Header: res.Header,
  3648. }
  3649. }
  3650. if err != nil {
  3651. return nil, err
  3652. }
  3653. defer googleapi.CloseBody(res)
  3654. if err := googleapi.CheckResponse(res); err != nil {
  3655. return nil, err
  3656. }
  3657. ret := &CourseAlias{
  3658. ServerResponse: googleapi.ServerResponse{
  3659. Header: res.Header,
  3660. HTTPStatusCode: res.StatusCode,
  3661. },
  3662. }
  3663. target := &ret
  3664. if err := gensupport.DecodeResponse(target, res); err != nil {
  3665. return nil, err
  3666. }
  3667. return ret, nil
  3668. // {
  3669. // "description": "Creates an alias for a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create the\nalias or for access errors.\n* `NOT_FOUND` if the course does not exist.\n* `ALREADY_EXISTS` if the alias already exists.\n* `FAILED_PRECONDITION` if the alias requested does not make sense for the\n requesting user or course (for example, if a user not in a domain\n attempts to access a domain-scoped alias).",
  3670. // "flatPath": "v1/courses/{courseId}/aliases",
  3671. // "httpMethod": "POST",
  3672. // "id": "classroom.courses.aliases.create",
  3673. // "parameterOrder": [
  3674. // "courseId"
  3675. // ],
  3676. // "parameters": {
  3677. // "courseId": {
  3678. // "description": "Identifier of the course to alias.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3679. // "location": "path",
  3680. // "required": true,
  3681. // "type": "string"
  3682. // }
  3683. // },
  3684. // "path": "v1/courses/{courseId}/aliases",
  3685. // "request": {
  3686. // "$ref": "CourseAlias"
  3687. // },
  3688. // "response": {
  3689. // "$ref": "CourseAlias"
  3690. // },
  3691. // "scopes": [
  3692. // "https://www.googleapis.com/auth/classroom.courses"
  3693. // ]
  3694. // }
  3695. }
  3696. // method id "classroom.courses.aliases.delete":
  3697. type CoursesAliasesDeleteCall struct {
  3698. s *Service
  3699. courseId string
  3700. aliasid string
  3701. urlParams_ gensupport.URLParams
  3702. ctx_ context.Context
  3703. header_ http.Header
  3704. }
  3705. // Delete: Deletes an alias of a course.
  3706. //
  3707. // This method returns the following error codes:
  3708. //
  3709. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3710. // remove the
  3711. // alias or for access errors.
  3712. // * `NOT_FOUND` if the alias does not exist.
  3713. // * `FAILED_PRECONDITION` if the alias requested does not make sense
  3714. // for the
  3715. // requesting user or course (for example, if a user not in a domain
  3716. // attempts to delete a domain-scoped alias).
  3717. func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall {
  3718. c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3719. c.courseId = courseId
  3720. c.aliasid = aliasid
  3721. return c
  3722. }
  3723. // Fields allows partial responses to be retrieved. See
  3724. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3725. // for more information.
  3726. func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall {
  3727. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3728. return c
  3729. }
  3730. // Context sets the context to be used in this call's Do method. Any
  3731. // pending HTTP request will be aborted if the provided context is
  3732. // canceled.
  3733. func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall {
  3734. c.ctx_ = ctx
  3735. return c
  3736. }
  3737. // Header returns an http.Header that can be modified by the caller to
  3738. // add HTTP headers to the request.
  3739. func (c *CoursesAliasesDeleteCall) Header() http.Header {
  3740. if c.header_ == nil {
  3741. c.header_ = make(http.Header)
  3742. }
  3743. return c.header_
  3744. }
  3745. func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3746. reqHeaders := make(http.Header)
  3747. for k, v := range c.header_ {
  3748. reqHeaders[k] = v
  3749. }
  3750. reqHeaders.Set("User-Agent", c.s.userAgent())
  3751. var body io.Reader = nil
  3752. c.urlParams_.Set("alt", alt)
  3753. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}")
  3754. urls += "?" + c.urlParams_.Encode()
  3755. req, _ := http.NewRequest("DELETE", urls, body)
  3756. req.Header = reqHeaders
  3757. googleapi.Expand(req.URL, map[string]string{
  3758. "courseId": c.courseId,
  3759. "alias": c.aliasid,
  3760. })
  3761. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3762. }
  3763. // Do executes the "classroom.courses.aliases.delete" call.
  3764. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3765. // code is an error. Response headers are in either
  3766. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3767. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3768. // check whether the returned error was because http.StatusNotModified
  3769. // was returned.
  3770. func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3771. gensupport.SetOptions(c.urlParams_, opts...)
  3772. res, err := c.doRequest("json")
  3773. if res != nil && res.StatusCode == http.StatusNotModified {
  3774. if res.Body != nil {
  3775. res.Body.Close()
  3776. }
  3777. return nil, &googleapi.Error{
  3778. Code: res.StatusCode,
  3779. Header: res.Header,
  3780. }
  3781. }
  3782. if err != nil {
  3783. return nil, err
  3784. }
  3785. defer googleapi.CloseBody(res)
  3786. if err := googleapi.CheckResponse(res); err != nil {
  3787. return nil, err
  3788. }
  3789. ret := &Empty{
  3790. ServerResponse: googleapi.ServerResponse{
  3791. Header: res.Header,
  3792. HTTPStatusCode: res.StatusCode,
  3793. },
  3794. }
  3795. target := &ret
  3796. if err := gensupport.DecodeResponse(target, res); err != nil {
  3797. return nil, err
  3798. }
  3799. return ret, nil
  3800. // {
  3801. // "description": "Deletes an alias of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to remove the\nalias or for access errors.\n* `NOT_FOUND` if the alias does not exist.\n* `FAILED_PRECONDITION` if the alias requested does not make sense for the\n requesting user or course (for example, if a user not in a domain\n attempts to delete a domain-scoped alias).",
  3802. // "flatPath": "v1/courses/{courseId}/aliases/{alias}",
  3803. // "httpMethod": "DELETE",
  3804. // "id": "classroom.courses.aliases.delete",
  3805. // "parameterOrder": [
  3806. // "courseId",
  3807. // "alias"
  3808. // ],
  3809. // "parameters": {
  3810. // "alias": {
  3811. // "description": "Alias to delete.\nThis may not be the Classroom-assigned identifier.",
  3812. // "location": "path",
  3813. // "required": true,
  3814. // "type": "string"
  3815. // },
  3816. // "courseId": {
  3817. // "description": "Identifier of the course whose alias should be deleted.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3818. // "location": "path",
  3819. // "required": true,
  3820. // "type": "string"
  3821. // }
  3822. // },
  3823. // "path": "v1/courses/{courseId}/aliases/{alias}",
  3824. // "response": {
  3825. // "$ref": "Empty"
  3826. // },
  3827. // "scopes": [
  3828. // "https://www.googleapis.com/auth/classroom.courses"
  3829. // ]
  3830. // }
  3831. }
  3832. // method id "classroom.courses.aliases.list":
  3833. type CoursesAliasesListCall struct {
  3834. s *Service
  3835. courseId string
  3836. urlParams_ gensupport.URLParams
  3837. ifNoneMatch_ string
  3838. ctx_ context.Context
  3839. header_ http.Header
  3840. }
  3841. // List: Returns a list of aliases for a course.
  3842. //
  3843. // This method returns the following error codes:
  3844. //
  3845. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3846. // access the
  3847. // course or for access errors.
  3848. // * `NOT_FOUND` if the course does not exist.
  3849. func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall {
  3850. c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3851. c.courseId = courseId
  3852. return c
  3853. }
  3854. // PageSize sets the optional parameter "pageSize": Maximum number of
  3855. // items to return. Zero or unspecified indicates that the
  3856. // server may assign a maximum.
  3857. //
  3858. // The server may return fewer than the specified number of results.
  3859. func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall {
  3860. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3861. return c
  3862. }
  3863. // PageToken sets the optional parameter "pageToken":
  3864. // nextPageToken
  3865. // value returned from a previous
  3866. // list call,
  3867. // indicating that the subsequent page of results should be
  3868. // returned.
  3869. //
  3870. // The list request
  3871. // must be otherwise identical to the one that resulted in this token.
  3872. func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall {
  3873. c.urlParams_.Set("pageToken", pageToken)
  3874. return c
  3875. }
  3876. // Fields allows partial responses to be retrieved. See
  3877. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3878. // for more information.
  3879. func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall {
  3880. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3881. return c
  3882. }
  3883. // IfNoneMatch sets the optional parameter which makes the operation
  3884. // fail if the object's ETag matches the given value. This is useful for
  3885. // getting updates only after the object has changed since the last
  3886. // request. Use googleapi.IsNotModified to check whether the response
  3887. // error from Do is the result of In-None-Match.
  3888. func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall {
  3889. c.ifNoneMatch_ = entityTag
  3890. return c
  3891. }
  3892. // Context sets the context to be used in this call's Do method. Any
  3893. // pending HTTP request will be aborted if the provided context is
  3894. // canceled.
  3895. func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall {
  3896. c.ctx_ = ctx
  3897. return c
  3898. }
  3899. // Header returns an http.Header that can be modified by the caller to
  3900. // add HTTP headers to the request.
  3901. func (c *CoursesAliasesListCall) Header() http.Header {
  3902. if c.header_ == nil {
  3903. c.header_ = make(http.Header)
  3904. }
  3905. return c.header_
  3906. }
  3907. func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) {
  3908. reqHeaders := make(http.Header)
  3909. for k, v := range c.header_ {
  3910. reqHeaders[k] = v
  3911. }
  3912. reqHeaders.Set("User-Agent", c.s.userAgent())
  3913. if c.ifNoneMatch_ != "" {
  3914. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3915. }
  3916. var body io.Reader = nil
  3917. c.urlParams_.Set("alt", alt)
  3918. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases")
  3919. urls += "?" + c.urlParams_.Encode()
  3920. req, _ := http.NewRequest("GET", urls, body)
  3921. req.Header = reqHeaders
  3922. googleapi.Expand(req.URL, map[string]string{
  3923. "courseId": c.courseId,
  3924. })
  3925. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3926. }
  3927. // Do executes the "classroom.courses.aliases.list" call.
  3928. // Exactly one of *ListCourseAliasesResponse or error will be non-nil.
  3929. // Any non-2xx status code is an error. Response headers are in either
  3930. // *ListCourseAliasesResponse.ServerResponse.Header or (if a response
  3931. // was returned at all) in error.(*googleapi.Error).Header. Use
  3932. // googleapi.IsNotModified to check whether the returned error was
  3933. // because http.StatusNotModified was returned.
  3934. func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) {
  3935. gensupport.SetOptions(c.urlParams_, opts...)
  3936. res, err := c.doRequest("json")
  3937. if res != nil && res.StatusCode == http.StatusNotModified {
  3938. if res.Body != nil {
  3939. res.Body.Close()
  3940. }
  3941. return nil, &googleapi.Error{
  3942. Code: res.StatusCode,
  3943. Header: res.Header,
  3944. }
  3945. }
  3946. if err != nil {
  3947. return nil, err
  3948. }
  3949. defer googleapi.CloseBody(res)
  3950. if err := googleapi.CheckResponse(res); err != nil {
  3951. return nil, err
  3952. }
  3953. ret := &ListCourseAliasesResponse{
  3954. ServerResponse: googleapi.ServerResponse{
  3955. Header: res.Header,
  3956. HTTPStatusCode: res.StatusCode,
  3957. },
  3958. }
  3959. target := &ret
  3960. if err := gensupport.DecodeResponse(target, res); err != nil {
  3961. return nil, err
  3962. }
  3963. return ret, nil
  3964. // {
  3965. // "description": "Returns a list of aliases for a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\ncourse or for access errors.\n* `NOT_FOUND` if the course does not exist.",
  3966. // "flatPath": "v1/courses/{courseId}/aliases",
  3967. // "httpMethod": "GET",
  3968. // "id": "classroom.courses.aliases.list",
  3969. // "parameterOrder": [
  3970. // "courseId"
  3971. // ],
  3972. // "parameters": {
  3973. // "courseId": {
  3974. // "description": "The identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3975. // "location": "path",
  3976. // "required": true,
  3977. // "type": "string"
  3978. // },
  3979. // "pageSize": {
  3980. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  3981. // "format": "int32",
  3982. // "location": "query",
  3983. // "type": "integer"
  3984. // },
  3985. // "pageToken": {
  3986. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.",
  3987. // "location": "query",
  3988. // "type": "string"
  3989. // }
  3990. // },
  3991. // "path": "v1/courses/{courseId}/aliases",
  3992. // "response": {
  3993. // "$ref": "ListCourseAliasesResponse"
  3994. // },
  3995. // "scopes": [
  3996. // "https://www.googleapis.com/auth/classroom.courses",
  3997. // "https://www.googleapis.com/auth/classroom.courses.readonly"
  3998. // ]
  3999. // }
  4000. }
  4001. // Pages invokes f for each page of results.
  4002. // A non-nil error returned from f will halt the iteration.
  4003. // The provided context supersedes any context provided to the Context method.
  4004. func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error {
  4005. c.ctx_ = ctx
  4006. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4007. for {
  4008. x, err := c.Do()
  4009. if err != nil {
  4010. return err
  4011. }
  4012. if err := f(x); err != nil {
  4013. return err
  4014. }
  4015. if x.NextPageToken == "" {
  4016. return nil
  4017. }
  4018. c.PageToken(x.NextPageToken)
  4019. }
  4020. }
  4021. // method id "classroom.courses.announcements.create":
  4022. type CoursesAnnouncementsCreateCall struct {
  4023. s *Service
  4024. courseId string
  4025. announcement *Announcement
  4026. urlParams_ gensupport.URLParams
  4027. ctx_ context.Context
  4028. header_ http.Header
  4029. }
  4030. // Create: Creates an announcement.
  4031. //
  4032. // This method returns the following error codes:
  4033. //
  4034. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4035. // access the
  4036. // requested course, create announcements in the requested course, share
  4037. // a
  4038. // Drive attachment, or for access errors.
  4039. // * `INVALID_ARGUMENT` if the request is malformed.
  4040. // * `NOT_FOUND` if the requested course does not exist.
  4041. // * `FAILED_PRECONDITION` for the following request error:
  4042. // * AttachmentNotVisible
  4043. func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall {
  4044. c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4045. c.courseId = courseId
  4046. c.announcement = announcement
  4047. return c
  4048. }
  4049. // Fields allows partial responses to be retrieved. See
  4050. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4051. // for more information.
  4052. func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall {
  4053. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4054. return c
  4055. }
  4056. // Context sets the context to be used in this call's Do method. Any
  4057. // pending HTTP request will be aborted if the provided context is
  4058. // canceled.
  4059. func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall {
  4060. c.ctx_ = ctx
  4061. return c
  4062. }
  4063. // Header returns an http.Header that can be modified by the caller to
  4064. // add HTTP headers to the request.
  4065. func (c *CoursesAnnouncementsCreateCall) Header() http.Header {
  4066. if c.header_ == nil {
  4067. c.header_ = make(http.Header)
  4068. }
  4069. return c.header_
  4070. }
  4071. func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) {
  4072. reqHeaders := make(http.Header)
  4073. for k, v := range c.header_ {
  4074. reqHeaders[k] = v
  4075. }
  4076. reqHeaders.Set("User-Agent", c.s.userAgent())
  4077. var body io.Reader = nil
  4078. body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement)
  4079. if err != nil {
  4080. return nil, err
  4081. }
  4082. reqHeaders.Set("Content-Type", "application/json")
  4083. c.urlParams_.Set("alt", alt)
  4084. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements")
  4085. urls += "?" + c.urlParams_.Encode()
  4086. req, _ := http.NewRequest("POST", urls, body)
  4087. req.Header = reqHeaders
  4088. googleapi.Expand(req.URL, map[string]string{
  4089. "courseId": c.courseId,
  4090. })
  4091. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4092. }
  4093. // Do executes the "classroom.courses.announcements.create" call.
  4094. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4095. // status code is an error. Response headers are in either
  4096. // *Announcement.ServerResponse.Header or (if a response was returned at
  4097. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4098. // to check whether the returned error was because
  4099. // http.StatusNotModified was returned.
  4100. func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4101. gensupport.SetOptions(c.urlParams_, opts...)
  4102. res, err := c.doRequest("json")
  4103. if res != nil && res.StatusCode == http.StatusNotModified {
  4104. if res.Body != nil {
  4105. res.Body.Close()
  4106. }
  4107. return nil, &googleapi.Error{
  4108. Code: res.StatusCode,
  4109. Header: res.Header,
  4110. }
  4111. }
  4112. if err != nil {
  4113. return nil, err
  4114. }
  4115. defer googleapi.CloseBody(res)
  4116. if err := googleapi.CheckResponse(res); err != nil {
  4117. return nil, err
  4118. }
  4119. ret := &Announcement{
  4120. ServerResponse: googleapi.ServerResponse{
  4121. Header: res.Header,
  4122. HTTPStatusCode: res.StatusCode,
  4123. },
  4124. }
  4125. target := &ret
  4126. if err := gensupport.DecodeResponse(target, res); err != nil {
  4127. return nil, err
  4128. }
  4129. return ret, nil
  4130. // {
  4131. // "description": "Creates an announcement.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, create announcements in the requested course, share a\nDrive attachment, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.\n* `FAILED_PRECONDITION` for the following request error:\n * AttachmentNotVisible",
  4132. // "flatPath": "v1/courses/{courseId}/announcements",
  4133. // "httpMethod": "POST",
  4134. // "id": "classroom.courses.announcements.create",
  4135. // "parameterOrder": [
  4136. // "courseId"
  4137. // ],
  4138. // "parameters": {
  4139. // "courseId": {
  4140. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4141. // "location": "path",
  4142. // "required": true,
  4143. // "type": "string"
  4144. // }
  4145. // },
  4146. // "path": "v1/courses/{courseId}/announcements",
  4147. // "request": {
  4148. // "$ref": "Announcement"
  4149. // },
  4150. // "response": {
  4151. // "$ref": "Announcement"
  4152. // },
  4153. // "scopes": [
  4154. // "https://www.googleapis.com/auth/classroom.announcements"
  4155. // ]
  4156. // }
  4157. }
  4158. // method id "classroom.courses.announcements.delete":
  4159. type CoursesAnnouncementsDeleteCall struct {
  4160. s *Service
  4161. courseId string
  4162. id string
  4163. urlParams_ gensupport.URLParams
  4164. ctx_ context.Context
  4165. header_ http.Header
  4166. }
  4167. // Delete: Deletes an announcement.
  4168. //
  4169. // This request must be made by the Developer Console project of
  4170. // the
  4171. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  4172. // used to
  4173. // create the corresponding announcement item.
  4174. //
  4175. // This method returns the following error codes:
  4176. //
  4177. // * `PERMISSION_DENIED` if the requesting developer project did not
  4178. // create
  4179. // the corresponding announcement, if the requesting user is not
  4180. // permitted
  4181. // to delete the requested course or for access errors.
  4182. // * `FAILED_PRECONDITION` if the requested announcement has already
  4183. // been
  4184. // deleted.
  4185. // * `NOT_FOUND` if no course exists with the requested ID.
  4186. func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall {
  4187. c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4188. c.courseId = courseId
  4189. c.id = id
  4190. return c
  4191. }
  4192. // Fields allows partial responses to be retrieved. See
  4193. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4194. // for more information.
  4195. func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall {
  4196. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4197. return c
  4198. }
  4199. // Context sets the context to be used in this call's Do method. Any
  4200. // pending HTTP request will be aborted if the provided context is
  4201. // canceled.
  4202. func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall {
  4203. c.ctx_ = ctx
  4204. return c
  4205. }
  4206. // Header returns an http.Header that can be modified by the caller to
  4207. // add HTTP headers to the request.
  4208. func (c *CoursesAnnouncementsDeleteCall) Header() http.Header {
  4209. if c.header_ == nil {
  4210. c.header_ = make(http.Header)
  4211. }
  4212. return c.header_
  4213. }
  4214. func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4215. reqHeaders := make(http.Header)
  4216. for k, v := range c.header_ {
  4217. reqHeaders[k] = v
  4218. }
  4219. reqHeaders.Set("User-Agent", c.s.userAgent())
  4220. var body io.Reader = nil
  4221. c.urlParams_.Set("alt", alt)
  4222. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}")
  4223. urls += "?" + c.urlParams_.Encode()
  4224. req, _ := http.NewRequest("DELETE", urls, body)
  4225. req.Header = reqHeaders
  4226. googleapi.Expand(req.URL, map[string]string{
  4227. "courseId": c.courseId,
  4228. "id": c.id,
  4229. })
  4230. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4231. }
  4232. // Do executes the "classroom.courses.announcements.delete" call.
  4233. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4234. // code is an error. Response headers are in either
  4235. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4236. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4237. // check whether the returned error was because http.StatusNotModified
  4238. // was returned.
  4239. func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4240. gensupport.SetOptions(c.urlParams_, opts...)
  4241. res, err := c.doRequest("json")
  4242. if res != nil && res.StatusCode == http.StatusNotModified {
  4243. if res.Body != nil {
  4244. res.Body.Close()
  4245. }
  4246. return nil, &googleapi.Error{
  4247. Code: res.StatusCode,
  4248. Header: res.Header,
  4249. }
  4250. }
  4251. if err != nil {
  4252. return nil, err
  4253. }
  4254. defer googleapi.CloseBody(res)
  4255. if err := googleapi.CheckResponse(res); err != nil {
  4256. return nil, err
  4257. }
  4258. ret := &Empty{
  4259. ServerResponse: googleapi.ServerResponse{
  4260. Header: res.Header,
  4261. HTTPStatusCode: res.StatusCode,
  4262. },
  4263. }
  4264. target := &ret
  4265. if err := gensupport.DecodeResponse(target, res); err != nil {
  4266. return nil, err
  4267. }
  4268. return ret, nil
  4269. // {
  4270. // "description": "Deletes an announcement.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding announcement item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding announcement, if the requesting user is not permitted\nto delete the requested course or for access errors.\n* `FAILED_PRECONDITION` if the requested announcement has already been\ndeleted.\n* `NOT_FOUND` if no course exists with the requested ID.",
  4271. // "flatPath": "v1/courses/{courseId}/announcements/{id}",
  4272. // "httpMethod": "DELETE",
  4273. // "id": "classroom.courses.announcements.delete",
  4274. // "parameterOrder": [
  4275. // "courseId",
  4276. // "id"
  4277. // ],
  4278. // "parameters": {
  4279. // "courseId": {
  4280. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4281. // "location": "path",
  4282. // "required": true,
  4283. // "type": "string"
  4284. // },
  4285. // "id": {
  4286. // "description": "Identifier of the announcement to delete.\nThis identifier is a Classroom-assigned identifier.",
  4287. // "location": "path",
  4288. // "required": true,
  4289. // "type": "string"
  4290. // }
  4291. // },
  4292. // "path": "v1/courses/{courseId}/announcements/{id}",
  4293. // "response": {
  4294. // "$ref": "Empty"
  4295. // },
  4296. // "scopes": [
  4297. // "https://www.googleapis.com/auth/classroom.announcements"
  4298. // ]
  4299. // }
  4300. }
  4301. // method id "classroom.courses.announcements.get":
  4302. type CoursesAnnouncementsGetCall struct {
  4303. s *Service
  4304. courseId string
  4305. id string
  4306. urlParams_ gensupport.URLParams
  4307. ifNoneMatch_ string
  4308. ctx_ context.Context
  4309. header_ http.Header
  4310. }
  4311. // Get: Returns an announcement.
  4312. //
  4313. // This method returns the following error codes:
  4314. //
  4315. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4316. // access the
  4317. // requested course or announcement, or for access errors.
  4318. // * `INVALID_ARGUMENT` if the request is malformed.
  4319. // * `NOT_FOUND` if the requested course or announcement does not exist.
  4320. func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall {
  4321. c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4322. c.courseId = courseId
  4323. c.id = id
  4324. return c
  4325. }
  4326. // Fields allows partial responses to be retrieved. See
  4327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4328. // for more information.
  4329. func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall {
  4330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4331. return c
  4332. }
  4333. // IfNoneMatch sets the optional parameter which makes the operation
  4334. // fail if the object's ETag matches the given value. This is useful for
  4335. // getting updates only after the object has changed since the last
  4336. // request. Use googleapi.IsNotModified to check whether the response
  4337. // error from Do is the result of In-None-Match.
  4338. func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall {
  4339. c.ifNoneMatch_ = entityTag
  4340. return c
  4341. }
  4342. // Context sets the context to be used in this call's Do method. Any
  4343. // pending HTTP request will be aborted if the provided context is
  4344. // canceled.
  4345. func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall {
  4346. c.ctx_ = ctx
  4347. return c
  4348. }
  4349. // Header returns an http.Header that can be modified by the caller to
  4350. // add HTTP headers to the request.
  4351. func (c *CoursesAnnouncementsGetCall) Header() http.Header {
  4352. if c.header_ == nil {
  4353. c.header_ = make(http.Header)
  4354. }
  4355. return c.header_
  4356. }
  4357. func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) {
  4358. reqHeaders := make(http.Header)
  4359. for k, v := range c.header_ {
  4360. reqHeaders[k] = v
  4361. }
  4362. reqHeaders.Set("User-Agent", c.s.userAgent())
  4363. if c.ifNoneMatch_ != "" {
  4364. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4365. }
  4366. var body io.Reader = nil
  4367. c.urlParams_.Set("alt", alt)
  4368. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}")
  4369. urls += "?" + c.urlParams_.Encode()
  4370. req, _ := http.NewRequest("GET", urls, body)
  4371. req.Header = reqHeaders
  4372. googleapi.Expand(req.URL, map[string]string{
  4373. "courseId": c.courseId,
  4374. "id": c.id,
  4375. })
  4376. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4377. }
  4378. // Do executes the "classroom.courses.announcements.get" call.
  4379. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4380. // status code is an error. Response headers are in either
  4381. // *Announcement.ServerResponse.Header or (if a response was returned at
  4382. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4383. // to check whether the returned error was because
  4384. // http.StatusNotModified was returned.
  4385. func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4386. gensupport.SetOptions(c.urlParams_, opts...)
  4387. res, err := c.doRequest("json")
  4388. if res != nil && res.StatusCode == http.StatusNotModified {
  4389. if res.Body != nil {
  4390. res.Body.Close()
  4391. }
  4392. return nil, &googleapi.Error{
  4393. Code: res.StatusCode,
  4394. Header: res.Header,
  4395. }
  4396. }
  4397. if err != nil {
  4398. return nil, err
  4399. }
  4400. defer googleapi.CloseBody(res)
  4401. if err := googleapi.CheckResponse(res); err != nil {
  4402. return nil, err
  4403. }
  4404. ret := &Announcement{
  4405. ServerResponse: googleapi.ServerResponse{
  4406. Header: res.Header,
  4407. HTTPStatusCode: res.StatusCode,
  4408. },
  4409. }
  4410. target := &ret
  4411. if err := gensupport.DecodeResponse(target, res); err != nil {
  4412. return nil, err
  4413. }
  4414. return ret, nil
  4415. // {
  4416. // "description": "Returns an announcement.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or announcement, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or announcement does not exist.",
  4417. // "flatPath": "v1/courses/{courseId}/announcements/{id}",
  4418. // "httpMethod": "GET",
  4419. // "id": "classroom.courses.announcements.get",
  4420. // "parameterOrder": [
  4421. // "courseId",
  4422. // "id"
  4423. // ],
  4424. // "parameters": {
  4425. // "courseId": {
  4426. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4427. // "location": "path",
  4428. // "required": true,
  4429. // "type": "string"
  4430. // },
  4431. // "id": {
  4432. // "description": "Identifier of the announcement.",
  4433. // "location": "path",
  4434. // "required": true,
  4435. // "type": "string"
  4436. // }
  4437. // },
  4438. // "path": "v1/courses/{courseId}/announcements/{id}",
  4439. // "response": {
  4440. // "$ref": "Announcement"
  4441. // },
  4442. // "scopes": [
  4443. // "https://www.googleapis.com/auth/classroom.announcements",
  4444. // "https://www.googleapis.com/auth/classroom.announcements.readonly"
  4445. // ]
  4446. // }
  4447. }
  4448. // method id "classroom.courses.announcements.list":
  4449. type CoursesAnnouncementsListCall struct {
  4450. s *Service
  4451. courseId string
  4452. urlParams_ gensupport.URLParams
  4453. ifNoneMatch_ string
  4454. ctx_ context.Context
  4455. header_ http.Header
  4456. }
  4457. // List: Returns a list of announcements that the requester is permitted
  4458. // to view.
  4459. //
  4460. // Course students may only view `PUBLISHED` announcements. Course
  4461. // teachers
  4462. // and domain administrators may view all announcements.
  4463. //
  4464. // This method returns the following error codes:
  4465. //
  4466. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4467. // access
  4468. // the requested course or for access errors.
  4469. // * `INVALID_ARGUMENT` if the request is malformed.
  4470. // * `NOT_FOUND` if the requested course does not exist.
  4471. func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall {
  4472. c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4473. c.courseId = courseId
  4474. return c
  4475. }
  4476. // AnnouncementStates sets the optional parameter "announcementStates":
  4477. // Restriction on the `state` of announcements returned.
  4478. // If this argument is left unspecified, the default value is
  4479. // `PUBLISHED`.
  4480. //
  4481. // Possible values:
  4482. // "ANNOUNCEMENT_STATE_UNSPECIFIED"
  4483. // "PUBLISHED"
  4484. // "DRAFT"
  4485. // "DELETED"
  4486. func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall {
  4487. c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...))
  4488. return c
  4489. }
  4490. // OrderBy sets the optional parameter "orderBy": Optional sort ordering
  4491. // for results. A comma-separated list of fields with
  4492. // an optional sort direction keyword. Supported field is
  4493. // `updateTime`.
  4494. // Supported direction keywords are `asc` and `desc`.
  4495. // If not specified, `updateTime desc` is the default
  4496. // behavior.
  4497. // Examples: `updateTime asc`, `updateTime`
  4498. func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall {
  4499. c.urlParams_.Set("orderBy", orderBy)
  4500. return c
  4501. }
  4502. // PageSize sets the optional parameter "pageSize": Maximum number of
  4503. // items to return. Zero or unspecified indicates that the
  4504. // server may assign a maximum.
  4505. //
  4506. // The server may return fewer than the specified number of results.
  4507. func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall {
  4508. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4509. return c
  4510. }
  4511. // PageToken sets the optional parameter "pageToken":
  4512. // nextPageToken
  4513. // value returned from a previous
  4514. // list call,
  4515. // indicating that the subsequent page of results should be
  4516. // returned.
  4517. //
  4518. // The list request
  4519. // must be otherwise identical to the one that resulted in this token.
  4520. func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall {
  4521. c.urlParams_.Set("pageToken", pageToken)
  4522. return c
  4523. }
  4524. // Fields allows partial responses to be retrieved. See
  4525. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4526. // for more information.
  4527. func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall {
  4528. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4529. return c
  4530. }
  4531. // IfNoneMatch sets the optional parameter which makes the operation
  4532. // fail if the object's ETag matches the given value. This is useful for
  4533. // getting updates only after the object has changed since the last
  4534. // request. Use googleapi.IsNotModified to check whether the response
  4535. // error from Do is the result of In-None-Match.
  4536. func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall {
  4537. c.ifNoneMatch_ = entityTag
  4538. return c
  4539. }
  4540. // Context sets the context to be used in this call's Do method. Any
  4541. // pending HTTP request will be aborted if the provided context is
  4542. // canceled.
  4543. func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall {
  4544. c.ctx_ = ctx
  4545. return c
  4546. }
  4547. // Header returns an http.Header that can be modified by the caller to
  4548. // add HTTP headers to the request.
  4549. func (c *CoursesAnnouncementsListCall) Header() http.Header {
  4550. if c.header_ == nil {
  4551. c.header_ = make(http.Header)
  4552. }
  4553. return c.header_
  4554. }
  4555. func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) {
  4556. reqHeaders := make(http.Header)
  4557. for k, v := range c.header_ {
  4558. reqHeaders[k] = v
  4559. }
  4560. reqHeaders.Set("User-Agent", c.s.userAgent())
  4561. if c.ifNoneMatch_ != "" {
  4562. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4563. }
  4564. var body io.Reader = nil
  4565. c.urlParams_.Set("alt", alt)
  4566. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements")
  4567. urls += "?" + c.urlParams_.Encode()
  4568. req, _ := http.NewRequest("GET", urls, body)
  4569. req.Header = reqHeaders
  4570. googleapi.Expand(req.URL, map[string]string{
  4571. "courseId": c.courseId,
  4572. })
  4573. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4574. }
  4575. // Do executes the "classroom.courses.announcements.list" call.
  4576. // Exactly one of *ListAnnouncementsResponse or error will be non-nil.
  4577. // Any non-2xx status code is an error. Response headers are in either
  4578. // *ListAnnouncementsResponse.ServerResponse.Header or (if a response
  4579. // was returned at all) in error.(*googleapi.Error).Header. Use
  4580. // googleapi.IsNotModified to check whether the returned error was
  4581. // because http.StatusNotModified was returned.
  4582. func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) {
  4583. gensupport.SetOptions(c.urlParams_, opts...)
  4584. res, err := c.doRequest("json")
  4585. if res != nil && res.StatusCode == http.StatusNotModified {
  4586. if res.Body != nil {
  4587. res.Body.Close()
  4588. }
  4589. return nil, &googleapi.Error{
  4590. Code: res.StatusCode,
  4591. Header: res.Header,
  4592. }
  4593. }
  4594. if err != nil {
  4595. return nil, err
  4596. }
  4597. defer googleapi.CloseBody(res)
  4598. if err := googleapi.CheckResponse(res); err != nil {
  4599. return nil, err
  4600. }
  4601. ret := &ListAnnouncementsResponse{
  4602. ServerResponse: googleapi.ServerResponse{
  4603. Header: res.Header,
  4604. HTTPStatusCode: res.StatusCode,
  4605. },
  4606. }
  4607. target := &ret
  4608. if err := gensupport.DecodeResponse(target, res); err != nil {
  4609. return nil, err
  4610. }
  4611. return ret, nil
  4612. // {
  4613. // "description": "Returns a list of announcements that the requester is permitted to view.\n\nCourse students may only view `PUBLISHED` announcements. Course teachers\nand domain administrators may view all announcements.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthe requested course or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.",
  4614. // "flatPath": "v1/courses/{courseId}/announcements",
  4615. // "httpMethod": "GET",
  4616. // "id": "classroom.courses.announcements.list",
  4617. // "parameterOrder": [
  4618. // "courseId"
  4619. // ],
  4620. // "parameters": {
  4621. // "announcementStates": {
  4622. // "description": "Restriction on the `state` of announcements returned.\nIf this argument is left unspecified, the default value is `PUBLISHED`.",
  4623. // "enum": [
  4624. // "ANNOUNCEMENT_STATE_UNSPECIFIED",
  4625. // "PUBLISHED",
  4626. // "DRAFT",
  4627. // "DELETED"
  4628. // ],
  4629. // "location": "query",
  4630. // "repeated": true,
  4631. // "type": "string"
  4632. // },
  4633. // "courseId": {
  4634. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4635. // "location": "path",
  4636. // "required": true,
  4637. // "type": "string"
  4638. // },
  4639. // "orderBy": {
  4640. // "description": "Optional sort ordering for results. A comma-separated list of fields with\nan optional sort direction keyword. Supported field is `updateTime`.\nSupported direction keywords are `asc` and `desc`.\nIf not specified, `updateTime desc` is the default behavior.\nExamples: `updateTime asc`, `updateTime`",
  4641. // "location": "query",
  4642. // "type": "string"
  4643. // },
  4644. // "pageSize": {
  4645. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  4646. // "format": "int32",
  4647. // "location": "query",
  4648. // "type": "integer"
  4649. // },
  4650. // "pageToken": {
  4651. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.",
  4652. // "location": "query",
  4653. // "type": "string"
  4654. // }
  4655. // },
  4656. // "path": "v1/courses/{courseId}/announcements",
  4657. // "response": {
  4658. // "$ref": "ListAnnouncementsResponse"
  4659. // },
  4660. // "scopes": [
  4661. // "https://www.googleapis.com/auth/classroom.announcements",
  4662. // "https://www.googleapis.com/auth/classroom.announcements.readonly"
  4663. // ]
  4664. // }
  4665. }
  4666. // Pages invokes f for each page of results.
  4667. // A non-nil error returned from f will halt the iteration.
  4668. // The provided context supersedes any context provided to the Context method.
  4669. func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error {
  4670. c.ctx_ = ctx
  4671. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4672. for {
  4673. x, err := c.Do()
  4674. if err != nil {
  4675. return err
  4676. }
  4677. if err := f(x); err != nil {
  4678. return err
  4679. }
  4680. if x.NextPageToken == "" {
  4681. return nil
  4682. }
  4683. c.PageToken(x.NextPageToken)
  4684. }
  4685. }
  4686. // method id "classroom.courses.announcements.modifyAssignees":
  4687. type CoursesAnnouncementsModifyAssigneesCall struct {
  4688. s *Service
  4689. courseId string
  4690. id string
  4691. modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest
  4692. urlParams_ gensupport.URLParams
  4693. ctx_ context.Context
  4694. header_ http.Header
  4695. }
  4696. // ModifyAssignees: Modifies assignee mode and options of an
  4697. // announcement.
  4698. //
  4699. // Only a teacher of the course that contains the announcement may
  4700. // call this method.
  4701. //
  4702. // This method returns the following error codes:
  4703. //
  4704. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4705. // access the
  4706. // requested course or course work or for access errors.
  4707. // * `INVALID_ARGUMENT` if the request is malformed.
  4708. // * `NOT_FOUND` if the requested course or course work does not exist.
  4709. func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall {
  4710. c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4711. c.courseId = courseId
  4712. c.id = id
  4713. c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest
  4714. return c
  4715. }
  4716. // Fields allows partial responses to be retrieved. See
  4717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4718. // for more information.
  4719. func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall {
  4720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4721. return c
  4722. }
  4723. // Context sets the context to be used in this call's Do method. Any
  4724. // pending HTTP request will be aborted if the provided context is
  4725. // canceled.
  4726. func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall {
  4727. c.ctx_ = ctx
  4728. return c
  4729. }
  4730. // Header returns an http.Header that can be modified by the caller to
  4731. // add HTTP headers to the request.
  4732. func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header {
  4733. if c.header_ == nil {
  4734. c.header_ = make(http.Header)
  4735. }
  4736. return c.header_
  4737. }
  4738. func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) {
  4739. reqHeaders := make(http.Header)
  4740. for k, v := range c.header_ {
  4741. reqHeaders[k] = v
  4742. }
  4743. reqHeaders.Set("User-Agent", c.s.userAgent())
  4744. var body io.Reader = nil
  4745. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest)
  4746. if err != nil {
  4747. return nil, err
  4748. }
  4749. reqHeaders.Set("Content-Type", "application/json")
  4750. c.urlParams_.Set("alt", alt)
  4751. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees")
  4752. urls += "?" + c.urlParams_.Encode()
  4753. req, _ := http.NewRequest("POST", urls, body)
  4754. req.Header = reqHeaders
  4755. googleapi.Expand(req.URL, map[string]string{
  4756. "courseId": c.courseId,
  4757. "id": c.id,
  4758. })
  4759. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4760. }
  4761. // Do executes the "classroom.courses.announcements.modifyAssignees" call.
  4762. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4763. // status code is an error. Response headers are in either
  4764. // *Announcement.ServerResponse.Header or (if a response was returned at
  4765. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4766. // to check whether the returned error was because
  4767. // http.StatusNotModified was returned.
  4768. func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4769. gensupport.SetOptions(c.urlParams_, opts...)
  4770. res, err := c.doRequest("json")
  4771. if res != nil && res.StatusCode == http.StatusNotModified {
  4772. if res.Body != nil {
  4773. res.Body.Close()
  4774. }
  4775. return nil, &googleapi.Error{
  4776. Code: res.StatusCode,
  4777. Header: res.Header,
  4778. }
  4779. }
  4780. if err != nil {
  4781. return nil, err
  4782. }
  4783. defer googleapi.CloseBody(res)
  4784. if err := googleapi.CheckResponse(res); err != nil {
  4785. return nil, err
  4786. }
  4787. ret := &Announcement{
  4788. ServerResponse: googleapi.ServerResponse{
  4789. Header: res.Header,
  4790. HTTPStatusCode: res.StatusCode,
  4791. },
  4792. }
  4793. target := &ret
  4794. if err := gensupport.DecodeResponse(target, res); err != nil {
  4795. return nil, err
  4796. }
  4797. return ret, nil
  4798. // {
  4799. // "description": "Modifies assignee mode and options of an announcement.\n\nOnly a teacher of the course that contains the announcement may\ncall this method.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or course work does not exist.",
  4800. // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees",
  4801. // "httpMethod": "POST",
  4802. // "id": "classroom.courses.announcements.modifyAssignees",
  4803. // "parameterOrder": [
  4804. // "courseId",
  4805. // "id"
  4806. // ],
  4807. // "parameters": {
  4808. // "courseId": {
  4809. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4810. // "location": "path",
  4811. // "required": true,
  4812. // "type": "string"
  4813. // },
  4814. // "id": {
  4815. // "description": "Identifier of the announcement.",
  4816. // "location": "path",
  4817. // "required": true,
  4818. // "type": "string"
  4819. // }
  4820. // },
  4821. // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees",
  4822. // "request": {
  4823. // "$ref": "ModifyAnnouncementAssigneesRequest"
  4824. // },
  4825. // "response": {
  4826. // "$ref": "Announcement"
  4827. // },
  4828. // "scopes": [
  4829. // "https://www.googleapis.com/auth/classroom.announcements"
  4830. // ]
  4831. // }
  4832. }
  4833. // method id "classroom.courses.announcements.patch":
  4834. type CoursesAnnouncementsPatchCall struct {
  4835. s *Service
  4836. courseId string
  4837. id string
  4838. announcement *Announcement
  4839. urlParams_ gensupport.URLParams
  4840. ctx_ context.Context
  4841. header_ http.Header
  4842. }
  4843. // Patch: Updates one or more fields of an announcement.
  4844. //
  4845. // This method returns the following error codes:
  4846. //
  4847. // * `PERMISSION_DENIED` if the requesting developer project did not
  4848. // create
  4849. // the corresponding announcement or for access errors.
  4850. // * `INVALID_ARGUMENT` if the request is malformed.
  4851. // * `FAILED_PRECONDITION` if the requested announcement has already
  4852. // been
  4853. // deleted.
  4854. // * `NOT_FOUND` if the requested course or announcement does not exist
  4855. func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall {
  4856. c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4857. c.courseId = courseId
  4858. c.id = id
  4859. c.announcement = announcement
  4860. return c
  4861. }
  4862. // UpdateMask sets the optional parameter "updateMask": Mask that
  4863. // identifies which fields on the announcement to update.
  4864. // This field is required to do an update. The update fails if
  4865. // invalid
  4866. // fields are specified. If a field supports empty values, it can be
  4867. // cleared
  4868. // by specifying it in the update mask and not in the Announcement
  4869. // object. If
  4870. // a field that does not support empty values is included in the update
  4871. // mask
  4872. // and not set in the Announcement object, an `INVALID_ARGUMENT` error
  4873. // will be
  4874. // returned.
  4875. //
  4876. // The following fields may be specified by teachers:
  4877. //
  4878. // * `text`
  4879. // * `state`
  4880. // * `scheduled_time`
  4881. func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall {
  4882. c.urlParams_.Set("updateMask", updateMask)
  4883. return c
  4884. }
  4885. // Fields allows partial responses to be retrieved. See
  4886. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4887. // for more information.
  4888. func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall {
  4889. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4890. return c
  4891. }
  4892. // Context sets the context to be used in this call's Do method. Any
  4893. // pending HTTP request will be aborted if the provided context is
  4894. // canceled.
  4895. func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall {
  4896. c.ctx_ = ctx
  4897. return c
  4898. }
  4899. // Header returns an http.Header that can be modified by the caller to
  4900. // add HTTP headers to the request.
  4901. func (c *CoursesAnnouncementsPatchCall) Header() http.Header {
  4902. if c.header_ == nil {
  4903. c.header_ = make(http.Header)
  4904. }
  4905. return c.header_
  4906. }
  4907. func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) {
  4908. reqHeaders := make(http.Header)
  4909. for k, v := range c.header_ {
  4910. reqHeaders[k] = v
  4911. }
  4912. reqHeaders.Set("User-Agent", c.s.userAgent())
  4913. var body io.Reader = nil
  4914. body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement)
  4915. if err != nil {
  4916. return nil, err
  4917. }
  4918. reqHeaders.Set("Content-Type", "application/json")
  4919. c.urlParams_.Set("alt", alt)
  4920. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}")
  4921. urls += "?" + c.urlParams_.Encode()
  4922. req, _ := http.NewRequest("PATCH", urls, body)
  4923. req.Header = reqHeaders
  4924. googleapi.Expand(req.URL, map[string]string{
  4925. "courseId": c.courseId,
  4926. "id": c.id,
  4927. })
  4928. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4929. }
  4930. // Do executes the "classroom.courses.announcements.patch" call.
  4931. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4932. // status code is an error. Response headers are in either
  4933. // *Announcement.ServerResponse.Header or (if a response was returned at
  4934. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4935. // to check whether the returned error was because
  4936. // http.StatusNotModified was returned.
  4937. func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4938. gensupport.SetOptions(c.urlParams_, opts...)
  4939. res, err := c.doRequest("json")
  4940. if res != nil && res.StatusCode == http.StatusNotModified {
  4941. if res.Body != nil {
  4942. res.Body.Close()
  4943. }
  4944. return nil, &googleapi.Error{
  4945. Code: res.StatusCode,
  4946. Header: res.Header,
  4947. }
  4948. }
  4949. if err != nil {
  4950. return nil, err
  4951. }
  4952. defer googleapi.CloseBody(res)
  4953. if err := googleapi.CheckResponse(res); err != nil {
  4954. return nil, err
  4955. }
  4956. ret := &Announcement{
  4957. ServerResponse: googleapi.ServerResponse{
  4958. Header: res.Header,
  4959. HTTPStatusCode: res.StatusCode,
  4960. },
  4961. }
  4962. target := &ret
  4963. if err := gensupport.DecodeResponse(target, res); err != nil {
  4964. return nil, err
  4965. }
  4966. return ret, nil
  4967. // {
  4968. // "description": "Updates one or more fields of an announcement.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding announcement or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `FAILED_PRECONDITION` if the requested announcement has already been\ndeleted.\n* `NOT_FOUND` if the requested course or announcement does not exist",
  4969. // "flatPath": "v1/courses/{courseId}/announcements/{id}",
  4970. // "httpMethod": "PATCH",
  4971. // "id": "classroom.courses.announcements.patch",
  4972. // "parameterOrder": [
  4973. // "courseId",
  4974. // "id"
  4975. // ],
  4976. // "parameters": {
  4977. // "courseId": {
  4978. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4979. // "location": "path",
  4980. // "required": true,
  4981. // "type": "string"
  4982. // },
  4983. // "id": {
  4984. // "description": "Identifier of the announcement.",
  4985. // "location": "path",
  4986. // "required": true,
  4987. // "type": "string"
  4988. // },
  4989. // "updateMask": {
  4990. // "description": "Mask that identifies which fields on the announcement to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified. If a field supports empty values, it can be cleared\nby specifying it in the update mask and not in the Announcement object. If\na field that does not support empty values is included in the update mask\nand not set in the Announcement object, an `INVALID_ARGUMENT` error will be\nreturned.\n\nThe following fields may be specified by teachers:\n\n* `text`\n* `state`\n* `scheduled_time`",
  4991. // "format": "google-fieldmask",
  4992. // "location": "query",
  4993. // "type": "string"
  4994. // }
  4995. // },
  4996. // "path": "v1/courses/{courseId}/announcements/{id}",
  4997. // "request": {
  4998. // "$ref": "Announcement"
  4999. // },
  5000. // "response": {
  5001. // "$ref": "Announcement"
  5002. // },
  5003. // "scopes": [
  5004. // "https://www.googleapis.com/auth/classroom.announcements"
  5005. // ]
  5006. // }
  5007. }
  5008. // method id "classroom.courses.courseWork.create":
  5009. type CoursesCourseWorkCreateCall struct {
  5010. s *Service
  5011. courseId string
  5012. coursework *CourseWork
  5013. urlParams_ gensupport.URLParams
  5014. ctx_ context.Context
  5015. header_ http.Header
  5016. }
  5017. // Create: Creates course work.
  5018. //
  5019. // The resulting course work (and corresponding student submissions)
  5020. // are
  5021. // associated with the Developer Console project of the
  5022. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  5023. // used to
  5024. // make the request. Classroom API requests to modify course work and
  5025. // student
  5026. // submissions must be made with an OAuth client ID from the
  5027. // associated
  5028. // Developer Console project.
  5029. //
  5030. // This method returns the following error codes:
  5031. //
  5032. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5033. // access the
  5034. // requested course, create course work in the requested course, share
  5035. // a
  5036. // Drive attachment, or for access errors.
  5037. // * `INVALID_ARGUMENT` if the request is malformed.
  5038. // * `NOT_FOUND` if the requested course does not exist.
  5039. // * `FAILED_PRECONDITION` for the following request error:
  5040. // * AttachmentNotVisible
  5041. func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall {
  5042. c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5043. c.courseId = courseId
  5044. c.coursework = coursework
  5045. return c
  5046. }
  5047. // Fields allows partial responses to be retrieved. See
  5048. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5049. // for more information.
  5050. func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall {
  5051. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5052. return c
  5053. }
  5054. // Context sets the context to be used in this call's Do method. Any
  5055. // pending HTTP request will be aborted if the provided context is
  5056. // canceled.
  5057. func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall {
  5058. c.ctx_ = ctx
  5059. return c
  5060. }
  5061. // Header returns an http.Header that can be modified by the caller to
  5062. // add HTTP headers to the request.
  5063. func (c *CoursesCourseWorkCreateCall) Header() http.Header {
  5064. if c.header_ == nil {
  5065. c.header_ = make(http.Header)
  5066. }
  5067. return c.header_
  5068. }
  5069. func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) {
  5070. reqHeaders := make(http.Header)
  5071. for k, v := range c.header_ {
  5072. reqHeaders[k] = v
  5073. }
  5074. reqHeaders.Set("User-Agent", c.s.userAgent())
  5075. var body io.Reader = nil
  5076. body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework)
  5077. if err != nil {
  5078. return nil, err
  5079. }
  5080. reqHeaders.Set("Content-Type", "application/json")
  5081. c.urlParams_.Set("alt", alt)
  5082. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork")
  5083. urls += "?" + c.urlParams_.Encode()
  5084. req, _ := http.NewRequest("POST", urls, body)
  5085. req.Header = reqHeaders
  5086. googleapi.Expand(req.URL, map[string]string{
  5087. "courseId": c.courseId,
  5088. })
  5089. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5090. }
  5091. // Do executes the "classroom.courses.courseWork.create" call.
  5092. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5093. // status code is an error. Response headers are in either
  5094. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5095. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5096. // to check whether the returned error was because
  5097. // http.StatusNotModified was returned.
  5098. func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5099. gensupport.SetOptions(c.urlParams_, opts...)
  5100. res, err := c.doRequest("json")
  5101. if res != nil && res.StatusCode == http.StatusNotModified {
  5102. if res.Body != nil {
  5103. res.Body.Close()
  5104. }
  5105. return nil, &googleapi.Error{
  5106. Code: res.StatusCode,
  5107. Header: res.Header,
  5108. }
  5109. }
  5110. if err != nil {
  5111. return nil, err
  5112. }
  5113. defer googleapi.CloseBody(res)
  5114. if err := googleapi.CheckResponse(res); err != nil {
  5115. return nil, err
  5116. }
  5117. ret := &CourseWork{
  5118. ServerResponse: googleapi.ServerResponse{
  5119. Header: res.Header,
  5120. HTTPStatusCode: res.StatusCode,
  5121. },
  5122. }
  5123. target := &ret
  5124. if err := gensupport.DecodeResponse(target, res); err != nil {
  5125. return nil, err
  5126. }
  5127. return ret, nil
  5128. // {
  5129. // "description": "Creates course work.\n\nThe resulting course work (and corresponding student submissions) are\nassociated with the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\nmake the request. Classroom API requests to modify course work and student\nsubmissions must be made with an OAuth client ID from the associated\nDeveloper Console project.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, create course work in the requested course, share a\nDrive attachment, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.\n* `FAILED_PRECONDITION` for the following request error:\n * AttachmentNotVisible",
  5130. // "flatPath": "v1/courses/{courseId}/courseWork",
  5131. // "httpMethod": "POST",
  5132. // "id": "classroom.courses.courseWork.create",
  5133. // "parameterOrder": [
  5134. // "courseId"
  5135. // ],
  5136. // "parameters": {
  5137. // "courseId": {
  5138. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5139. // "location": "path",
  5140. // "required": true,
  5141. // "type": "string"
  5142. // }
  5143. // },
  5144. // "path": "v1/courses/{courseId}/courseWork",
  5145. // "request": {
  5146. // "$ref": "CourseWork"
  5147. // },
  5148. // "response": {
  5149. // "$ref": "CourseWork"
  5150. // },
  5151. // "scopes": [
  5152. // "https://www.googleapis.com/auth/classroom.coursework.students"
  5153. // ]
  5154. // }
  5155. }
  5156. // method id "classroom.courses.courseWork.delete":
  5157. type CoursesCourseWorkDeleteCall struct {
  5158. s *Service
  5159. courseId string
  5160. id string
  5161. urlParams_ gensupport.URLParams
  5162. ctx_ context.Context
  5163. header_ http.Header
  5164. }
  5165. // Delete: Deletes a course work.
  5166. //
  5167. // This request must be made by the Developer Console project of
  5168. // the
  5169. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  5170. // used to
  5171. // create the corresponding course work item.
  5172. //
  5173. // This method returns the following error codes:
  5174. //
  5175. // * `PERMISSION_DENIED` if the requesting developer project did not
  5176. // create
  5177. // the corresponding course work, if the requesting user is not
  5178. // permitted
  5179. // to delete the requested course or for access errors.
  5180. // * `FAILED_PRECONDITION` if the requested course work has already
  5181. // been
  5182. // deleted.
  5183. // * `NOT_FOUND` if no course exists with the requested ID.
  5184. func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall {
  5185. c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5186. c.courseId = courseId
  5187. c.id = id
  5188. return c
  5189. }
  5190. // Fields allows partial responses to be retrieved. See
  5191. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5192. // for more information.
  5193. func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall {
  5194. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5195. return c
  5196. }
  5197. // Context sets the context to be used in this call's Do method. Any
  5198. // pending HTTP request will be aborted if the provided context is
  5199. // canceled.
  5200. func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall {
  5201. c.ctx_ = ctx
  5202. return c
  5203. }
  5204. // Header returns an http.Header that can be modified by the caller to
  5205. // add HTTP headers to the request.
  5206. func (c *CoursesCourseWorkDeleteCall) Header() http.Header {
  5207. if c.header_ == nil {
  5208. c.header_ = make(http.Header)
  5209. }
  5210. return c.header_
  5211. }
  5212. func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) {
  5213. reqHeaders := make(http.Header)
  5214. for k, v := range c.header_ {
  5215. reqHeaders[k] = v
  5216. }
  5217. reqHeaders.Set("User-Agent", c.s.userAgent())
  5218. var body io.Reader = nil
  5219. c.urlParams_.Set("alt", alt)
  5220. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}")
  5221. urls += "?" + c.urlParams_.Encode()
  5222. req, _ := http.NewRequest("DELETE", urls, body)
  5223. req.Header = reqHeaders
  5224. googleapi.Expand(req.URL, map[string]string{
  5225. "courseId": c.courseId,
  5226. "id": c.id,
  5227. })
  5228. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5229. }
  5230. // Do executes the "classroom.courses.courseWork.delete" call.
  5231. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5232. // code is an error. Response headers are in either
  5233. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5234. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5235. // check whether the returned error was because http.StatusNotModified
  5236. // was returned.
  5237. func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5238. gensupport.SetOptions(c.urlParams_, opts...)
  5239. res, err := c.doRequest("json")
  5240. if res != nil && res.StatusCode == http.StatusNotModified {
  5241. if res.Body != nil {
  5242. res.Body.Close()
  5243. }
  5244. return nil, &googleapi.Error{
  5245. Code: res.StatusCode,
  5246. Header: res.Header,
  5247. }
  5248. }
  5249. if err != nil {
  5250. return nil, err
  5251. }
  5252. defer googleapi.CloseBody(res)
  5253. if err := googleapi.CheckResponse(res); err != nil {
  5254. return nil, err
  5255. }
  5256. ret := &Empty{
  5257. ServerResponse: googleapi.ServerResponse{
  5258. Header: res.Header,
  5259. HTTPStatusCode: res.StatusCode,
  5260. },
  5261. }
  5262. target := &ret
  5263. if err := gensupport.DecodeResponse(target, res); err != nil {
  5264. return nil, err
  5265. }
  5266. return ret, nil
  5267. // {
  5268. // "description": "Deletes a course work.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding course work, if the requesting user is not permitted\nto delete the requested course or for access errors.\n* `FAILED_PRECONDITION` if the requested course work has already been\ndeleted.\n* `NOT_FOUND` if no course exists with the requested ID.",
  5269. // "flatPath": "v1/courses/{courseId}/courseWork/{id}",
  5270. // "httpMethod": "DELETE",
  5271. // "id": "classroom.courses.courseWork.delete",
  5272. // "parameterOrder": [
  5273. // "courseId",
  5274. // "id"
  5275. // ],
  5276. // "parameters": {
  5277. // "courseId": {
  5278. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5279. // "location": "path",
  5280. // "required": true,
  5281. // "type": "string"
  5282. // },
  5283. // "id": {
  5284. // "description": "Identifier of the course work to delete.\nThis identifier is a Classroom-assigned identifier.",
  5285. // "location": "path",
  5286. // "required": true,
  5287. // "type": "string"
  5288. // }
  5289. // },
  5290. // "path": "v1/courses/{courseId}/courseWork/{id}",
  5291. // "response": {
  5292. // "$ref": "Empty"
  5293. // },
  5294. // "scopes": [
  5295. // "https://www.googleapis.com/auth/classroom.coursework.students"
  5296. // ]
  5297. // }
  5298. }
  5299. // method id "classroom.courses.courseWork.get":
  5300. type CoursesCourseWorkGetCall struct {
  5301. s *Service
  5302. courseId string
  5303. id string
  5304. urlParams_ gensupport.URLParams
  5305. ifNoneMatch_ string
  5306. ctx_ context.Context
  5307. header_ http.Header
  5308. }
  5309. // Get: Returns course work.
  5310. //
  5311. // This method returns the following error codes:
  5312. //
  5313. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5314. // access the
  5315. // requested course or course work, or for access errors.
  5316. // * `INVALID_ARGUMENT` if the request is malformed.
  5317. // * `NOT_FOUND` if the requested course or course work does not exist.
  5318. func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall {
  5319. c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5320. c.courseId = courseId
  5321. c.id = id
  5322. return c
  5323. }
  5324. // Fields allows partial responses to be retrieved. See
  5325. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5326. // for more information.
  5327. func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall {
  5328. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5329. return c
  5330. }
  5331. // IfNoneMatch sets the optional parameter which makes the operation
  5332. // fail if the object's ETag matches the given value. This is useful for
  5333. // getting updates only after the object has changed since the last
  5334. // request. Use googleapi.IsNotModified to check whether the response
  5335. // error from Do is the result of In-None-Match.
  5336. func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall {
  5337. c.ifNoneMatch_ = entityTag
  5338. return c
  5339. }
  5340. // Context sets the context to be used in this call's Do method. Any
  5341. // pending HTTP request will be aborted if the provided context is
  5342. // canceled.
  5343. func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall {
  5344. c.ctx_ = ctx
  5345. return c
  5346. }
  5347. // Header returns an http.Header that can be modified by the caller to
  5348. // add HTTP headers to the request.
  5349. func (c *CoursesCourseWorkGetCall) Header() http.Header {
  5350. if c.header_ == nil {
  5351. c.header_ = make(http.Header)
  5352. }
  5353. return c.header_
  5354. }
  5355. func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) {
  5356. reqHeaders := make(http.Header)
  5357. for k, v := range c.header_ {
  5358. reqHeaders[k] = v
  5359. }
  5360. reqHeaders.Set("User-Agent", c.s.userAgent())
  5361. if c.ifNoneMatch_ != "" {
  5362. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5363. }
  5364. var body io.Reader = nil
  5365. c.urlParams_.Set("alt", alt)
  5366. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}")
  5367. urls += "?" + c.urlParams_.Encode()
  5368. req, _ := http.NewRequest("GET", urls, body)
  5369. req.Header = reqHeaders
  5370. googleapi.Expand(req.URL, map[string]string{
  5371. "courseId": c.courseId,
  5372. "id": c.id,
  5373. })
  5374. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5375. }
  5376. // Do executes the "classroom.courses.courseWork.get" call.
  5377. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5378. // status code is an error. Response headers are in either
  5379. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5380. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5381. // to check whether the returned error was because
  5382. // http.StatusNotModified was returned.
  5383. func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5384. gensupport.SetOptions(c.urlParams_, opts...)
  5385. res, err := c.doRequest("json")
  5386. if res != nil && res.StatusCode == http.StatusNotModified {
  5387. if res.Body != nil {
  5388. res.Body.Close()
  5389. }
  5390. return nil, &googleapi.Error{
  5391. Code: res.StatusCode,
  5392. Header: res.Header,
  5393. }
  5394. }
  5395. if err != nil {
  5396. return nil, err
  5397. }
  5398. defer googleapi.CloseBody(res)
  5399. if err := googleapi.CheckResponse(res); err != nil {
  5400. return nil, err
  5401. }
  5402. ret := &CourseWork{
  5403. ServerResponse: googleapi.ServerResponse{
  5404. Header: res.Header,
  5405. HTTPStatusCode: res.StatusCode,
  5406. },
  5407. }
  5408. target := &ret
  5409. if err := gensupport.DecodeResponse(target, res); err != nil {
  5410. return nil, err
  5411. }
  5412. return ret, nil
  5413. // {
  5414. // "description": "Returns course work.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or course work does not exist.",
  5415. // "flatPath": "v1/courses/{courseId}/courseWork/{id}",
  5416. // "httpMethod": "GET",
  5417. // "id": "classroom.courses.courseWork.get",
  5418. // "parameterOrder": [
  5419. // "courseId",
  5420. // "id"
  5421. // ],
  5422. // "parameters": {
  5423. // "courseId": {
  5424. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5425. // "location": "path",
  5426. // "required": true,
  5427. // "type": "string"
  5428. // },
  5429. // "id": {
  5430. // "description": "Identifier of the course work.",
  5431. // "location": "path",
  5432. // "required": true,
  5433. // "type": "string"
  5434. // }
  5435. // },
  5436. // "path": "v1/courses/{courseId}/courseWork/{id}",
  5437. // "response": {
  5438. // "$ref": "CourseWork"
  5439. // },
  5440. // "scopes": [
  5441. // "https://www.googleapis.com/auth/classroom.coursework.me",
  5442. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  5443. // "https://www.googleapis.com/auth/classroom.coursework.students",
  5444. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly"
  5445. // ]
  5446. // }
  5447. }
  5448. // method id "classroom.courses.courseWork.list":
  5449. type CoursesCourseWorkListCall struct {
  5450. s *Service
  5451. courseId string
  5452. urlParams_ gensupport.URLParams
  5453. ifNoneMatch_ string
  5454. ctx_ context.Context
  5455. header_ http.Header
  5456. }
  5457. // List: Returns a list of course work that the requester is permitted
  5458. // to view.
  5459. //
  5460. // Course students may only view `PUBLISHED` course work. Course
  5461. // teachers
  5462. // and domain administrators may view all course work.
  5463. //
  5464. // This method returns the following error codes:
  5465. //
  5466. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5467. // access
  5468. // the requested course or for access errors.
  5469. // * `INVALID_ARGUMENT` if the request is malformed.
  5470. // * `NOT_FOUND` if the requested course does not exist.
  5471. func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall {
  5472. c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5473. c.courseId = courseId
  5474. return c
  5475. }
  5476. // CourseWorkStates sets the optional parameter "courseWorkStates":
  5477. // Restriction on the work status to return. Only courseWork that
  5478. // matches
  5479. // is returned. If unspecified, items with a work status of
  5480. // `PUBLISHED`
  5481. // is returned.
  5482. //
  5483. // Possible values:
  5484. // "COURSE_WORK_STATE_UNSPECIFIED"
  5485. // "PUBLISHED"
  5486. // "DRAFT"
  5487. // "DELETED"
  5488. func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall {
  5489. c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...))
  5490. return c
  5491. }
  5492. // OrderBy sets the optional parameter "orderBy": Optional sort ordering
  5493. // for results. A comma-separated list of fields with
  5494. // an optional sort direction keyword. Supported fields are
  5495. // `updateTime`
  5496. // and `dueDate`. Supported direction keywords are `asc` and `desc`.
  5497. // If not specified, `updateTime desc` is the default
  5498. // behavior.
  5499. // Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc`
  5500. func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall {
  5501. c.urlParams_.Set("orderBy", orderBy)
  5502. return c
  5503. }
  5504. // PageSize sets the optional parameter "pageSize": Maximum number of
  5505. // items to return. Zero or unspecified indicates that the
  5506. // server may assign a maximum.
  5507. //
  5508. // The server may return fewer than the specified number of results.
  5509. func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall {
  5510. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5511. return c
  5512. }
  5513. // PageToken sets the optional parameter "pageToken":
  5514. // nextPageToken
  5515. // value returned from a previous
  5516. // list call,
  5517. // indicating that the subsequent page of results should be
  5518. // returned.
  5519. //
  5520. // The list request
  5521. // must be otherwise identical to the one that resulted in this token.
  5522. func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall {
  5523. c.urlParams_.Set("pageToken", pageToken)
  5524. return c
  5525. }
  5526. // Fields allows partial responses to be retrieved. See
  5527. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5528. // for more information.
  5529. func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall {
  5530. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5531. return c
  5532. }
  5533. // IfNoneMatch sets the optional parameter which makes the operation
  5534. // fail if the object's ETag matches the given value. This is useful for
  5535. // getting updates only after the object has changed since the last
  5536. // request. Use googleapi.IsNotModified to check whether the response
  5537. // error from Do is the result of In-None-Match.
  5538. func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall {
  5539. c.ifNoneMatch_ = entityTag
  5540. return c
  5541. }
  5542. // Context sets the context to be used in this call's Do method. Any
  5543. // pending HTTP request will be aborted if the provided context is
  5544. // canceled.
  5545. func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall {
  5546. c.ctx_ = ctx
  5547. return c
  5548. }
  5549. // Header returns an http.Header that can be modified by the caller to
  5550. // add HTTP headers to the request.
  5551. func (c *CoursesCourseWorkListCall) Header() http.Header {
  5552. if c.header_ == nil {
  5553. c.header_ = make(http.Header)
  5554. }
  5555. return c.header_
  5556. }
  5557. func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) {
  5558. reqHeaders := make(http.Header)
  5559. for k, v := range c.header_ {
  5560. reqHeaders[k] = v
  5561. }
  5562. reqHeaders.Set("User-Agent", c.s.userAgent())
  5563. if c.ifNoneMatch_ != "" {
  5564. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5565. }
  5566. var body io.Reader = nil
  5567. c.urlParams_.Set("alt", alt)
  5568. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork")
  5569. urls += "?" + c.urlParams_.Encode()
  5570. req, _ := http.NewRequest("GET", urls, body)
  5571. req.Header = reqHeaders
  5572. googleapi.Expand(req.URL, map[string]string{
  5573. "courseId": c.courseId,
  5574. })
  5575. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5576. }
  5577. // Do executes the "classroom.courses.courseWork.list" call.
  5578. // Exactly one of *ListCourseWorkResponse or error will be non-nil. Any
  5579. // non-2xx status code is an error. Response headers are in either
  5580. // *ListCourseWorkResponse.ServerResponse.Header or (if a response was
  5581. // returned at all) in error.(*googleapi.Error).Header. Use
  5582. // googleapi.IsNotModified to check whether the returned error was
  5583. // because http.StatusNotModified was returned.
  5584. func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) {
  5585. gensupport.SetOptions(c.urlParams_, opts...)
  5586. res, err := c.doRequest("json")
  5587. if res != nil && res.StatusCode == http.StatusNotModified {
  5588. if res.Body != nil {
  5589. res.Body.Close()
  5590. }
  5591. return nil, &googleapi.Error{
  5592. Code: res.StatusCode,
  5593. Header: res.Header,
  5594. }
  5595. }
  5596. if err != nil {
  5597. return nil, err
  5598. }
  5599. defer googleapi.CloseBody(res)
  5600. if err := googleapi.CheckResponse(res); err != nil {
  5601. return nil, err
  5602. }
  5603. ret := &ListCourseWorkResponse{
  5604. ServerResponse: googleapi.ServerResponse{
  5605. Header: res.Header,
  5606. HTTPStatusCode: res.StatusCode,
  5607. },
  5608. }
  5609. target := &ret
  5610. if err := gensupport.DecodeResponse(target, res); err != nil {
  5611. return nil, err
  5612. }
  5613. return ret, nil
  5614. // {
  5615. // "description": "Returns a list of course work that the requester is permitted to view.\n\nCourse students may only view `PUBLISHED` course work. Course teachers\nand domain administrators may view all course work.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthe requested course or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.",
  5616. // "flatPath": "v1/courses/{courseId}/courseWork",
  5617. // "httpMethod": "GET",
  5618. // "id": "classroom.courses.courseWork.list",
  5619. // "parameterOrder": [
  5620. // "courseId"
  5621. // ],
  5622. // "parameters": {
  5623. // "courseId": {
  5624. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5625. // "location": "path",
  5626. // "required": true,
  5627. // "type": "string"
  5628. // },
  5629. // "courseWorkStates": {
  5630. // "description": "Restriction on the work status to return. Only courseWork that matches\nis returned. If unspecified, items with a work status of `PUBLISHED`\nis returned.",
  5631. // "enum": [
  5632. // "COURSE_WORK_STATE_UNSPECIFIED",
  5633. // "PUBLISHED",
  5634. // "DRAFT",
  5635. // "DELETED"
  5636. // ],
  5637. // "location": "query",
  5638. // "repeated": true,
  5639. // "type": "string"
  5640. // },
  5641. // "orderBy": {
  5642. // "description": "Optional sort ordering for results. A comma-separated list of fields with\nan optional sort direction keyword. Supported fields are `updateTime`\nand `dueDate`. Supported direction keywords are `asc` and `desc`.\nIf not specified, `updateTime desc` is the default behavior.\nExamples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc`",
  5643. // "location": "query",
  5644. // "type": "string"
  5645. // },
  5646. // "pageSize": {
  5647. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  5648. // "format": "int32",
  5649. // "location": "query",
  5650. // "type": "integer"
  5651. // },
  5652. // "pageToken": {
  5653. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.",
  5654. // "location": "query",
  5655. // "type": "string"
  5656. // }
  5657. // },
  5658. // "path": "v1/courses/{courseId}/courseWork",
  5659. // "response": {
  5660. // "$ref": "ListCourseWorkResponse"
  5661. // },
  5662. // "scopes": [
  5663. // "https://www.googleapis.com/auth/classroom.coursework.me",
  5664. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  5665. // "https://www.googleapis.com/auth/classroom.coursework.students",
  5666. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly"
  5667. // ]
  5668. // }
  5669. }
  5670. // Pages invokes f for each page of results.
  5671. // A non-nil error returned from f will halt the iteration.
  5672. // The provided context supersedes any context provided to the Context method.
  5673. func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error {
  5674. c.ctx_ = ctx
  5675. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5676. for {
  5677. x, err := c.Do()
  5678. if err != nil {
  5679. return err
  5680. }
  5681. if err := f(x); err != nil {
  5682. return err
  5683. }
  5684. if x.NextPageToken == "" {
  5685. return nil
  5686. }
  5687. c.PageToken(x.NextPageToken)
  5688. }
  5689. }
  5690. // method id "classroom.courses.courseWork.modifyAssignees":
  5691. type CoursesCourseWorkModifyAssigneesCall struct {
  5692. s *Service
  5693. courseId string
  5694. id string
  5695. modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest
  5696. urlParams_ gensupport.URLParams
  5697. ctx_ context.Context
  5698. header_ http.Header
  5699. }
  5700. // ModifyAssignees: Modifies assignee mode and options of a
  5701. // coursework.
  5702. //
  5703. // Only a teacher of the course that contains the coursework may
  5704. // call this method.
  5705. //
  5706. // This method returns the following error codes:
  5707. //
  5708. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5709. // access the
  5710. // requested course or course work or for access errors.
  5711. // * `INVALID_ARGUMENT` if the request is malformed.
  5712. // * `NOT_FOUND` if the requested course or course work does not exist.
  5713. func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall {
  5714. c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5715. c.courseId = courseId
  5716. c.id = id
  5717. c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest
  5718. return c
  5719. }
  5720. // Fields allows partial responses to be retrieved. See
  5721. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5722. // for more information.
  5723. func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall {
  5724. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5725. return c
  5726. }
  5727. // Context sets the context to be used in this call's Do method. Any
  5728. // pending HTTP request will be aborted if the provided context is
  5729. // canceled.
  5730. func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall {
  5731. c.ctx_ = ctx
  5732. return c
  5733. }
  5734. // Header returns an http.Header that can be modified by the caller to
  5735. // add HTTP headers to the request.
  5736. func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header {
  5737. if c.header_ == nil {
  5738. c.header_ = make(http.Header)
  5739. }
  5740. return c.header_
  5741. }
  5742. func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) {
  5743. reqHeaders := make(http.Header)
  5744. for k, v := range c.header_ {
  5745. reqHeaders[k] = v
  5746. }
  5747. reqHeaders.Set("User-Agent", c.s.userAgent())
  5748. var body io.Reader = nil
  5749. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest)
  5750. if err != nil {
  5751. return nil, err
  5752. }
  5753. reqHeaders.Set("Content-Type", "application/json")
  5754. c.urlParams_.Set("alt", alt)
  5755. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees")
  5756. urls += "?" + c.urlParams_.Encode()
  5757. req, _ := http.NewRequest("POST", urls, body)
  5758. req.Header = reqHeaders
  5759. googleapi.Expand(req.URL, map[string]string{
  5760. "courseId": c.courseId,
  5761. "id": c.id,
  5762. })
  5763. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5764. }
  5765. // Do executes the "classroom.courses.courseWork.modifyAssignees" call.
  5766. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5767. // status code is an error. Response headers are in either
  5768. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5769. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5770. // to check whether the returned error was because
  5771. // http.StatusNotModified was returned.
  5772. func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5773. gensupport.SetOptions(c.urlParams_, opts...)
  5774. res, err := c.doRequest("json")
  5775. if res != nil && res.StatusCode == http.StatusNotModified {
  5776. if res.Body != nil {
  5777. res.Body.Close()
  5778. }
  5779. return nil, &googleapi.Error{
  5780. Code: res.StatusCode,
  5781. Header: res.Header,
  5782. }
  5783. }
  5784. if err != nil {
  5785. return nil, err
  5786. }
  5787. defer googleapi.CloseBody(res)
  5788. if err := googleapi.CheckResponse(res); err != nil {
  5789. return nil, err
  5790. }
  5791. ret := &CourseWork{
  5792. ServerResponse: googleapi.ServerResponse{
  5793. Header: res.Header,
  5794. HTTPStatusCode: res.StatusCode,
  5795. },
  5796. }
  5797. target := &ret
  5798. if err := gensupport.DecodeResponse(target, res); err != nil {
  5799. return nil, err
  5800. }
  5801. return ret, nil
  5802. // {
  5803. // "description": "Modifies assignee mode and options of a coursework.\n\nOnly a teacher of the course that contains the coursework may\ncall this method.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course or course work does not exist.",
  5804. // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees",
  5805. // "httpMethod": "POST",
  5806. // "id": "classroom.courses.courseWork.modifyAssignees",
  5807. // "parameterOrder": [
  5808. // "courseId",
  5809. // "id"
  5810. // ],
  5811. // "parameters": {
  5812. // "courseId": {
  5813. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5814. // "location": "path",
  5815. // "required": true,
  5816. // "type": "string"
  5817. // },
  5818. // "id": {
  5819. // "description": "Identifier of the coursework.",
  5820. // "location": "path",
  5821. // "required": true,
  5822. // "type": "string"
  5823. // }
  5824. // },
  5825. // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees",
  5826. // "request": {
  5827. // "$ref": "ModifyCourseWorkAssigneesRequest"
  5828. // },
  5829. // "response": {
  5830. // "$ref": "CourseWork"
  5831. // },
  5832. // "scopes": [
  5833. // "https://www.googleapis.com/auth/classroom.coursework.students"
  5834. // ]
  5835. // }
  5836. }
  5837. // method id "classroom.courses.courseWork.patch":
  5838. type CoursesCourseWorkPatchCall struct {
  5839. s *Service
  5840. courseId string
  5841. id string
  5842. coursework *CourseWork
  5843. urlParams_ gensupport.URLParams
  5844. ctx_ context.Context
  5845. header_ http.Header
  5846. }
  5847. // Patch: Updates one or more fields of a course work.
  5848. //
  5849. // See google.classroom.v1.CourseWork for details
  5850. // of which fields may be updated and who may change them.
  5851. //
  5852. // This request must be made by the Developer Console project of
  5853. // the
  5854. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  5855. // used to
  5856. // create the corresponding course work item.
  5857. //
  5858. // This method returns the following error codes:
  5859. //
  5860. // * `PERMISSION_DENIED` if the requesting developer project did not
  5861. // create
  5862. // the corresponding course work, if the user is not permitted to make
  5863. // the
  5864. // requested modification to the student submission, or for
  5865. // access errors.
  5866. // * `INVALID_ARGUMENT` if the request is malformed.
  5867. // * `FAILED_PRECONDITION` if the requested course work has already
  5868. // been
  5869. // deleted.
  5870. // * `NOT_FOUND` if the requested course, course work, or student
  5871. // submission
  5872. // does not exist.
  5873. func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall {
  5874. c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5875. c.courseId = courseId
  5876. c.id = id
  5877. c.coursework = coursework
  5878. return c
  5879. }
  5880. // UpdateMask sets the optional parameter "updateMask": Mask that
  5881. // identifies which fields on the course work to update.
  5882. // This field is required to do an update. The update fails if
  5883. // invalid
  5884. // fields are specified. If a field supports empty values, it can be
  5885. // cleared
  5886. // by specifying it in the update mask and not in the CourseWork object.
  5887. // If a
  5888. // field that does not support empty values is included in the update
  5889. // mask and
  5890. // not set in the CourseWork object, an `INVALID_ARGUMENT` error will
  5891. // be
  5892. // returned.
  5893. //
  5894. // The following fields may be specified by teachers:
  5895. //
  5896. // * `title`
  5897. // * `description`
  5898. // * `state`
  5899. // * `due_date`
  5900. // * `due_time`
  5901. // * `max_points`
  5902. // * `scheduled_time`
  5903. // * `submission_modification_mode`
  5904. func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall {
  5905. c.urlParams_.Set("updateMask", updateMask)
  5906. return c
  5907. }
  5908. // Fields allows partial responses to be retrieved. See
  5909. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5910. // for more information.
  5911. func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall {
  5912. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5913. return c
  5914. }
  5915. // Context sets the context to be used in this call's Do method. Any
  5916. // pending HTTP request will be aborted if the provided context is
  5917. // canceled.
  5918. func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall {
  5919. c.ctx_ = ctx
  5920. return c
  5921. }
  5922. // Header returns an http.Header that can be modified by the caller to
  5923. // add HTTP headers to the request.
  5924. func (c *CoursesCourseWorkPatchCall) Header() http.Header {
  5925. if c.header_ == nil {
  5926. c.header_ = make(http.Header)
  5927. }
  5928. return c.header_
  5929. }
  5930. func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) {
  5931. reqHeaders := make(http.Header)
  5932. for k, v := range c.header_ {
  5933. reqHeaders[k] = v
  5934. }
  5935. reqHeaders.Set("User-Agent", c.s.userAgent())
  5936. var body io.Reader = nil
  5937. body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework)
  5938. if err != nil {
  5939. return nil, err
  5940. }
  5941. reqHeaders.Set("Content-Type", "application/json")
  5942. c.urlParams_.Set("alt", alt)
  5943. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}")
  5944. urls += "?" + c.urlParams_.Encode()
  5945. req, _ := http.NewRequest("PATCH", urls, body)
  5946. req.Header = reqHeaders
  5947. googleapi.Expand(req.URL, map[string]string{
  5948. "courseId": c.courseId,
  5949. "id": c.id,
  5950. })
  5951. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5952. }
  5953. // Do executes the "classroom.courses.courseWork.patch" call.
  5954. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5955. // status code is an error. Response headers are in either
  5956. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5957. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5958. // to check whether the returned error was because
  5959. // http.StatusNotModified was returned.
  5960. func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5961. gensupport.SetOptions(c.urlParams_, opts...)
  5962. res, err := c.doRequest("json")
  5963. if res != nil && res.StatusCode == http.StatusNotModified {
  5964. if res.Body != nil {
  5965. res.Body.Close()
  5966. }
  5967. return nil, &googleapi.Error{
  5968. Code: res.StatusCode,
  5969. Header: res.Header,
  5970. }
  5971. }
  5972. if err != nil {
  5973. return nil, err
  5974. }
  5975. defer googleapi.CloseBody(res)
  5976. if err := googleapi.CheckResponse(res); err != nil {
  5977. return nil, err
  5978. }
  5979. ret := &CourseWork{
  5980. ServerResponse: googleapi.ServerResponse{
  5981. Header: res.Header,
  5982. HTTPStatusCode: res.StatusCode,
  5983. },
  5984. }
  5985. target := &ret
  5986. if err := gensupport.DecodeResponse(target, res); err != nil {
  5987. return nil, err
  5988. }
  5989. return ret, nil
  5990. // {
  5991. // "description": "Updates one or more fields of a course work.\n\nSee google.classroom.v1.CourseWork for details\nof which fields may be updated and who may change them.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding course work, if the user is not permitted to make the\nrequested modification to the student submission, or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `FAILED_PRECONDITION` if the requested course work has already been\ndeleted.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  5992. // "flatPath": "v1/courses/{courseId}/courseWork/{id}",
  5993. // "httpMethod": "PATCH",
  5994. // "id": "classroom.courses.courseWork.patch",
  5995. // "parameterOrder": [
  5996. // "courseId",
  5997. // "id"
  5998. // ],
  5999. // "parameters": {
  6000. // "courseId": {
  6001. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6002. // "location": "path",
  6003. // "required": true,
  6004. // "type": "string"
  6005. // },
  6006. // "id": {
  6007. // "description": "Identifier of the course work.",
  6008. // "location": "path",
  6009. // "required": true,
  6010. // "type": "string"
  6011. // },
  6012. // "updateMask": {
  6013. // "description": "Mask that identifies which fields on the course work to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified. If a field supports empty values, it can be cleared\nby specifying it in the update mask and not in the CourseWork object. If a\nfield that does not support empty values is included in the update mask and\nnot set in the CourseWork object, an `INVALID_ARGUMENT` error will be\nreturned.\n\nThe following fields may be specified by teachers:\n\n* `title`\n* `description`\n* `state`\n* `due_date`\n* `due_time`\n* `max_points`\n* `scheduled_time`\n* `submission_modification_mode`",
  6014. // "format": "google-fieldmask",
  6015. // "location": "query",
  6016. // "type": "string"
  6017. // }
  6018. // },
  6019. // "path": "v1/courses/{courseId}/courseWork/{id}",
  6020. // "request": {
  6021. // "$ref": "CourseWork"
  6022. // },
  6023. // "response": {
  6024. // "$ref": "CourseWork"
  6025. // },
  6026. // "scopes": [
  6027. // "https://www.googleapis.com/auth/classroom.coursework.students"
  6028. // ]
  6029. // }
  6030. }
  6031. // method id "classroom.courses.courseWork.studentSubmissions.get":
  6032. type CoursesCourseWorkStudentSubmissionsGetCall struct {
  6033. s *Service
  6034. courseId string
  6035. courseWorkId string
  6036. id string
  6037. urlParams_ gensupport.URLParams
  6038. ifNoneMatch_ string
  6039. ctx_ context.Context
  6040. header_ http.Header
  6041. }
  6042. // Get: Returns a student submission.
  6043. //
  6044. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6045. // access the
  6046. // requested course, course work, or student submission or for
  6047. // access errors.
  6048. // * `INVALID_ARGUMENT` if the request is malformed.
  6049. // * `NOT_FOUND` if the requested course, course work, or student
  6050. // submission
  6051. // does not exist.
  6052. func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall {
  6053. c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6054. c.courseId = courseId
  6055. c.courseWorkId = courseWorkId
  6056. c.id = id
  6057. return c
  6058. }
  6059. // Fields allows partial responses to be retrieved. See
  6060. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6061. // for more information.
  6062. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall {
  6063. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6064. return c
  6065. }
  6066. // IfNoneMatch sets the optional parameter which makes the operation
  6067. // fail if the object's ETag matches the given value. This is useful for
  6068. // getting updates only after the object has changed since the last
  6069. // request. Use googleapi.IsNotModified to check whether the response
  6070. // error from Do is the result of In-None-Match.
  6071. func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall {
  6072. c.ifNoneMatch_ = entityTag
  6073. return c
  6074. }
  6075. // Context sets the context to be used in this call's Do method. Any
  6076. // pending HTTP request will be aborted if the provided context is
  6077. // canceled.
  6078. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall {
  6079. c.ctx_ = ctx
  6080. return c
  6081. }
  6082. // Header returns an http.Header that can be modified by the caller to
  6083. // add HTTP headers to the request.
  6084. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header {
  6085. if c.header_ == nil {
  6086. c.header_ = make(http.Header)
  6087. }
  6088. return c.header_
  6089. }
  6090. func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) {
  6091. reqHeaders := make(http.Header)
  6092. for k, v := range c.header_ {
  6093. reqHeaders[k] = v
  6094. }
  6095. reqHeaders.Set("User-Agent", c.s.userAgent())
  6096. if c.ifNoneMatch_ != "" {
  6097. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6098. }
  6099. var body io.Reader = nil
  6100. c.urlParams_.Set("alt", alt)
  6101. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}")
  6102. urls += "?" + c.urlParams_.Encode()
  6103. req, _ := http.NewRequest("GET", urls, body)
  6104. req.Header = reqHeaders
  6105. googleapi.Expand(req.URL, map[string]string{
  6106. "courseId": c.courseId,
  6107. "courseWorkId": c.courseWorkId,
  6108. "id": c.id,
  6109. })
  6110. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6111. }
  6112. // Do executes the "classroom.courses.courseWork.studentSubmissions.get" call.
  6113. // Exactly one of *StudentSubmission or error will be non-nil. Any
  6114. // non-2xx status code is an error. Response headers are in either
  6115. // *StudentSubmission.ServerResponse.Header or (if a response was
  6116. // returned at all) in error.(*googleapi.Error).Header. Use
  6117. // googleapi.IsNotModified to check whether the returned error was
  6118. // because http.StatusNotModified was returned.
  6119. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) {
  6120. gensupport.SetOptions(c.urlParams_, opts...)
  6121. res, err := c.doRequest("json")
  6122. if res != nil && res.StatusCode == http.StatusNotModified {
  6123. if res.Body != nil {
  6124. res.Body.Close()
  6125. }
  6126. return nil, &googleapi.Error{
  6127. Code: res.StatusCode,
  6128. Header: res.Header,
  6129. }
  6130. }
  6131. if err != nil {
  6132. return nil, err
  6133. }
  6134. defer googleapi.CloseBody(res)
  6135. if err := googleapi.CheckResponse(res); err != nil {
  6136. return nil, err
  6137. }
  6138. ret := &StudentSubmission{
  6139. ServerResponse: googleapi.ServerResponse{
  6140. Header: res.Header,
  6141. HTTPStatusCode: res.StatusCode,
  6142. },
  6143. }
  6144. target := &ret
  6145. if err := gensupport.DecodeResponse(target, res); err != nil {
  6146. return nil, err
  6147. }
  6148. return ret, nil
  6149. // {
  6150. // "description": "Returns a student submission.\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course, course work, or student submission or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  6151. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  6152. // "httpMethod": "GET",
  6153. // "id": "classroom.courses.courseWork.studentSubmissions.get",
  6154. // "parameterOrder": [
  6155. // "courseId",
  6156. // "courseWorkId",
  6157. // "id"
  6158. // ],
  6159. // "parameters": {
  6160. // "courseId": {
  6161. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6162. // "location": "path",
  6163. // "required": true,
  6164. // "type": "string"
  6165. // },
  6166. // "courseWorkId": {
  6167. // "description": "Identifier of the course work.",
  6168. // "location": "path",
  6169. // "required": true,
  6170. // "type": "string"
  6171. // },
  6172. // "id": {
  6173. // "description": "Identifier of the student submission.",
  6174. // "location": "path",
  6175. // "required": true,
  6176. // "type": "string"
  6177. // }
  6178. // },
  6179. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  6180. // "response": {
  6181. // "$ref": "StudentSubmission"
  6182. // },
  6183. // "scopes": [
  6184. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6185. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  6186. // "https://www.googleapis.com/auth/classroom.coursework.students",
  6187. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly",
  6188. // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly",
  6189. // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly"
  6190. // ]
  6191. // }
  6192. }
  6193. // method id "classroom.courses.courseWork.studentSubmissions.list":
  6194. type CoursesCourseWorkStudentSubmissionsListCall struct {
  6195. s *Service
  6196. courseId string
  6197. courseWorkId string
  6198. urlParams_ gensupport.URLParams
  6199. ifNoneMatch_ string
  6200. ctx_ context.Context
  6201. header_ http.Header
  6202. }
  6203. // List: Returns a list of student submissions that the requester is
  6204. // permitted to
  6205. // view, factoring in the OAuth scopes of the request.
  6206. // `-` may be specified as the `course_work_id` to include
  6207. // student
  6208. // submissions for multiple course work items.
  6209. //
  6210. // Course students may only view their own work. Course teachers
  6211. // and domain administrators may view all student submissions.
  6212. //
  6213. // This method returns the following error codes:
  6214. //
  6215. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6216. // access the
  6217. // requested course or course work, or for access errors.
  6218. // * `INVALID_ARGUMENT` if the request is malformed.
  6219. // * `NOT_FOUND` if the requested course does not exist.
  6220. func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall {
  6221. c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6222. c.courseId = courseId
  6223. c.courseWorkId = courseWorkId
  6224. return c
  6225. }
  6226. // Late sets the optional parameter "late": Requested lateness value. If
  6227. // specified, returned student submissions are
  6228. // restricted by the requested value.
  6229. // If unspecified, submissions are returned regardless of `late` value.
  6230. //
  6231. // Possible values:
  6232. // "LATE_VALUES_UNSPECIFIED"
  6233. // "LATE_ONLY"
  6234. // "NOT_LATE_ONLY"
  6235. func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall {
  6236. c.urlParams_.Set("late", late)
  6237. return c
  6238. }
  6239. // PageSize sets the optional parameter "pageSize": Maximum number of
  6240. // items to return. Zero or unspecified indicates that the
  6241. // server may assign a maximum.
  6242. //
  6243. // The server may return fewer than the specified number of results.
  6244. func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall {
  6245. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6246. return c
  6247. }
  6248. // PageToken sets the optional parameter "pageToken":
  6249. // nextPageToken
  6250. // value returned from a previous
  6251. // list call,
  6252. // indicating that the subsequent page of results should be
  6253. // returned.
  6254. //
  6255. // The list request
  6256. // must be otherwise identical to the one that resulted in this token.
  6257. func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall {
  6258. c.urlParams_.Set("pageToken", pageToken)
  6259. return c
  6260. }
  6261. // States sets the optional parameter "states": Requested submission
  6262. // states. If specified, returned student submissions
  6263. // match one of the specified submission states.
  6264. //
  6265. // Possible values:
  6266. // "SUBMISSION_STATE_UNSPECIFIED"
  6267. // "NEW"
  6268. // "CREATED"
  6269. // "TURNED_IN"
  6270. // "RETURNED"
  6271. // "RECLAIMED_BY_STUDENT"
  6272. func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall {
  6273. c.urlParams_.SetMulti("states", append([]string{}, states...))
  6274. return c
  6275. }
  6276. // UserId sets the optional parameter "userId": Optional argument to
  6277. // restrict returned student work to those owned by the
  6278. // student with the specified identifier. The identifier can be one of
  6279. // the
  6280. // following:
  6281. //
  6282. // * the numeric identifier for the user
  6283. // * the email address of the user
  6284. // * the string literal "me", indicating the requesting user
  6285. func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall {
  6286. c.urlParams_.Set("userId", userId)
  6287. return c
  6288. }
  6289. // Fields allows partial responses to be retrieved. See
  6290. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6291. // for more information.
  6292. func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall {
  6293. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6294. return c
  6295. }
  6296. // IfNoneMatch sets the optional parameter which makes the operation
  6297. // fail if the object's ETag matches the given value. This is useful for
  6298. // getting updates only after the object has changed since the last
  6299. // request. Use googleapi.IsNotModified to check whether the response
  6300. // error from Do is the result of In-None-Match.
  6301. func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall {
  6302. c.ifNoneMatch_ = entityTag
  6303. return c
  6304. }
  6305. // Context sets the context to be used in this call's Do method. Any
  6306. // pending HTTP request will be aborted if the provided context is
  6307. // canceled.
  6308. func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall {
  6309. c.ctx_ = ctx
  6310. return c
  6311. }
  6312. // Header returns an http.Header that can be modified by the caller to
  6313. // add HTTP headers to the request.
  6314. func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header {
  6315. if c.header_ == nil {
  6316. c.header_ = make(http.Header)
  6317. }
  6318. return c.header_
  6319. }
  6320. func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) {
  6321. reqHeaders := make(http.Header)
  6322. for k, v := range c.header_ {
  6323. reqHeaders[k] = v
  6324. }
  6325. reqHeaders.Set("User-Agent", c.s.userAgent())
  6326. if c.ifNoneMatch_ != "" {
  6327. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6328. }
  6329. var body io.Reader = nil
  6330. c.urlParams_.Set("alt", alt)
  6331. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions")
  6332. urls += "?" + c.urlParams_.Encode()
  6333. req, _ := http.NewRequest("GET", urls, body)
  6334. req.Header = reqHeaders
  6335. googleapi.Expand(req.URL, map[string]string{
  6336. "courseId": c.courseId,
  6337. "courseWorkId": c.courseWorkId,
  6338. })
  6339. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6340. }
  6341. // Do executes the "classroom.courses.courseWork.studentSubmissions.list" call.
  6342. // Exactly one of *ListStudentSubmissionsResponse or error will be
  6343. // non-nil. Any non-2xx status code is an error. Response headers are in
  6344. // either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a
  6345. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6346. // googleapi.IsNotModified to check whether the returned error was
  6347. // because http.StatusNotModified was returned.
  6348. func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) {
  6349. gensupport.SetOptions(c.urlParams_, opts...)
  6350. res, err := c.doRequest("json")
  6351. if res != nil && res.StatusCode == http.StatusNotModified {
  6352. if res.Body != nil {
  6353. res.Body.Close()
  6354. }
  6355. return nil, &googleapi.Error{
  6356. Code: res.StatusCode,
  6357. Header: res.Header,
  6358. }
  6359. }
  6360. if err != nil {
  6361. return nil, err
  6362. }
  6363. defer googleapi.CloseBody(res)
  6364. if err := googleapi.CheckResponse(res); err != nil {
  6365. return nil, err
  6366. }
  6367. ret := &ListStudentSubmissionsResponse{
  6368. ServerResponse: googleapi.ServerResponse{
  6369. Header: res.Header,
  6370. HTTPStatusCode: res.StatusCode,
  6371. },
  6372. }
  6373. target := &ret
  6374. if err := gensupport.DecodeResponse(target, res); err != nil {
  6375. return nil, err
  6376. }
  6377. return ret, nil
  6378. // {
  6379. // "description": "Returns a list of student submissions that the requester is permitted to\nview, factoring in the OAuth scopes of the request.\n`-` may be specified as the `course_work_id` to include student\nsubmissions for multiple course work items.\n\nCourse students may only view their own work. Course teachers\nand domain administrators may view all student submissions.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, or for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course does not exist.",
  6380. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions",
  6381. // "httpMethod": "GET",
  6382. // "id": "classroom.courses.courseWork.studentSubmissions.list",
  6383. // "parameterOrder": [
  6384. // "courseId",
  6385. // "courseWorkId"
  6386. // ],
  6387. // "parameters": {
  6388. // "courseId": {
  6389. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6390. // "location": "path",
  6391. // "required": true,
  6392. // "type": "string"
  6393. // },
  6394. // "courseWorkId": {
  6395. // "description": "Identifier of the student work to request.\nThis may be set to the string literal `\"-\"` to request student work for\nall course work in the specified course.",
  6396. // "location": "path",
  6397. // "required": true,
  6398. // "type": "string"
  6399. // },
  6400. // "late": {
  6401. // "description": "Requested lateness value. If specified, returned student submissions are\nrestricted by the requested value.\nIf unspecified, submissions are returned regardless of `late` value.",
  6402. // "enum": [
  6403. // "LATE_VALUES_UNSPECIFIED",
  6404. // "LATE_ONLY",
  6405. // "NOT_LATE_ONLY"
  6406. // ],
  6407. // "location": "query",
  6408. // "type": "string"
  6409. // },
  6410. // "pageSize": {
  6411. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  6412. // "format": "int32",
  6413. // "location": "query",
  6414. // "type": "integer"
  6415. // },
  6416. // "pageToken": {
  6417. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.",
  6418. // "location": "query",
  6419. // "type": "string"
  6420. // },
  6421. // "states": {
  6422. // "description": "Requested submission states. If specified, returned student submissions\nmatch one of the specified submission states.",
  6423. // "enum": [
  6424. // "SUBMISSION_STATE_UNSPECIFIED",
  6425. // "NEW",
  6426. // "CREATED",
  6427. // "TURNED_IN",
  6428. // "RETURNED",
  6429. // "RECLAIMED_BY_STUDENT"
  6430. // ],
  6431. // "location": "query",
  6432. // "repeated": true,
  6433. // "type": "string"
  6434. // },
  6435. // "userId": {
  6436. // "description": "Optional argument to restrict returned student work to those owned by the\nstudent with the specified identifier. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  6437. // "location": "query",
  6438. // "type": "string"
  6439. // }
  6440. // },
  6441. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions",
  6442. // "response": {
  6443. // "$ref": "ListStudentSubmissionsResponse"
  6444. // },
  6445. // "scopes": [
  6446. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6447. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  6448. // "https://www.googleapis.com/auth/classroom.coursework.students",
  6449. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly",
  6450. // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly",
  6451. // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly"
  6452. // ]
  6453. // }
  6454. }
  6455. // Pages invokes f for each page of results.
  6456. // A non-nil error returned from f will halt the iteration.
  6457. // The provided context supersedes any context provided to the Context method.
  6458. func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error {
  6459. c.ctx_ = ctx
  6460. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6461. for {
  6462. x, err := c.Do()
  6463. if err != nil {
  6464. return err
  6465. }
  6466. if err := f(x); err != nil {
  6467. return err
  6468. }
  6469. if x.NextPageToken == "" {
  6470. return nil
  6471. }
  6472. c.PageToken(x.NextPageToken)
  6473. }
  6474. }
  6475. // method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments":
  6476. type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct {
  6477. s *Service
  6478. courseId string
  6479. courseWorkId string
  6480. id string
  6481. modifyattachmentsrequest *ModifyAttachmentsRequest
  6482. urlParams_ gensupport.URLParams
  6483. ctx_ context.Context
  6484. header_ http.Header
  6485. }
  6486. // ModifyAttachments: Modifies attachments of student
  6487. // submission.
  6488. //
  6489. // Attachments may only be added to student submissions belonging to
  6490. // course
  6491. // work objects with a `workType` of `ASSIGNMENT`.
  6492. //
  6493. // This request must be made by the Developer Console project of
  6494. // the
  6495. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  6496. // used to
  6497. // create the corresponding course work item.
  6498. //
  6499. // This method returns the following error codes:
  6500. //
  6501. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6502. // access the
  6503. // requested course or course work, if the user is not permitted to
  6504. // modify
  6505. // attachments on the requested student submission, or for
  6506. // access errors.
  6507. // * `INVALID_ARGUMENT` if the request is malformed.
  6508. // * `NOT_FOUND` if the requested course, course work, or student
  6509. // submission
  6510. // does not exist.
  6511. func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall {
  6512. c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6513. c.courseId = courseId
  6514. c.courseWorkId = courseWorkId
  6515. c.id = id
  6516. c.modifyattachmentsrequest = modifyattachmentsrequest
  6517. return c
  6518. }
  6519. // Fields allows partial responses to be retrieved. See
  6520. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6521. // for more information.
  6522. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall {
  6523. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6524. return c
  6525. }
  6526. // Context sets the context to be used in this call's Do method. Any
  6527. // pending HTTP request will be aborted if the provided context is
  6528. // canceled.
  6529. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall {
  6530. c.ctx_ = ctx
  6531. return c
  6532. }
  6533. // Header returns an http.Header that can be modified by the caller to
  6534. // add HTTP headers to the request.
  6535. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header {
  6536. if c.header_ == nil {
  6537. c.header_ = make(http.Header)
  6538. }
  6539. return c.header_
  6540. }
  6541. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) {
  6542. reqHeaders := make(http.Header)
  6543. for k, v := range c.header_ {
  6544. reqHeaders[k] = v
  6545. }
  6546. reqHeaders.Set("User-Agent", c.s.userAgent())
  6547. var body io.Reader = nil
  6548. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest)
  6549. if err != nil {
  6550. return nil, err
  6551. }
  6552. reqHeaders.Set("Content-Type", "application/json")
  6553. c.urlParams_.Set("alt", alt)
  6554. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments")
  6555. urls += "?" + c.urlParams_.Encode()
  6556. req, _ := http.NewRequest("POST", urls, body)
  6557. req.Header = reqHeaders
  6558. googleapi.Expand(req.URL, map[string]string{
  6559. "courseId": c.courseId,
  6560. "courseWorkId": c.courseWorkId,
  6561. "id": c.id,
  6562. })
  6563. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6564. }
  6565. // Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call.
  6566. // Exactly one of *StudentSubmission or error will be non-nil. Any
  6567. // non-2xx status code is an error. Response headers are in either
  6568. // *StudentSubmission.ServerResponse.Header or (if a response was
  6569. // returned at all) in error.(*googleapi.Error).Header. Use
  6570. // googleapi.IsNotModified to check whether the returned error was
  6571. // because http.StatusNotModified was returned.
  6572. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) {
  6573. gensupport.SetOptions(c.urlParams_, opts...)
  6574. res, err := c.doRequest("json")
  6575. if res != nil && res.StatusCode == http.StatusNotModified {
  6576. if res.Body != nil {
  6577. res.Body.Close()
  6578. }
  6579. return nil, &googleapi.Error{
  6580. Code: res.StatusCode,
  6581. Header: res.Header,
  6582. }
  6583. }
  6584. if err != nil {
  6585. return nil, err
  6586. }
  6587. defer googleapi.CloseBody(res)
  6588. if err := googleapi.CheckResponse(res); err != nil {
  6589. return nil, err
  6590. }
  6591. ret := &StudentSubmission{
  6592. ServerResponse: googleapi.ServerResponse{
  6593. Header: res.Header,
  6594. HTTPStatusCode: res.StatusCode,
  6595. },
  6596. }
  6597. target := &ret
  6598. if err := gensupport.DecodeResponse(target, res); err != nil {
  6599. return nil, err
  6600. }
  6601. return ret, nil
  6602. // {
  6603. // "description": "Modifies attachments of student submission.\n\nAttachments may only be added to student submissions belonging to course\nwork objects with a `workType` of `ASSIGNMENT`.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, if the user is not permitted to modify\nattachments on the requested student submission, or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  6604. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments",
  6605. // "httpMethod": "POST",
  6606. // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments",
  6607. // "parameterOrder": [
  6608. // "courseId",
  6609. // "courseWorkId",
  6610. // "id"
  6611. // ],
  6612. // "parameters": {
  6613. // "courseId": {
  6614. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6615. // "location": "path",
  6616. // "required": true,
  6617. // "type": "string"
  6618. // },
  6619. // "courseWorkId": {
  6620. // "description": "Identifier of the course work.",
  6621. // "location": "path",
  6622. // "required": true,
  6623. // "type": "string"
  6624. // },
  6625. // "id": {
  6626. // "description": "Identifier of the student submission.",
  6627. // "location": "path",
  6628. // "required": true,
  6629. // "type": "string"
  6630. // }
  6631. // },
  6632. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments",
  6633. // "request": {
  6634. // "$ref": "ModifyAttachmentsRequest"
  6635. // },
  6636. // "response": {
  6637. // "$ref": "StudentSubmission"
  6638. // },
  6639. // "scopes": [
  6640. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6641. // "https://www.googleapis.com/auth/classroom.coursework.students"
  6642. // ]
  6643. // }
  6644. }
  6645. // method id "classroom.courses.courseWork.studentSubmissions.patch":
  6646. type CoursesCourseWorkStudentSubmissionsPatchCall struct {
  6647. s *Service
  6648. courseId string
  6649. courseWorkId string
  6650. id string
  6651. studentsubmission *StudentSubmission
  6652. urlParams_ gensupport.URLParams
  6653. ctx_ context.Context
  6654. header_ http.Header
  6655. }
  6656. // Patch: Updates one or more fields of a student submission.
  6657. //
  6658. // See google.classroom.v1.StudentSubmission for details
  6659. // of which fields may be updated and who may change them.
  6660. //
  6661. // This request must be made by the Developer Console project of
  6662. // the
  6663. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  6664. // used to
  6665. // create the corresponding course work item.
  6666. //
  6667. // This method returns the following error codes:
  6668. //
  6669. // * `PERMISSION_DENIED` if the requesting developer project did not
  6670. // create
  6671. // the corresponding course work, if the user is not permitted to make
  6672. // the
  6673. // requested modification to the student submission, or for
  6674. // access errors.
  6675. // * `INVALID_ARGUMENT` if the request is malformed.
  6676. // * `NOT_FOUND` if the requested course, course work, or student
  6677. // submission
  6678. // does not exist.
  6679. func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6680. c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6681. c.courseId = courseId
  6682. c.courseWorkId = courseWorkId
  6683. c.id = id
  6684. c.studentsubmission = studentsubmission
  6685. return c
  6686. }
  6687. // UpdateMask sets the optional parameter "updateMask": Mask that
  6688. // identifies which fields on the student submission to update.
  6689. // This field is required to do an update. The update fails if
  6690. // invalid
  6691. // fields are specified.
  6692. //
  6693. // The following fields may be specified by teachers:
  6694. //
  6695. // * `draft_grade`
  6696. // * `assigned_grade`
  6697. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6698. c.urlParams_.Set("updateMask", updateMask)
  6699. return c
  6700. }
  6701. // Fields allows partial responses to be retrieved. See
  6702. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6703. // for more information.
  6704. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6705. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6706. return c
  6707. }
  6708. // Context sets the context to be used in this call's Do method. Any
  6709. // pending HTTP request will be aborted if the provided context is
  6710. // canceled.
  6711. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6712. c.ctx_ = ctx
  6713. return c
  6714. }
  6715. // Header returns an http.Header that can be modified by the caller to
  6716. // add HTTP headers to the request.
  6717. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header {
  6718. if c.header_ == nil {
  6719. c.header_ = make(http.Header)
  6720. }
  6721. return c.header_
  6722. }
  6723. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) {
  6724. reqHeaders := make(http.Header)
  6725. for k, v := range c.header_ {
  6726. reqHeaders[k] = v
  6727. }
  6728. reqHeaders.Set("User-Agent", c.s.userAgent())
  6729. var body io.Reader = nil
  6730. body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission)
  6731. if err != nil {
  6732. return nil, err
  6733. }
  6734. reqHeaders.Set("Content-Type", "application/json")
  6735. c.urlParams_.Set("alt", alt)
  6736. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}")
  6737. urls += "?" + c.urlParams_.Encode()
  6738. req, _ := http.NewRequest("PATCH", urls, body)
  6739. req.Header = reqHeaders
  6740. googleapi.Expand(req.URL, map[string]string{
  6741. "courseId": c.courseId,
  6742. "courseWorkId": c.courseWorkId,
  6743. "id": c.id,
  6744. })
  6745. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6746. }
  6747. // Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call.
  6748. // Exactly one of *StudentSubmission or error will be non-nil. Any
  6749. // non-2xx status code is an error. Response headers are in either
  6750. // *StudentSubmission.ServerResponse.Header or (if a response was
  6751. // returned at all) in error.(*googleapi.Error).Header. Use
  6752. // googleapi.IsNotModified to check whether the returned error was
  6753. // because http.StatusNotModified was returned.
  6754. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) {
  6755. gensupport.SetOptions(c.urlParams_, opts...)
  6756. res, err := c.doRequest("json")
  6757. if res != nil && res.StatusCode == http.StatusNotModified {
  6758. if res.Body != nil {
  6759. res.Body.Close()
  6760. }
  6761. return nil, &googleapi.Error{
  6762. Code: res.StatusCode,
  6763. Header: res.Header,
  6764. }
  6765. }
  6766. if err != nil {
  6767. return nil, err
  6768. }
  6769. defer googleapi.CloseBody(res)
  6770. if err := googleapi.CheckResponse(res); err != nil {
  6771. return nil, err
  6772. }
  6773. ret := &StudentSubmission{
  6774. ServerResponse: googleapi.ServerResponse{
  6775. Header: res.Header,
  6776. HTTPStatusCode: res.StatusCode,
  6777. },
  6778. }
  6779. target := &ret
  6780. if err := gensupport.DecodeResponse(target, res); err != nil {
  6781. return nil, err
  6782. }
  6783. return ret, nil
  6784. // {
  6785. // "description": "Updates one or more fields of a student submission.\n\nSee google.classroom.v1.StudentSubmission for details\nof which fields may be updated and who may change them.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting developer project did not create\nthe corresponding course work, if the user is not permitted to make the\nrequested modification to the student submission, or for\naccess errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  6786. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  6787. // "httpMethod": "PATCH",
  6788. // "id": "classroom.courses.courseWork.studentSubmissions.patch",
  6789. // "parameterOrder": [
  6790. // "courseId",
  6791. // "courseWorkId",
  6792. // "id"
  6793. // ],
  6794. // "parameters": {
  6795. // "courseId": {
  6796. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6797. // "location": "path",
  6798. // "required": true,
  6799. // "type": "string"
  6800. // },
  6801. // "courseWorkId": {
  6802. // "description": "Identifier of the course work.",
  6803. // "location": "path",
  6804. // "required": true,
  6805. // "type": "string"
  6806. // },
  6807. // "id": {
  6808. // "description": "Identifier of the student submission.",
  6809. // "location": "path",
  6810. // "required": true,
  6811. // "type": "string"
  6812. // },
  6813. // "updateMask": {
  6814. // "description": "Mask that identifies which fields on the student submission to update.\nThis field is required to do an update. The update fails if invalid\nfields are specified.\n\nThe following fields may be specified by teachers:\n\n* `draft_grade`\n* `assigned_grade`",
  6815. // "format": "google-fieldmask",
  6816. // "location": "query",
  6817. // "type": "string"
  6818. // }
  6819. // },
  6820. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  6821. // "request": {
  6822. // "$ref": "StudentSubmission"
  6823. // },
  6824. // "response": {
  6825. // "$ref": "StudentSubmission"
  6826. // },
  6827. // "scopes": [
  6828. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6829. // "https://www.googleapis.com/auth/classroom.coursework.students"
  6830. // ]
  6831. // }
  6832. }
  6833. // method id "classroom.courses.courseWork.studentSubmissions.reclaim":
  6834. type CoursesCourseWorkStudentSubmissionsReclaimCall struct {
  6835. s *Service
  6836. courseId string
  6837. courseWorkId string
  6838. id string
  6839. reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest
  6840. urlParams_ gensupport.URLParams
  6841. ctx_ context.Context
  6842. header_ http.Header
  6843. }
  6844. // Reclaim: Reclaims a student submission on behalf of the student that
  6845. // owns it.
  6846. //
  6847. // Reclaiming a student submission transfers ownership of attached
  6848. // Drive
  6849. // files to the student and update the submission state.
  6850. //
  6851. // Only the student that owns the requested student submission may call
  6852. // this
  6853. // method, and only for a student submission that has been turned
  6854. // in.
  6855. //
  6856. // This request must be made by the Developer Console project of
  6857. // the
  6858. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  6859. // used to
  6860. // create the corresponding course work item.
  6861. //
  6862. // This method returns the following error codes:
  6863. //
  6864. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6865. // access the
  6866. // requested course or course work, unsubmit the requested student
  6867. // submission,
  6868. // or for access errors.
  6869. // * `FAILED_PRECONDITION` if the student submission has not been turned
  6870. // in.
  6871. // * `INVALID_ARGUMENT` if the request is malformed.
  6872. // * `NOT_FOUND` if the requested course, course work, or student
  6873. // submission
  6874. // does not exist.
  6875. func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall {
  6876. c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6877. c.courseId = courseId
  6878. c.courseWorkId = courseWorkId
  6879. c.id = id
  6880. c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest
  6881. return c
  6882. }
  6883. // Fields allows partial responses to be retrieved. See
  6884. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6885. // for more information.
  6886. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall {
  6887. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6888. return c
  6889. }
  6890. // Context sets the context to be used in this call's Do method. Any
  6891. // pending HTTP request will be aborted if the provided context is
  6892. // canceled.
  6893. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall {
  6894. c.ctx_ = ctx
  6895. return c
  6896. }
  6897. // Header returns an http.Header that can be modified by the caller to
  6898. // add HTTP headers to the request.
  6899. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header {
  6900. if c.header_ == nil {
  6901. c.header_ = make(http.Header)
  6902. }
  6903. return c.header_
  6904. }
  6905. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) {
  6906. reqHeaders := make(http.Header)
  6907. for k, v := range c.header_ {
  6908. reqHeaders[k] = v
  6909. }
  6910. reqHeaders.Set("User-Agent", c.s.userAgent())
  6911. var body io.Reader = nil
  6912. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest)
  6913. if err != nil {
  6914. return nil, err
  6915. }
  6916. reqHeaders.Set("Content-Type", "application/json")
  6917. c.urlParams_.Set("alt", alt)
  6918. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim")
  6919. urls += "?" + c.urlParams_.Encode()
  6920. req, _ := http.NewRequest("POST", urls, body)
  6921. req.Header = reqHeaders
  6922. googleapi.Expand(req.URL, map[string]string{
  6923. "courseId": c.courseId,
  6924. "courseWorkId": c.courseWorkId,
  6925. "id": c.id,
  6926. })
  6927. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6928. }
  6929. // Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call.
  6930. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6931. // code is an error. Response headers are in either
  6932. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6933. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6934. // check whether the returned error was because http.StatusNotModified
  6935. // was returned.
  6936. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6937. gensupport.SetOptions(c.urlParams_, opts...)
  6938. res, err := c.doRequest("json")
  6939. if res != nil && res.StatusCode == http.StatusNotModified {
  6940. if res.Body != nil {
  6941. res.Body.Close()
  6942. }
  6943. return nil, &googleapi.Error{
  6944. Code: res.StatusCode,
  6945. Header: res.Header,
  6946. }
  6947. }
  6948. if err != nil {
  6949. return nil, err
  6950. }
  6951. defer googleapi.CloseBody(res)
  6952. if err := googleapi.CheckResponse(res); err != nil {
  6953. return nil, err
  6954. }
  6955. ret := &Empty{
  6956. ServerResponse: googleapi.ServerResponse{
  6957. Header: res.Header,
  6958. HTTPStatusCode: res.StatusCode,
  6959. },
  6960. }
  6961. target := &ret
  6962. if err := gensupport.DecodeResponse(target, res); err != nil {
  6963. return nil, err
  6964. }
  6965. return ret, nil
  6966. // {
  6967. // "description": "Reclaims a student submission on behalf of the student that owns it.\n\nReclaiming a student submission transfers ownership of attached Drive\nfiles to the student and update the submission state.\n\nOnly the student that owns the requested student submission may call this\nmethod, and only for a student submission that has been turned in.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, unsubmit the requested student submission,\nor for access errors.\n* `FAILED_PRECONDITION` if the student submission has not been turned in.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  6968. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim",
  6969. // "httpMethod": "POST",
  6970. // "id": "classroom.courses.courseWork.studentSubmissions.reclaim",
  6971. // "parameterOrder": [
  6972. // "courseId",
  6973. // "courseWorkId",
  6974. // "id"
  6975. // ],
  6976. // "parameters": {
  6977. // "courseId": {
  6978. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6979. // "location": "path",
  6980. // "required": true,
  6981. // "type": "string"
  6982. // },
  6983. // "courseWorkId": {
  6984. // "description": "Identifier of the course work.",
  6985. // "location": "path",
  6986. // "required": true,
  6987. // "type": "string"
  6988. // },
  6989. // "id": {
  6990. // "description": "Identifier of the student submission.",
  6991. // "location": "path",
  6992. // "required": true,
  6993. // "type": "string"
  6994. // }
  6995. // },
  6996. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim",
  6997. // "request": {
  6998. // "$ref": "ReclaimStudentSubmissionRequest"
  6999. // },
  7000. // "response": {
  7001. // "$ref": "Empty"
  7002. // },
  7003. // "scopes": [
  7004. // "https://www.googleapis.com/auth/classroom.coursework.me"
  7005. // ]
  7006. // }
  7007. }
  7008. // method id "classroom.courses.courseWork.studentSubmissions.return":
  7009. type CoursesCourseWorkStudentSubmissionsReturnCall struct {
  7010. s *Service
  7011. courseId string
  7012. courseWorkId string
  7013. id string
  7014. returnstudentsubmissionrequest *ReturnStudentSubmissionRequest
  7015. urlParams_ gensupport.URLParams
  7016. ctx_ context.Context
  7017. header_ http.Header
  7018. }
  7019. // Return: Returns a student submission.
  7020. //
  7021. // Returning a student submission transfers ownership of attached
  7022. // Drive
  7023. // files to the student and may also update the submission state.
  7024. // Unlike the Classroom application, returning a student submission does
  7025. // not
  7026. // set assignedGrade to the draftGrade value.
  7027. //
  7028. // Only a teacher of the course that contains the requested student
  7029. // submission
  7030. // may call this method.
  7031. //
  7032. // This request must be made by the Developer Console project of
  7033. // the
  7034. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  7035. // used to
  7036. // create the corresponding course work item.
  7037. //
  7038. // This method returns the following error codes:
  7039. //
  7040. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7041. // access the
  7042. // requested course or course work, return the requested student
  7043. // submission,
  7044. // or for access errors.
  7045. // * `INVALID_ARGUMENT` if the request is malformed.
  7046. // * `NOT_FOUND` if the requested course, course work, or student
  7047. // submission
  7048. // does not exist.
  7049. func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall {
  7050. c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7051. c.courseId = courseId
  7052. c.courseWorkId = courseWorkId
  7053. c.id = id
  7054. c.returnstudentsubmissionrequest = returnstudentsubmissionrequest
  7055. return c
  7056. }
  7057. // Fields allows partial responses to be retrieved. See
  7058. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7059. // for more information.
  7060. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall {
  7061. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7062. return c
  7063. }
  7064. // Context sets the context to be used in this call's Do method. Any
  7065. // pending HTTP request will be aborted if the provided context is
  7066. // canceled.
  7067. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall {
  7068. c.ctx_ = ctx
  7069. return c
  7070. }
  7071. // Header returns an http.Header that can be modified by the caller to
  7072. // add HTTP headers to the request.
  7073. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header {
  7074. if c.header_ == nil {
  7075. c.header_ = make(http.Header)
  7076. }
  7077. return c.header_
  7078. }
  7079. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) {
  7080. reqHeaders := make(http.Header)
  7081. for k, v := range c.header_ {
  7082. reqHeaders[k] = v
  7083. }
  7084. reqHeaders.Set("User-Agent", c.s.userAgent())
  7085. var body io.Reader = nil
  7086. body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest)
  7087. if err != nil {
  7088. return nil, err
  7089. }
  7090. reqHeaders.Set("Content-Type", "application/json")
  7091. c.urlParams_.Set("alt", alt)
  7092. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return")
  7093. urls += "?" + c.urlParams_.Encode()
  7094. req, _ := http.NewRequest("POST", urls, body)
  7095. req.Header = reqHeaders
  7096. googleapi.Expand(req.URL, map[string]string{
  7097. "courseId": c.courseId,
  7098. "courseWorkId": c.courseWorkId,
  7099. "id": c.id,
  7100. })
  7101. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7102. }
  7103. // Do executes the "classroom.courses.courseWork.studentSubmissions.return" call.
  7104. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7105. // code is an error. Response headers are in either
  7106. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7107. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7108. // check whether the returned error was because http.StatusNotModified
  7109. // was returned.
  7110. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7111. gensupport.SetOptions(c.urlParams_, opts...)
  7112. res, err := c.doRequest("json")
  7113. if res != nil && res.StatusCode == http.StatusNotModified {
  7114. if res.Body != nil {
  7115. res.Body.Close()
  7116. }
  7117. return nil, &googleapi.Error{
  7118. Code: res.StatusCode,
  7119. Header: res.Header,
  7120. }
  7121. }
  7122. if err != nil {
  7123. return nil, err
  7124. }
  7125. defer googleapi.CloseBody(res)
  7126. if err := googleapi.CheckResponse(res); err != nil {
  7127. return nil, err
  7128. }
  7129. ret := &Empty{
  7130. ServerResponse: googleapi.ServerResponse{
  7131. Header: res.Header,
  7132. HTTPStatusCode: res.StatusCode,
  7133. },
  7134. }
  7135. target := &ret
  7136. if err := gensupport.DecodeResponse(target, res); err != nil {
  7137. return nil, err
  7138. }
  7139. return ret, nil
  7140. // {
  7141. // "description": "Returns a student submission.\n\nReturning a student submission transfers ownership of attached Drive\nfiles to the student and may also update the submission state.\nUnlike the Classroom application, returning a student submission does not\nset assignedGrade to the draftGrade value.\n\nOnly a teacher of the course that contains the requested student submission\nmay call this method.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, return the requested student submission,\nor for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  7142. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return",
  7143. // "httpMethod": "POST",
  7144. // "id": "classroom.courses.courseWork.studentSubmissions.return",
  7145. // "parameterOrder": [
  7146. // "courseId",
  7147. // "courseWorkId",
  7148. // "id"
  7149. // ],
  7150. // "parameters": {
  7151. // "courseId": {
  7152. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7153. // "location": "path",
  7154. // "required": true,
  7155. // "type": "string"
  7156. // },
  7157. // "courseWorkId": {
  7158. // "description": "Identifier of the course work.",
  7159. // "location": "path",
  7160. // "required": true,
  7161. // "type": "string"
  7162. // },
  7163. // "id": {
  7164. // "description": "Identifier of the student submission.",
  7165. // "location": "path",
  7166. // "required": true,
  7167. // "type": "string"
  7168. // }
  7169. // },
  7170. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return",
  7171. // "request": {
  7172. // "$ref": "ReturnStudentSubmissionRequest"
  7173. // },
  7174. // "response": {
  7175. // "$ref": "Empty"
  7176. // },
  7177. // "scopes": [
  7178. // "https://www.googleapis.com/auth/classroom.coursework.students"
  7179. // ]
  7180. // }
  7181. }
  7182. // method id "classroom.courses.courseWork.studentSubmissions.turnIn":
  7183. type CoursesCourseWorkStudentSubmissionsTurnInCall struct {
  7184. s *Service
  7185. courseId string
  7186. courseWorkId string
  7187. id string
  7188. turninstudentsubmissionrequest *TurnInStudentSubmissionRequest
  7189. urlParams_ gensupport.URLParams
  7190. ctx_ context.Context
  7191. header_ http.Header
  7192. }
  7193. // TurnIn: Turns in a student submission.
  7194. //
  7195. // Turning in a student submission transfers ownership of attached
  7196. // Drive
  7197. // files to the teacher and may also update the submission state.
  7198. //
  7199. // This may only be called by the student that owns the specified
  7200. // student
  7201. // submission.
  7202. //
  7203. // This request must be made by the Developer Console project of
  7204. // the
  7205. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  7206. // used to
  7207. // create the corresponding course work item.
  7208. //
  7209. // This method returns the following error codes:
  7210. //
  7211. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7212. // access the
  7213. // requested course or course work, turn in the requested student
  7214. // submission,
  7215. // or for access errors.
  7216. // * `INVALID_ARGUMENT` if the request is malformed.
  7217. // * `NOT_FOUND` if the requested course, course work, or student
  7218. // submission
  7219. // does not exist.
  7220. func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall {
  7221. c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7222. c.courseId = courseId
  7223. c.courseWorkId = courseWorkId
  7224. c.id = id
  7225. c.turninstudentsubmissionrequest = turninstudentsubmissionrequest
  7226. return c
  7227. }
  7228. // Fields allows partial responses to be retrieved. See
  7229. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7230. // for more information.
  7231. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall {
  7232. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7233. return c
  7234. }
  7235. // Context sets the context to be used in this call's Do method. Any
  7236. // pending HTTP request will be aborted if the provided context is
  7237. // canceled.
  7238. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall {
  7239. c.ctx_ = ctx
  7240. return c
  7241. }
  7242. // Header returns an http.Header that can be modified by the caller to
  7243. // add HTTP headers to the request.
  7244. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header {
  7245. if c.header_ == nil {
  7246. c.header_ = make(http.Header)
  7247. }
  7248. return c.header_
  7249. }
  7250. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) {
  7251. reqHeaders := make(http.Header)
  7252. for k, v := range c.header_ {
  7253. reqHeaders[k] = v
  7254. }
  7255. reqHeaders.Set("User-Agent", c.s.userAgent())
  7256. var body io.Reader = nil
  7257. body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest)
  7258. if err != nil {
  7259. return nil, err
  7260. }
  7261. reqHeaders.Set("Content-Type", "application/json")
  7262. c.urlParams_.Set("alt", alt)
  7263. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn")
  7264. urls += "?" + c.urlParams_.Encode()
  7265. req, _ := http.NewRequest("POST", urls, body)
  7266. req.Header = reqHeaders
  7267. googleapi.Expand(req.URL, map[string]string{
  7268. "courseId": c.courseId,
  7269. "courseWorkId": c.courseWorkId,
  7270. "id": c.id,
  7271. })
  7272. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7273. }
  7274. // Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call.
  7275. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7276. // code is an error. Response headers are in either
  7277. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7278. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7279. // check whether the returned error was because http.StatusNotModified
  7280. // was returned.
  7281. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7282. gensupport.SetOptions(c.urlParams_, opts...)
  7283. res, err := c.doRequest("json")
  7284. if res != nil && res.StatusCode == http.StatusNotModified {
  7285. if res.Body != nil {
  7286. res.Body.Close()
  7287. }
  7288. return nil, &googleapi.Error{
  7289. Code: res.StatusCode,
  7290. Header: res.Header,
  7291. }
  7292. }
  7293. if err != nil {
  7294. return nil, err
  7295. }
  7296. defer googleapi.CloseBody(res)
  7297. if err := googleapi.CheckResponse(res); err != nil {
  7298. return nil, err
  7299. }
  7300. ret := &Empty{
  7301. ServerResponse: googleapi.ServerResponse{
  7302. Header: res.Header,
  7303. HTTPStatusCode: res.StatusCode,
  7304. },
  7305. }
  7306. target := &ret
  7307. if err := gensupport.DecodeResponse(target, res); err != nil {
  7308. return nil, err
  7309. }
  7310. return ret, nil
  7311. // {
  7312. // "description": "Turns in a student submission.\n\nTurning in a student submission transfers ownership of attached Drive\nfiles to the teacher and may also update the submission state.\n\nThis may only be called by the student that owns the specified student\nsubmission.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, turn in the requested student submission,\nor for access errors.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  7313. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn",
  7314. // "httpMethod": "POST",
  7315. // "id": "classroom.courses.courseWork.studentSubmissions.turnIn",
  7316. // "parameterOrder": [
  7317. // "courseId",
  7318. // "courseWorkId",
  7319. // "id"
  7320. // ],
  7321. // "parameters": {
  7322. // "courseId": {
  7323. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7324. // "location": "path",
  7325. // "required": true,
  7326. // "type": "string"
  7327. // },
  7328. // "courseWorkId": {
  7329. // "description": "Identifier of the course work.",
  7330. // "location": "path",
  7331. // "required": true,
  7332. // "type": "string"
  7333. // },
  7334. // "id": {
  7335. // "description": "Identifier of the student submission.",
  7336. // "location": "path",
  7337. // "required": true,
  7338. // "type": "string"
  7339. // }
  7340. // },
  7341. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn",
  7342. // "request": {
  7343. // "$ref": "TurnInStudentSubmissionRequest"
  7344. // },
  7345. // "response": {
  7346. // "$ref": "Empty"
  7347. // },
  7348. // "scopes": [
  7349. // "https://www.googleapis.com/auth/classroom.coursework.me"
  7350. // ]
  7351. // }
  7352. }
  7353. // method id "classroom.courses.students.create":
  7354. type CoursesStudentsCreateCall struct {
  7355. s *Service
  7356. courseId string
  7357. student *Student
  7358. urlParams_ gensupport.URLParams
  7359. ctx_ context.Context
  7360. header_ http.Header
  7361. }
  7362. // Create: Adds a user as a student of a course.
  7363. //
  7364. // This method returns the following error codes:
  7365. //
  7366. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7367. // create
  7368. // students in this course or for access errors.
  7369. // * `NOT_FOUND` if the requested course ID does not exist.
  7370. // * `FAILED_PRECONDITION` if the requested user's account is
  7371. // disabled,
  7372. // for the following request errors:
  7373. // * CourseMemberLimitReached
  7374. // * CourseNotModifiable
  7375. // * UserGroupsMembershipLimitReached
  7376. // * `ALREADY_EXISTS` if the user is already a student or teacher in
  7377. // the
  7378. // course.
  7379. func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall {
  7380. c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7381. c.courseId = courseId
  7382. c.student = student
  7383. return c
  7384. }
  7385. // EnrollmentCode sets the optional parameter "enrollmentCode":
  7386. // Enrollment code of the course to create the student in.
  7387. // This code is required if userId
  7388. // corresponds to the requesting user; it may be omitted if the
  7389. // requesting
  7390. // user has administrative permissions to create students for any user.
  7391. func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall {
  7392. c.urlParams_.Set("enrollmentCode", enrollmentCode)
  7393. return c
  7394. }
  7395. // Fields allows partial responses to be retrieved. See
  7396. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7397. // for more information.
  7398. func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall {
  7399. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7400. return c
  7401. }
  7402. // Context sets the context to be used in this call's Do method. Any
  7403. // pending HTTP request will be aborted if the provided context is
  7404. // canceled.
  7405. func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall {
  7406. c.ctx_ = ctx
  7407. return c
  7408. }
  7409. // Header returns an http.Header that can be modified by the caller to
  7410. // add HTTP headers to the request.
  7411. func (c *CoursesStudentsCreateCall) Header() http.Header {
  7412. if c.header_ == nil {
  7413. c.header_ = make(http.Header)
  7414. }
  7415. return c.header_
  7416. }
  7417. func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) {
  7418. reqHeaders := make(http.Header)
  7419. for k, v := range c.header_ {
  7420. reqHeaders[k] = v
  7421. }
  7422. reqHeaders.Set("User-Agent", c.s.userAgent())
  7423. var body io.Reader = nil
  7424. body, err := googleapi.WithoutDataWrapper.JSONReader(c.student)
  7425. if err != nil {
  7426. return nil, err
  7427. }
  7428. reqHeaders.Set("Content-Type", "application/json")
  7429. c.urlParams_.Set("alt", alt)
  7430. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students")
  7431. urls += "?" + c.urlParams_.Encode()
  7432. req, _ := http.NewRequest("POST", urls, body)
  7433. req.Header = reqHeaders
  7434. googleapi.Expand(req.URL, map[string]string{
  7435. "courseId": c.courseId,
  7436. })
  7437. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7438. }
  7439. // Do executes the "classroom.courses.students.create" call.
  7440. // Exactly one of *Student or error will be non-nil. Any non-2xx status
  7441. // code is an error. Response headers are in either
  7442. // *Student.ServerResponse.Header or (if a response was returned at all)
  7443. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7444. // check whether the returned error was because http.StatusNotModified
  7445. // was returned.
  7446. func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) {
  7447. gensupport.SetOptions(c.urlParams_, opts...)
  7448. res, err := c.doRequest("json")
  7449. if res != nil && res.StatusCode == http.StatusNotModified {
  7450. if res.Body != nil {
  7451. res.Body.Close()
  7452. }
  7453. return nil, &googleapi.Error{
  7454. Code: res.StatusCode,
  7455. Header: res.Header,
  7456. }
  7457. }
  7458. if err != nil {
  7459. return nil, err
  7460. }
  7461. defer googleapi.CloseBody(res)
  7462. if err := googleapi.CheckResponse(res); err != nil {
  7463. return nil, err
  7464. }
  7465. ret := &Student{
  7466. ServerResponse: googleapi.ServerResponse{
  7467. Header: res.Header,
  7468. HTTPStatusCode: res.StatusCode,
  7469. },
  7470. }
  7471. target := &ret
  7472. if err := gensupport.DecodeResponse(target, res); err != nil {
  7473. return nil, err
  7474. }
  7475. return ret, nil
  7476. // {
  7477. // "description": "Adds a user as a student of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\nstudents in this course or for access errors.\n* `NOT_FOUND` if the requested course ID does not exist.\n* `FAILED_PRECONDITION` if the requested user's account is disabled,\nfor the following request errors:\n * CourseMemberLimitReached\n * CourseNotModifiable\n * UserGroupsMembershipLimitReached\n* `ALREADY_EXISTS` if the user is already a student or teacher in the\ncourse.",
  7478. // "flatPath": "v1/courses/{courseId}/students",
  7479. // "httpMethod": "POST",
  7480. // "id": "classroom.courses.students.create",
  7481. // "parameterOrder": [
  7482. // "courseId"
  7483. // ],
  7484. // "parameters": {
  7485. // "courseId": {
  7486. // "description": "Identifier of the course to create the student in.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7487. // "location": "path",
  7488. // "required": true,
  7489. // "type": "string"
  7490. // },
  7491. // "enrollmentCode": {
  7492. // "description": "Enrollment code of the course to create the student in.\nThis code is required if userId\ncorresponds to the requesting user; it may be omitted if the requesting\nuser has administrative permissions to create students for any user.",
  7493. // "location": "query",
  7494. // "type": "string"
  7495. // }
  7496. // },
  7497. // "path": "v1/courses/{courseId}/students",
  7498. // "request": {
  7499. // "$ref": "Student"
  7500. // },
  7501. // "response": {
  7502. // "$ref": "Student"
  7503. // },
  7504. // "scopes": [
  7505. // "https://www.googleapis.com/auth/classroom.profile.emails",
  7506. // "https://www.googleapis.com/auth/classroom.profile.photos",
  7507. // "https://www.googleapis.com/auth/classroom.rosters"
  7508. // ]
  7509. // }
  7510. }
  7511. // method id "classroom.courses.students.delete":
  7512. type CoursesStudentsDeleteCall struct {
  7513. s *Service
  7514. courseId string
  7515. userId string
  7516. urlParams_ gensupport.URLParams
  7517. ctx_ context.Context
  7518. header_ http.Header
  7519. }
  7520. // Delete: Deletes a student of a course.
  7521. //
  7522. // This method returns the following error codes:
  7523. //
  7524. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7525. // delete
  7526. // students of this course or for access errors.
  7527. // * `NOT_FOUND` if no student of this course has the requested ID or if
  7528. // the
  7529. // course does not exist.
  7530. func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall {
  7531. c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7532. c.courseId = courseId
  7533. c.userId = userId
  7534. return c
  7535. }
  7536. // Fields allows partial responses to be retrieved. See
  7537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7538. // for more information.
  7539. func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall {
  7540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7541. return c
  7542. }
  7543. // Context sets the context to be used in this call's Do method. Any
  7544. // pending HTTP request will be aborted if the provided context is
  7545. // canceled.
  7546. func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall {
  7547. c.ctx_ = ctx
  7548. return c
  7549. }
  7550. // Header returns an http.Header that can be modified by the caller to
  7551. // add HTTP headers to the request.
  7552. func (c *CoursesStudentsDeleteCall) Header() http.Header {
  7553. if c.header_ == nil {
  7554. c.header_ = make(http.Header)
  7555. }
  7556. return c.header_
  7557. }
  7558. func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7559. reqHeaders := make(http.Header)
  7560. for k, v := range c.header_ {
  7561. reqHeaders[k] = v
  7562. }
  7563. reqHeaders.Set("User-Agent", c.s.userAgent())
  7564. var body io.Reader = nil
  7565. c.urlParams_.Set("alt", alt)
  7566. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}")
  7567. urls += "?" + c.urlParams_.Encode()
  7568. req, _ := http.NewRequest("DELETE", urls, body)
  7569. req.Header = reqHeaders
  7570. googleapi.Expand(req.URL, map[string]string{
  7571. "courseId": c.courseId,
  7572. "userId": c.userId,
  7573. })
  7574. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7575. }
  7576. // Do executes the "classroom.courses.students.delete" call.
  7577. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7578. // code is an error. Response headers are in either
  7579. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7580. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7581. // check whether the returned error was because http.StatusNotModified
  7582. // was returned.
  7583. func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7584. gensupport.SetOptions(c.urlParams_, opts...)
  7585. res, err := c.doRequest("json")
  7586. if res != nil && res.StatusCode == http.StatusNotModified {
  7587. if res.Body != nil {
  7588. res.Body.Close()
  7589. }
  7590. return nil, &googleapi.Error{
  7591. Code: res.StatusCode,
  7592. Header: res.Header,
  7593. }
  7594. }
  7595. if err != nil {
  7596. return nil, err
  7597. }
  7598. defer googleapi.CloseBody(res)
  7599. if err := googleapi.CheckResponse(res); err != nil {
  7600. return nil, err
  7601. }
  7602. ret := &Empty{
  7603. ServerResponse: googleapi.ServerResponse{
  7604. Header: res.Header,
  7605. HTTPStatusCode: res.StatusCode,
  7606. },
  7607. }
  7608. target := &ret
  7609. if err := gensupport.DecodeResponse(target, res); err != nil {
  7610. return nil, err
  7611. }
  7612. return ret, nil
  7613. // {
  7614. // "description": "Deletes a student of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete\nstudents of this course or for access errors.\n* `NOT_FOUND` if no student of this course has the requested ID or if the\ncourse does not exist.",
  7615. // "flatPath": "v1/courses/{courseId}/students/{userId}",
  7616. // "httpMethod": "DELETE",
  7617. // "id": "classroom.courses.students.delete",
  7618. // "parameterOrder": [
  7619. // "courseId",
  7620. // "userId"
  7621. // ],
  7622. // "parameters": {
  7623. // "courseId": {
  7624. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7625. // "location": "path",
  7626. // "required": true,
  7627. // "type": "string"
  7628. // },
  7629. // "userId": {
  7630. // "description": "Identifier of the student to delete. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  7631. // "location": "path",
  7632. // "required": true,
  7633. // "type": "string"
  7634. // }
  7635. // },
  7636. // "path": "v1/courses/{courseId}/students/{userId}",
  7637. // "response": {
  7638. // "$ref": "Empty"
  7639. // },
  7640. // "scopes": [
  7641. // "https://www.googleapis.com/auth/classroom.rosters"
  7642. // ]
  7643. // }
  7644. }
  7645. // method id "classroom.courses.students.get":
  7646. type CoursesStudentsGetCall struct {
  7647. s *Service
  7648. courseId string
  7649. userId string
  7650. urlParams_ gensupport.URLParams
  7651. ifNoneMatch_ string
  7652. ctx_ context.Context
  7653. header_ http.Header
  7654. }
  7655. // Get: Returns a student of a course.
  7656. //
  7657. // This method returns the following error codes:
  7658. //
  7659. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7660. // view
  7661. // students of this course or for access errors.
  7662. // * `NOT_FOUND` if no student of this course has the requested ID or if
  7663. // the
  7664. // course does not exist.
  7665. func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall {
  7666. c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7667. c.courseId = courseId
  7668. c.userId = userId
  7669. return c
  7670. }
  7671. // Fields allows partial responses to be retrieved. See
  7672. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7673. // for more information.
  7674. func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall {
  7675. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7676. return c
  7677. }
  7678. // IfNoneMatch sets the optional parameter which makes the operation
  7679. // fail if the object's ETag matches the given value. This is useful for
  7680. // getting updates only after the object has changed since the last
  7681. // request. Use googleapi.IsNotModified to check whether the response
  7682. // error from Do is the result of In-None-Match.
  7683. func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall {
  7684. c.ifNoneMatch_ = entityTag
  7685. return c
  7686. }
  7687. // Context sets the context to be used in this call's Do method. Any
  7688. // pending HTTP request will be aborted if the provided context is
  7689. // canceled.
  7690. func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall {
  7691. c.ctx_ = ctx
  7692. return c
  7693. }
  7694. // Header returns an http.Header that can be modified by the caller to
  7695. // add HTTP headers to the request.
  7696. func (c *CoursesStudentsGetCall) Header() http.Header {
  7697. if c.header_ == nil {
  7698. c.header_ = make(http.Header)
  7699. }
  7700. return c.header_
  7701. }
  7702. func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) {
  7703. reqHeaders := make(http.Header)
  7704. for k, v := range c.header_ {
  7705. reqHeaders[k] = v
  7706. }
  7707. reqHeaders.Set("User-Agent", c.s.userAgent())
  7708. if c.ifNoneMatch_ != "" {
  7709. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7710. }
  7711. var body io.Reader = nil
  7712. c.urlParams_.Set("alt", alt)
  7713. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}")
  7714. urls += "?" + c.urlParams_.Encode()
  7715. req, _ := http.NewRequest("GET", urls, body)
  7716. req.Header = reqHeaders
  7717. googleapi.Expand(req.URL, map[string]string{
  7718. "courseId": c.courseId,
  7719. "userId": c.userId,
  7720. })
  7721. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7722. }
  7723. // Do executes the "classroom.courses.students.get" call.
  7724. // Exactly one of *Student or error will be non-nil. Any non-2xx status
  7725. // code is an error. Response headers are in either
  7726. // *Student.ServerResponse.Header or (if a response was returned at all)
  7727. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7728. // check whether the returned error was because http.StatusNotModified
  7729. // was returned.
  7730. func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) {
  7731. gensupport.SetOptions(c.urlParams_, opts...)
  7732. res, err := c.doRequest("json")
  7733. if res != nil && res.StatusCode == http.StatusNotModified {
  7734. if res.Body != nil {
  7735. res.Body.Close()
  7736. }
  7737. return nil, &googleapi.Error{
  7738. Code: res.StatusCode,
  7739. Header: res.Header,
  7740. }
  7741. }
  7742. if err != nil {
  7743. return nil, err
  7744. }
  7745. defer googleapi.CloseBody(res)
  7746. if err := googleapi.CheckResponse(res); err != nil {
  7747. return nil, err
  7748. }
  7749. ret := &Student{
  7750. ServerResponse: googleapi.ServerResponse{
  7751. Header: res.Header,
  7752. HTTPStatusCode: res.StatusCode,
  7753. },
  7754. }
  7755. target := &ret
  7756. if err := gensupport.DecodeResponse(target, res); err != nil {
  7757. return nil, err
  7758. }
  7759. return ret, nil
  7760. // {
  7761. // "description": "Returns a student of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view\nstudents of this course or for access errors.\n* `NOT_FOUND` if no student of this course has the requested ID or if the\ncourse does not exist.",
  7762. // "flatPath": "v1/courses/{courseId}/students/{userId}",
  7763. // "httpMethod": "GET",
  7764. // "id": "classroom.courses.students.get",
  7765. // "parameterOrder": [
  7766. // "courseId",
  7767. // "userId"
  7768. // ],
  7769. // "parameters": {
  7770. // "courseId": {
  7771. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7772. // "location": "path",
  7773. // "required": true,
  7774. // "type": "string"
  7775. // },
  7776. // "userId": {
  7777. // "description": "Identifier of the student to return. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  7778. // "location": "path",
  7779. // "required": true,
  7780. // "type": "string"
  7781. // }
  7782. // },
  7783. // "path": "v1/courses/{courseId}/students/{userId}",
  7784. // "response": {
  7785. // "$ref": "Student"
  7786. // },
  7787. // "scopes": [
  7788. // "https://www.googleapis.com/auth/classroom.profile.emails",
  7789. // "https://www.googleapis.com/auth/classroom.profile.photos",
  7790. // "https://www.googleapis.com/auth/classroom.rosters",
  7791. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  7792. // ]
  7793. // }
  7794. }
  7795. // method id "classroom.courses.students.list":
  7796. type CoursesStudentsListCall struct {
  7797. s *Service
  7798. courseId string
  7799. urlParams_ gensupport.URLParams
  7800. ifNoneMatch_ string
  7801. ctx_ context.Context
  7802. header_ http.Header
  7803. }
  7804. // List: Returns a list of students of this course that the requester
  7805. // is permitted to view.
  7806. //
  7807. // This method returns the following error codes:
  7808. //
  7809. // * `NOT_FOUND` if the course does not exist.
  7810. // * `PERMISSION_DENIED` for access errors.
  7811. func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall {
  7812. c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7813. c.courseId = courseId
  7814. return c
  7815. }
  7816. // PageSize sets the optional parameter "pageSize": Maximum number of
  7817. // items to return. Zero means no maximum.
  7818. //
  7819. // The server may return fewer than the specified number of results.
  7820. func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall {
  7821. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7822. return c
  7823. }
  7824. // PageToken sets the optional parameter "pageToken":
  7825. // nextPageToken
  7826. // value returned from a previous
  7827. // list call, indicating that
  7828. // the subsequent page of results should be returned.
  7829. //
  7830. // The list request must be
  7831. // otherwise identical to the one that resulted in this token.
  7832. func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall {
  7833. c.urlParams_.Set("pageToken", pageToken)
  7834. return c
  7835. }
  7836. // Fields allows partial responses to be retrieved. See
  7837. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7838. // for more information.
  7839. func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall {
  7840. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7841. return c
  7842. }
  7843. // IfNoneMatch sets the optional parameter which makes the operation
  7844. // fail if the object's ETag matches the given value. This is useful for
  7845. // getting updates only after the object has changed since the last
  7846. // request. Use googleapi.IsNotModified to check whether the response
  7847. // error from Do is the result of In-None-Match.
  7848. func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall {
  7849. c.ifNoneMatch_ = entityTag
  7850. return c
  7851. }
  7852. // Context sets the context to be used in this call's Do method. Any
  7853. // pending HTTP request will be aborted if the provided context is
  7854. // canceled.
  7855. func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall {
  7856. c.ctx_ = ctx
  7857. return c
  7858. }
  7859. // Header returns an http.Header that can be modified by the caller to
  7860. // add HTTP headers to the request.
  7861. func (c *CoursesStudentsListCall) Header() http.Header {
  7862. if c.header_ == nil {
  7863. c.header_ = make(http.Header)
  7864. }
  7865. return c.header_
  7866. }
  7867. func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) {
  7868. reqHeaders := make(http.Header)
  7869. for k, v := range c.header_ {
  7870. reqHeaders[k] = v
  7871. }
  7872. reqHeaders.Set("User-Agent", c.s.userAgent())
  7873. if c.ifNoneMatch_ != "" {
  7874. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7875. }
  7876. var body io.Reader = nil
  7877. c.urlParams_.Set("alt", alt)
  7878. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students")
  7879. urls += "?" + c.urlParams_.Encode()
  7880. req, _ := http.NewRequest("GET", urls, body)
  7881. req.Header = reqHeaders
  7882. googleapi.Expand(req.URL, map[string]string{
  7883. "courseId": c.courseId,
  7884. })
  7885. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7886. }
  7887. // Do executes the "classroom.courses.students.list" call.
  7888. // Exactly one of *ListStudentsResponse or error will be non-nil. Any
  7889. // non-2xx status code is an error. Response headers are in either
  7890. // *ListStudentsResponse.ServerResponse.Header or (if a response was
  7891. // returned at all) in error.(*googleapi.Error).Header. Use
  7892. // googleapi.IsNotModified to check whether the returned error was
  7893. // because http.StatusNotModified was returned.
  7894. func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) {
  7895. gensupport.SetOptions(c.urlParams_, opts...)
  7896. res, err := c.doRequest("json")
  7897. if res != nil && res.StatusCode == http.StatusNotModified {
  7898. if res.Body != nil {
  7899. res.Body.Close()
  7900. }
  7901. return nil, &googleapi.Error{
  7902. Code: res.StatusCode,
  7903. Header: res.Header,
  7904. }
  7905. }
  7906. if err != nil {
  7907. return nil, err
  7908. }
  7909. defer googleapi.CloseBody(res)
  7910. if err := googleapi.CheckResponse(res); err != nil {
  7911. return nil, err
  7912. }
  7913. ret := &ListStudentsResponse{
  7914. ServerResponse: googleapi.ServerResponse{
  7915. Header: res.Header,
  7916. HTTPStatusCode: res.StatusCode,
  7917. },
  7918. }
  7919. target := &ret
  7920. if err := gensupport.DecodeResponse(target, res); err != nil {
  7921. return nil, err
  7922. }
  7923. return ret, nil
  7924. // {
  7925. // "description": "Returns a list of students of this course that the requester\nis permitted to view.\n\nThis method returns the following error codes:\n\n* `NOT_FOUND` if the course does not exist.\n* `PERMISSION_DENIED` for access errors.",
  7926. // "flatPath": "v1/courses/{courseId}/students",
  7927. // "httpMethod": "GET",
  7928. // "id": "classroom.courses.students.list",
  7929. // "parameterOrder": [
  7930. // "courseId"
  7931. // ],
  7932. // "parameters": {
  7933. // "courseId": {
  7934. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7935. // "location": "path",
  7936. // "required": true,
  7937. // "type": "string"
  7938. // },
  7939. // "pageSize": {
  7940. // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.",
  7941. // "format": "int32",
  7942. // "location": "query",
  7943. // "type": "integer"
  7944. // },
  7945. // "pageToken": {
  7946. // "description": "nextPageToken\nvalue returned from a previous\nlist call, indicating that\nthe subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.",
  7947. // "location": "query",
  7948. // "type": "string"
  7949. // }
  7950. // },
  7951. // "path": "v1/courses/{courseId}/students",
  7952. // "response": {
  7953. // "$ref": "ListStudentsResponse"
  7954. // },
  7955. // "scopes": [
  7956. // "https://www.googleapis.com/auth/classroom.profile.emails",
  7957. // "https://www.googleapis.com/auth/classroom.profile.photos",
  7958. // "https://www.googleapis.com/auth/classroom.rosters",
  7959. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  7960. // ]
  7961. // }
  7962. }
  7963. // Pages invokes f for each page of results.
  7964. // A non-nil error returned from f will halt the iteration.
  7965. // The provided context supersedes any context provided to the Context method.
  7966. func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error {
  7967. c.ctx_ = ctx
  7968. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7969. for {
  7970. x, err := c.Do()
  7971. if err != nil {
  7972. return err
  7973. }
  7974. if err := f(x); err != nil {
  7975. return err
  7976. }
  7977. if x.NextPageToken == "" {
  7978. return nil
  7979. }
  7980. c.PageToken(x.NextPageToken)
  7981. }
  7982. }
  7983. // method id "classroom.courses.teachers.create":
  7984. type CoursesTeachersCreateCall struct {
  7985. s *Service
  7986. courseId string
  7987. teacher *Teacher
  7988. urlParams_ gensupport.URLParams
  7989. ctx_ context.Context
  7990. header_ http.Header
  7991. }
  7992. // Create: Creates a teacher of a course.
  7993. //
  7994. // This method returns the following error codes:
  7995. //
  7996. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7997. // create
  7998. // teachers in this course or for access errors.
  7999. // * `NOT_FOUND` if the requested course ID does not exist.
  8000. // * `FAILED_PRECONDITION` if the requested user's account is
  8001. // disabled,
  8002. // for the following request errors:
  8003. // * CourseMemberLimitReached
  8004. // * CourseNotModifiable
  8005. // * CourseTeacherLimitReached
  8006. // * UserGroupsMembershipLimitReached
  8007. // * `ALREADY_EXISTS` if the user is already a teacher or student in
  8008. // the
  8009. // course.
  8010. func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall {
  8011. c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8012. c.courseId = courseId
  8013. c.teacher = teacher
  8014. return c
  8015. }
  8016. // Fields allows partial responses to be retrieved. See
  8017. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8018. // for more information.
  8019. func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall {
  8020. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8021. return c
  8022. }
  8023. // Context sets the context to be used in this call's Do method. Any
  8024. // pending HTTP request will be aborted if the provided context is
  8025. // canceled.
  8026. func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall {
  8027. c.ctx_ = ctx
  8028. return c
  8029. }
  8030. // Header returns an http.Header that can be modified by the caller to
  8031. // add HTTP headers to the request.
  8032. func (c *CoursesTeachersCreateCall) Header() http.Header {
  8033. if c.header_ == nil {
  8034. c.header_ = make(http.Header)
  8035. }
  8036. return c.header_
  8037. }
  8038. func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) {
  8039. reqHeaders := make(http.Header)
  8040. for k, v := range c.header_ {
  8041. reqHeaders[k] = v
  8042. }
  8043. reqHeaders.Set("User-Agent", c.s.userAgent())
  8044. var body io.Reader = nil
  8045. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher)
  8046. if err != nil {
  8047. return nil, err
  8048. }
  8049. reqHeaders.Set("Content-Type", "application/json")
  8050. c.urlParams_.Set("alt", alt)
  8051. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers")
  8052. urls += "?" + c.urlParams_.Encode()
  8053. req, _ := http.NewRequest("POST", urls, body)
  8054. req.Header = reqHeaders
  8055. googleapi.Expand(req.URL, map[string]string{
  8056. "courseId": c.courseId,
  8057. })
  8058. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8059. }
  8060. // Do executes the "classroom.courses.teachers.create" call.
  8061. // Exactly one of *Teacher or error will be non-nil. Any non-2xx status
  8062. // code is an error. Response headers are in either
  8063. // *Teacher.ServerResponse.Header or (if a response was returned at all)
  8064. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8065. // check whether the returned error was because http.StatusNotModified
  8066. // was returned.
  8067. func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) {
  8068. gensupport.SetOptions(c.urlParams_, opts...)
  8069. res, err := c.doRequest("json")
  8070. if res != nil && res.StatusCode == http.StatusNotModified {
  8071. if res.Body != nil {
  8072. res.Body.Close()
  8073. }
  8074. return nil, &googleapi.Error{
  8075. Code: res.StatusCode,
  8076. Header: res.Header,
  8077. }
  8078. }
  8079. if err != nil {
  8080. return nil, err
  8081. }
  8082. defer googleapi.CloseBody(res)
  8083. if err := googleapi.CheckResponse(res); err != nil {
  8084. return nil, err
  8085. }
  8086. ret := &Teacher{
  8087. ServerResponse: googleapi.ServerResponse{
  8088. Header: res.Header,
  8089. HTTPStatusCode: res.StatusCode,
  8090. },
  8091. }
  8092. target := &ret
  8093. if err := gensupport.DecodeResponse(target, res); err != nil {
  8094. return nil, err
  8095. }
  8096. return ret, nil
  8097. // {
  8098. // "description": "Creates a teacher of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\nteachers in this course or for access errors.\n* `NOT_FOUND` if the requested course ID does not exist.\n* `FAILED_PRECONDITION` if the requested user's account is disabled,\nfor the following request errors:\n * CourseMemberLimitReached\n * CourseNotModifiable\n * CourseTeacherLimitReached\n * UserGroupsMembershipLimitReached\n* `ALREADY_EXISTS` if the user is already a teacher or student in the\ncourse.",
  8099. // "flatPath": "v1/courses/{courseId}/teachers",
  8100. // "httpMethod": "POST",
  8101. // "id": "classroom.courses.teachers.create",
  8102. // "parameterOrder": [
  8103. // "courseId"
  8104. // ],
  8105. // "parameters": {
  8106. // "courseId": {
  8107. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8108. // "location": "path",
  8109. // "required": true,
  8110. // "type": "string"
  8111. // }
  8112. // },
  8113. // "path": "v1/courses/{courseId}/teachers",
  8114. // "request": {
  8115. // "$ref": "Teacher"
  8116. // },
  8117. // "response": {
  8118. // "$ref": "Teacher"
  8119. // },
  8120. // "scopes": [
  8121. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8122. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8123. // "https://www.googleapis.com/auth/classroom.rosters"
  8124. // ]
  8125. // }
  8126. }
  8127. // method id "classroom.courses.teachers.delete":
  8128. type CoursesTeachersDeleteCall struct {
  8129. s *Service
  8130. courseId string
  8131. userId string
  8132. urlParams_ gensupport.URLParams
  8133. ctx_ context.Context
  8134. header_ http.Header
  8135. }
  8136. // Delete: Deletes a teacher of a course.
  8137. //
  8138. // This method returns the following error codes:
  8139. //
  8140. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8141. // delete
  8142. // teachers of this course or for access errors.
  8143. // * `NOT_FOUND` if no teacher of this course has the requested ID or if
  8144. // the
  8145. // course does not exist.
  8146. // * `FAILED_PRECONDITION` if the requested ID belongs to the primary
  8147. // teacher
  8148. // of this course.
  8149. func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall {
  8150. c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8151. c.courseId = courseId
  8152. c.userId = userId
  8153. return c
  8154. }
  8155. // Fields allows partial responses to be retrieved. See
  8156. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8157. // for more information.
  8158. func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall {
  8159. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8160. return c
  8161. }
  8162. // Context sets the context to be used in this call's Do method. Any
  8163. // pending HTTP request will be aborted if the provided context is
  8164. // canceled.
  8165. func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall {
  8166. c.ctx_ = ctx
  8167. return c
  8168. }
  8169. // Header returns an http.Header that can be modified by the caller to
  8170. // add HTTP headers to the request.
  8171. func (c *CoursesTeachersDeleteCall) Header() http.Header {
  8172. if c.header_ == nil {
  8173. c.header_ = make(http.Header)
  8174. }
  8175. return c.header_
  8176. }
  8177. func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) {
  8178. reqHeaders := make(http.Header)
  8179. for k, v := range c.header_ {
  8180. reqHeaders[k] = v
  8181. }
  8182. reqHeaders.Set("User-Agent", c.s.userAgent())
  8183. var body io.Reader = nil
  8184. c.urlParams_.Set("alt", alt)
  8185. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}")
  8186. urls += "?" + c.urlParams_.Encode()
  8187. req, _ := http.NewRequest("DELETE", urls, body)
  8188. req.Header = reqHeaders
  8189. googleapi.Expand(req.URL, map[string]string{
  8190. "courseId": c.courseId,
  8191. "userId": c.userId,
  8192. })
  8193. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8194. }
  8195. // Do executes the "classroom.courses.teachers.delete" call.
  8196. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8197. // code is an error. Response headers are in either
  8198. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8199. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8200. // check whether the returned error was because http.StatusNotModified
  8201. // was returned.
  8202. func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8203. gensupport.SetOptions(c.urlParams_, opts...)
  8204. res, err := c.doRequest("json")
  8205. if res != nil && res.StatusCode == http.StatusNotModified {
  8206. if res.Body != nil {
  8207. res.Body.Close()
  8208. }
  8209. return nil, &googleapi.Error{
  8210. Code: res.StatusCode,
  8211. Header: res.Header,
  8212. }
  8213. }
  8214. if err != nil {
  8215. return nil, err
  8216. }
  8217. defer googleapi.CloseBody(res)
  8218. if err := googleapi.CheckResponse(res); err != nil {
  8219. return nil, err
  8220. }
  8221. ret := &Empty{
  8222. ServerResponse: googleapi.ServerResponse{
  8223. Header: res.Header,
  8224. HTTPStatusCode: res.StatusCode,
  8225. },
  8226. }
  8227. target := &ret
  8228. if err := gensupport.DecodeResponse(target, res); err != nil {
  8229. return nil, err
  8230. }
  8231. return ret, nil
  8232. // {
  8233. // "description": "Deletes a teacher of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete\nteachers of this course or for access errors.\n* `NOT_FOUND` if no teacher of this course has the requested ID or if the\ncourse does not exist.\n* `FAILED_PRECONDITION` if the requested ID belongs to the primary teacher\nof this course.",
  8234. // "flatPath": "v1/courses/{courseId}/teachers/{userId}",
  8235. // "httpMethod": "DELETE",
  8236. // "id": "classroom.courses.teachers.delete",
  8237. // "parameterOrder": [
  8238. // "courseId",
  8239. // "userId"
  8240. // ],
  8241. // "parameters": {
  8242. // "courseId": {
  8243. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8244. // "location": "path",
  8245. // "required": true,
  8246. // "type": "string"
  8247. // },
  8248. // "userId": {
  8249. // "description": "Identifier of the teacher to delete. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  8250. // "location": "path",
  8251. // "required": true,
  8252. // "type": "string"
  8253. // }
  8254. // },
  8255. // "path": "v1/courses/{courseId}/teachers/{userId}",
  8256. // "response": {
  8257. // "$ref": "Empty"
  8258. // },
  8259. // "scopes": [
  8260. // "https://www.googleapis.com/auth/classroom.rosters"
  8261. // ]
  8262. // }
  8263. }
  8264. // method id "classroom.courses.teachers.get":
  8265. type CoursesTeachersGetCall struct {
  8266. s *Service
  8267. courseId string
  8268. userId string
  8269. urlParams_ gensupport.URLParams
  8270. ifNoneMatch_ string
  8271. ctx_ context.Context
  8272. header_ http.Header
  8273. }
  8274. // Get: Returns a teacher of a course.
  8275. //
  8276. // This method returns the following error codes:
  8277. //
  8278. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8279. // view
  8280. // teachers of this course or for access errors.
  8281. // * `NOT_FOUND` if no teacher of this course has the requested ID or if
  8282. // the
  8283. // course does not exist.
  8284. func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall {
  8285. c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8286. c.courseId = courseId
  8287. c.userId = userId
  8288. return c
  8289. }
  8290. // Fields allows partial responses to be retrieved. See
  8291. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8292. // for more information.
  8293. func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall {
  8294. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8295. return c
  8296. }
  8297. // IfNoneMatch sets the optional parameter which makes the operation
  8298. // fail if the object's ETag matches the given value. This is useful for
  8299. // getting updates only after the object has changed since the last
  8300. // request. Use googleapi.IsNotModified to check whether the response
  8301. // error from Do is the result of In-None-Match.
  8302. func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall {
  8303. c.ifNoneMatch_ = entityTag
  8304. return c
  8305. }
  8306. // Context sets the context to be used in this call's Do method. Any
  8307. // pending HTTP request will be aborted if the provided context is
  8308. // canceled.
  8309. func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall {
  8310. c.ctx_ = ctx
  8311. return c
  8312. }
  8313. // Header returns an http.Header that can be modified by the caller to
  8314. // add HTTP headers to the request.
  8315. func (c *CoursesTeachersGetCall) Header() http.Header {
  8316. if c.header_ == nil {
  8317. c.header_ = make(http.Header)
  8318. }
  8319. return c.header_
  8320. }
  8321. func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) {
  8322. reqHeaders := make(http.Header)
  8323. for k, v := range c.header_ {
  8324. reqHeaders[k] = v
  8325. }
  8326. reqHeaders.Set("User-Agent", c.s.userAgent())
  8327. if c.ifNoneMatch_ != "" {
  8328. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8329. }
  8330. var body io.Reader = nil
  8331. c.urlParams_.Set("alt", alt)
  8332. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}")
  8333. urls += "?" + c.urlParams_.Encode()
  8334. req, _ := http.NewRequest("GET", urls, body)
  8335. req.Header = reqHeaders
  8336. googleapi.Expand(req.URL, map[string]string{
  8337. "courseId": c.courseId,
  8338. "userId": c.userId,
  8339. })
  8340. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8341. }
  8342. // Do executes the "classroom.courses.teachers.get" call.
  8343. // Exactly one of *Teacher or error will be non-nil. Any non-2xx status
  8344. // code is an error. Response headers are in either
  8345. // *Teacher.ServerResponse.Header or (if a response was returned at all)
  8346. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8347. // check whether the returned error was because http.StatusNotModified
  8348. // was returned.
  8349. func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) {
  8350. gensupport.SetOptions(c.urlParams_, opts...)
  8351. res, err := c.doRequest("json")
  8352. if res != nil && res.StatusCode == http.StatusNotModified {
  8353. if res.Body != nil {
  8354. res.Body.Close()
  8355. }
  8356. return nil, &googleapi.Error{
  8357. Code: res.StatusCode,
  8358. Header: res.Header,
  8359. }
  8360. }
  8361. if err != nil {
  8362. return nil, err
  8363. }
  8364. defer googleapi.CloseBody(res)
  8365. if err := googleapi.CheckResponse(res); err != nil {
  8366. return nil, err
  8367. }
  8368. ret := &Teacher{
  8369. ServerResponse: googleapi.ServerResponse{
  8370. Header: res.Header,
  8371. HTTPStatusCode: res.StatusCode,
  8372. },
  8373. }
  8374. target := &ret
  8375. if err := gensupport.DecodeResponse(target, res); err != nil {
  8376. return nil, err
  8377. }
  8378. return ret, nil
  8379. // {
  8380. // "description": "Returns a teacher of a course.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view\nteachers of this course or for access errors.\n* `NOT_FOUND` if no teacher of this course has the requested ID or if the\ncourse does not exist.",
  8381. // "flatPath": "v1/courses/{courseId}/teachers/{userId}",
  8382. // "httpMethod": "GET",
  8383. // "id": "classroom.courses.teachers.get",
  8384. // "parameterOrder": [
  8385. // "courseId",
  8386. // "userId"
  8387. // ],
  8388. // "parameters": {
  8389. // "courseId": {
  8390. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8391. // "location": "path",
  8392. // "required": true,
  8393. // "type": "string"
  8394. // },
  8395. // "userId": {
  8396. // "description": "Identifier of the teacher to return. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  8397. // "location": "path",
  8398. // "required": true,
  8399. // "type": "string"
  8400. // }
  8401. // },
  8402. // "path": "v1/courses/{courseId}/teachers/{userId}",
  8403. // "response": {
  8404. // "$ref": "Teacher"
  8405. // },
  8406. // "scopes": [
  8407. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8408. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8409. // "https://www.googleapis.com/auth/classroom.rosters",
  8410. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  8411. // ]
  8412. // }
  8413. }
  8414. // method id "classroom.courses.teachers.list":
  8415. type CoursesTeachersListCall struct {
  8416. s *Service
  8417. courseId string
  8418. urlParams_ gensupport.URLParams
  8419. ifNoneMatch_ string
  8420. ctx_ context.Context
  8421. header_ http.Header
  8422. }
  8423. // List: Returns a list of teachers of this course that the requester
  8424. // is permitted to view.
  8425. //
  8426. // This method returns the following error codes:
  8427. //
  8428. // * `NOT_FOUND` if the course does not exist.
  8429. // * `PERMISSION_DENIED` for access errors.
  8430. func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall {
  8431. c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8432. c.courseId = courseId
  8433. return c
  8434. }
  8435. // PageSize sets the optional parameter "pageSize": Maximum number of
  8436. // items to return. Zero means no maximum.
  8437. //
  8438. // The server may return fewer than the specified number of results.
  8439. func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall {
  8440. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8441. return c
  8442. }
  8443. // PageToken sets the optional parameter "pageToken":
  8444. // nextPageToken
  8445. // value returned from a previous
  8446. // list call, indicating that
  8447. // the subsequent page of results should be returned.
  8448. //
  8449. // The list request must be
  8450. // otherwise identical to the one that resulted in this token.
  8451. func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall {
  8452. c.urlParams_.Set("pageToken", pageToken)
  8453. return c
  8454. }
  8455. // Fields allows partial responses to be retrieved. See
  8456. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8457. // for more information.
  8458. func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall {
  8459. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8460. return c
  8461. }
  8462. // IfNoneMatch sets the optional parameter which makes the operation
  8463. // fail if the object's ETag matches the given value. This is useful for
  8464. // getting updates only after the object has changed since the last
  8465. // request. Use googleapi.IsNotModified to check whether the response
  8466. // error from Do is the result of In-None-Match.
  8467. func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall {
  8468. c.ifNoneMatch_ = entityTag
  8469. return c
  8470. }
  8471. // Context sets the context to be used in this call's Do method. Any
  8472. // pending HTTP request will be aborted if the provided context is
  8473. // canceled.
  8474. func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall {
  8475. c.ctx_ = ctx
  8476. return c
  8477. }
  8478. // Header returns an http.Header that can be modified by the caller to
  8479. // add HTTP headers to the request.
  8480. func (c *CoursesTeachersListCall) Header() http.Header {
  8481. if c.header_ == nil {
  8482. c.header_ = make(http.Header)
  8483. }
  8484. return c.header_
  8485. }
  8486. func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) {
  8487. reqHeaders := make(http.Header)
  8488. for k, v := range c.header_ {
  8489. reqHeaders[k] = v
  8490. }
  8491. reqHeaders.Set("User-Agent", c.s.userAgent())
  8492. if c.ifNoneMatch_ != "" {
  8493. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8494. }
  8495. var body io.Reader = nil
  8496. c.urlParams_.Set("alt", alt)
  8497. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers")
  8498. urls += "?" + c.urlParams_.Encode()
  8499. req, _ := http.NewRequest("GET", urls, body)
  8500. req.Header = reqHeaders
  8501. googleapi.Expand(req.URL, map[string]string{
  8502. "courseId": c.courseId,
  8503. })
  8504. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8505. }
  8506. // Do executes the "classroom.courses.teachers.list" call.
  8507. // Exactly one of *ListTeachersResponse or error will be non-nil. Any
  8508. // non-2xx status code is an error. Response headers are in either
  8509. // *ListTeachersResponse.ServerResponse.Header or (if a response was
  8510. // returned at all) in error.(*googleapi.Error).Header. Use
  8511. // googleapi.IsNotModified to check whether the returned error was
  8512. // because http.StatusNotModified was returned.
  8513. func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) {
  8514. gensupport.SetOptions(c.urlParams_, opts...)
  8515. res, err := c.doRequest("json")
  8516. if res != nil && res.StatusCode == http.StatusNotModified {
  8517. if res.Body != nil {
  8518. res.Body.Close()
  8519. }
  8520. return nil, &googleapi.Error{
  8521. Code: res.StatusCode,
  8522. Header: res.Header,
  8523. }
  8524. }
  8525. if err != nil {
  8526. return nil, err
  8527. }
  8528. defer googleapi.CloseBody(res)
  8529. if err := googleapi.CheckResponse(res); err != nil {
  8530. return nil, err
  8531. }
  8532. ret := &ListTeachersResponse{
  8533. ServerResponse: googleapi.ServerResponse{
  8534. Header: res.Header,
  8535. HTTPStatusCode: res.StatusCode,
  8536. },
  8537. }
  8538. target := &ret
  8539. if err := gensupport.DecodeResponse(target, res); err != nil {
  8540. return nil, err
  8541. }
  8542. return ret, nil
  8543. // {
  8544. // "description": "Returns a list of teachers of this course that the requester\nis permitted to view.\n\nThis method returns the following error codes:\n\n* `NOT_FOUND` if the course does not exist.\n* `PERMISSION_DENIED` for access errors.",
  8545. // "flatPath": "v1/courses/{courseId}/teachers",
  8546. // "httpMethod": "GET",
  8547. // "id": "classroom.courses.teachers.list",
  8548. // "parameterOrder": [
  8549. // "courseId"
  8550. // ],
  8551. // "parameters": {
  8552. // "courseId": {
  8553. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8554. // "location": "path",
  8555. // "required": true,
  8556. // "type": "string"
  8557. // },
  8558. // "pageSize": {
  8559. // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.",
  8560. // "format": "int32",
  8561. // "location": "query",
  8562. // "type": "integer"
  8563. // },
  8564. // "pageToken": {
  8565. // "description": "nextPageToken\nvalue returned from a previous\nlist call, indicating that\nthe subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.",
  8566. // "location": "query",
  8567. // "type": "string"
  8568. // }
  8569. // },
  8570. // "path": "v1/courses/{courseId}/teachers",
  8571. // "response": {
  8572. // "$ref": "ListTeachersResponse"
  8573. // },
  8574. // "scopes": [
  8575. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8576. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8577. // "https://www.googleapis.com/auth/classroom.rosters",
  8578. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  8579. // ]
  8580. // }
  8581. }
  8582. // Pages invokes f for each page of results.
  8583. // A non-nil error returned from f will halt the iteration.
  8584. // The provided context supersedes any context provided to the Context method.
  8585. func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error {
  8586. c.ctx_ = ctx
  8587. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8588. for {
  8589. x, err := c.Do()
  8590. if err != nil {
  8591. return err
  8592. }
  8593. if err := f(x); err != nil {
  8594. return err
  8595. }
  8596. if x.NextPageToken == "" {
  8597. return nil
  8598. }
  8599. c.PageToken(x.NextPageToken)
  8600. }
  8601. }
  8602. // method id "classroom.invitations.accept":
  8603. type InvitationsAcceptCall struct {
  8604. s *Service
  8605. id string
  8606. urlParams_ gensupport.URLParams
  8607. ctx_ context.Context
  8608. header_ http.Header
  8609. }
  8610. // Accept: Accepts an invitation, removing it and adding the invited
  8611. // user to the
  8612. // teachers or students (as appropriate) of the specified course. Only
  8613. // the
  8614. // invited user may accept an invitation.
  8615. //
  8616. // This method returns the following error codes:
  8617. //
  8618. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8619. // accept the
  8620. // requested invitation or for access errors.
  8621. // * `FAILED_PRECONDITION` for the following request errors:
  8622. // * CourseMemberLimitReached
  8623. // * CourseNotModifiable
  8624. // * CourseTeacherLimitReached
  8625. // * UserGroupsMembershipLimitReached
  8626. // * `NOT_FOUND` if no invitation exists with the requested ID.
  8627. func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall {
  8628. c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8629. c.id = id
  8630. return c
  8631. }
  8632. // Fields allows partial responses to be retrieved. See
  8633. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8634. // for more information.
  8635. func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall {
  8636. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8637. return c
  8638. }
  8639. // Context sets the context to be used in this call's Do method. Any
  8640. // pending HTTP request will be aborted if the provided context is
  8641. // canceled.
  8642. func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall {
  8643. c.ctx_ = ctx
  8644. return c
  8645. }
  8646. // Header returns an http.Header that can be modified by the caller to
  8647. // add HTTP headers to the request.
  8648. func (c *InvitationsAcceptCall) Header() http.Header {
  8649. if c.header_ == nil {
  8650. c.header_ = make(http.Header)
  8651. }
  8652. return c.header_
  8653. }
  8654. func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) {
  8655. reqHeaders := make(http.Header)
  8656. for k, v := range c.header_ {
  8657. reqHeaders[k] = v
  8658. }
  8659. reqHeaders.Set("User-Agent", c.s.userAgent())
  8660. var body io.Reader = nil
  8661. c.urlParams_.Set("alt", alt)
  8662. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept")
  8663. urls += "?" + c.urlParams_.Encode()
  8664. req, _ := http.NewRequest("POST", urls, body)
  8665. req.Header = reqHeaders
  8666. googleapi.Expand(req.URL, map[string]string{
  8667. "id": c.id,
  8668. })
  8669. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8670. }
  8671. // Do executes the "classroom.invitations.accept" call.
  8672. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8673. // code is an error. Response headers are in either
  8674. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8675. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8676. // check whether the returned error was because http.StatusNotModified
  8677. // was returned.
  8678. func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8679. gensupport.SetOptions(c.urlParams_, opts...)
  8680. res, err := c.doRequest("json")
  8681. if res != nil && res.StatusCode == http.StatusNotModified {
  8682. if res.Body != nil {
  8683. res.Body.Close()
  8684. }
  8685. return nil, &googleapi.Error{
  8686. Code: res.StatusCode,
  8687. Header: res.Header,
  8688. }
  8689. }
  8690. if err != nil {
  8691. return nil, err
  8692. }
  8693. defer googleapi.CloseBody(res)
  8694. if err := googleapi.CheckResponse(res); err != nil {
  8695. return nil, err
  8696. }
  8697. ret := &Empty{
  8698. ServerResponse: googleapi.ServerResponse{
  8699. Header: res.Header,
  8700. HTTPStatusCode: res.StatusCode,
  8701. },
  8702. }
  8703. target := &ret
  8704. if err := gensupport.DecodeResponse(target, res); err != nil {
  8705. return nil, err
  8706. }
  8707. return ret, nil
  8708. // {
  8709. // "description": "Accepts an invitation, removing it and adding the invited user to the\nteachers or students (as appropriate) of the specified course. Only the\ninvited user may accept an invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to accept the\nrequested invitation or for access errors.\n* `FAILED_PRECONDITION` for the following request errors:\n * CourseMemberLimitReached\n * CourseNotModifiable\n * CourseTeacherLimitReached\n * UserGroupsMembershipLimitReached\n* `NOT_FOUND` if no invitation exists with the requested ID.",
  8710. // "flatPath": "v1/invitations/{id}:accept",
  8711. // "httpMethod": "POST",
  8712. // "id": "classroom.invitations.accept",
  8713. // "parameterOrder": [
  8714. // "id"
  8715. // ],
  8716. // "parameters": {
  8717. // "id": {
  8718. // "description": "Identifier of the invitation to accept.",
  8719. // "location": "path",
  8720. // "required": true,
  8721. // "type": "string"
  8722. // }
  8723. // },
  8724. // "path": "v1/invitations/{id}:accept",
  8725. // "response": {
  8726. // "$ref": "Empty"
  8727. // },
  8728. // "scopes": [
  8729. // "https://www.googleapis.com/auth/classroom.rosters"
  8730. // ]
  8731. // }
  8732. }
  8733. // method id "classroom.invitations.create":
  8734. type InvitationsCreateCall struct {
  8735. s *Service
  8736. invitation *Invitation
  8737. urlParams_ gensupport.URLParams
  8738. ctx_ context.Context
  8739. header_ http.Header
  8740. }
  8741. // Create: Creates an invitation. Only one invitation for a user and
  8742. // course may exist
  8743. // at a time. Delete and re-create an invitation to make changes.
  8744. //
  8745. // This method returns the following error codes:
  8746. //
  8747. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8748. // create
  8749. // invitations for this course or for access errors.
  8750. // * `NOT_FOUND` if the course or the user does not exist.
  8751. // * `FAILED_PRECONDITION` if the requested user's account is disabled
  8752. // or if
  8753. // the user already has this role or a role with greater permissions.
  8754. // * `ALREADY_EXISTS` if an invitation for the specified user and
  8755. // course
  8756. // already exists.
  8757. func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall {
  8758. c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8759. c.invitation = invitation
  8760. return c
  8761. }
  8762. // Fields allows partial responses to be retrieved. See
  8763. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8764. // for more information.
  8765. func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall {
  8766. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8767. return c
  8768. }
  8769. // Context sets the context to be used in this call's Do method. Any
  8770. // pending HTTP request will be aborted if the provided context is
  8771. // canceled.
  8772. func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall {
  8773. c.ctx_ = ctx
  8774. return c
  8775. }
  8776. // Header returns an http.Header that can be modified by the caller to
  8777. // add HTTP headers to the request.
  8778. func (c *InvitationsCreateCall) Header() http.Header {
  8779. if c.header_ == nil {
  8780. c.header_ = make(http.Header)
  8781. }
  8782. return c.header_
  8783. }
  8784. func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) {
  8785. reqHeaders := make(http.Header)
  8786. for k, v := range c.header_ {
  8787. reqHeaders[k] = v
  8788. }
  8789. reqHeaders.Set("User-Agent", c.s.userAgent())
  8790. var body io.Reader = nil
  8791. body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation)
  8792. if err != nil {
  8793. return nil, err
  8794. }
  8795. reqHeaders.Set("Content-Type", "application/json")
  8796. c.urlParams_.Set("alt", alt)
  8797. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations")
  8798. urls += "?" + c.urlParams_.Encode()
  8799. req, _ := http.NewRequest("POST", urls, body)
  8800. req.Header = reqHeaders
  8801. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8802. }
  8803. // Do executes the "classroom.invitations.create" call.
  8804. // Exactly one of *Invitation or error will be non-nil. Any non-2xx
  8805. // status code is an error. Response headers are in either
  8806. // *Invitation.ServerResponse.Header or (if a response was returned at
  8807. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8808. // to check whether the returned error was because
  8809. // http.StatusNotModified was returned.
  8810. func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) {
  8811. gensupport.SetOptions(c.urlParams_, opts...)
  8812. res, err := c.doRequest("json")
  8813. if res != nil && res.StatusCode == http.StatusNotModified {
  8814. if res.Body != nil {
  8815. res.Body.Close()
  8816. }
  8817. return nil, &googleapi.Error{
  8818. Code: res.StatusCode,
  8819. Header: res.Header,
  8820. }
  8821. }
  8822. if err != nil {
  8823. return nil, err
  8824. }
  8825. defer googleapi.CloseBody(res)
  8826. if err := googleapi.CheckResponse(res); err != nil {
  8827. return nil, err
  8828. }
  8829. ret := &Invitation{
  8830. ServerResponse: googleapi.ServerResponse{
  8831. Header: res.Header,
  8832. HTTPStatusCode: res.StatusCode,
  8833. },
  8834. }
  8835. target := &ret
  8836. if err := gensupport.DecodeResponse(target, res); err != nil {
  8837. return nil, err
  8838. }
  8839. return ret, nil
  8840. // {
  8841. // "description": "Creates an invitation. Only one invitation for a user and course may exist\nat a time. Delete and re-create an invitation to make changes.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to create\ninvitations for this course or for access errors.\n* `NOT_FOUND` if the course or the user does not exist.\n* `FAILED_PRECONDITION` if the requested user's account is disabled or if\nthe user already has this role or a role with greater permissions.\n* `ALREADY_EXISTS` if an invitation for the specified user and course\nalready exists.",
  8842. // "flatPath": "v1/invitations",
  8843. // "httpMethod": "POST",
  8844. // "id": "classroom.invitations.create",
  8845. // "parameterOrder": [],
  8846. // "parameters": {},
  8847. // "path": "v1/invitations",
  8848. // "request": {
  8849. // "$ref": "Invitation"
  8850. // },
  8851. // "response": {
  8852. // "$ref": "Invitation"
  8853. // },
  8854. // "scopes": [
  8855. // "https://www.googleapis.com/auth/classroom.rosters"
  8856. // ]
  8857. // }
  8858. }
  8859. // method id "classroom.invitations.delete":
  8860. type InvitationsDeleteCall struct {
  8861. s *Service
  8862. id string
  8863. urlParams_ gensupport.URLParams
  8864. ctx_ context.Context
  8865. header_ http.Header
  8866. }
  8867. // Delete: Deletes an invitation.
  8868. //
  8869. // This method returns the following error codes:
  8870. //
  8871. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8872. // delete the
  8873. // requested invitation or for access errors.
  8874. // * `NOT_FOUND` if no invitation exists with the requested ID.
  8875. func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall {
  8876. c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8877. c.id = id
  8878. return c
  8879. }
  8880. // Fields allows partial responses to be retrieved. See
  8881. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8882. // for more information.
  8883. func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall {
  8884. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8885. return c
  8886. }
  8887. // Context sets the context to be used in this call's Do method. Any
  8888. // pending HTTP request will be aborted if the provided context is
  8889. // canceled.
  8890. func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall {
  8891. c.ctx_ = ctx
  8892. return c
  8893. }
  8894. // Header returns an http.Header that can be modified by the caller to
  8895. // add HTTP headers to the request.
  8896. func (c *InvitationsDeleteCall) Header() http.Header {
  8897. if c.header_ == nil {
  8898. c.header_ = make(http.Header)
  8899. }
  8900. return c.header_
  8901. }
  8902. func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8903. reqHeaders := make(http.Header)
  8904. for k, v := range c.header_ {
  8905. reqHeaders[k] = v
  8906. }
  8907. reqHeaders.Set("User-Agent", c.s.userAgent())
  8908. var body io.Reader = nil
  8909. c.urlParams_.Set("alt", alt)
  8910. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}")
  8911. urls += "?" + c.urlParams_.Encode()
  8912. req, _ := http.NewRequest("DELETE", urls, body)
  8913. req.Header = reqHeaders
  8914. googleapi.Expand(req.URL, map[string]string{
  8915. "id": c.id,
  8916. })
  8917. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8918. }
  8919. // Do executes the "classroom.invitations.delete" call.
  8920. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8921. // code is an error. Response headers are in either
  8922. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8923. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8924. // check whether the returned error was because http.StatusNotModified
  8925. // was returned.
  8926. func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8927. gensupport.SetOptions(c.urlParams_, opts...)
  8928. res, err := c.doRequest("json")
  8929. if res != nil && res.StatusCode == http.StatusNotModified {
  8930. if res.Body != nil {
  8931. res.Body.Close()
  8932. }
  8933. return nil, &googleapi.Error{
  8934. Code: res.StatusCode,
  8935. Header: res.Header,
  8936. }
  8937. }
  8938. if err != nil {
  8939. return nil, err
  8940. }
  8941. defer googleapi.CloseBody(res)
  8942. if err := googleapi.CheckResponse(res); err != nil {
  8943. return nil, err
  8944. }
  8945. ret := &Empty{
  8946. ServerResponse: googleapi.ServerResponse{
  8947. Header: res.Header,
  8948. HTTPStatusCode: res.StatusCode,
  8949. },
  8950. }
  8951. target := &ret
  8952. if err := gensupport.DecodeResponse(target, res); err != nil {
  8953. return nil, err
  8954. }
  8955. return ret, nil
  8956. // {
  8957. // "description": "Deletes an invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to delete the\nrequested invitation or for access errors.\n* `NOT_FOUND` if no invitation exists with the requested ID.",
  8958. // "flatPath": "v1/invitations/{id}",
  8959. // "httpMethod": "DELETE",
  8960. // "id": "classroom.invitations.delete",
  8961. // "parameterOrder": [
  8962. // "id"
  8963. // ],
  8964. // "parameters": {
  8965. // "id": {
  8966. // "description": "Identifier of the invitation to delete.",
  8967. // "location": "path",
  8968. // "required": true,
  8969. // "type": "string"
  8970. // }
  8971. // },
  8972. // "path": "v1/invitations/{id}",
  8973. // "response": {
  8974. // "$ref": "Empty"
  8975. // },
  8976. // "scopes": [
  8977. // "https://www.googleapis.com/auth/classroom.rosters"
  8978. // ]
  8979. // }
  8980. }
  8981. // method id "classroom.invitations.get":
  8982. type InvitationsGetCall struct {
  8983. s *Service
  8984. id string
  8985. urlParams_ gensupport.URLParams
  8986. ifNoneMatch_ string
  8987. ctx_ context.Context
  8988. header_ http.Header
  8989. }
  8990. // Get: Returns an invitation.
  8991. //
  8992. // This method returns the following error codes:
  8993. //
  8994. // * `PERMISSION_DENIED` if the requesting user is not permitted to view
  8995. // the
  8996. // requested invitation or for access errors.
  8997. // * `NOT_FOUND` if no invitation exists with the requested ID.
  8998. func (r *InvitationsService) Get(id string) *InvitationsGetCall {
  8999. c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9000. c.id = id
  9001. return c
  9002. }
  9003. // Fields allows partial responses to be retrieved. See
  9004. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9005. // for more information.
  9006. func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall {
  9007. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9008. return c
  9009. }
  9010. // IfNoneMatch sets the optional parameter which makes the operation
  9011. // fail if the object's ETag matches the given value. This is useful for
  9012. // getting updates only after the object has changed since the last
  9013. // request. Use googleapi.IsNotModified to check whether the response
  9014. // error from Do is the result of In-None-Match.
  9015. func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall {
  9016. c.ifNoneMatch_ = entityTag
  9017. return c
  9018. }
  9019. // Context sets the context to be used in this call's Do method. Any
  9020. // pending HTTP request will be aborted if the provided context is
  9021. // canceled.
  9022. func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall {
  9023. c.ctx_ = ctx
  9024. return c
  9025. }
  9026. // Header returns an http.Header that can be modified by the caller to
  9027. // add HTTP headers to the request.
  9028. func (c *InvitationsGetCall) Header() http.Header {
  9029. if c.header_ == nil {
  9030. c.header_ = make(http.Header)
  9031. }
  9032. return c.header_
  9033. }
  9034. func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) {
  9035. reqHeaders := make(http.Header)
  9036. for k, v := range c.header_ {
  9037. reqHeaders[k] = v
  9038. }
  9039. reqHeaders.Set("User-Agent", c.s.userAgent())
  9040. if c.ifNoneMatch_ != "" {
  9041. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9042. }
  9043. var body io.Reader = nil
  9044. c.urlParams_.Set("alt", alt)
  9045. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}")
  9046. urls += "?" + c.urlParams_.Encode()
  9047. req, _ := http.NewRequest("GET", urls, body)
  9048. req.Header = reqHeaders
  9049. googleapi.Expand(req.URL, map[string]string{
  9050. "id": c.id,
  9051. })
  9052. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9053. }
  9054. // Do executes the "classroom.invitations.get" call.
  9055. // Exactly one of *Invitation or error will be non-nil. Any non-2xx
  9056. // status code is an error. Response headers are in either
  9057. // *Invitation.ServerResponse.Header or (if a response was returned at
  9058. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9059. // to check whether the returned error was because
  9060. // http.StatusNotModified was returned.
  9061. func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) {
  9062. gensupport.SetOptions(c.urlParams_, opts...)
  9063. res, err := c.doRequest("json")
  9064. if res != nil && res.StatusCode == http.StatusNotModified {
  9065. if res.Body != nil {
  9066. res.Body.Close()
  9067. }
  9068. return nil, &googleapi.Error{
  9069. Code: res.StatusCode,
  9070. Header: res.Header,
  9071. }
  9072. }
  9073. if err != nil {
  9074. return nil, err
  9075. }
  9076. defer googleapi.CloseBody(res)
  9077. if err := googleapi.CheckResponse(res); err != nil {
  9078. return nil, err
  9079. }
  9080. ret := &Invitation{
  9081. ServerResponse: googleapi.ServerResponse{
  9082. Header: res.Header,
  9083. HTTPStatusCode: res.StatusCode,
  9084. },
  9085. }
  9086. target := &ret
  9087. if err := gensupport.DecodeResponse(target, res); err != nil {
  9088. return nil, err
  9089. }
  9090. return ret, nil
  9091. // {
  9092. // "description": "Returns an invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view the\nrequested invitation or for access errors.\n* `NOT_FOUND` if no invitation exists with the requested ID.",
  9093. // "flatPath": "v1/invitations/{id}",
  9094. // "httpMethod": "GET",
  9095. // "id": "classroom.invitations.get",
  9096. // "parameterOrder": [
  9097. // "id"
  9098. // ],
  9099. // "parameters": {
  9100. // "id": {
  9101. // "description": "Identifier of the invitation to return.",
  9102. // "location": "path",
  9103. // "required": true,
  9104. // "type": "string"
  9105. // }
  9106. // },
  9107. // "path": "v1/invitations/{id}",
  9108. // "response": {
  9109. // "$ref": "Invitation"
  9110. // },
  9111. // "scopes": [
  9112. // "https://www.googleapis.com/auth/classroom.rosters",
  9113. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  9114. // ]
  9115. // }
  9116. }
  9117. // method id "classroom.invitations.list":
  9118. type InvitationsListCall struct {
  9119. s *Service
  9120. urlParams_ gensupport.URLParams
  9121. ifNoneMatch_ string
  9122. ctx_ context.Context
  9123. header_ http.Header
  9124. }
  9125. // List: Returns a list of invitations that the requesting user is
  9126. // permitted to
  9127. // view, restricted to those that match the list request.
  9128. //
  9129. // *Note:* At least one of `user_id` or `course_id` must be supplied.
  9130. // Both
  9131. // fields can be supplied.
  9132. //
  9133. // This method returns the following error codes:
  9134. //
  9135. // * `PERMISSION_DENIED` for access errors.
  9136. func (r *InvitationsService) List() *InvitationsListCall {
  9137. c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9138. return c
  9139. }
  9140. // CourseId sets the optional parameter "courseId": Restricts returned
  9141. // invitations to those for a course with the specified
  9142. // identifier.
  9143. func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall {
  9144. c.urlParams_.Set("courseId", courseId)
  9145. return c
  9146. }
  9147. // PageSize sets the optional parameter "pageSize": Maximum number of
  9148. // items to return. Zero means no maximum.
  9149. //
  9150. // The server may return fewer than the specified number of results.
  9151. func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall {
  9152. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9153. return c
  9154. }
  9155. // PageToken sets the optional parameter "pageToken":
  9156. // nextPageToken
  9157. // value returned from a previous
  9158. // list call, indicating
  9159. // that the subsequent page of results should be returned.
  9160. //
  9161. // The list request must be
  9162. // otherwise identical to the one that resulted in this token.
  9163. func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall {
  9164. c.urlParams_.Set("pageToken", pageToken)
  9165. return c
  9166. }
  9167. // UserId sets the optional parameter "userId": Restricts returned
  9168. // invitations to those for a specific user. The identifier
  9169. // can be one of the following:
  9170. //
  9171. // * the numeric identifier for the user
  9172. // * the email address of the user
  9173. // * the string literal "me", indicating the requesting user
  9174. func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall {
  9175. c.urlParams_.Set("userId", userId)
  9176. return c
  9177. }
  9178. // Fields allows partial responses to be retrieved. See
  9179. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9180. // for more information.
  9181. func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall {
  9182. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9183. return c
  9184. }
  9185. // IfNoneMatch sets the optional parameter which makes the operation
  9186. // fail if the object's ETag matches the given value. This is useful for
  9187. // getting updates only after the object has changed since the last
  9188. // request. Use googleapi.IsNotModified to check whether the response
  9189. // error from Do is the result of In-None-Match.
  9190. func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall {
  9191. c.ifNoneMatch_ = entityTag
  9192. return c
  9193. }
  9194. // Context sets the context to be used in this call's Do method. Any
  9195. // pending HTTP request will be aborted if the provided context is
  9196. // canceled.
  9197. func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall {
  9198. c.ctx_ = ctx
  9199. return c
  9200. }
  9201. // Header returns an http.Header that can be modified by the caller to
  9202. // add HTTP headers to the request.
  9203. func (c *InvitationsListCall) Header() http.Header {
  9204. if c.header_ == nil {
  9205. c.header_ = make(http.Header)
  9206. }
  9207. return c.header_
  9208. }
  9209. func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) {
  9210. reqHeaders := make(http.Header)
  9211. for k, v := range c.header_ {
  9212. reqHeaders[k] = v
  9213. }
  9214. reqHeaders.Set("User-Agent", c.s.userAgent())
  9215. if c.ifNoneMatch_ != "" {
  9216. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9217. }
  9218. var body io.Reader = nil
  9219. c.urlParams_.Set("alt", alt)
  9220. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations")
  9221. urls += "?" + c.urlParams_.Encode()
  9222. req, _ := http.NewRequest("GET", urls, body)
  9223. req.Header = reqHeaders
  9224. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9225. }
  9226. // Do executes the "classroom.invitations.list" call.
  9227. // Exactly one of *ListInvitationsResponse or error will be non-nil. Any
  9228. // non-2xx status code is an error. Response headers are in either
  9229. // *ListInvitationsResponse.ServerResponse.Header or (if a response was
  9230. // returned at all) in error.(*googleapi.Error).Header. Use
  9231. // googleapi.IsNotModified to check whether the returned error was
  9232. // because http.StatusNotModified was returned.
  9233. func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) {
  9234. gensupport.SetOptions(c.urlParams_, opts...)
  9235. res, err := c.doRequest("json")
  9236. if res != nil && res.StatusCode == http.StatusNotModified {
  9237. if res.Body != nil {
  9238. res.Body.Close()
  9239. }
  9240. return nil, &googleapi.Error{
  9241. Code: res.StatusCode,
  9242. Header: res.Header,
  9243. }
  9244. }
  9245. if err != nil {
  9246. return nil, err
  9247. }
  9248. defer googleapi.CloseBody(res)
  9249. if err := googleapi.CheckResponse(res); err != nil {
  9250. return nil, err
  9251. }
  9252. ret := &ListInvitationsResponse{
  9253. ServerResponse: googleapi.ServerResponse{
  9254. Header: res.Header,
  9255. HTTPStatusCode: res.StatusCode,
  9256. },
  9257. }
  9258. target := &ret
  9259. if err := gensupport.DecodeResponse(target, res); err != nil {
  9260. return nil, err
  9261. }
  9262. return ret, nil
  9263. // {
  9264. // "description": "Returns a list of invitations that the requesting user is permitted to\nview, restricted to those that match the list request.\n\n*Note:* At least one of `user_id` or `course_id` must be supplied. Both\nfields can be supplied.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` for access errors.",
  9265. // "flatPath": "v1/invitations",
  9266. // "httpMethod": "GET",
  9267. // "id": "classroom.invitations.list",
  9268. // "parameterOrder": [],
  9269. // "parameters": {
  9270. // "courseId": {
  9271. // "description": "Restricts returned invitations to those for a course with the specified\nidentifier.",
  9272. // "location": "query",
  9273. // "type": "string"
  9274. // },
  9275. // "pageSize": {
  9276. // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.",
  9277. // "format": "int32",
  9278. // "location": "query",
  9279. // "type": "integer"
  9280. // },
  9281. // "pageToken": {
  9282. // "description": "nextPageToken\nvalue returned from a previous\nlist call, indicating\nthat the subsequent page of results should be returned.\n\nThe list request must be\notherwise identical to the one that resulted in this token.",
  9283. // "location": "query",
  9284. // "type": "string"
  9285. // },
  9286. // "userId": {
  9287. // "description": "Restricts returned invitations to those for a specific user. The identifier\ncan be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  9288. // "location": "query",
  9289. // "type": "string"
  9290. // }
  9291. // },
  9292. // "path": "v1/invitations",
  9293. // "response": {
  9294. // "$ref": "ListInvitationsResponse"
  9295. // },
  9296. // "scopes": [
  9297. // "https://www.googleapis.com/auth/classroom.rosters",
  9298. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  9299. // ]
  9300. // }
  9301. }
  9302. // Pages invokes f for each page of results.
  9303. // A non-nil error returned from f will halt the iteration.
  9304. // The provided context supersedes any context provided to the Context method.
  9305. func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error {
  9306. c.ctx_ = ctx
  9307. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9308. for {
  9309. x, err := c.Do()
  9310. if err != nil {
  9311. return err
  9312. }
  9313. if err := f(x); err != nil {
  9314. return err
  9315. }
  9316. if x.NextPageToken == "" {
  9317. return nil
  9318. }
  9319. c.PageToken(x.NextPageToken)
  9320. }
  9321. }
  9322. // method id "classroom.registrations.create":
  9323. type RegistrationsCreateCall struct {
  9324. s *Service
  9325. registration *Registration
  9326. urlParams_ gensupport.URLParams
  9327. ctx_ context.Context
  9328. header_ http.Header
  9329. }
  9330. // Create: Creates a `Registration`, causing Classroom to start sending
  9331. // notifications
  9332. // from the provided `feed` to the destination provided in
  9333. // `cloudPubSubTopic`.
  9334. //
  9335. // Returns the created `Registration`. Currently, this will be the same
  9336. // as
  9337. // the argument, but with server-assigned fields such as `expiry_time`
  9338. // and
  9339. // `id` filled in.
  9340. //
  9341. // Note that any value specified for the `expiry_time` or `id` fields
  9342. // will be
  9343. // ignored.
  9344. //
  9345. // While Classroom may validate the `cloudPubSubTopic` and return errors
  9346. // on a
  9347. // best effort basis, it is the caller's responsibility to ensure that
  9348. // it
  9349. // exists and that Classroom has permission to publish to it.
  9350. //
  9351. // This method may return the following error codes:
  9352. //
  9353. // * `PERMISSION_DENIED` if:
  9354. // * the authenticated user does not have permission to receive
  9355. // notifications from the requested field; or
  9356. // * the credential provided does not include the appropriate scope
  9357. // for
  9358. // the requested feed.
  9359. // * another access error is encountered.
  9360. // * `INVALID_ARGUMENT` if:
  9361. // * no `cloudPubsubTopic` is specified, or the specified
  9362. // `cloudPubsubTopic` is not valid; or
  9363. // * no `feed` is specified, or the specified `feed` is not valid.
  9364. // * `NOT_FOUND` if:
  9365. // * the specified `feed` cannot be located, or the requesting user
  9366. // does
  9367. // not have permission to determine whether or not it exists; or
  9368. // * the specified `cloudPubsubTopic` cannot be located, or
  9369. // Classroom has
  9370. // not been granted permission to publish to it.
  9371. func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall {
  9372. c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9373. c.registration = registration
  9374. return c
  9375. }
  9376. // Fields allows partial responses to be retrieved. See
  9377. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9378. // for more information.
  9379. func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall {
  9380. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9381. return c
  9382. }
  9383. // Context sets the context to be used in this call's Do method. Any
  9384. // pending HTTP request will be aborted if the provided context is
  9385. // canceled.
  9386. func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall {
  9387. c.ctx_ = ctx
  9388. return c
  9389. }
  9390. // Header returns an http.Header that can be modified by the caller to
  9391. // add HTTP headers to the request.
  9392. func (c *RegistrationsCreateCall) Header() http.Header {
  9393. if c.header_ == nil {
  9394. c.header_ = make(http.Header)
  9395. }
  9396. return c.header_
  9397. }
  9398. func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) {
  9399. reqHeaders := make(http.Header)
  9400. for k, v := range c.header_ {
  9401. reqHeaders[k] = v
  9402. }
  9403. reqHeaders.Set("User-Agent", c.s.userAgent())
  9404. var body io.Reader = nil
  9405. body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration)
  9406. if err != nil {
  9407. return nil, err
  9408. }
  9409. reqHeaders.Set("Content-Type", "application/json")
  9410. c.urlParams_.Set("alt", alt)
  9411. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations")
  9412. urls += "?" + c.urlParams_.Encode()
  9413. req, _ := http.NewRequest("POST", urls, body)
  9414. req.Header = reqHeaders
  9415. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9416. }
  9417. // Do executes the "classroom.registrations.create" call.
  9418. // Exactly one of *Registration or error will be non-nil. Any non-2xx
  9419. // status code is an error. Response headers are in either
  9420. // *Registration.ServerResponse.Header or (if a response was returned at
  9421. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9422. // to check whether the returned error was because
  9423. // http.StatusNotModified was returned.
  9424. func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) {
  9425. gensupport.SetOptions(c.urlParams_, opts...)
  9426. res, err := c.doRequest("json")
  9427. if res != nil && res.StatusCode == http.StatusNotModified {
  9428. if res.Body != nil {
  9429. res.Body.Close()
  9430. }
  9431. return nil, &googleapi.Error{
  9432. Code: res.StatusCode,
  9433. Header: res.Header,
  9434. }
  9435. }
  9436. if err != nil {
  9437. return nil, err
  9438. }
  9439. defer googleapi.CloseBody(res)
  9440. if err := googleapi.CheckResponse(res); err != nil {
  9441. return nil, err
  9442. }
  9443. ret := &Registration{
  9444. ServerResponse: googleapi.ServerResponse{
  9445. Header: res.Header,
  9446. HTTPStatusCode: res.StatusCode,
  9447. },
  9448. }
  9449. target := &ret
  9450. if err := gensupport.DecodeResponse(target, res); err != nil {
  9451. return nil, err
  9452. }
  9453. return ret, nil
  9454. // {
  9455. // "description": "Creates a `Registration`, causing Classroom to start sending notifications\nfrom the provided `feed` to the destination provided in `cloudPubSubTopic`.\n\nReturns the created `Registration`. Currently, this will be the same as\nthe argument, but with server-assigned fields such as `expiry_time` and\n`id` filled in.\n\nNote that any value specified for the `expiry_time` or `id` fields will be\nignored.\n\nWhile Classroom may validate the `cloudPubSubTopic` and return errors on a\nbest effort basis, it is the caller's responsibility to ensure that it\nexists and that Classroom has permission to publish to it.\n\nThis method may return the following error codes:\n\n* `PERMISSION_DENIED` if:\n * the authenticated user does not have permission to receive\n notifications from the requested field; or\n * the credential provided does not include the appropriate scope for\n the requested feed.\n * another access error is encountered.\n* `INVALID_ARGUMENT` if:\n * no `cloudPubsubTopic` is specified, or the specified\n `cloudPubsubTopic` is not valid; or\n * no `feed` is specified, or the specified `feed` is not valid.\n* `NOT_FOUND` if:\n * the specified `feed` cannot be located, or the requesting user does\n not have permission to determine whether or not it exists; or\n * the specified `cloudPubsubTopic` cannot be located, or Classroom has\n not been granted permission to publish to it.",
  9456. // "flatPath": "v1/registrations",
  9457. // "httpMethod": "POST",
  9458. // "id": "classroom.registrations.create",
  9459. // "parameterOrder": [],
  9460. // "parameters": {},
  9461. // "path": "v1/registrations",
  9462. // "request": {
  9463. // "$ref": "Registration"
  9464. // },
  9465. // "response": {
  9466. // "$ref": "Registration"
  9467. // },
  9468. // "scopes": [
  9469. // "https://www.googleapis.com/auth/classroom.push-notifications"
  9470. // ]
  9471. // }
  9472. }
  9473. // method id "classroom.registrations.delete":
  9474. type RegistrationsDeleteCall struct {
  9475. s *Service
  9476. registrationId string
  9477. urlParams_ gensupport.URLParams
  9478. ctx_ context.Context
  9479. header_ http.Header
  9480. }
  9481. // Delete: Deletes a `Registration`, causing Classroom to stop sending
  9482. // notifications
  9483. // for that `Registration`.
  9484. func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall {
  9485. c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9486. c.registrationId = registrationId
  9487. return c
  9488. }
  9489. // Fields allows partial responses to be retrieved. See
  9490. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9491. // for more information.
  9492. func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall {
  9493. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9494. return c
  9495. }
  9496. // Context sets the context to be used in this call's Do method. Any
  9497. // pending HTTP request will be aborted if the provided context is
  9498. // canceled.
  9499. func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall {
  9500. c.ctx_ = ctx
  9501. return c
  9502. }
  9503. // Header returns an http.Header that can be modified by the caller to
  9504. // add HTTP headers to the request.
  9505. func (c *RegistrationsDeleteCall) Header() http.Header {
  9506. if c.header_ == nil {
  9507. c.header_ = make(http.Header)
  9508. }
  9509. return c.header_
  9510. }
  9511. func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9512. reqHeaders := make(http.Header)
  9513. for k, v := range c.header_ {
  9514. reqHeaders[k] = v
  9515. }
  9516. reqHeaders.Set("User-Agent", c.s.userAgent())
  9517. var body io.Reader = nil
  9518. c.urlParams_.Set("alt", alt)
  9519. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}")
  9520. urls += "?" + c.urlParams_.Encode()
  9521. req, _ := http.NewRequest("DELETE", urls, body)
  9522. req.Header = reqHeaders
  9523. googleapi.Expand(req.URL, map[string]string{
  9524. "registrationId": c.registrationId,
  9525. })
  9526. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9527. }
  9528. // Do executes the "classroom.registrations.delete" call.
  9529. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9530. // code is an error. Response headers are in either
  9531. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9532. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9533. // check whether the returned error was because http.StatusNotModified
  9534. // was returned.
  9535. func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9536. gensupport.SetOptions(c.urlParams_, opts...)
  9537. res, err := c.doRequest("json")
  9538. if res != nil && res.StatusCode == http.StatusNotModified {
  9539. if res.Body != nil {
  9540. res.Body.Close()
  9541. }
  9542. return nil, &googleapi.Error{
  9543. Code: res.StatusCode,
  9544. Header: res.Header,
  9545. }
  9546. }
  9547. if err != nil {
  9548. return nil, err
  9549. }
  9550. defer googleapi.CloseBody(res)
  9551. if err := googleapi.CheckResponse(res); err != nil {
  9552. return nil, err
  9553. }
  9554. ret := &Empty{
  9555. ServerResponse: googleapi.ServerResponse{
  9556. Header: res.Header,
  9557. HTTPStatusCode: res.StatusCode,
  9558. },
  9559. }
  9560. target := &ret
  9561. if err := gensupport.DecodeResponse(target, res); err != nil {
  9562. return nil, err
  9563. }
  9564. return ret, nil
  9565. // {
  9566. // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications\nfor that `Registration`.",
  9567. // "flatPath": "v1/registrations/{registrationId}",
  9568. // "httpMethod": "DELETE",
  9569. // "id": "classroom.registrations.delete",
  9570. // "parameterOrder": [
  9571. // "registrationId"
  9572. // ],
  9573. // "parameters": {
  9574. // "registrationId": {
  9575. // "description": "The `registration_id` of the `Registration` to be deleted.",
  9576. // "location": "path",
  9577. // "required": true,
  9578. // "type": "string"
  9579. // }
  9580. // },
  9581. // "path": "v1/registrations/{registrationId}",
  9582. // "response": {
  9583. // "$ref": "Empty"
  9584. // },
  9585. // "scopes": [
  9586. // "https://www.googleapis.com/auth/classroom.push-notifications"
  9587. // ]
  9588. // }
  9589. }
  9590. // method id "classroom.userProfiles.get":
  9591. type UserProfilesGetCall struct {
  9592. s *Service
  9593. userId string
  9594. urlParams_ gensupport.URLParams
  9595. ifNoneMatch_ string
  9596. ctx_ context.Context
  9597. header_ http.Header
  9598. }
  9599. // Get: Returns a user profile.
  9600. //
  9601. // This method returns the following error codes:
  9602. //
  9603. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  9604. // access
  9605. // this user profile, if no profile exists with the requested ID, or
  9606. // for
  9607. // access errors.
  9608. func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall {
  9609. c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9610. c.userId = userId
  9611. return c
  9612. }
  9613. // Fields allows partial responses to be retrieved. See
  9614. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9615. // for more information.
  9616. func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall {
  9617. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9618. return c
  9619. }
  9620. // IfNoneMatch sets the optional parameter which makes the operation
  9621. // fail if the object's ETag matches the given value. This is useful for
  9622. // getting updates only after the object has changed since the last
  9623. // request. Use googleapi.IsNotModified to check whether the response
  9624. // error from Do is the result of In-None-Match.
  9625. func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall {
  9626. c.ifNoneMatch_ = entityTag
  9627. return c
  9628. }
  9629. // Context sets the context to be used in this call's Do method. Any
  9630. // pending HTTP request will be aborted if the provided context is
  9631. // canceled.
  9632. func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall {
  9633. c.ctx_ = ctx
  9634. return c
  9635. }
  9636. // Header returns an http.Header that can be modified by the caller to
  9637. // add HTTP headers to the request.
  9638. func (c *UserProfilesGetCall) Header() http.Header {
  9639. if c.header_ == nil {
  9640. c.header_ = make(http.Header)
  9641. }
  9642. return c.header_
  9643. }
  9644. func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) {
  9645. reqHeaders := make(http.Header)
  9646. for k, v := range c.header_ {
  9647. reqHeaders[k] = v
  9648. }
  9649. reqHeaders.Set("User-Agent", c.s.userAgent())
  9650. if c.ifNoneMatch_ != "" {
  9651. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9652. }
  9653. var body io.Reader = nil
  9654. c.urlParams_.Set("alt", alt)
  9655. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}")
  9656. urls += "?" + c.urlParams_.Encode()
  9657. req, _ := http.NewRequest("GET", urls, body)
  9658. req.Header = reqHeaders
  9659. googleapi.Expand(req.URL, map[string]string{
  9660. "userId": c.userId,
  9661. })
  9662. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9663. }
  9664. // Do executes the "classroom.userProfiles.get" call.
  9665. // Exactly one of *UserProfile or error will be non-nil. Any non-2xx
  9666. // status code is an error. Response headers are in either
  9667. // *UserProfile.ServerResponse.Header or (if a response was returned at
  9668. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9669. // to check whether the returned error was because
  9670. // http.StatusNotModified was returned.
  9671. func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) {
  9672. gensupport.SetOptions(c.urlParams_, opts...)
  9673. res, err := c.doRequest("json")
  9674. if res != nil && res.StatusCode == http.StatusNotModified {
  9675. if res.Body != nil {
  9676. res.Body.Close()
  9677. }
  9678. return nil, &googleapi.Error{
  9679. Code: res.StatusCode,
  9680. Header: res.Header,
  9681. }
  9682. }
  9683. if err != nil {
  9684. return nil, err
  9685. }
  9686. defer googleapi.CloseBody(res)
  9687. if err := googleapi.CheckResponse(res); err != nil {
  9688. return nil, err
  9689. }
  9690. ret := &UserProfile{
  9691. ServerResponse: googleapi.ServerResponse{
  9692. Header: res.Header,
  9693. HTTPStatusCode: res.StatusCode,
  9694. },
  9695. }
  9696. target := &ret
  9697. if err := gensupport.DecodeResponse(target, res); err != nil {
  9698. return nil, err
  9699. }
  9700. return ret, nil
  9701. // {
  9702. // "description": "Returns a user profile.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access\nthis user profile, if no profile exists with the requested ID, or for\naccess errors.",
  9703. // "flatPath": "v1/userProfiles/{userId}",
  9704. // "httpMethod": "GET",
  9705. // "id": "classroom.userProfiles.get",
  9706. // "parameterOrder": [
  9707. // "userId"
  9708. // ],
  9709. // "parameters": {
  9710. // "userId": {
  9711. // "description": "Identifier of the profile to return. The identifier can be one of the\nfollowing:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  9712. // "location": "path",
  9713. // "required": true,
  9714. // "type": "string"
  9715. // }
  9716. // },
  9717. // "path": "v1/userProfiles/{userId}",
  9718. // "response": {
  9719. // "$ref": "UserProfile"
  9720. // },
  9721. // "scopes": [
  9722. // "https://www.googleapis.com/auth/classroom.profile.emails",
  9723. // "https://www.googleapis.com/auth/classroom.profile.photos",
  9724. // "https://www.googleapis.com/auth/classroom.rosters",
  9725. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  9726. // ]
  9727. // }
  9728. }
  9729. // method id "classroom.userProfiles.guardianInvitations.create":
  9730. type UserProfilesGuardianInvitationsCreateCall struct {
  9731. s *Service
  9732. studentId string
  9733. guardianinvitation *GuardianInvitation
  9734. urlParams_ gensupport.URLParams
  9735. ctx_ context.Context
  9736. header_ http.Header
  9737. }
  9738. // Create: Creates a guardian invitation, and sends an email to the
  9739. // guardian asking
  9740. // them to confirm that they are the student's guardian.
  9741. //
  9742. // Once the guardian accepts the invitation, their `state` will change
  9743. // to
  9744. // `COMPLETED` and they will start receiving guardian notifications.
  9745. // A
  9746. // `Guardian` resource will also be created to represent the active
  9747. // guardian.
  9748. //
  9749. // The request object must have the `student_id`
  9750. // and
  9751. // `invited_email_address` fields set. Failing to set these fields,
  9752. // or
  9753. // setting any other fields in the request, will result in an
  9754. // error.
  9755. //
  9756. // This method returns the following error codes:
  9757. //
  9758. // * `PERMISSION_DENIED` if the current user does not have permission
  9759. // to
  9760. // manage guardians, if the guardian in question has already rejected
  9761. // too many requests for that student, if guardians are not enabled
  9762. // for the
  9763. // domain in question, or for other access errors.
  9764. // * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the
  9765. // guardian
  9766. // link limit.
  9767. // * `INVALID_ARGUMENT` if the guardian email address is not valid (for
  9768. // example, if it is too long), or if the format of the student ID
  9769. // provided
  9770. // cannot be recognized (it is not an email address, nor a `user_id`
  9771. // from
  9772. // this API). This error will also be returned if read-only fields are
  9773. // set,
  9774. // or if the `state` field is set to to a value other than
  9775. // `PENDING`.
  9776. // * `NOT_FOUND` if the student ID provided is a valid student ID, but
  9777. // Classroom has no record of that student.
  9778. // * `ALREADY_EXISTS` if there is already a pending guardian invitation
  9779. // for
  9780. // the student and `invited_email_address` provided, or if the
  9781. // provided
  9782. // `invited_email_address` matches the Google account of an existing
  9783. // `Guardian` for this user.
  9784. func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall {
  9785. c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9786. c.studentId = studentId
  9787. c.guardianinvitation = guardianinvitation
  9788. return c
  9789. }
  9790. // Fields allows partial responses to be retrieved. See
  9791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9792. // for more information.
  9793. func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall {
  9794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9795. return c
  9796. }
  9797. // Context sets the context to be used in this call's Do method. Any
  9798. // pending HTTP request will be aborted if the provided context is
  9799. // canceled.
  9800. func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall {
  9801. c.ctx_ = ctx
  9802. return c
  9803. }
  9804. // Header returns an http.Header that can be modified by the caller to
  9805. // add HTTP headers to the request.
  9806. func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header {
  9807. if c.header_ == nil {
  9808. c.header_ = make(http.Header)
  9809. }
  9810. return c.header_
  9811. }
  9812. func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) {
  9813. reqHeaders := make(http.Header)
  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.guardianinvitation)
  9820. if err != nil {
  9821. return nil, err
  9822. }
  9823. reqHeaders.Set("Content-Type", "application/json")
  9824. c.urlParams_.Set("alt", alt)
  9825. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations")
  9826. urls += "?" + c.urlParams_.Encode()
  9827. req, _ := http.NewRequest("POST", urls, body)
  9828. req.Header = reqHeaders
  9829. googleapi.Expand(req.URL, map[string]string{
  9830. "studentId": c.studentId,
  9831. })
  9832. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9833. }
  9834. // Do executes the "classroom.userProfiles.guardianInvitations.create" call.
  9835. // Exactly one of *GuardianInvitation or error will be non-nil. Any
  9836. // non-2xx status code is an error. Response headers are in either
  9837. // *GuardianInvitation.ServerResponse.Header or (if a response was
  9838. // returned at all) in error.(*googleapi.Error).Header. Use
  9839. // googleapi.IsNotModified to check whether the returned error was
  9840. // because http.StatusNotModified was returned.
  9841. func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) {
  9842. gensupport.SetOptions(c.urlParams_, opts...)
  9843. res, err := c.doRequest("json")
  9844. if res != nil && res.StatusCode == http.StatusNotModified {
  9845. if res.Body != nil {
  9846. res.Body.Close()
  9847. }
  9848. return nil, &googleapi.Error{
  9849. Code: res.StatusCode,
  9850. Header: res.Header,
  9851. }
  9852. }
  9853. if err != nil {
  9854. return nil, err
  9855. }
  9856. defer googleapi.CloseBody(res)
  9857. if err := googleapi.CheckResponse(res); err != nil {
  9858. return nil, err
  9859. }
  9860. ret := &GuardianInvitation{
  9861. ServerResponse: googleapi.ServerResponse{
  9862. Header: res.Header,
  9863. HTTPStatusCode: res.StatusCode,
  9864. },
  9865. }
  9866. target := &ret
  9867. if err := gensupport.DecodeResponse(target, res); err != nil {
  9868. return nil, err
  9869. }
  9870. return ret, nil
  9871. // {
  9872. // "description": "Creates a guardian invitation, and sends an email to the guardian asking\nthem to confirm that they are the student's guardian.\n\nOnce the guardian accepts the invitation, their `state` will change to\n`COMPLETED` and they will start receiving guardian notifications. A\n`Guardian` resource will also be created to represent the active guardian.\n\nThe request object must have the `student_id` and\n`invited_email_address` fields set. Failing to set these fields, or\nsetting any other fields in the request, will result in an error.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the current user does not have permission to\n manage guardians, if the guardian in question has already rejected\n too many requests for that student, if guardians are not enabled for the\n domain in question, or for other access errors.\n* `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the guardian\n link limit.\n* `INVALID_ARGUMENT` if the guardian email address is not valid (for\n example, if it is too long), or if the format of the student ID provided\n cannot be recognized (it is not an email address, nor a `user_id` from\n this API). This error will also be returned if read-only fields are set,\n or if the `state` field is set to to a value other than `PENDING`.\n* `NOT_FOUND` if the student ID provided is a valid student ID, but\n Classroom has no record of that student.\n* `ALREADY_EXISTS` if there is already a pending guardian invitation for\n the student and `invited_email_address` provided, or if the provided\n `invited_email_address` matches the Google account of an existing\n `Guardian` for this user.",
  9873. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations",
  9874. // "httpMethod": "POST",
  9875. // "id": "classroom.userProfiles.guardianInvitations.create",
  9876. // "parameterOrder": [
  9877. // "studentId"
  9878. // ],
  9879. // "parameters": {
  9880. // "studentId": {
  9881. // "description": "ID of the student (in standard format)",
  9882. // "location": "path",
  9883. // "required": true,
  9884. // "type": "string"
  9885. // }
  9886. // },
  9887. // "path": "v1/userProfiles/{studentId}/guardianInvitations",
  9888. // "request": {
  9889. // "$ref": "GuardianInvitation"
  9890. // },
  9891. // "response": {
  9892. // "$ref": "GuardianInvitation"
  9893. // },
  9894. // "scopes": [
  9895. // "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  9896. // ]
  9897. // }
  9898. }
  9899. // method id "classroom.userProfiles.guardianInvitations.get":
  9900. type UserProfilesGuardianInvitationsGetCall struct {
  9901. s *Service
  9902. studentId string
  9903. invitationId string
  9904. urlParams_ gensupport.URLParams
  9905. ifNoneMatch_ string
  9906. ctx_ context.Context
  9907. header_ http.Header
  9908. }
  9909. // Get: Returns a specific guardian invitation.
  9910. //
  9911. // This method returns the following error codes:
  9912. //
  9913. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  9914. // view
  9915. // guardian invitations for the student identified by the
  9916. // `student_id`, if
  9917. // guardians are not enabled for the domain in question, or for other
  9918. // access errors.
  9919. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  9920. // cannot
  9921. // be recognized (it is not an email address, nor a `student_id` from
  9922. // the
  9923. // API, nor the literal string `me`).
  9924. // * `NOT_FOUND` if Classroom cannot find any record of the given
  9925. // student or
  9926. // `invitation_id`. May also be returned if the student exists, but
  9927. // the
  9928. // requesting user does not have access to see that student.
  9929. func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall {
  9930. c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9931. c.studentId = studentId
  9932. c.invitationId = invitationId
  9933. return c
  9934. }
  9935. // Fields allows partial responses to be retrieved. See
  9936. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9937. // for more information.
  9938. func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall {
  9939. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9940. return c
  9941. }
  9942. // IfNoneMatch sets the optional parameter which makes the operation
  9943. // fail if the object's ETag matches the given value. This is useful for
  9944. // getting updates only after the object has changed since the last
  9945. // request. Use googleapi.IsNotModified to check whether the response
  9946. // error from Do is the result of In-None-Match.
  9947. func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall {
  9948. c.ifNoneMatch_ = entityTag
  9949. return c
  9950. }
  9951. // Context sets the context to be used in this call's Do method. Any
  9952. // pending HTTP request will be aborted if the provided context is
  9953. // canceled.
  9954. func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall {
  9955. c.ctx_ = ctx
  9956. return c
  9957. }
  9958. // Header returns an http.Header that can be modified by the caller to
  9959. // add HTTP headers to the request.
  9960. func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header {
  9961. if c.header_ == nil {
  9962. c.header_ = make(http.Header)
  9963. }
  9964. return c.header_
  9965. }
  9966. func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) {
  9967. reqHeaders := make(http.Header)
  9968. for k, v := range c.header_ {
  9969. reqHeaders[k] = v
  9970. }
  9971. reqHeaders.Set("User-Agent", c.s.userAgent())
  9972. if c.ifNoneMatch_ != "" {
  9973. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9974. }
  9975. var body io.Reader = nil
  9976. c.urlParams_.Set("alt", alt)
  9977. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}")
  9978. urls += "?" + c.urlParams_.Encode()
  9979. req, _ := http.NewRequest("GET", urls, body)
  9980. req.Header = reqHeaders
  9981. googleapi.Expand(req.URL, map[string]string{
  9982. "studentId": c.studentId,
  9983. "invitationId": c.invitationId,
  9984. })
  9985. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9986. }
  9987. // Do executes the "classroom.userProfiles.guardianInvitations.get" call.
  9988. // Exactly one of *GuardianInvitation or error will be non-nil. Any
  9989. // non-2xx status code is an error. Response headers are in either
  9990. // *GuardianInvitation.ServerResponse.Header or (if a response was
  9991. // returned at all) in error.(*googleapi.Error).Header. Use
  9992. // googleapi.IsNotModified to check whether the returned error was
  9993. // because http.StatusNotModified was returned.
  9994. func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) {
  9995. gensupport.SetOptions(c.urlParams_, opts...)
  9996. res, err := c.doRequest("json")
  9997. if res != nil && res.StatusCode == http.StatusNotModified {
  9998. if res.Body != nil {
  9999. res.Body.Close()
  10000. }
  10001. return nil, &googleapi.Error{
  10002. Code: res.StatusCode,
  10003. Header: res.Header,
  10004. }
  10005. }
  10006. if err != nil {
  10007. return nil, err
  10008. }
  10009. defer googleapi.CloseBody(res)
  10010. if err := googleapi.CheckResponse(res); err != nil {
  10011. return nil, err
  10012. }
  10013. ret := &GuardianInvitation{
  10014. ServerResponse: googleapi.ServerResponse{
  10015. Header: res.Header,
  10016. HTTPStatusCode: res.StatusCode,
  10017. },
  10018. }
  10019. target := &ret
  10020. if err := gensupport.DecodeResponse(target, res); err != nil {
  10021. return nil, err
  10022. }
  10023. return ret, nil
  10024. // {
  10025. // "description": "Returns a specific guardian invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to view\n guardian invitations for the student identified by the `student_id`, if\n guardians are not enabled for the domain in question, or for other\n access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`).\n* `NOT_FOUND` if Classroom cannot find any record of the given student or\n `invitation_id`. May also be returned if the student exists, but the\n requesting user does not have access to see that student.",
  10026. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10027. // "httpMethod": "GET",
  10028. // "id": "classroom.userProfiles.guardianInvitations.get",
  10029. // "parameterOrder": [
  10030. // "studentId",
  10031. // "invitationId"
  10032. // ],
  10033. // "parameters": {
  10034. // "invitationId": {
  10035. // "description": "The `id` field of the `GuardianInvitation` being requested.",
  10036. // "location": "path",
  10037. // "required": true,
  10038. // "type": "string"
  10039. // },
  10040. // "studentId": {
  10041. // "description": "The ID of the student whose guardian invitation is being requested.",
  10042. // "location": "path",
  10043. // "required": true,
  10044. // "type": "string"
  10045. // }
  10046. // },
  10047. // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10048. // "response": {
  10049. // "$ref": "GuardianInvitation"
  10050. // },
  10051. // "scopes": [
  10052. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  10053. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  10054. // ]
  10055. // }
  10056. }
  10057. // method id "classroom.userProfiles.guardianInvitations.list":
  10058. type UserProfilesGuardianInvitationsListCall struct {
  10059. s *Service
  10060. studentId string
  10061. urlParams_ gensupport.URLParams
  10062. ifNoneMatch_ string
  10063. ctx_ context.Context
  10064. header_ http.Header
  10065. }
  10066. // List: Returns a list of guardian invitations that the requesting user
  10067. // is
  10068. // permitted to view, filtered by the parameters provided.
  10069. //
  10070. // This method returns the following error codes:
  10071. //
  10072. // * `PERMISSION_DENIED` if a `student_id` is specified, and the
  10073. // requesting
  10074. // user is not permitted to view guardian invitations for that
  10075. // student, if
  10076. // "-" is specified as the `student_id` and the user is not a
  10077. // domain
  10078. // administrator, if guardians are not enabled for the domain in
  10079. // question,
  10080. // or for other access errors.
  10081. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10082. // cannot
  10083. // be recognized (it is not an email address, nor a `student_id` from
  10084. // the
  10085. // API, nor the literal string `me`). May also be returned if an
  10086. // invalid
  10087. // `page_token` or `state` is provided.
  10088. // * `NOT_FOUND` if a `student_id` is specified, and its format can be
  10089. // recognized, but Classroom has no record of that student.
  10090. func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall {
  10091. c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10092. c.studentId = studentId
  10093. return c
  10094. }
  10095. // InvitedEmailAddress sets the optional parameter
  10096. // "invitedEmailAddress": If specified, only results with the specified
  10097. // `invited_email_address`
  10098. // will be returned.
  10099. func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall {
  10100. c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress)
  10101. return c
  10102. }
  10103. // PageSize sets the optional parameter "pageSize": Maximum number of
  10104. // items to return. Zero or unspecified indicates that the
  10105. // server may assign a maximum.
  10106. //
  10107. // The server may return fewer than the specified number of results.
  10108. func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall {
  10109. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  10110. return c
  10111. }
  10112. // PageToken sets the optional parameter "pageToken":
  10113. // nextPageToken
  10114. // value returned from a previous
  10115. // list call,
  10116. // indicating that the subsequent page of results should be
  10117. // returned.
  10118. //
  10119. // The list request
  10120. // must be otherwise identical to the one that resulted in this token.
  10121. func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall {
  10122. c.urlParams_.Set("pageToken", pageToken)
  10123. return c
  10124. }
  10125. // States sets the optional parameter "states": If specified, only
  10126. // results with the specified `state` values will be
  10127. // returned. Otherwise, results with a `state` of `PENDING` will be
  10128. // returned.
  10129. //
  10130. // Possible values:
  10131. // "GUARDIAN_INVITATION_STATE_UNSPECIFIED"
  10132. // "PENDING"
  10133. // "COMPLETE"
  10134. func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall {
  10135. c.urlParams_.SetMulti("states", append([]string{}, states...))
  10136. return c
  10137. }
  10138. // Fields allows partial responses to be retrieved. See
  10139. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10140. // for more information.
  10141. func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall {
  10142. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10143. return c
  10144. }
  10145. // IfNoneMatch sets the optional parameter which makes the operation
  10146. // fail if the object's ETag matches the given value. This is useful for
  10147. // getting updates only after the object has changed since the last
  10148. // request. Use googleapi.IsNotModified to check whether the response
  10149. // error from Do is the result of In-None-Match.
  10150. func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall {
  10151. c.ifNoneMatch_ = entityTag
  10152. return c
  10153. }
  10154. // Context sets the context to be used in this call's Do method. Any
  10155. // pending HTTP request will be aborted if the provided context is
  10156. // canceled.
  10157. func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall {
  10158. c.ctx_ = ctx
  10159. return c
  10160. }
  10161. // Header returns an http.Header that can be modified by the caller to
  10162. // add HTTP headers to the request.
  10163. func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header {
  10164. if c.header_ == nil {
  10165. c.header_ = make(http.Header)
  10166. }
  10167. return c.header_
  10168. }
  10169. func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) {
  10170. reqHeaders := make(http.Header)
  10171. for k, v := range c.header_ {
  10172. reqHeaders[k] = v
  10173. }
  10174. reqHeaders.Set("User-Agent", c.s.userAgent())
  10175. if c.ifNoneMatch_ != "" {
  10176. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10177. }
  10178. var body io.Reader = nil
  10179. c.urlParams_.Set("alt", alt)
  10180. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations")
  10181. urls += "?" + c.urlParams_.Encode()
  10182. req, _ := http.NewRequest("GET", urls, body)
  10183. req.Header = reqHeaders
  10184. googleapi.Expand(req.URL, map[string]string{
  10185. "studentId": c.studentId,
  10186. })
  10187. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10188. }
  10189. // Do executes the "classroom.userProfiles.guardianInvitations.list" call.
  10190. // Exactly one of *ListGuardianInvitationsResponse or error will be
  10191. // non-nil. Any non-2xx status code is an error. Response headers are in
  10192. // either *ListGuardianInvitationsResponse.ServerResponse.Header or (if
  10193. // a response was returned at all) in error.(*googleapi.Error).Header.
  10194. // Use googleapi.IsNotModified to check whether the returned error was
  10195. // because http.StatusNotModified was returned.
  10196. func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) {
  10197. gensupport.SetOptions(c.urlParams_, opts...)
  10198. res, err := c.doRequest("json")
  10199. if res != nil && res.StatusCode == http.StatusNotModified {
  10200. if res.Body != nil {
  10201. res.Body.Close()
  10202. }
  10203. return nil, &googleapi.Error{
  10204. Code: res.StatusCode,
  10205. Header: res.Header,
  10206. }
  10207. }
  10208. if err != nil {
  10209. return nil, err
  10210. }
  10211. defer googleapi.CloseBody(res)
  10212. if err := googleapi.CheckResponse(res); err != nil {
  10213. return nil, err
  10214. }
  10215. ret := &ListGuardianInvitationsResponse{
  10216. ServerResponse: googleapi.ServerResponse{
  10217. Header: res.Header,
  10218. HTTPStatusCode: res.StatusCode,
  10219. },
  10220. }
  10221. target := &ret
  10222. if err := gensupport.DecodeResponse(target, res); err != nil {
  10223. return nil, err
  10224. }
  10225. return ret, nil
  10226. // {
  10227. // "description": "Returns a list of guardian invitations that the requesting user is\npermitted to view, filtered by the parameters provided.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if a `student_id` is specified, and the requesting\n user is not permitted to view guardian invitations for that student, if\n `\"-\"` is specified as the `student_id` and the user is not a domain\n administrator, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`). May also be returned if an invalid\n `page_token` or `state` is provided.\n* `NOT_FOUND` if a `student_id` is specified, and its format can be\n recognized, but Classroom has no record of that student.",
  10228. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations",
  10229. // "httpMethod": "GET",
  10230. // "id": "classroom.userProfiles.guardianInvitations.list",
  10231. // "parameterOrder": [
  10232. // "studentId"
  10233. // ],
  10234. // "parameters": {
  10235. // "invitedEmailAddress": {
  10236. // "description": "If specified, only results with the specified `invited_email_address`\nwill be returned.",
  10237. // "location": "query",
  10238. // "type": "string"
  10239. // },
  10240. // "pageSize": {
  10241. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  10242. // "format": "int32",
  10243. // "location": "query",
  10244. // "type": "integer"
  10245. // },
  10246. // "pageToken": {
  10247. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.",
  10248. // "location": "query",
  10249. // "type": "string"
  10250. // },
  10251. // "states": {
  10252. // "description": "If specified, only results with the specified `state` values will be\nreturned. Otherwise, results with a `state` of `PENDING` will be returned.",
  10253. // "enum": [
  10254. // "GUARDIAN_INVITATION_STATE_UNSPECIFIED",
  10255. // "PENDING",
  10256. // "COMPLETE"
  10257. // ],
  10258. // "location": "query",
  10259. // "repeated": true,
  10260. // "type": "string"
  10261. // },
  10262. // "studentId": {
  10263. // "description": "The ID of the student whose guardian invitations are to be returned.\nThe identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user\n* the string literal `\"-\"`, indicating that results should be returned for\n all students that the requesting user is permitted to view guardian\n invitations.",
  10264. // "location": "path",
  10265. // "required": true,
  10266. // "type": "string"
  10267. // }
  10268. // },
  10269. // "path": "v1/userProfiles/{studentId}/guardianInvitations",
  10270. // "response": {
  10271. // "$ref": "ListGuardianInvitationsResponse"
  10272. // },
  10273. // "scopes": [
  10274. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  10275. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  10276. // ]
  10277. // }
  10278. }
  10279. // Pages invokes f for each page of results.
  10280. // A non-nil error returned from f will halt the iteration.
  10281. // The provided context supersedes any context provided to the Context method.
  10282. func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error {
  10283. c.ctx_ = ctx
  10284. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  10285. for {
  10286. x, err := c.Do()
  10287. if err != nil {
  10288. return err
  10289. }
  10290. if err := f(x); err != nil {
  10291. return err
  10292. }
  10293. if x.NextPageToken == "" {
  10294. return nil
  10295. }
  10296. c.PageToken(x.NextPageToken)
  10297. }
  10298. }
  10299. // method id "classroom.userProfiles.guardianInvitations.patch":
  10300. type UserProfilesGuardianInvitationsPatchCall struct {
  10301. s *Service
  10302. studentId string
  10303. invitationId string
  10304. guardianinvitation *GuardianInvitation
  10305. urlParams_ gensupport.URLParams
  10306. ctx_ context.Context
  10307. header_ http.Header
  10308. }
  10309. // Patch: Modifies a guardian invitation.
  10310. //
  10311. // Currently, the only valid modification is to change the `state`
  10312. // from
  10313. // `PENDING` to `COMPLETE`. This has the effect of withdrawing the
  10314. // invitation.
  10315. //
  10316. // This method returns the following error codes:
  10317. //
  10318. // * `PERMISSION_DENIED` if the current user does not have permission
  10319. // to
  10320. // manage guardians, if guardians are not enabled for the domain in
  10321. // question
  10322. // or for other access errors.
  10323. // * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING`
  10324. // state.
  10325. // * `INVALID_ARGUMENT` if the format of the student ID provided
  10326. // cannot be recognized (it is not an email address, nor a `user_id`
  10327. // from
  10328. // this API), or if the passed `GuardianInvitation` has a `state`
  10329. // other than
  10330. // `COMPLETE`, or if it modifies fields other than `state`.
  10331. // * `NOT_FOUND` if the student ID provided is a valid student ID, but
  10332. // Classroom has no record of that student, or if the `id` field does
  10333. // not
  10334. // refer to a guardian invitation known to Classroom.
  10335. func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall {
  10336. c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10337. c.studentId = studentId
  10338. c.invitationId = invitationId
  10339. c.guardianinvitation = guardianinvitation
  10340. return c
  10341. }
  10342. // UpdateMask sets the optional parameter "updateMask": Mask that
  10343. // identifies which fields on the course to update.
  10344. // This field is required to do an update. The update will fail if
  10345. // invalid
  10346. // fields are specified. The following fields are valid:
  10347. //
  10348. // * `state`
  10349. //
  10350. // When set in a query parameter, this field should be specified
  10351. // as
  10352. //
  10353. // `updateMask=<field1>,<field2>,...`
  10354. func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall {
  10355. c.urlParams_.Set("updateMask", updateMask)
  10356. return c
  10357. }
  10358. // Fields allows partial responses to be retrieved. See
  10359. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10360. // for more information.
  10361. func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall {
  10362. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10363. return c
  10364. }
  10365. // Context sets the context to be used in this call's Do method. Any
  10366. // pending HTTP request will be aborted if the provided context is
  10367. // canceled.
  10368. func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall {
  10369. c.ctx_ = ctx
  10370. return c
  10371. }
  10372. // Header returns an http.Header that can be modified by the caller to
  10373. // add HTTP headers to the request.
  10374. func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header {
  10375. if c.header_ == nil {
  10376. c.header_ = make(http.Header)
  10377. }
  10378. return c.header_
  10379. }
  10380. func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) {
  10381. reqHeaders := make(http.Header)
  10382. for k, v := range c.header_ {
  10383. reqHeaders[k] = v
  10384. }
  10385. reqHeaders.Set("User-Agent", c.s.userAgent())
  10386. var body io.Reader = nil
  10387. body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation)
  10388. if err != nil {
  10389. return nil, err
  10390. }
  10391. reqHeaders.Set("Content-Type", "application/json")
  10392. c.urlParams_.Set("alt", alt)
  10393. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}")
  10394. urls += "?" + c.urlParams_.Encode()
  10395. req, _ := http.NewRequest("PATCH", urls, body)
  10396. req.Header = reqHeaders
  10397. googleapi.Expand(req.URL, map[string]string{
  10398. "studentId": c.studentId,
  10399. "invitationId": c.invitationId,
  10400. })
  10401. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10402. }
  10403. // Do executes the "classroom.userProfiles.guardianInvitations.patch" call.
  10404. // Exactly one of *GuardianInvitation or error will be non-nil. Any
  10405. // non-2xx status code is an error. Response headers are in either
  10406. // *GuardianInvitation.ServerResponse.Header or (if a response was
  10407. // returned at all) in error.(*googleapi.Error).Header. Use
  10408. // googleapi.IsNotModified to check whether the returned error was
  10409. // because http.StatusNotModified was returned.
  10410. func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) {
  10411. gensupport.SetOptions(c.urlParams_, opts...)
  10412. res, err := c.doRequest("json")
  10413. if res != nil && res.StatusCode == http.StatusNotModified {
  10414. if res.Body != nil {
  10415. res.Body.Close()
  10416. }
  10417. return nil, &googleapi.Error{
  10418. Code: res.StatusCode,
  10419. Header: res.Header,
  10420. }
  10421. }
  10422. if err != nil {
  10423. return nil, err
  10424. }
  10425. defer googleapi.CloseBody(res)
  10426. if err := googleapi.CheckResponse(res); err != nil {
  10427. return nil, err
  10428. }
  10429. ret := &GuardianInvitation{
  10430. ServerResponse: googleapi.ServerResponse{
  10431. Header: res.Header,
  10432. HTTPStatusCode: res.StatusCode,
  10433. },
  10434. }
  10435. target := &ret
  10436. if err := gensupport.DecodeResponse(target, res); err != nil {
  10437. return nil, err
  10438. }
  10439. return ret, nil
  10440. // {
  10441. // "description": "Modifies a guardian invitation.\n\nCurrently, the only valid modification is to change the `state` from\n`PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the current user does not have permission to\n manage guardians, if guardians are not enabled for the domain in question\n or for other access errors.\n* `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state.\n* `INVALID_ARGUMENT` if the format of the student ID provided\n cannot be recognized (it is not an email address, nor a `user_id` from\n this API), or if the passed `GuardianInvitation` has a `state` other than\n `COMPLETE`, or if it modifies fields other than `state`.\n* `NOT_FOUND` if the student ID provided is a valid student ID, but\n Classroom has no record of that student, or if the `id` field does not\n refer to a guardian invitation known to Classroom.",
  10442. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10443. // "httpMethod": "PATCH",
  10444. // "id": "classroom.userProfiles.guardianInvitations.patch",
  10445. // "parameterOrder": [
  10446. // "studentId",
  10447. // "invitationId"
  10448. // ],
  10449. // "parameters": {
  10450. // "invitationId": {
  10451. // "description": "The `id` field of the `GuardianInvitation` to be modified.",
  10452. // "location": "path",
  10453. // "required": true,
  10454. // "type": "string"
  10455. // },
  10456. // "studentId": {
  10457. // "description": "The ID of the student whose guardian invitation is to be modified.",
  10458. // "location": "path",
  10459. // "required": true,
  10460. // "type": "string"
  10461. // },
  10462. // "updateMask": {
  10463. // "description": "Mask that identifies which fields on the course to update.\nThis field is required to do an update. The update will fail if invalid\nfields are specified. The following fields are valid:\n\n* `state`\n\nWhen set in a query parameter, this field should be specified as\n\n`updateMask=\u003cfield1\u003e,\u003cfield2\u003e,...`",
  10464. // "format": "google-fieldmask",
  10465. // "location": "query",
  10466. // "type": "string"
  10467. // }
  10468. // },
  10469. // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10470. // "request": {
  10471. // "$ref": "GuardianInvitation"
  10472. // },
  10473. // "response": {
  10474. // "$ref": "GuardianInvitation"
  10475. // },
  10476. // "scopes": [
  10477. // "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  10478. // ]
  10479. // }
  10480. }
  10481. // method id "classroom.userProfiles.guardians.delete":
  10482. type UserProfilesGuardiansDeleteCall struct {
  10483. s *Service
  10484. studentId string
  10485. guardianId string
  10486. urlParams_ gensupport.URLParams
  10487. ctx_ context.Context
  10488. header_ http.Header
  10489. }
  10490. // Delete: Deletes a guardian.
  10491. //
  10492. // The guardian will no longer receive guardian notifications and the
  10493. // guardian
  10494. // will no longer be accessible via the API.
  10495. //
  10496. // This method returns the following error codes:
  10497. //
  10498. // * `PERMISSION_DENIED` if no user that matches the provided
  10499. // `student_id`
  10500. // is visible to the requesting user, if the requesting user is not
  10501. // permitted to manage guardians for the student identified by the
  10502. // `student_id`, if guardians are not enabled for the domain in
  10503. // question,
  10504. // or for other access errors.
  10505. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10506. // cannot
  10507. // be recognized (it is not an email address, nor a `student_id` from
  10508. // the
  10509. // API).
  10510. // * `NOT_FOUND` if the requesting user is permitted to modify guardians
  10511. // for
  10512. // the requested `student_id`, but no `Guardian` record exists for
  10513. // that
  10514. // student with the provided `guardian_id`.
  10515. func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall {
  10516. c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10517. c.studentId = studentId
  10518. c.guardianId = guardianId
  10519. return c
  10520. }
  10521. // Fields allows partial responses to be retrieved. See
  10522. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10523. // for more information.
  10524. func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall {
  10525. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10526. return c
  10527. }
  10528. // Context sets the context to be used in this call's Do method. Any
  10529. // pending HTTP request will be aborted if the provided context is
  10530. // canceled.
  10531. func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall {
  10532. c.ctx_ = ctx
  10533. return c
  10534. }
  10535. // Header returns an http.Header that can be modified by the caller to
  10536. // add HTTP headers to the request.
  10537. func (c *UserProfilesGuardiansDeleteCall) Header() http.Header {
  10538. if c.header_ == nil {
  10539. c.header_ = make(http.Header)
  10540. }
  10541. return c.header_
  10542. }
  10543. func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) {
  10544. reqHeaders := make(http.Header)
  10545. for k, v := range c.header_ {
  10546. reqHeaders[k] = v
  10547. }
  10548. reqHeaders.Set("User-Agent", c.s.userAgent())
  10549. var body io.Reader = nil
  10550. c.urlParams_.Set("alt", alt)
  10551. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}")
  10552. urls += "?" + c.urlParams_.Encode()
  10553. req, _ := http.NewRequest("DELETE", urls, body)
  10554. req.Header = reqHeaders
  10555. googleapi.Expand(req.URL, map[string]string{
  10556. "studentId": c.studentId,
  10557. "guardianId": c.guardianId,
  10558. })
  10559. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10560. }
  10561. // Do executes the "classroom.userProfiles.guardians.delete" call.
  10562. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  10563. // code is an error. Response headers are in either
  10564. // *Empty.ServerResponse.Header or (if a response was returned at all)
  10565. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10566. // check whether the returned error was because http.StatusNotModified
  10567. // was returned.
  10568. func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  10569. gensupport.SetOptions(c.urlParams_, opts...)
  10570. res, err := c.doRequest("json")
  10571. if res != nil && res.StatusCode == http.StatusNotModified {
  10572. if res.Body != nil {
  10573. res.Body.Close()
  10574. }
  10575. return nil, &googleapi.Error{
  10576. Code: res.StatusCode,
  10577. Header: res.Header,
  10578. }
  10579. }
  10580. if err != nil {
  10581. return nil, err
  10582. }
  10583. defer googleapi.CloseBody(res)
  10584. if err := googleapi.CheckResponse(res); err != nil {
  10585. return nil, err
  10586. }
  10587. ret := &Empty{
  10588. ServerResponse: googleapi.ServerResponse{
  10589. Header: res.Header,
  10590. HTTPStatusCode: res.StatusCode,
  10591. },
  10592. }
  10593. target := &ret
  10594. if err := gensupport.DecodeResponse(target, res); err != nil {
  10595. return nil, err
  10596. }
  10597. return ret, nil
  10598. // {
  10599. // "description": "Deletes a guardian.\n\nThe guardian will no longer receive guardian notifications and the guardian\nwill no longer be accessible via the API.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if no user that matches the provided `student_id`\n is visible to the requesting user, if the requesting user is not\n permitted to manage guardians for the student identified by the\n `student_id`, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API).\n* `NOT_FOUND` if the requesting user is permitted to modify guardians for\n the requested `student_id`, but no `Guardian` record exists for that\n student with the provided `guardian_id`.",
  10600. // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  10601. // "httpMethod": "DELETE",
  10602. // "id": "classroom.userProfiles.guardians.delete",
  10603. // "parameterOrder": [
  10604. // "studentId",
  10605. // "guardianId"
  10606. // ],
  10607. // "parameters": {
  10608. // "guardianId": {
  10609. // "description": "The `id` field from a `Guardian`.",
  10610. // "location": "path",
  10611. // "required": true,
  10612. // "type": "string"
  10613. // },
  10614. // "studentId": {
  10615. // "description": "The student whose guardian is to be deleted. One of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  10616. // "location": "path",
  10617. // "required": true,
  10618. // "type": "string"
  10619. // }
  10620. // },
  10621. // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  10622. // "response": {
  10623. // "$ref": "Empty"
  10624. // },
  10625. // "scopes": [
  10626. // "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  10627. // ]
  10628. // }
  10629. }
  10630. // method id "classroom.userProfiles.guardians.get":
  10631. type UserProfilesGuardiansGetCall struct {
  10632. s *Service
  10633. studentId string
  10634. guardianId string
  10635. urlParams_ gensupport.URLParams
  10636. ifNoneMatch_ string
  10637. ctx_ context.Context
  10638. header_ http.Header
  10639. }
  10640. // Get: Returns a specific guardian.
  10641. //
  10642. // This method returns the following error codes:
  10643. //
  10644. // * `PERMISSION_DENIED` if no user that matches the provided
  10645. // `student_id`
  10646. // is visible to the requesting user, if the requesting user is not
  10647. // permitted to view guardian information for the student identified
  10648. // by the
  10649. // `student_id`, if guardians are not enabled for the domain in
  10650. // question,
  10651. // or for other access errors.
  10652. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10653. // cannot
  10654. // be recognized (it is not an email address, nor a `student_id` from
  10655. // the
  10656. // API, nor the literal string `me`).
  10657. // * `NOT_FOUND` if the requesting user is permitted to view guardians
  10658. // for
  10659. // the requested `student_id`, but no `Guardian` record exists for
  10660. // that
  10661. // student that matches the provided `guardian_id`.
  10662. func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall {
  10663. c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10664. c.studentId = studentId
  10665. c.guardianId = guardianId
  10666. return c
  10667. }
  10668. // Fields allows partial responses to be retrieved. See
  10669. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10670. // for more information.
  10671. func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall {
  10672. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10673. return c
  10674. }
  10675. // IfNoneMatch sets the optional parameter which makes the operation
  10676. // fail if the object's ETag matches the given value. This is useful for
  10677. // getting updates only after the object has changed since the last
  10678. // request. Use googleapi.IsNotModified to check whether the response
  10679. // error from Do is the result of In-None-Match.
  10680. func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall {
  10681. c.ifNoneMatch_ = entityTag
  10682. return c
  10683. }
  10684. // Context sets the context to be used in this call's Do method. Any
  10685. // pending HTTP request will be aborted if the provided context is
  10686. // canceled.
  10687. func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall {
  10688. c.ctx_ = ctx
  10689. return c
  10690. }
  10691. // Header returns an http.Header that can be modified by the caller to
  10692. // add HTTP headers to the request.
  10693. func (c *UserProfilesGuardiansGetCall) Header() http.Header {
  10694. if c.header_ == nil {
  10695. c.header_ = make(http.Header)
  10696. }
  10697. return c.header_
  10698. }
  10699. func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) {
  10700. reqHeaders := make(http.Header)
  10701. for k, v := range c.header_ {
  10702. reqHeaders[k] = v
  10703. }
  10704. reqHeaders.Set("User-Agent", c.s.userAgent())
  10705. if c.ifNoneMatch_ != "" {
  10706. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10707. }
  10708. var body io.Reader = nil
  10709. c.urlParams_.Set("alt", alt)
  10710. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}")
  10711. urls += "?" + c.urlParams_.Encode()
  10712. req, _ := http.NewRequest("GET", urls, body)
  10713. req.Header = reqHeaders
  10714. googleapi.Expand(req.URL, map[string]string{
  10715. "studentId": c.studentId,
  10716. "guardianId": c.guardianId,
  10717. })
  10718. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10719. }
  10720. // Do executes the "classroom.userProfiles.guardians.get" call.
  10721. // Exactly one of *Guardian or error will be non-nil. Any non-2xx status
  10722. // code is an error. Response headers are in either
  10723. // *Guardian.ServerResponse.Header or (if a response was returned at
  10724. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10725. // to check whether the returned error was because
  10726. // http.StatusNotModified was returned.
  10727. func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) {
  10728. gensupport.SetOptions(c.urlParams_, opts...)
  10729. res, err := c.doRequest("json")
  10730. if res != nil && res.StatusCode == http.StatusNotModified {
  10731. if res.Body != nil {
  10732. res.Body.Close()
  10733. }
  10734. return nil, &googleapi.Error{
  10735. Code: res.StatusCode,
  10736. Header: res.Header,
  10737. }
  10738. }
  10739. if err != nil {
  10740. return nil, err
  10741. }
  10742. defer googleapi.CloseBody(res)
  10743. if err := googleapi.CheckResponse(res); err != nil {
  10744. return nil, err
  10745. }
  10746. ret := &Guardian{
  10747. ServerResponse: googleapi.ServerResponse{
  10748. Header: res.Header,
  10749. HTTPStatusCode: res.StatusCode,
  10750. },
  10751. }
  10752. target := &ret
  10753. if err := gensupport.DecodeResponse(target, res); err != nil {
  10754. return nil, err
  10755. }
  10756. return ret, nil
  10757. // {
  10758. // "description": "Returns a specific guardian.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if no user that matches the provided `student_id`\n is visible to the requesting user, if the requesting user is not\n permitted to view guardian information for the student identified by the\n `student_id`, if guardians are not enabled for the domain in question,\n or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`).\n* `NOT_FOUND` if the requesting user is permitted to view guardians for\n the requested `student_id`, but no `Guardian` record exists for that\n student that matches the provided `guardian_id`.",
  10759. // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  10760. // "httpMethod": "GET",
  10761. // "id": "classroom.userProfiles.guardians.get",
  10762. // "parameterOrder": [
  10763. // "studentId",
  10764. // "guardianId"
  10765. // ],
  10766. // "parameters": {
  10767. // "guardianId": {
  10768. // "description": "The `id` field from a `Guardian`.",
  10769. // "location": "path",
  10770. // "required": true,
  10771. // "type": "string"
  10772. // },
  10773. // "studentId": {
  10774. // "description": "The student whose guardian is being requested. One of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user",
  10775. // "location": "path",
  10776. // "required": true,
  10777. // "type": "string"
  10778. // }
  10779. // },
  10780. // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  10781. // "response": {
  10782. // "$ref": "Guardian"
  10783. // },
  10784. // "scopes": [
  10785. // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly",
  10786. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  10787. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  10788. // ]
  10789. // }
  10790. }
  10791. // method id "classroom.userProfiles.guardians.list":
  10792. type UserProfilesGuardiansListCall struct {
  10793. s *Service
  10794. studentId string
  10795. urlParams_ gensupport.URLParams
  10796. ifNoneMatch_ string
  10797. ctx_ context.Context
  10798. header_ http.Header
  10799. }
  10800. // List: Returns a list of guardians that the requesting user is
  10801. // permitted to
  10802. // view, restricted to those that match the request.
  10803. //
  10804. // To list guardians for any student that the requesting user may
  10805. // view
  10806. // guardians for, use the literal character `-` for the student
  10807. // ID.
  10808. //
  10809. // This method returns the following error codes:
  10810. //
  10811. // * `PERMISSION_DENIED` if a `student_id` is specified, and the
  10812. // requesting
  10813. // user is not permitted to view guardian information for that
  10814. // student, if
  10815. // "-" is specified as the `student_id` and the user is not a
  10816. // domain
  10817. // administrator, if guardians are not enabled for the domain in
  10818. // question,
  10819. // if the `invited_email_address` filter is set by a user who is not
  10820. // a
  10821. // domain administrator, or for other access errors.
  10822. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10823. // cannot
  10824. // be recognized (it is not an email address, nor a `student_id` from
  10825. // the
  10826. // API, nor the literal string `me`). May also be returned if an
  10827. // invalid
  10828. // `page_token` is provided.
  10829. // * `NOT_FOUND` if a `student_id` is specified, and its format can be
  10830. // recognized, but Classroom has no record of that student.
  10831. func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall {
  10832. c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10833. c.studentId = studentId
  10834. return c
  10835. }
  10836. // InvitedEmailAddress sets the optional parameter
  10837. // "invitedEmailAddress": Filter results by the email address that the
  10838. // original invitation was sent
  10839. // to, resulting in this guardian link.
  10840. // This filter can only be used by domain administrators.
  10841. func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall {
  10842. c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress)
  10843. return c
  10844. }
  10845. // PageSize sets the optional parameter "pageSize": Maximum number of
  10846. // items to return. Zero or unspecified indicates that the
  10847. // server may assign a maximum.
  10848. //
  10849. // The server may return fewer than the specified number of results.
  10850. func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall {
  10851. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  10852. return c
  10853. }
  10854. // PageToken sets the optional parameter "pageToken":
  10855. // nextPageToken
  10856. // value returned from a previous
  10857. // list call,
  10858. // indicating that the subsequent page of results should be
  10859. // returned.
  10860. //
  10861. // The list request
  10862. // must be otherwise identical to the one that resulted in this token.
  10863. func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall {
  10864. c.urlParams_.Set("pageToken", pageToken)
  10865. return c
  10866. }
  10867. // Fields allows partial responses to be retrieved. See
  10868. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10869. // for more information.
  10870. func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall {
  10871. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10872. return c
  10873. }
  10874. // IfNoneMatch sets the optional parameter which makes the operation
  10875. // fail if the object's ETag matches the given value. This is useful for
  10876. // getting updates only after the object has changed since the last
  10877. // request. Use googleapi.IsNotModified to check whether the response
  10878. // error from Do is the result of In-None-Match.
  10879. func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall {
  10880. c.ifNoneMatch_ = entityTag
  10881. return c
  10882. }
  10883. // Context sets the context to be used in this call's Do method. Any
  10884. // pending HTTP request will be aborted if the provided context is
  10885. // canceled.
  10886. func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall {
  10887. c.ctx_ = ctx
  10888. return c
  10889. }
  10890. // Header returns an http.Header that can be modified by the caller to
  10891. // add HTTP headers to the request.
  10892. func (c *UserProfilesGuardiansListCall) Header() http.Header {
  10893. if c.header_ == nil {
  10894. c.header_ = make(http.Header)
  10895. }
  10896. return c.header_
  10897. }
  10898. func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) {
  10899. reqHeaders := make(http.Header)
  10900. for k, v := range c.header_ {
  10901. reqHeaders[k] = v
  10902. }
  10903. reqHeaders.Set("User-Agent", c.s.userAgent())
  10904. if c.ifNoneMatch_ != "" {
  10905. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10906. }
  10907. var body io.Reader = nil
  10908. c.urlParams_.Set("alt", alt)
  10909. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians")
  10910. urls += "?" + c.urlParams_.Encode()
  10911. req, _ := http.NewRequest("GET", urls, body)
  10912. req.Header = reqHeaders
  10913. googleapi.Expand(req.URL, map[string]string{
  10914. "studentId": c.studentId,
  10915. })
  10916. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10917. }
  10918. // Do executes the "classroom.userProfiles.guardians.list" call.
  10919. // Exactly one of *ListGuardiansResponse or error will be non-nil. Any
  10920. // non-2xx status code is an error. Response headers are in either
  10921. // *ListGuardiansResponse.ServerResponse.Header or (if a response was
  10922. // returned at all) in error.(*googleapi.Error).Header. Use
  10923. // googleapi.IsNotModified to check whether the returned error was
  10924. // because http.StatusNotModified was returned.
  10925. func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) {
  10926. gensupport.SetOptions(c.urlParams_, opts...)
  10927. res, err := c.doRequest("json")
  10928. if res != nil && res.StatusCode == http.StatusNotModified {
  10929. if res.Body != nil {
  10930. res.Body.Close()
  10931. }
  10932. return nil, &googleapi.Error{
  10933. Code: res.StatusCode,
  10934. Header: res.Header,
  10935. }
  10936. }
  10937. if err != nil {
  10938. return nil, err
  10939. }
  10940. defer googleapi.CloseBody(res)
  10941. if err := googleapi.CheckResponse(res); err != nil {
  10942. return nil, err
  10943. }
  10944. ret := &ListGuardiansResponse{
  10945. ServerResponse: googleapi.ServerResponse{
  10946. Header: res.Header,
  10947. HTTPStatusCode: res.StatusCode,
  10948. },
  10949. }
  10950. target := &ret
  10951. if err := gensupport.DecodeResponse(target, res); err != nil {
  10952. return nil, err
  10953. }
  10954. return ret, nil
  10955. // {
  10956. // "description": "Returns a list of guardians that the requesting user is permitted to\nview, restricted to those that match the request.\n\nTo list guardians for any student that the requesting user may view\nguardians for, use the literal character `-` for the student ID.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if a `student_id` is specified, and the requesting\n user is not permitted to view guardian information for that student, if\n `\"-\"` is specified as the `student_id` and the user is not a domain\n administrator, if guardians are not enabled for the domain in question,\n if the `invited_email_address` filter is set by a user who is not a\n domain administrator, or for other access errors.\n* `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot\n be recognized (it is not an email address, nor a `student_id` from the\n API, nor the literal string `me`). May also be returned if an invalid\n `page_token` is provided.\n* `NOT_FOUND` if a `student_id` is specified, and its format can be\n recognized, but Classroom has no record of that student.",
  10957. // "flatPath": "v1/userProfiles/{studentId}/guardians",
  10958. // "httpMethod": "GET",
  10959. // "id": "classroom.userProfiles.guardians.list",
  10960. // "parameterOrder": [
  10961. // "studentId"
  10962. // ],
  10963. // "parameters": {
  10964. // "invitedEmailAddress": {
  10965. // "description": "Filter results by the email address that the original invitation was sent\nto, resulting in this guardian link.\nThis filter can only be used by domain administrators.",
  10966. // "location": "query",
  10967. // "type": "string"
  10968. // },
  10969. // "pageSize": {
  10970. // "description": "Maximum number of items to return. Zero or unspecified indicates that the\nserver may assign a maximum.\n\nThe server may return fewer than the specified number of results.",
  10971. // "format": "int32",
  10972. // "location": "query",
  10973. // "type": "integer"
  10974. // },
  10975. // "pageToken": {
  10976. // "description": "nextPageToken\nvalue returned from a previous\nlist call,\nindicating that the subsequent page of results should be returned.\n\nThe list request\nmust be otherwise identical to the one that resulted in this token.",
  10977. // "location": "query",
  10978. // "type": "string"
  10979. // },
  10980. // "studentId": {
  10981. // "description": "Filter results by the student who the guardian is linked to.\nThe identifier can be one of the following:\n\n* the numeric identifier for the user\n* the email address of the user\n* the string literal `\"me\"`, indicating the requesting user\n* the string literal `\"-\"`, indicating that results should be returned for\n all students that the requesting user has access to view.",
  10982. // "location": "path",
  10983. // "required": true,
  10984. // "type": "string"
  10985. // }
  10986. // },
  10987. // "path": "v1/userProfiles/{studentId}/guardians",
  10988. // "response": {
  10989. // "$ref": "ListGuardiansResponse"
  10990. // },
  10991. // "scopes": [
  10992. // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly",
  10993. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  10994. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  10995. // ]
  10996. // }
  10997. }
  10998. // Pages invokes f for each page of results.
  10999. // A non-nil error returned from f will halt the iteration.
  11000. // The provided context supersedes any context provided to the Context method.
  11001. func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error {
  11002. c.ctx_ = ctx
  11003. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11004. for {
  11005. x, err := c.Do()
  11006. if err != nil {
  11007. return err
  11008. }
  11009. if err := f(x); err != nil {
  11010. return err
  11011. }
  11012. if x.NextPageToken == "" {
  11013. return nil
  11014. }
  11015. c.PageToken(x.NextPageToken)
  11016. }
  11017. }