You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

12317 lines
443 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package classroom provides access to the Google Classroom API.
  6. //
  7. // For product documentation, see: https://developers.google.com/classroom/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/classroom/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // classroomService, err := classroom.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // classroomService, err := classroom.NewService(ctx, option.WithScopes(classroom.ClassroomStudentSubmissionsStudentsReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // classroomService, err := classroom.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // classroomService, err := classroom.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package classroom // import "google.golang.org/api/classroom/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "classroom:v1"
  71. const apiName = "classroom"
  72. const apiVersion = "v1"
  73. const basePath = "https://classroom.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage announcements in Google Classroom
  77. ClassroomAnnouncementsScope = "https://www.googleapis.com/auth/classroom.announcements"
  78. // View announcements in Google Classroom
  79. ClassroomAnnouncementsReadonlyScope = "https://www.googleapis.com/auth/classroom.announcements.readonly"
  80. // Manage your Google Classroom classes
  81. ClassroomCoursesScope = "https://www.googleapis.com/auth/classroom.courses"
  82. // View your Google Classroom classes
  83. ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/classroom.courses.readonly"
  84. // Manage your course work and view your grades in Google Classroom
  85. ClassroomCourseworkMeScope = "https://www.googleapis.com/auth/classroom.coursework.me"
  86. // View your course work and grades in Google Classroom
  87. ClassroomCourseworkMeReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.me.readonly"
  88. // Manage course work and grades for students in the Google Classroom
  89. // classes you teach and view the course work and grades for classes you
  90. // administer
  91. ClassroomCourseworkStudentsScope = "https://www.googleapis.com/auth/classroom.coursework.students"
  92. // View course work and grades for students in the Google Classroom
  93. // classes you teach or administer
  94. ClassroomCourseworkStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.coursework.students.readonly"
  95. // View your Google Classroom guardians
  96. ClassroomGuardianlinksMeReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly"
  97. // View and manage guardians for students in your Google Classroom
  98. // classes
  99. ClassroomGuardianlinksStudentsScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  100. // View guardians for students in your Google Classroom classes
  101. ClassroomGuardianlinksStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  102. // View the email addresses of people in your classes
  103. ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/classroom.profile.emails"
  104. // View the profile photos of people in your classes
  105. ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/classroom.profile.photos"
  106. // Receive notifications about your Google Classroom data
  107. ClassroomPushNotificationsScope = "https://www.googleapis.com/auth/classroom.push-notifications"
  108. // Manage your Google Classroom class rosters
  109. ClassroomRostersScope = "https://www.googleapis.com/auth/classroom.rosters"
  110. // View your Google Classroom class rosters
  111. ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/classroom.rosters.readonly"
  112. // View your course work and grades in Google Classroom
  113. ClassroomStudentSubmissionsMeReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly"
  114. // View course work and grades for students in the Google Classroom
  115. // classes you teach or administer
  116. ClassroomStudentSubmissionsStudentsReadonlyScope = "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly"
  117. )
  118. // NewService creates a new Service.
  119. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  120. scopesOption := option.WithScopes(
  121. "https://www.googleapis.com/auth/classroom.announcements",
  122. "https://www.googleapis.com/auth/classroom.announcements.readonly",
  123. "https://www.googleapis.com/auth/classroom.courses",
  124. "https://www.googleapis.com/auth/classroom.courses.readonly",
  125. "https://www.googleapis.com/auth/classroom.coursework.me",
  126. "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  127. "https://www.googleapis.com/auth/classroom.coursework.students",
  128. "https://www.googleapis.com/auth/classroom.coursework.students.readonly",
  129. "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly",
  130. "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  131. "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly",
  132. "https://www.googleapis.com/auth/classroom.profile.emails",
  133. "https://www.googleapis.com/auth/classroom.profile.photos",
  134. "https://www.googleapis.com/auth/classroom.push-notifications",
  135. "https://www.googleapis.com/auth/classroom.rosters",
  136. "https://www.googleapis.com/auth/classroom.rosters.readonly",
  137. "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly",
  138. "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly",
  139. )
  140. // NOTE: prepend, so we don't override user-specified scopes.
  141. opts = append([]option.ClientOption{scopesOption}, opts...)
  142. client, endpoint, err := htransport.NewClient(ctx, opts...)
  143. if err != nil {
  144. return nil, err
  145. }
  146. s, err := New(client)
  147. if err != nil {
  148. return nil, err
  149. }
  150. if endpoint != "" {
  151. s.BasePath = endpoint
  152. }
  153. return s, nil
  154. }
  155. // New creates a new Service. It uses the provided http.Client for requests.
  156. //
  157. // Deprecated: please use NewService instead.
  158. // To provide a custom HTTP client, use option.WithHTTPClient.
  159. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  160. func New(client *http.Client) (*Service, error) {
  161. if client == nil {
  162. return nil, errors.New("client is nil")
  163. }
  164. s := &Service{client: client, BasePath: basePath}
  165. s.Courses = NewCoursesService(s)
  166. s.Invitations = NewInvitationsService(s)
  167. s.Registrations = NewRegistrationsService(s)
  168. s.UserProfiles = NewUserProfilesService(s)
  169. return s, nil
  170. }
  171. type Service struct {
  172. client *http.Client
  173. BasePath string // API endpoint base URL
  174. UserAgent string // optional additional User-Agent fragment
  175. Courses *CoursesService
  176. Invitations *InvitationsService
  177. Registrations *RegistrationsService
  178. UserProfiles *UserProfilesService
  179. }
  180. func (s *Service) userAgent() string {
  181. if s.UserAgent == "" {
  182. return googleapi.UserAgent
  183. }
  184. return googleapi.UserAgent + " " + s.UserAgent
  185. }
  186. func NewCoursesService(s *Service) *CoursesService {
  187. rs := &CoursesService{s: s}
  188. rs.Aliases = NewCoursesAliasesService(s)
  189. rs.Announcements = NewCoursesAnnouncementsService(s)
  190. rs.CourseWork = NewCoursesCourseWorkService(s)
  191. rs.Students = NewCoursesStudentsService(s)
  192. rs.Teachers = NewCoursesTeachersService(s)
  193. return rs
  194. }
  195. type CoursesService struct {
  196. s *Service
  197. Aliases *CoursesAliasesService
  198. Announcements *CoursesAnnouncementsService
  199. CourseWork *CoursesCourseWorkService
  200. Students *CoursesStudentsService
  201. Teachers *CoursesTeachersService
  202. }
  203. func NewCoursesAliasesService(s *Service) *CoursesAliasesService {
  204. rs := &CoursesAliasesService{s: s}
  205. return rs
  206. }
  207. type CoursesAliasesService struct {
  208. s *Service
  209. }
  210. func NewCoursesAnnouncementsService(s *Service) *CoursesAnnouncementsService {
  211. rs := &CoursesAnnouncementsService{s: s}
  212. return rs
  213. }
  214. type CoursesAnnouncementsService struct {
  215. s *Service
  216. }
  217. func NewCoursesCourseWorkService(s *Service) *CoursesCourseWorkService {
  218. rs := &CoursesCourseWorkService{s: s}
  219. rs.StudentSubmissions = NewCoursesCourseWorkStudentSubmissionsService(s)
  220. return rs
  221. }
  222. type CoursesCourseWorkService struct {
  223. s *Service
  224. StudentSubmissions *CoursesCourseWorkStudentSubmissionsService
  225. }
  226. func NewCoursesCourseWorkStudentSubmissionsService(s *Service) *CoursesCourseWorkStudentSubmissionsService {
  227. rs := &CoursesCourseWorkStudentSubmissionsService{s: s}
  228. return rs
  229. }
  230. type CoursesCourseWorkStudentSubmissionsService struct {
  231. s *Service
  232. }
  233. func NewCoursesStudentsService(s *Service) *CoursesStudentsService {
  234. rs := &CoursesStudentsService{s: s}
  235. return rs
  236. }
  237. type CoursesStudentsService struct {
  238. s *Service
  239. }
  240. func NewCoursesTeachersService(s *Service) *CoursesTeachersService {
  241. rs := &CoursesTeachersService{s: s}
  242. return rs
  243. }
  244. type CoursesTeachersService struct {
  245. s *Service
  246. }
  247. func NewInvitationsService(s *Service) *InvitationsService {
  248. rs := &InvitationsService{s: s}
  249. return rs
  250. }
  251. type InvitationsService struct {
  252. s *Service
  253. }
  254. func NewRegistrationsService(s *Service) *RegistrationsService {
  255. rs := &RegistrationsService{s: s}
  256. return rs
  257. }
  258. type RegistrationsService struct {
  259. s *Service
  260. }
  261. func NewUserProfilesService(s *Service) *UserProfilesService {
  262. rs := &UserProfilesService{s: s}
  263. rs.GuardianInvitations = NewUserProfilesGuardianInvitationsService(s)
  264. rs.Guardians = NewUserProfilesGuardiansService(s)
  265. return rs
  266. }
  267. type UserProfilesService struct {
  268. s *Service
  269. GuardianInvitations *UserProfilesGuardianInvitationsService
  270. Guardians *UserProfilesGuardiansService
  271. }
  272. func NewUserProfilesGuardianInvitationsService(s *Service) *UserProfilesGuardianInvitationsService {
  273. rs := &UserProfilesGuardianInvitationsService{s: s}
  274. return rs
  275. }
  276. type UserProfilesGuardianInvitationsService struct {
  277. s *Service
  278. }
  279. func NewUserProfilesGuardiansService(s *Service) *UserProfilesGuardiansService {
  280. rs := &UserProfilesGuardiansService{s: s}
  281. return rs
  282. }
  283. type UserProfilesGuardiansService struct {
  284. s *Service
  285. }
  286. // Announcement: Announcement created by a teacher for students of the
  287. // course
  288. type Announcement struct {
  289. // AlternateLink: Absolute link to this announcement in the Classroom
  290. // web UI.
  291. // This is only populated if `state` is `PUBLISHED`.
  292. //
  293. // Read-only.
  294. AlternateLink string `json:"alternateLink,omitempty"`
  295. // AssigneeMode: Assignee mode of the announcement.
  296. // If unspecified, the default value is `ALL_STUDENTS`.
  297. //
  298. // Possible values:
  299. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  300. // returned.
  301. // "ALL_STUDENTS" - All students can see the item.
  302. // This is the default state.
  303. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  304. AssigneeMode string `json:"assigneeMode,omitempty"`
  305. // CourseId: Identifier of the course.
  306. //
  307. // Read-only.
  308. CourseId string `json:"courseId,omitempty"`
  309. // CreationTime: Timestamp when this announcement was
  310. // created.
  311. //
  312. // Read-only.
  313. CreationTime string `json:"creationTime,omitempty"`
  314. // CreatorUserId: Identifier for the user that created the
  315. // announcement.
  316. //
  317. // Read-only.
  318. CreatorUserId string `json:"creatorUserId,omitempty"`
  319. // Id: Classroom-assigned identifier of this announcement, unique per
  320. // course.
  321. //
  322. // Read-only.
  323. Id string `json:"id,omitempty"`
  324. // IndividualStudentsOptions: Identifiers of students with access to the
  325. // announcement.
  326. // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  327. // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only students
  328. // specified in this
  329. // field will be able to see the announcement.
  330. IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"`
  331. // Materials: Additional materials.
  332. //
  333. // Announcements must have no more than 20 material items.
  334. Materials []*Material `json:"materials,omitempty"`
  335. // ScheduledTime: Optional timestamp when this announcement is scheduled
  336. // to be published.
  337. ScheduledTime string `json:"scheduledTime,omitempty"`
  338. // State: Status of this announcement.
  339. // If unspecified, the default state is `DRAFT`.
  340. //
  341. // Possible values:
  342. // "ANNOUNCEMENT_STATE_UNSPECIFIED" - No state specified. This is
  343. // never returned.
  344. // "PUBLISHED" - Status for announcement that has been published.
  345. // This is the default state.
  346. // "DRAFT" - Status for an announcement that is not yet
  347. // published.
  348. // Announcement in this state is visible only to course teachers and
  349. // domain
  350. // administrators.
  351. // "DELETED" - Status for announcement that was published but is now
  352. // deleted.
  353. // Announcement in this state is visible only to course teachers and
  354. // domain
  355. // administrators.
  356. // Announcement in this state is deleted after some time.
  357. State string `json:"state,omitempty"`
  358. // Text: Description of this announcement.
  359. // The text must be a valid UTF-8 string containing no more
  360. // than 30,000 characters.
  361. Text string `json:"text,omitempty"`
  362. // UpdateTime: Timestamp of the most recent change to this
  363. // announcement.
  364. //
  365. // Read-only.
  366. UpdateTime string `json:"updateTime,omitempty"`
  367. // ServerResponse contains the HTTP response code and headers from the
  368. // server.
  369. googleapi.ServerResponse `json:"-"`
  370. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  371. // unconditionally include in API requests. By default, fields with
  372. // empty values are omitted from API requests. However, any non-pointer,
  373. // non-interface field appearing in ForceSendFields will be sent to the
  374. // server regardless of whether the field is empty or not. This may be
  375. // used to include empty fields in Patch requests.
  376. ForceSendFields []string `json:"-"`
  377. // NullFields is a list of field names (e.g. "AlternateLink") to include
  378. // in API requests with the JSON null value. By default, fields with
  379. // empty values are omitted from API requests. However, any field with
  380. // an empty value appearing in NullFields will be sent to the server as
  381. // null. It is an error if a field in this list has a non-empty value.
  382. // This may be used to include null fields in Patch requests.
  383. NullFields []string `json:"-"`
  384. }
  385. func (s *Announcement) MarshalJSON() ([]byte, error) {
  386. type NoMethod Announcement
  387. raw := NoMethod(*s)
  388. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  389. }
  390. // Assignment: Additional details for assignments.
  391. type Assignment struct {
  392. // StudentWorkFolder: Drive folder where attachments from student
  393. // submissions are placed.
  394. // This is only populated for course teachers and administrators.
  395. StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"`
  396. // ForceSendFields is a list of field names (e.g. "StudentWorkFolder")
  397. // to unconditionally include in API requests. By default, fields with
  398. // empty values are omitted from API requests. However, any non-pointer,
  399. // non-interface field appearing in ForceSendFields will be sent to the
  400. // server regardless of whether the field is empty or not. This may be
  401. // used to include empty fields in Patch requests.
  402. ForceSendFields []string `json:"-"`
  403. // NullFields is a list of field names (e.g. "StudentWorkFolder") to
  404. // include in API requests with the JSON null value. By default, fields
  405. // with empty values are omitted from API requests. However, any field
  406. // with an empty value appearing in NullFields will be sent to the
  407. // server as null. It is an error if a field in this list has a
  408. // non-empty value. This may be used to include null fields in Patch
  409. // requests.
  410. NullFields []string `json:"-"`
  411. }
  412. func (s *Assignment) MarshalJSON() ([]byte, error) {
  413. type NoMethod Assignment
  414. raw := NoMethod(*s)
  415. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  416. }
  417. // AssignmentSubmission: Student work for an assignment.
  418. type AssignmentSubmission struct {
  419. // Attachments: Attachments added by the student.
  420. // Drive files that correspond to materials with a share mode
  421. // of
  422. // STUDENT_COPY may not exist yet if the student has not accessed
  423. // the
  424. // assignment in Classroom.
  425. //
  426. // Some attachment metadata is only populated if the requesting user
  427. // has
  428. // permission to access it. Identifier and alternate_link fields are
  429. // always
  430. // available, but others (e.g. title) may not be.
  431. Attachments []*Attachment `json:"attachments,omitempty"`
  432. // ForceSendFields is a list of field names (e.g. "Attachments") to
  433. // unconditionally include in API requests. By default, fields with
  434. // empty values are omitted from API requests. However, any non-pointer,
  435. // non-interface field appearing in ForceSendFields will be sent to the
  436. // server regardless of whether the field is empty or not. This may be
  437. // used to include empty fields in Patch requests.
  438. ForceSendFields []string `json:"-"`
  439. // NullFields is a list of field names (e.g. "Attachments") to include
  440. // in API requests with the JSON null value. By default, fields with
  441. // empty values are omitted from API requests. However, any field with
  442. // an empty value appearing in NullFields will be sent to the server as
  443. // null. It is an error if a field in this list has a non-empty value.
  444. // This may be used to include null fields in Patch requests.
  445. NullFields []string `json:"-"`
  446. }
  447. func (s *AssignmentSubmission) MarshalJSON() ([]byte, error) {
  448. type NoMethod AssignmentSubmission
  449. raw := NoMethod(*s)
  450. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  451. }
  452. // Attachment: Attachment added to student assignment work.
  453. //
  454. // When creating attachments, setting the `form` field is not supported.
  455. type Attachment struct {
  456. // DriveFile: Google Drive file attachment.
  457. DriveFile *DriveFile `json:"driveFile,omitempty"`
  458. // Form: Google Forms attachment.
  459. Form *Form `json:"form,omitempty"`
  460. // Link: Link attachment.
  461. Link *Link `json:"link,omitempty"`
  462. // YouTubeVideo: Youtube video attachment.
  463. YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"`
  464. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  465. // unconditionally include in API requests. By default, fields with
  466. // empty values are omitted from API requests. However, any non-pointer,
  467. // non-interface field appearing in ForceSendFields will be sent to the
  468. // server regardless of whether the field is empty or not. This may be
  469. // used to include empty fields in Patch requests.
  470. ForceSendFields []string `json:"-"`
  471. // NullFields is a list of field names (e.g. "DriveFile") to include in
  472. // API requests with the JSON null value. By default, fields with empty
  473. // values are omitted from API requests. However, any field with an
  474. // empty value appearing in NullFields will be sent to the server as
  475. // null. It is an error if a field in this list has a non-empty value.
  476. // This may be used to include null fields in Patch requests.
  477. NullFields []string `json:"-"`
  478. }
  479. func (s *Attachment) MarshalJSON() ([]byte, error) {
  480. type NoMethod Attachment
  481. raw := NoMethod(*s)
  482. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  483. }
  484. // CloudPubsubTopic: A reference to a Cloud Pub/Sub topic.
  485. //
  486. // To register for notifications, the owner of the topic must
  487. // grant
  488. // `classroom-notifications@system.gserviceaccount.com` the
  489. // `projects.topics.publish` permission.
  490. type CloudPubsubTopic struct {
  491. // TopicName: The `name` field of a Cloud
  492. // Pub/Sub
  493. // [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1
  494. // /projects.topics#Topic).
  495. TopicName string `json:"topicName,omitempty"`
  496. // ForceSendFields is a list of field names (e.g. "TopicName") to
  497. // unconditionally include in API requests. By default, fields with
  498. // empty values are omitted from API requests. However, any non-pointer,
  499. // non-interface field appearing in ForceSendFields will be sent to the
  500. // server regardless of whether the field is empty or not. This may be
  501. // used to include empty fields in Patch requests.
  502. ForceSendFields []string `json:"-"`
  503. // NullFields is a list of field names (e.g. "TopicName") to include in
  504. // API requests with the JSON null value. By default, fields with empty
  505. // values are omitted from API requests. However, any field with an
  506. // empty value appearing in NullFields will be sent to the server as
  507. // null. It is an error if a field in this list has a non-empty value.
  508. // This may be used to include null fields in Patch requests.
  509. NullFields []string `json:"-"`
  510. }
  511. func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) {
  512. type NoMethod CloudPubsubTopic
  513. raw := NoMethod(*s)
  514. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  515. }
  516. // Course: A Course in Classroom.
  517. type Course struct {
  518. // AlternateLink: Absolute link to this course in the Classroom web
  519. // UI.
  520. //
  521. // Read-only.
  522. AlternateLink string `json:"alternateLink,omitempty"`
  523. // CalendarId: The Calendar ID for a calendar that all course members
  524. // can see, to which
  525. // Classroom adds events for course work and announcements in the
  526. // course.
  527. //
  528. // Read-only.
  529. CalendarId string `json:"calendarId,omitempty"`
  530. // CourseGroupEmail: The email address of a Google group containing all
  531. // members of the course.
  532. // This group does not accept email and can only be used for
  533. // permissions.
  534. //
  535. // Read-only.
  536. CourseGroupEmail string `json:"courseGroupEmail,omitempty"`
  537. // CourseMaterialSets: Sets of materials that appear on the "about" page
  538. // of this course.
  539. //
  540. // Read-only.
  541. CourseMaterialSets []*CourseMaterialSet `json:"courseMaterialSets,omitempty"`
  542. // CourseState: State of the course.
  543. // If unspecified, the default state is `PROVISIONED`.
  544. //
  545. // Possible values:
  546. // "COURSE_STATE_UNSPECIFIED" - No course state. No returned Course
  547. // message will use this value.
  548. // "ACTIVE" - The course is active.
  549. // "ARCHIVED" - The course has been archived. You cannot modify it
  550. // except to change it
  551. // to a different state.
  552. // "PROVISIONED" - The course has been created, but not yet activated.
  553. // It is accessible by
  554. // the primary teacher and domain administrators, who may modify it
  555. // or
  556. // change it to the `ACTIVE` or `DECLINED` states.
  557. // A course may only be changed to `PROVISIONED` if it is in the
  558. // `DECLINED`
  559. // state.
  560. // "DECLINED" - The course has been created, but declined. It is
  561. // accessible by the
  562. // course owner and domain administrators, though it will not
  563. // be
  564. // displayed in the web UI. You cannot modify the course except to
  565. // change it
  566. // to the `PROVISIONED` state.
  567. // A course may only be changed to `DECLINED` if it is in the
  568. // `PROVISIONED`
  569. // state.
  570. // "SUSPENDED" - The course has been suspended. You cannot modify the
  571. // course, and only the
  572. // user identified by the `owner_id` can view the course.
  573. // A course may be placed in this state if it potentially violates
  574. // the
  575. // Terms of Service.
  576. CourseState string `json:"courseState,omitempty"`
  577. // CreationTime: Creation time of the course.
  578. // Specifying this field in a course update mask results in an
  579. // error.
  580. //
  581. // Read-only.
  582. CreationTime string `json:"creationTime,omitempty"`
  583. // Description: Optional description.
  584. // For example, "We'll be learning about the structure of
  585. // living
  586. // creatures from a combination of textbooks, guest lectures, and lab
  587. // work.
  588. // Expect to be excited!"
  589. // If set, this field must be a valid UTF-8 string and no longer than
  590. // 30,000
  591. // characters.
  592. Description string `json:"description,omitempty"`
  593. // DescriptionHeading: Optional heading for the description.
  594. // For example, "Welcome to 10th Grade Biology."
  595. // If set, this field must be a valid UTF-8 string and no longer than
  596. // 3600
  597. // characters.
  598. DescriptionHeading string `json:"descriptionHeading,omitempty"`
  599. // EnrollmentCode: Enrollment code to use when joining this
  600. // course.
  601. // Specifying this field in a course update mask results in an
  602. // error.
  603. //
  604. // Read-only.
  605. EnrollmentCode string `json:"enrollmentCode,omitempty"`
  606. // GuardiansEnabled: Whether or not guardian notifications are enabled
  607. // for this course.
  608. //
  609. // Read-only.
  610. GuardiansEnabled bool `json:"guardiansEnabled,omitempty"`
  611. // Id: Identifier for this course assigned by Classroom.
  612. //
  613. // When
  614. // creating a course,
  615. // you may optionally set this identifier to an
  616. // alias string in the
  617. // request to create a corresponding alias. The `id` is still assigned
  618. // by
  619. // Classroom and cannot be updated after the course is
  620. // created.
  621. //
  622. // Specifying this field in a course update mask results in an error.
  623. Id string `json:"id,omitempty"`
  624. // Name: Name of the course.
  625. // For example, "10th Grade Biology".
  626. // The name is required. It must be between 1 and 750 characters and a
  627. // valid
  628. // UTF-8 string.
  629. Name string `json:"name,omitempty"`
  630. // OwnerId: The identifier of the owner of a course.
  631. //
  632. // When specified as a parameter of a
  633. // create course request, this
  634. // field is required.
  635. // The identifier can be one of the following:
  636. //
  637. // * the numeric identifier for the user
  638. // * the email address of the user
  639. // * the string literal "me", indicating the requesting user
  640. //
  641. // This must be set in a create request. Admins can also specify this
  642. // field
  643. // in a patch course request to
  644. // transfer ownership. In other contexts, it is read-only.
  645. OwnerId string `json:"ownerId,omitempty"`
  646. // Room: Optional room location.
  647. // For example, "301".
  648. // If set, this field must be a valid UTF-8 string and no longer than
  649. // 650
  650. // characters.
  651. Room string `json:"room,omitempty"`
  652. // Section: Section of the course.
  653. // For example, "Period 2".
  654. // If set, this field must be a valid UTF-8 string and no longer than
  655. // 2800
  656. // characters.
  657. Section string `json:"section,omitempty"`
  658. // TeacherFolder: Information about a Drive Folder that is shared with
  659. // all teachers of the
  660. // course.
  661. //
  662. // This field will only be set for teachers of the course and domain
  663. // administrators.
  664. //
  665. // Read-only.
  666. TeacherFolder *DriveFolder `json:"teacherFolder,omitempty"`
  667. // TeacherGroupEmail: The email address of a Google group containing all
  668. // teachers of the course.
  669. // This group does not accept email and can only be used for
  670. // permissions.
  671. //
  672. // Read-only.
  673. TeacherGroupEmail string `json:"teacherGroupEmail,omitempty"`
  674. // UpdateTime: Time of the most recent update to this course.
  675. // Specifying this field in a course update mask results in an
  676. // error.
  677. //
  678. // Read-only.
  679. UpdateTime string `json:"updateTime,omitempty"`
  680. // ServerResponse contains the HTTP response code and headers from the
  681. // server.
  682. googleapi.ServerResponse `json:"-"`
  683. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  684. // unconditionally include in API requests. By default, fields with
  685. // empty values are omitted from API requests. However, any non-pointer,
  686. // non-interface field appearing in ForceSendFields will be sent to the
  687. // server regardless of whether the field is empty or not. This may be
  688. // used to include empty fields in Patch requests.
  689. ForceSendFields []string `json:"-"`
  690. // NullFields is a list of field names (e.g. "AlternateLink") to include
  691. // in API requests with the JSON null value. By default, fields with
  692. // empty values are omitted from API requests. However, any field with
  693. // an empty value appearing in NullFields will be sent to the server as
  694. // null. It is an error if a field in this list has a non-empty value.
  695. // This may be used to include null fields in Patch requests.
  696. NullFields []string `json:"-"`
  697. }
  698. func (s *Course) MarshalJSON() ([]byte, error) {
  699. type NoMethod Course
  700. raw := NoMethod(*s)
  701. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  702. }
  703. // CourseAlias: Alternative identifier for a course.
  704. //
  705. // An alias uniquely identifies a course. It must be unique within one
  706. // of the
  707. // following scopes:
  708. //
  709. // * domain: A domain-scoped alias is visible to all users within the
  710. // alias
  711. // creator's domain and can be created only by a domain admin. A
  712. // domain-scoped
  713. // alias is often used when a course has an identifier external to
  714. // Classroom.
  715. //
  716. // * project: A project-scoped alias is visible to any request from
  717. // an
  718. // application using the Developer Console project ID that created the
  719. // alias
  720. // and can be created by any project. A project-scoped alias is often
  721. // used when
  722. // an application has alternative identifiers. A random value can also
  723. // be used
  724. // to avoid duplicate courses in the event of transmission failures, as
  725. // retrying
  726. // a request will return `ALREADY_EXISTS` if a previous one has
  727. // succeeded.
  728. type CourseAlias struct {
  729. // Alias: Alias string. The format of the string indicates the desired
  730. // alias scoping.
  731. //
  732. // * `d:<name>` indicates a domain-scoped alias.
  733. // Example: `d:math_101`
  734. // * `p:<name>` indicates a project-scoped alias.
  735. // Example: `p:abc123`
  736. //
  737. // This field has a maximum length of 256 characters.
  738. Alias string `json:"alias,omitempty"`
  739. // ServerResponse contains the HTTP response code and headers from the
  740. // server.
  741. googleapi.ServerResponse `json:"-"`
  742. // ForceSendFields is a list of field names (e.g. "Alias") to
  743. // unconditionally include in API requests. By default, fields with
  744. // empty values are omitted from API requests. However, any non-pointer,
  745. // non-interface field appearing in ForceSendFields will be sent to the
  746. // server regardless of whether the field is empty or not. This may be
  747. // used to include empty fields in Patch requests.
  748. ForceSendFields []string `json:"-"`
  749. // NullFields is a list of field names (e.g. "Alias") to include in API
  750. // requests with the JSON null value. By default, fields with empty
  751. // values are omitted from API requests. However, any field with an
  752. // empty value appearing in NullFields will be sent to the server as
  753. // null. It is an error if a field in this list has a non-empty value.
  754. // This may be used to include null fields in Patch requests.
  755. NullFields []string `json:"-"`
  756. }
  757. func (s *CourseAlias) MarshalJSON() ([]byte, error) {
  758. type NoMethod CourseAlias
  759. raw := NoMethod(*s)
  760. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  761. }
  762. // CourseMaterial: A material attached to a course as part of a material
  763. // set.
  764. type CourseMaterial struct {
  765. // DriveFile: Google Drive file attachment.
  766. DriveFile *DriveFile `json:"driveFile,omitempty"`
  767. // Form: Google Forms attachment.
  768. Form *Form `json:"form,omitempty"`
  769. // Link: Link atatchment.
  770. Link *Link `json:"link,omitempty"`
  771. // YouTubeVideo: Youtube video attachment.
  772. YouTubeVideo *YouTubeVideo `json:"youTubeVideo,omitempty"`
  773. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  774. // unconditionally include in API requests. By default, fields with
  775. // empty values are omitted from API requests. However, any non-pointer,
  776. // non-interface field appearing in ForceSendFields will be sent to the
  777. // server regardless of whether the field is empty or not. This may be
  778. // used to include empty fields in Patch requests.
  779. ForceSendFields []string `json:"-"`
  780. // NullFields is a list of field names (e.g. "DriveFile") to include in
  781. // API requests with the JSON null value. By default, fields with empty
  782. // values are omitted from API requests. However, any field with an
  783. // empty value appearing in NullFields will be sent to the server as
  784. // null. It is an error if a field in this list has a non-empty value.
  785. // This may be used to include null fields in Patch requests.
  786. NullFields []string `json:"-"`
  787. }
  788. func (s *CourseMaterial) MarshalJSON() ([]byte, error) {
  789. type NoMethod CourseMaterial
  790. raw := NoMethod(*s)
  791. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  792. }
  793. // CourseMaterialSet: A set of materials that appears on the "About"
  794. // page of the course.
  795. // These materials might include a syllabus, schedule, or other
  796. // background
  797. // information relating to the course as a whole.
  798. type CourseMaterialSet struct {
  799. // Materials: Materials attached to this set.
  800. Materials []*CourseMaterial `json:"materials,omitempty"`
  801. // Title: Title for this set.
  802. Title string `json:"title,omitempty"`
  803. // ForceSendFields is a list of field names (e.g. "Materials") to
  804. // unconditionally include in API requests. By default, fields with
  805. // empty values are omitted from API requests. However, any non-pointer,
  806. // non-interface field appearing in ForceSendFields will be sent to the
  807. // server regardless of whether the field is empty or not. This may be
  808. // used to include empty fields in Patch requests.
  809. ForceSendFields []string `json:"-"`
  810. // NullFields is a list of field names (e.g. "Materials") to include in
  811. // API requests with the JSON null value. By default, fields with empty
  812. // values are omitted from API requests. However, any field with an
  813. // empty value appearing in NullFields will be sent to the server as
  814. // null. It is an error if a field in this list has a non-empty value.
  815. // This may be used to include null fields in Patch requests.
  816. NullFields []string `json:"-"`
  817. }
  818. func (s *CourseMaterialSet) MarshalJSON() ([]byte, error) {
  819. type NoMethod CourseMaterialSet
  820. raw := NoMethod(*s)
  821. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  822. }
  823. // CourseRosterChangesInfo: Information about a `Feed` with a
  824. // `feed_type` of `COURSE_ROSTER_CHANGES`.
  825. type CourseRosterChangesInfo struct {
  826. // CourseId: The `course_id` of the course to subscribe to roster
  827. // changes for.
  828. CourseId string `json:"courseId,omitempty"`
  829. // ForceSendFields is a list of field names (e.g. "CourseId") to
  830. // unconditionally include in API requests. By default, fields with
  831. // empty values are omitted from API requests. However, any non-pointer,
  832. // non-interface field appearing in ForceSendFields will be sent to the
  833. // server regardless of whether the field is empty or not. This may be
  834. // used to include empty fields in Patch requests.
  835. ForceSendFields []string `json:"-"`
  836. // NullFields is a list of field names (e.g. "CourseId") to include in
  837. // API requests with the JSON null value. By default, fields with empty
  838. // values are omitted from API requests. However, any field with an
  839. // empty value appearing in NullFields will be sent to the server as
  840. // null. It is an error if a field in this list has a non-empty value.
  841. // This may be used to include null fields in Patch requests.
  842. NullFields []string `json:"-"`
  843. }
  844. func (s *CourseRosterChangesInfo) MarshalJSON() ([]byte, error) {
  845. type NoMethod CourseRosterChangesInfo
  846. raw := NoMethod(*s)
  847. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  848. }
  849. // CourseWork: Course work created by a teacher for students of the
  850. // course.
  851. type CourseWork struct {
  852. // AlternateLink: Absolute link to this course work in the Classroom web
  853. // UI.
  854. // This is only populated if `state` is `PUBLISHED`.
  855. //
  856. // Read-only.
  857. AlternateLink string `json:"alternateLink,omitempty"`
  858. // AssigneeMode: Assignee mode of the coursework.
  859. // If unspecified, the default value is `ALL_STUDENTS`.
  860. //
  861. // Possible values:
  862. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  863. // returned.
  864. // "ALL_STUDENTS" - All students can see the item.
  865. // This is the default state.
  866. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  867. AssigneeMode string `json:"assigneeMode,omitempty"`
  868. // Assignment: Assignment details.
  869. // This is populated only when `work_type` is `ASSIGNMENT`.
  870. //
  871. // Read-only.
  872. Assignment *Assignment `json:"assignment,omitempty"`
  873. // AssociatedWithDeveloper: Whether this course work item is associated
  874. // with the Developer Console
  875. // project making the request.
  876. //
  877. // See google.classroom.Work.CreateCourseWork for
  878. // more
  879. // details.
  880. //
  881. // Read-only.
  882. AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"`
  883. // CourseId: Identifier of the course.
  884. //
  885. // Read-only.
  886. CourseId string `json:"courseId,omitempty"`
  887. // CreationTime: Timestamp when this course work was
  888. // created.
  889. //
  890. // Read-only.
  891. CreationTime string `json:"creationTime,omitempty"`
  892. // CreatorUserId: Identifier for the user that created the
  893. // coursework.
  894. //
  895. // Read-only.
  896. CreatorUserId string `json:"creatorUserId,omitempty"`
  897. // Description: Optional description of this course work.
  898. // If set, the description must be a valid UTF-8 string containing no
  899. // more
  900. // than 30,000 characters.
  901. Description string `json:"description,omitempty"`
  902. // DueDate: Optional date, in UTC, that submissions for this course work
  903. // are due.
  904. // This must be specified if `due_time` is specified.
  905. DueDate *Date `json:"dueDate,omitempty"`
  906. // DueTime: Optional time of day, in UTC, that submissions for this
  907. // course work
  908. // are due.
  909. // This must be specified if `due_date` is specified.
  910. DueTime *TimeOfDay `json:"dueTime,omitempty"`
  911. // Id: Classroom-assigned identifier of this course work, unique per
  912. // course.
  913. //
  914. // Read-only.
  915. Id string `json:"id,omitempty"`
  916. // IndividualStudentsOptions: Identifiers of students with access to the
  917. // coursework.
  918. // This field is set only if `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  919. // If the `assigneeMode` is `INDIVIDUAL_STUDENTS`, then only
  920. // students
  921. // specified in this field will be assigned the coursework.
  922. IndividualStudentsOptions *IndividualStudentsOptions `json:"individualStudentsOptions,omitempty"`
  923. // Materials: Additional materials.
  924. //
  925. // CourseWork must have no more than 20 material items.
  926. Materials []*Material `json:"materials,omitempty"`
  927. // MaxPoints: Maximum grade for this course work.
  928. // If zero or unspecified, this assignment is considered ungraded.
  929. // This must be a non-negative integer value.
  930. MaxPoints float64 `json:"maxPoints,omitempty"`
  931. // MultipleChoiceQuestion: Multiple choice question details.
  932. // For read operations, this field is populated only when `work_type`
  933. // is
  934. // `MULTIPLE_CHOICE_QUESTION`.
  935. // For write operations, this field must be specified when creating
  936. // course
  937. // work with a `work_type` of `MULTIPLE_CHOICE_QUESTION`, and it must
  938. // not be
  939. // set otherwise.
  940. MultipleChoiceQuestion *MultipleChoiceQuestion `json:"multipleChoiceQuestion,omitempty"`
  941. // ScheduledTime: Optional timestamp when this course work is scheduled
  942. // to be published.
  943. ScheduledTime string `json:"scheduledTime,omitempty"`
  944. // State: Status of this course work.
  945. // If unspecified, the default state is `DRAFT`.
  946. //
  947. // Possible values:
  948. // "COURSE_WORK_STATE_UNSPECIFIED" - No state specified. This is never
  949. // returned.
  950. // "PUBLISHED" - Status for work that has been published.
  951. // This is the default state.
  952. // "DRAFT" - Status for work that is not yet published.
  953. // Work in this state is visible only to course teachers and
  954. // domain
  955. // administrators.
  956. // "DELETED" - Status for work that was published but is now
  957. // deleted.
  958. // Work in this state is visible only to course teachers and
  959. // domain
  960. // administrators.
  961. // Work in this state is deleted after some time.
  962. State string `json:"state,omitempty"`
  963. // SubmissionModificationMode: Setting to determine when students are
  964. // allowed to modify submissions.
  965. // If unspecified, the default value is `MODIFIABLE_UNTIL_TURNED_IN`.
  966. //
  967. // Possible values:
  968. // "SUBMISSION_MODIFICATION_MODE_UNSPECIFIED" - No modification mode
  969. // specified. This is never returned.
  970. // "MODIFIABLE_UNTIL_TURNED_IN" - Submissions can be modified before
  971. // being turned in.
  972. // "MODIFIABLE" - Submissions can be modified at any time.
  973. SubmissionModificationMode string `json:"submissionModificationMode,omitempty"`
  974. // Title: Title of this course work.
  975. // The title must be a valid UTF-8 string containing between 1 and
  976. // 3000
  977. // characters.
  978. Title string `json:"title,omitempty"`
  979. // UpdateTime: Timestamp of the most recent change to this course
  980. // work.
  981. //
  982. // Read-only.
  983. UpdateTime string `json:"updateTime,omitempty"`
  984. // WorkType: Type of this course work.
  985. //
  986. // The type is set when the course work is created and cannot be
  987. // changed.
  988. //
  989. // Possible values:
  990. // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is
  991. // never returned.
  992. // "ASSIGNMENT" - An assignment.
  993. // "SHORT_ANSWER_QUESTION" - A short answer question.
  994. // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question.
  995. WorkType string `json:"workType,omitempty"`
  996. // ServerResponse contains the HTTP response code and headers from the
  997. // server.
  998. googleapi.ServerResponse `json:"-"`
  999. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1000. // unconditionally include in API requests. By default, fields with
  1001. // empty values are omitted from API requests. However, any non-pointer,
  1002. // non-interface field appearing in ForceSendFields will be sent to the
  1003. // server regardless of whether the field is empty or not. This may be
  1004. // used to include empty fields in Patch requests.
  1005. ForceSendFields []string `json:"-"`
  1006. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1007. // in API requests with the JSON null value. By default, fields with
  1008. // empty values are omitted from API requests. However, any field with
  1009. // an empty value appearing in NullFields will be sent to the server as
  1010. // null. It is an error if a field in this list has a non-empty value.
  1011. // This may be used to include null fields in Patch requests.
  1012. NullFields []string `json:"-"`
  1013. }
  1014. func (s *CourseWork) MarshalJSON() ([]byte, error) {
  1015. type NoMethod CourseWork
  1016. raw := NoMethod(*s)
  1017. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1018. }
  1019. func (s *CourseWork) UnmarshalJSON(data []byte) error {
  1020. type NoMethod CourseWork
  1021. var s1 struct {
  1022. MaxPoints gensupport.JSONFloat64 `json:"maxPoints"`
  1023. *NoMethod
  1024. }
  1025. s1.NoMethod = (*NoMethod)(s)
  1026. if err := json.Unmarshal(data, &s1); err != nil {
  1027. return err
  1028. }
  1029. s.MaxPoints = float64(s1.MaxPoints)
  1030. return nil
  1031. }
  1032. // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type`
  1033. // of `COURSE_WORK_CHANGES`.
  1034. type CourseWorkChangesInfo struct {
  1035. // CourseId: The `course_id` of the course to subscribe to work changes
  1036. // for.
  1037. CourseId string `json:"courseId,omitempty"`
  1038. // ForceSendFields is a list of field names (e.g. "CourseId") to
  1039. // unconditionally include in API requests. By default, fields with
  1040. // empty values are omitted from API requests. However, any non-pointer,
  1041. // non-interface field appearing in ForceSendFields will be sent to the
  1042. // server regardless of whether the field is empty or not. This may be
  1043. // used to include empty fields in Patch requests.
  1044. ForceSendFields []string `json:"-"`
  1045. // NullFields is a list of field names (e.g. "CourseId") to include in
  1046. // API requests with the JSON null value. By default, fields with empty
  1047. // values are omitted from API requests. However, any field with an
  1048. // empty value appearing in NullFields will be sent to the server as
  1049. // null. It is an error if a field in this list has a non-empty value.
  1050. // This may be used to include null fields in Patch requests.
  1051. NullFields []string `json:"-"`
  1052. }
  1053. func (s *CourseWorkChangesInfo) MarshalJSON() ([]byte, error) {
  1054. type NoMethod CourseWorkChangesInfo
  1055. raw := NoMethod(*s)
  1056. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1057. }
  1058. // Date: Represents a whole or partial calendar date, e.g. a birthday.
  1059. // The time of day
  1060. // and time zone are either specified elsewhere or are not significant.
  1061. // The date
  1062. // is relative to the Proleptic Gregorian Calendar. This can
  1063. // represent:
  1064. //
  1065. // * A full date, with non-zero year, month and day values
  1066. // * A month and day value, with a zero year, e.g. an anniversary
  1067. // * A year on its own, with zero month and day values
  1068. // * A year and month value, with a zero day, e.g. a credit card
  1069. // expiration date
  1070. //
  1071. // Related types are google.type.TimeOfDay and
  1072. // `google.protobuf.Timestamp`.
  1073. type Date struct {
  1074. // Day: Day of month. Must be from 1 to 31 and valid for the year and
  1075. // month, or 0
  1076. // if specifying a year by itself or a year and month where the day is
  1077. // not
  1078. // significant.
  1079. Day int64 `json:"day,omitempty"`
  1080. // Month: Month of year. Must be from 1 to 12, or 0 if specifying a year
  1081. // without a
  1082. // month and day.
  1083. Month int64 `json:"month,omitempty"`
  1084. // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date
  1085. // without
  1086. // a year.
  1087. Year int64 `json:"year,omitempty"`
  1088. // ForceSendFields is a list of field names (e.g. "Day") to
  1089. // unconditionally include in API requests. By default, fields with
  1090. // empty values are omitted from API requests. However, any non-pointer,
  1091. // non-interface field appearing in ForceSendFields will be sent to the
  1092. // server regardless of whether the field is empty or not. This may be
  1093. // used to include empty fields in Patch requests.
  1094. ForceSendFields []string `json:"-"`
  1095. // NullFields is a list of field names (e.g. "Day") to include in API
  1096. // requests with the JSON null value. By default, fields with empty
  1097. // values are omitted from API requests. However, any field with an
  1098. // empty value appearing in NullFields will be sent to the server as
  1099. // null. It is an error if a field in this list has a non-empty value.
  1100. // This may be used to include null fields in Patch requests.
  1101. NullFields []string `json:"-"`
  1102. }
  1103. func (s *Date) MarshalJSON() ([]byte, error) {
  1104. type NoMethod Date
  1105. raw := NoMethod(*s)
  1106. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1107. }
  1108. // DriveFile: Representation of a Google Drive file.
  1109. type DriveFile struct {
  1110. // AlternateLink: URL that can be used to access the Drive
  1111. // item.
  1112. //
  1113. // Read-only.
  1114. AlternateLink string `json:"alternateLink,omitempty"`
  1115. // Id: Drive API resource ID.
  1116. Id string `json:"id,omitempty"`
  1117. // ThumbnailUrl: URL of a thumbnail image of the Drive item.
  1118. //
  1119. // Read-only.
  1120. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  1121. // Title: Title of the Drive item.
  1122. //
  1123. // Read-only.
  1124. Title string `json:"title,omitempty"`
  1125. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1126. // unconditionally include in API requests. By default, fields with
  1127. // empty values are omitted from API requests. However, any non-pointer,
  1128. // non-interface field appearing in ForceSendFields will be sent to the
  1129. // server regardless of whether the field is empty or not. This may be
  1130. // used to include empty fields in Patch requests.
  1131. ForceSendFields []string `json:"-"`
  1132. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1133. // in API requests with the JSON null value. By default, fields with
  1134. // empty values are omitted from API requests. However, any field with
  1135. // an empty value appearing in NullFields will be sent to the server as
  1136. // null. It is an error if a field in this list has a non-empty value.
  1137. // This may be used to include null fields in Patch requests.
  1138. NullFields []string `json:"-"`
  1139. }
  1140. func (s *DriveFile) MarshalJSON() ([]byte, error) {
  1141. type NoMethod DriveFile
  1142. raw := NoMethod(*s)
  1143. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1144. }
  1145. // DriveFolder: Representation of a Google Drive folder.
  1146. type DriveFolder struct {
  1147. // AlternateLink: URL that can be used to access the Drive
  1148. // folder.
  1149. //
  1150. // Read-only.
  1151. AlternateLink string `json:"alternateLink,omitempty"`
  1152. // Id: Drive API resource ID.
  1153. Id string `json:"id,omitempty"`
  1154. // Title: Title of the Drive folder.
  1155. //
  1156. // Read-only.
  1157. Title string `json:"title,omitempty"`
  1158. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1159. // unconditionally include in API requests. By default, fields with
  1160. // empty values are omitted from API requests. However, any non-pointer,
  1161. // non-interface field appearing in ForceSendFields will be sent to the
  1162. // server regardless of whether the field is empty or not. This may be
  1163. // used to include empty fields in Patch requests.
  1164. ForceSendFields []string `json:"-"`
  1165. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1166. // in API requests with the JSON null value. By default, fields with
  1167. // empty values are omitted from API requests. However, any field with
  1168. // an empty value appearing in NullFields will be sent to the server as
  1169. // null. It is an error if a field in this list has a non-empty value.
  1170. // This may be used to include null fields in Patch requests.
  1171. NullFields []string `json:"-"`
  1172. }
  1173. func (s *DriveFolder) MarshalJSON() ([]byte, error) {
  1174. type NoMethod DriveFolder
  1175. raw := NoMethod(*s)
  1176. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1177. }
  1178. // Empty: A generic empty message that you can re-use to avoid defining
  1179. // duplicated
  1180. // empty messages in your APIs. A typical example is to use it as the
  1181. // request
  1182. // or the response type of an API method. For instance:
  1183. //
  1184. // service Foo {
  1185. // rpc Bar(google.protobuf.Empty) returns
  1186. // (google.protobuf.Empty);
  1187. // }
  1188. //
  1189. // The JSON representation for `Empty` is empty JSON object `{}`.
  1190. type Empty struct {
  1191. // ServerResponse contains the HTTP response code and headers from the
  1192. // server.
  1193. googleapi.ServerResponse `json:"-"`
  1194. }
  1195. // Feed: A class of notifications that an application can register to
  1196. // receive.
  1197. // For example: "all roster changes for a domain".
  1198. type Feed struct {
  1199. // CourseRosterChangesInfo: Information about a `Feed` with a
  1200. // `feed_type` of `COURSE_ROSTER_CHANGES`.
  1201. // This field must be specified if `feed_type` is
  1202. // `COURSE_ROSTER_CHANGES`.
  1203. CourseRosterChangesInfo *CourseRosterChangesInfo `json:"courseRosterChangesInfo,omitempty"`
  1204. // CourseWorkChangesInfo: Information about a `Feed` with a `feed_type`
  1205. // of `COURSE_WORK_CHANGES`.
  1206. // This field must be specified if `feed_type` is `COURSE_WORK_CHANGES`.
  1207. CourseWorkChangesInfo *CourseWorkChangesInfo `json:"courseWorkChangesInfo,omitempty"`
  1208. // FeedType: The type of feed.
  1209. //
  1210. // Possible values:
  1211. // "FEED_TYPE_UNSPECIFIED" - Should never be returned or provided.
  1212. // "DOMAIN_ROSTER_CHANGES" - All roster changes for a particular
  1213. // domain.
  1214. //
  1215. // Notifications will be generated whenever a user joins or leaves a
  1216. // course.
  1217. //
  1218. // No notifications will be generated when an invitation is created
  1219. // or
  1220. // deleted, but notifications will be generated when a user joins a
  1221. // course
  1222. // by accepting an invitation.
  1223. // "COURSE_ROSTER_CHANGES" - All roster changes for a particular
  1224. // course.
  1225. //
  1226. // Notifications will be generated whenever a user joins or leaves a
  1227. // course.
  1228. //
  1229. // No notifications will be generated when an invitation is created
  1230. // or
  1231. // deleted, but notifications will be generated when a user joins a
  1232. // course
  1233. // by accepting an invitation.
  1234. // "COURSE_WORK_CHANGES" - All course work activity for a particular
  1235. // course.
  1236. //
  1237. // Notifications will be generated when a CourseWork
  1238. // or
  1239. // StudentSubmission object is created or modified. No notification will
  1240. // be
  1241. // generated when a StudentSubmission object is created in connection
  1242. // with
  1243. // the creation or modification of its parent CourseWork object (but
  1244. // a
  1245. // notification will be generated for that CourseWork object's creation
  1246. // or
  1247. // modification).
  1248. FeedType string `json:"feedType,omitempty"`
  1249. // ForceSendFields is a list of field names (e.g.
  1250. // "CourseRosterChangesInfo") to unconditionally include in API
  1251. // requests. By default, fields with empty values are omitted from API
  1252. // requests. However, any non-pointer, non-interface field appearing in
  1253. // ForceSendFields will be sent to the server regardless of whether the
  1254. // field is empty or not. This may be used to include empty fields in
  1255. // Patch requests.
  1256. ForceSendFields []string `json:"-"`
  1257. // NullFields is a list of field names (e.g. "CourseRosterChangesInfo")
  1258. // to include in API requests with the JSON null value. By default,
  1259. // fields with empty values are omitted from API requests. However, any
  1260. // field with an empty value appearing in NullFields will be sent to the
  1261. // server as null. It is an error if a field in this list has a
  1262. // non-empty value. This may be used to include null fields in Patch
  1263. // requests.
  1264. NullFields []string `json:"-"`
  1265. }
  1266. func (s *Feed) MarshalJSON() ([]byte, error) {
  1267. type NoMethod Feed
  1268. raw := NoMethod(*s)
  1269. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1270. }
  1271. // Form: Google Forms item.
  1272. type Form struct {
  1273. // FormUrl: URL of the form.
  1274. FormUrl string `json:"formUrl,omitempty"`
  1275. // ResponseUrl: URL of the form responses document.
  1276. // Only set if respsonses have been recorded and only when
  1277. // the
  1278. // requesting user is an editor of the form.
  1279. //
  1280. // Read-only.
  1281. ResponseUrl string `json:"responseUrl,omitempty"`
  1282. // ThumbnailUrl: URL of a thumbnail image of the Form.
  1283. //
  1284. // Read-only.
  1285. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  1286. // Title: Title of the Form.
  1287. //
  1288. // Read-only.
  1289. Title string `json:"title,omitempty"`
  1290. // ForceSendFields is a list of field names (e.g. "FormUrl") to
  1291. // unconditionally include in API requests. By default, fields with
  1292. // empty values are omitted from API requests. However, any non-pointer,
  1293. // non-interface field appearing in ForceSendFields will be sent to the
  1294. // server regardless of whether the field is empty or not. This may be
  1295. // used to include empty fields in Patch requests.
  1296. ForceSendFields []string `json:"-"`
  1297. // NullFields is a list of field names (e.g. "FormUrl") to include in
  1298. // API requests with the JSON null value. By default, fields with empty
  1299. // values are omitted from API requests. However, any field with an
  1300. // empty value appearing in NullFields will be sent to the server as
  1301. // null. It is an error if a field in this list has a non-empty value.
  1302. // This may be used to include null fields in Patch requests.
  1303. NullFields []string `json:"-"`
  1304. }
  1305. func (s *Form) MarshalJSON() ([]byte, error) {
  1306. type NoMethod Form
  1307. raw := NoMethod(*s)
  1308. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1309. }
  1310. // GlobalPermission: Global user permission description.
  1311. type GlobalPermission struct {
  1312. // Permission: Permission value.
  1313. //
  1314. // Possible values:
  1315. // "PERMISSION_UNSPECIFIED" - No permission is specified. This is not
  1316. // returned and is not a
  1317. // valid value.
  1318. // "CREATE_COURSE" - User is permitted to create a course.
  1319. Permission string `json:"permission,omitempty"`
  1320. // ForceSendFields is a list of field names (e.g. "Permission") to
  1321. // unconditionally include in API requests. By default, fields with
  1322. // empty values are omitted from API requests. However, any non-pointer,
  1323. // non-interface field appearing in ForceSendFields will be sent to the
  1324. // server regardless of whether the field is empty or not. This may be
  1325. // used to include empty fields in Patch requests.
  1326. ForceSendFields []string `json:"-"`
  1327. // NullFields is a list of field names (e.g. "Permission") to include in
  1328. // API requests with the JSON null value. By default, fields with empty
  1329. // values are omitted from API requests. However, any field with an
  1330. // empty value appearing in NullFields will be sent to the server as
  1331. // null. It is an error if a field in this list has a non-empty value.
  1332. // This may be used to include null fields in Patch requests.
  1333. NullFields []string `json:"-"`
  1334. }
  1335. func (s *GlobalPermission) MarshalJSON() ([]byte, error) {
  1336. type NoMethod GlobalPermission
  1337. raw := NoMethod(*s)
  1338. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1339. }
  1340. // GradeHistory: The history of each grade on this submission.
  1341. type GradeHistory struct {
  1342. // ActorUserId: The teacher who made the grade change.
  1343. ActorUserId string `json:"actorUserId,omitempty"`
  1344. // GradeChangeType: The type of grade change at this time in the
  1345. // submission grade history.
  1346. //
  1347. // Possible values:
  1348. // "UNKNOWN_GRADE_CHANGE_TYPE" - No grade change type specified. This
  1349. // should never be returned.
  1350. // "DRAFT_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator of
  1351. // the draft grade.
  1352. // "ASSIGNED_GRADE_POINTS_EARNED_CHANGE" - A change in the numerator
  1353. // of the assigned grade.
  1354. // "MAX_POINTS_CHANGE" - A change in the denominator of the grade.
  1355. GradeChangeType string `json:"gradeChangeType,omitempty"`
  1356. // GradeTimestamp: When the grade of the submission was changed.
  1357. GradeTimestamp string `json:"gradeTimestamp,omitempty"`
  1358. // MaxPoints: The denominator of the grade at this time in the
  1359. // submission grade
  1360. // history.
  1361. MaxPoints float64 `json:"maxPoints,omitempty"`
  1362. // PointsEarned: The numerator of the grade at this time in the
  1363. // submission grade history.
  1364. PointsEarned float64 `json:"pointsEarned,omitempty"`
  1365. // ForceSendFields is a list of field names (e.g. "ActorUserId") to
  1366. // unconditionally include in API requests. By default, fields with
  1367. // empty values are omitted from API requests. However, any non-pointer,
  1368. // non-interface field appearing in ForceSendFields will be sent to the
  1369. // server regardless of whether the field is empty or not. This may be
  1370. // used to include empty fields in Patch requests.
  1371. ForceSendFields []string `json:"-"`
  1372. // NullFields is a list of field names (e.g. "ActorUserId") to include
  1373. // in API requests with the JSON null value. By default, fields with
  1374. // empty values are omitted from API requests. However, any field with
  1375. // an empty value appearing in NullFields will be sent to the server as
  1376. // null. It is an error if a field in this list has a non-empty value.
  1377. // This may be used to include null fields in Patch requests.
  1378. NullFields []string `json:"-"`
  1379. }
  1380. func (s *GradeHistory) MarshalJSON() ([]byte, error) {
  1381. type NoMethod GradeHistory
  1382. raw := NoMethod(*s)
  1383. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1384. }
  1385. func (s *GradeHistory) UnmarshalJSON(data []byte) error {
  1386. type NoMethod GradeHistory
  1387. var s1 struct {
  1388. MaxPoints gensupport.JSONFloat64 `json:"maxPoints"`
  1389. PointsEarned gensupport.JSONFloat64 `json:"pointsEarned"`
  1390. *NoMethod
  1391. }
  1392. s1.NoMethod = (*NoMethod)(s)
  1393. if err := json.Unmarshal(data, &s1); err != nil {
  1394. return err
  1395. }
  1396. s.MaxPoints = float64(s1.MaxPoints)
  1397. s.PointsEarned = float64(s1.PointsEarned)
  1398. return nil
  1399. }
  1400. // Guardian: Association between a student and a guardian of that
  1401. // student. The guardian
  1402. // may receive information about the student's course work.
  1403. type Guardian struct {
  1404. // GuardianId: Identifier for the guardian.
  1405. GuardianId string `json:"guardianId,omitempty"`
  1406. // GuardianProfile: User profile for the guardian.
  1407. GuardianProfile *UserProfile `json:"guardianProfile,omitempty"`
  1408. // InvitedEmailAddress: The email address to which the initial guardian
  1409. // invitation was sent.
  1410. // This field is only visible to domain administrators.
  1411. InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"`
  1412. // StudentId: Identifier for the student to whom the guardian
  1413. // relationship applies.
  1414. StudentId string `json:"studentId,omitempty"`
  1415. // ServerResponse contains the HTTP response code and headers from the
  1416. // server.
  1417. googleapi.ServerResponse `json:"-"`
  1418. // ForceSendFields is a list of field names (e.g. "GuardianId") to
  1419. // unconditionally include in API requests. By default, fields with
  1420. // empty values are omitted from API requests. However, any non-pointer,
  1421. // non-interface field appearing in ForceSendFields will be sent to the
  1422. // server regardless of whether the field is empty or not. This may be
  1423. // used to include empty fields in Patch requests.
  1424. ForceSendFields []string `json:"-"`
  1425. // NullFields is a list of field names (e.g. "GuardianId") to include in
  1426. // API requests with the JSON null value. By default, fields with empty
  1427. // values are omitted from API requests. However, any field with an
  1428. // empty value appearing in NullFields will be sent to the server as
  1429. // null. It is an error if a field in this list has a non-empty value.
  1430. // This may be used to include null fields in Patch requests.
  1431. NullFields []string `json:"-"`
  1432. }
  1433. func (s *Guardian) MarshalJSON() ([]byte, error) {
  1434. type NoMethod Guardian
  1435. raw := NoMethod(*s)
  1436. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1437. }
  1438. // GuardianInvitation: An invitation to become the guardian of a
  1439. // specified user, sent to a specified
  1440. // email address.
  1441. type GuardianInvitation struct {
  1442. // CreationTime: The time that this invitation was created.
  1443. //
  1444. // Read-only.
  1445. CreationTime string `json:"creationTime,omitempty"`
  1446. // InvitationId: Unique identifier for this invitation.
  1447. //
  1448. // Read-only.
  1449. InvitationId string `json:"invitationId,omitempty"`
  1450. // InvitedEmailAddress: Email address that the invitation was sent
  1451. // to.
  1452. // This field is only visible to domain administrators.
  1453. InvitedEmailAddress string `json:"invitedEmailAddress,omitempty"`
  1454. // State: The state that this invitation is in.
  1455. //
  1456. // Possible values:
  1457. // "GUARDIAN_INVITATION_STATE_UNSPECIFIED" - Should never be returned.
  1458. // "PENDING" - The invitation is active and awaiting a response.
  1459. // "COMPLETE" - The invitation is no longer active. It may have been
  1460. // accepted, declined,
  1461. // withdrawn or it may have expired.
  1462. State string `json:"state,omitempty"`
  1463. // StudentId: ID of the student (in standard format)
  1464. StudentId string `json:"studentId,omitempty"`
  1465. // ServerResponse contains the HTTP response code and headers from the
  1466. // server.
  1467. googleapi.ServerResponse `json:"-"`
  1468. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1469. // unconditionally include in API requests. By default, fields with
  1470. // empty values are omitted from API requests. However, any non-pointer,
  1471. // non-interface field appearing in ForceSendFields will be sent to the
  1472. // server regardless of whether the field is empty or not. This may be
  1473. // used to include empty fields in Patch requests.
  1474. ForceSendFields []string `json:"-"`
  1475. // NullFields is a list of field names (e.g. "CreationTime") to include
  1476. // in API requests with the JSON null value. By default, fields with
  1477. // empty values are omitted from API requests. However, any field with
  1478. // an empty value appearing in NullFields will be sent to the server as
  1479. // null. It is an error if a field in this list has a non-empty value.
  1480. // This may be used to include null fields in Patch requests.
  1481. NullFields []string `json:"-"`
  1482. }
  1483. func (s *GuardianInvitation) MarshalJSON() ([]byte, error) {
  1484. type NoMethod GuardianInvitation
  1485. raw := NoMethod(*s)
  1486. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1487. }
  1488. // IndividualStudentsOptions: Assignee details about a
  1489. // coursework/announcement.
  1490. // This field is set if and only if `assigneeMode` is
  1491. // `INDIVIDUAL_STUDENTS`.
  1492. type IndividualStudentsOptions struct {
  1493. // StudentIds: Identifiers for the students that have access to
  1494. // the
  1495. // coursework/announcement.
  1496. StudentIds []string `json:"studentIds,omitempty"`
  1497. // ForceSendFields is a list of field names (e.g. "StudentIds") to
  1498. // unconditionally include in API requests. By default, fields with
  1499. // empty values are omitted from API requests. However, any non-pointer,
  1500. // non-interface field appearing in ForceSendFields will be sent to the
  1501. // server regardless of whether the field is empty or not. This may be
  1502. // used to include empty fields in Patch requests.
  1503. ForceSendFields []string `json:"-"`
  1504. // NullFields is a list of field names (e.g. "StudentIds") to include in
  1505. // API requests with the JSON null value. By default, fields with empty
  1506. // values are omitted from API requests. However, any field with an
  1507. // empty value appearing in NullFields will be sent to the server as
  1508. // null. It is an error if a field in this list has a non-empty value.
  1509. // This may be used to include null fields in Patch requests.
  1510. NullFields []string `json:"-"`
  1511. }
  1512. func (s *IndividualStudentsOptions) MarshalJSON() ([]byte, error) {
  1513. type NoMethod IndividualStudentsOptions
  1514. raw := NoMethod(*s)
  1515. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1516. }
  1517. // Invitation: An invitation to join a course.
  1518. type Invitation struct {
  1519. // CourseId: Identifier of the course to invite the user to.
  1520. CourseId string `json:"courseId,omitempty"`
  1521. // Id: Identifier assigned by Classroom.
  1522. //
  1523. // Read-only.
  1524. Id string `json:"id,omitempty"`
  1525. // Role: Role to invite the user to have.
  1526. // Must not be `COURSE_ROLE_UNSPECIFIED`.
  1527. //
  1528. // Possible values:
  1529. // "COURSE_ROLE_UNSPECIFIED" - No course role.
  1530. // "STUDENT" - Student in the course.
  1531. // "TEACHER" - Teacher of the course.
  1532. // "OWNER" - Owner of the course.
  1533. Role string `json:"role,omitempty"`
  1534. // UserId: Identifier of the invited user.
  1535. //
  1536. // When specified as a parameter of a request, this identifier can be
  1537. // set to
  1538. // one of the following:
  1539. //
  1540. // * the numeric identifier for the user
  1541. // * the email address of the user
  1542. // * the string literal "me", indicating the requesting user
  1543. UserId string `json:"userId,omitempty"`
  1544. // ServerResponse contains the HTTP response code and headers from the
  1545. // server.
  1546. googleapi.ServerResponse `json:"-"`
  1547. // ForceSendFields is a list of field names (e.g. "CourseId") to
  1548. // unconditionally include in API requests. By default, fields with
  1549. // empty values are omitted from API requests. However, any non-pointer,
  1550. // non-interface field appearing in ForceSendFields will be sent to the
  1551. // server regardless of whether the field is empty or not. This may be
  1552. // used to include empty fields in Patch requests.
  1553. ForceSendFields []string `json:"-"`
  1554. // NullFields is a list of field names (e.g. "CourseId") to include in
  1555. // API requests with the JSON null value. By default, fields with empty
  1556. // values are omitted from API requests. However, any field with an
  1557. // empty value appearing in NullFields will be sent to the server as
  1558. // null. It is an error if a field in this list has a non-empty value.
  1559. // This may be used to include null fields in Patch requests.
  1560. NullFields []string `json:"-"`
  1561. }
  1562. func (s *Invitation) MarshalJSON() ([]byte, error) {
  1563. type NoMethod Invitation
  1564. raw := NoMethod(*s)
  1565. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1566. }
  1567. // Link: URL item.
  1568. type Link struct {
  1569. // ThumbnailUrl: URL of a thumbnail image of the target URL.
  1570. //
  1571. // Read-only.
  1572. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  1573. // Title: Title of the target of the URL.
  1574. //
  1575. // Read-only.
  1576. Title string `json:"title,omitempty"`
  1577. // Url: URL to link to.
  1578. // This must be a valid UTF-8 string containing between 1 and 2024
  1579. // characters.
  1580. Url string `json:"url,omitempty"`
  1581. // ForceSendFields is a list of field names (e.g. "ThumbnailUrl") to
  1582. // unconditionally include in API requests. By default, fields with
  1583. // empty values are omitted from API requests. However, any non-pointer,
  1584. // non-interface field appearing in ForceSendFields will be sent to the
  1585. // server regardless of whether the field is empty or not. This may be
  1586. // used to include empty fields in Patch requests.
  1587. ForceSendFields []string `json:"-"`
  1588. // NullFields is a list of field names (e.g. "ThumbnailUrl") to include
  1589. // in API requests with the JSON null value. By default, fields with
  1590. // empty values are omitted from API requests. However, any field with
  1591. // an empty value appearing in NullFields will be sent to the server as
  1592. // null. It is an error if a field in this list has a non-empty value.
  1593. // This may be used to include null fields in Patch requests.
  1594. NullFields []string `json:"-"`
  1595. }
  1596. func (s *Link) MarshalJSON() ([]byte, error) {
  1597. type NoMethod Link
  1598. raw := NoMethod(*s)
  1599. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1600. }
  1601. // ListAnnouncementsResponse: Response when listing course work.
  1602. type ListAnnouncementsResponse struct {
  1603. // Announcements: Announcement items that match the request.
  1604. Announcements []*Announcement `json:"announcements,omitempty"`
  1605. // NextPageToken: Token identifying the next page of results to return.
  1606. // If empty, no further
  1607. // results are available.
  1608. NextPageToken string `json:"nextPageToken,omitempty"`
  1609. // ServerResponse contains the HTTP response code and headers from the
  1610. // server.
  1611. googleapi.ServerResponse `json:"-"`
  1612. // ForceSendFields is a list of field names (e.g. "Announcements") to
  1613. // unconditionally include in API requests. By default, fields with
  1614. // empty values are omitted from API requests. However, any non-pointer,
  1615. // non-interface field appearing in ForceSendFields will be sent to the
  1616. // server regardless of whether the field is empty or not. This may be
  1617. // used to include empty fields in Patch requests.
  1618. ForceSendFields []string `json:"-"`
  1619. // NullFields is a list of field names (e.g. "Announcements") to include
  1620. // in API requests with the JSON null value. By default, fields with
  1621. // empty values are omitted from API requests. However, any field with
  1622. // an empty value appearing in NullFields will be sent to the server as
  1623. // null. It is an error if a field in this list has a non-empty value.
  1624. // This may be used to include null fields in Patch requests.
  1625. NullFields []string `json:"-"`
  1626. }
  1627. func (s *ListAnnouncementsResponse) MarshalJSON() ([]byte, error) {
  1628. type NoMethod ListAnnouncementsResponse
  1629. raw := NoMethod(*s)
  1630. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1631. }
  1632. // ListCourseAliasesResponse: Response when listing course aliases.
  1633. type ListCourseAliasesResponse struct {
  1634. // Aliases: The course aliases.
  1635. Aliases []*CourseAlias `json:"aliases,omitempty"`
  1636. // NextPageToken: Token identifying the next page of results to return.
  1637. // If empty, no further
  1638. // results are available.
  1639. NextPageToken string `json:"nextPageToken,omitempty"`
  1640. // ServerResponse contains the HTTP response code and headers from the
  1641. // server.
  1642. googleapi.ServerResponse `json:"-"`
  1643. // ForceSendFields is a list of field names (e.g. "Aliases") to
  1644. // unconditionally include in API requests. By default, fields with
  1645. // empty values are omitted from API requests. However, any non-pointer,
  1646. // non-interface field appearing in ForceSendFields will be sent to the
  1647. // server regardless of whether the field is empty or not. This may be
  1648. // used to include empty fields in Patch requests.
  1649. ForceSendFields []string `json:"-"`
  1650. // NullFields is a list of field names (e.g. "Aliases") to include in
  1651. // API requests with the JSON null value. By default, fields with empty
  1652. // values are omitted from API requests. However, any field with an
  1653. // empty value appearing in NullFields will be sent to the server as
  1654. // null. It is an error if a field in this list has a non-empty value.
  1655. // This may be used to include null fields in Patch requests.
  1656. NullFields []string `json:"-"`
  1657. }
  1658. func (s *ListCourseAliasesResponse) MarshalJSON() ([]byte, error) {
  1659. type NoMethod ListCourseAliasesResponse
  1660. raw := NoMethod(*s)
  1661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1662. }
  1663. // ListCourseWorkResponse: Response when listing course work.
  1664. type ListCourseWorkResponse struct {
  1665. // CourseWork: Course work items that match the request.
  1666. CourseWork []*CourseWork `json:"courseWork,omitempty"`
  1667. // NextPageToken: Token identifying the next page of results to return.
  1668. // If empty, no further
  1669. // results are available.
  1670. NextPageToken string `json:"nextPageToken,omitempty"`
  1671. // ServerResponse contains the HTTP response code and headers from the
  1672. // server.
  1673. googleapi.ServerResponse `json:"-"`
  1674. // ForceSendFields is a list of field names (e.g. "CourseWork") to
  1675. // unconditionally include in API requests. By default, fields with
  1676. // empty values are omitted from API requests. However, any non-pointer,
  1677. // non-interface field appearing in ForceSendFields will be sent to the
  1678. // server regardless of whether the field is empty or not. This may be
  1679. // used to include empty fields in Patch requests.
  1680. ForceSendFields []string `json:"-"`
  1681. // NullFields is a list of field names (e.g. "CourseWork") to include in
  1682. // API requests with the JSON null value. By default, fields with empty
  1683. // values are omitted from API requests. However, any field with an
  1684. // empty value appearing in NullFields will be sent to the server as
  1685. // null. It is an error if a field in this list has a non-empty value.
  1686. // This may be used to include null fields in Patch requests.
  1687. NullFields []string `json:"-"`
  1688. }
  1689. func (s *ListCourseWorkResponse) MarshalJSON() ([]byte, error) {
  1690. type NoMethod ListCourseWorkResponse
  1691. raw := NoMethod(*s)
  1692. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1693. }
  1694. // ListCoursesResponse: Response when listing courses.
  1695. type ListCoursesResponse struct {
  1696. // Courses: Courses that match the list request.
  1697. Courses []*Course `json:"courses,omitempty"`
  1698. // NextPageToken: Token identifying the next page of results to return.
  1699. // If empty, no further
  1700. // results are available.
  1701. NextPageToken string `json:"nextPageToken,omitempty"`
  1702. // ServerResponse contains the HTTP response code and headers from the
  1703. // server.
  1704. googleapi.ServerResponse `json:"-"`
  1705. // ForceSendFields is a list of field names (e.g. "Courses") to
  1706. // unconditionally include in API requests. By default, fields with
  1707. // empty values are omitted from API requests. However, any non-pointer,
  1708. // non-interface field appearing in ForceSendFields will be sent to the
  1709. // server regardless of whether the field is empty or not. This may be
  1710. // used to include empty fields in Patch requests.
  1711. ForceSendFields []string `json:"-"`
  1712. // NullFields is a list of field names (e.g. "Courses") to include in
  1713. // API requests with the JSON null value. By default, fields with empty
  1714. // values are omitted from API requests. However, any field with an
  1715. // empty value appearing in NullFields will be sent to the server as
  1716. // null. It is an error if a field in this list has a non-empty value.
  1717. // This may be used to include null fields in Patch requests.
  1718. NullFields []string `json:"-"`
  1719. }
  1720. func (s *ListCoursesResponse) MarshalJSON() ([]byte, error) {
  1721. type NoMethod ListCoursesResponse
  1722. raw := NoMethod(*s)
  1723. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1724. }
  1725. // ListGuardianInvitationsResponse: Response when listing guardian
  1726. // invitations.
  1727. type ListGuardianInvitationsResponse struct {
  1728. // GuardianInvitations: Guardian invitations that matched the list
  1729. // request.
  1730. GuardianInvitations []*GuardianInvitation `json:"guardianInvitations,omitempty"`
  1731. // NextPageToken: Token identifying the next page of results to return.
  1732. // If empty, no further
  1733. // results are available.
  1734. NextPageToken string `json:"nextPageToken,omitempty"`
  1735. // ServerResponse contains the HTTP response code and headers from the
  1736. // server.
  1737. googleapi.ServerResponse `json:"-"`
  1738. // ForceSendFields is a list of field names (e.g. "GuardianInvitations")
  1739. // to unconditionally include in API requests. By default, fields with
  1740. // empty values are omitted from API requests. However, any non-pointer,
  1741. // non-interface field appearing in ForceSendFields will be sent to the
  1742. // server regardless of whether the field is empty or not. This may be
  1743. // used to include empty fields in Patch requests.
  1744. ForceSendFields []string `json:"-"`
  1745. // NullFields is a list of field names (e.g. "GuardianInvitations") to
  1746. // include in API requests with the JSON null value. By default, fields
  1747. // with empty values are omitted from API requests. However, any field
  1748. // with an empty value appearing in NullFields will be sent to the
  1749. // server as null. It is an error if a field in this list has a
  1750. // non-empty value. This may be used to include null fields in Patch
  1751. // requests.
  1752. NullFields []string `json:"-"`
  1753. }
  1754. func (s *ListGuardianInvitationsResponse) MarshalJSON() ([]byte, error) {
  1755. type NoMethod ListGuardianInvitationsResponse
  1756. raw := NoMethod(*s)
  1757. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1758. }
  1759. // ListGuardiansResponse: Response when listing guardians.
  1760. type ListGuardiansResponse struct {
  1761. // Guardians: Guardians on this page of results that met the criteria
  1762. // specified in
  1763. // the request.
  1764. Guardians []*Guardian `json:"guardians,omitempty"`
  1765. // NextPageToken: Token identifying the next page of results to return.
  1766. // If empty, no further
  1767. // results are available.
  1768. NextPageToken string `json:"nextPageToken,omitempty"`
  1769. // ServerResponse contains the HTTP response code and headers from the
  1770. // server.
  1771. googleapi.ServerResponse `json:"-"`
  1772. // ForceSendFields is a list of field names (e.g. "Guardians") to
  1773. // unconditionally include in API requests. By default, fields with
  1774. // empty values are omitted from API requests. However, any non-pointer,
  1775. // non-interface field appearing in ForceSendFields will be sent to the
  1776. // server regardless of whether the field is empty or not. This may be
  1777. // used to include empty fields in Patch requests.
  1778. ForceSendFields []string `json:"-"`
  1779. // NullFields is a list of field names (e.g. "Guardians") to include in
  1780. // API requests with the JSON null value. By default, fields with empty
  1781. // values are omitted from API requests. However, any field with an
  1782. // empty value appearing in NullFields will be sent to the server as
  1783. // null. It is an error if a field in this list has a non-empty value.
  1784. // This may be used to include null fields in Patch requests.
  1785. NullFields []string `json:"-"`
  1786. }
  1787. func (s *ListGuardiansResponse) MarshalJSON() ([]byte, error) {
  1788. type NoMethod ListGuardiansResponse
  1789. raw := NoMethod(*s)
  1790. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1791. }
  1792. // ListInvitationsResponse: Response when listing invitations.
  1793. type ListInvitationsResponse struct {
  1794. // Invitations: Invitations that match the list request.
  1795. Invitations []*Invitation `json:"invitations,omitempty"`
  1796. // NextPageToken: Token identifying the next page of results to return.
  1797. // If empty, no further
  1798. // results are available.
  1799. NextPageToken string `json:"nextPageToken,omitempty"`
  1800. // ServerResponse contains the HTTP response code and headers from the
  1801. // server.
  1802. googleapi.ServerResponse `json:"-"`
  1803. // ForceSendFields is a list of field names (e.g. "Invitations") to
  1804. // unconditionally include in API requests. By default, fields with
  1805. // empty values are omitted from API requests. However, any non-pointer,
  1806. // non-interface field appearing in ForceSendFields will be sent to the
  1807. // server regardless of whether the field is empty or not. This may be
  1808. // used to include empty fields in Patch requests.
  1809. ForceSendFields []string `json:"-"`
  1810. // NullFields is a list of field names (e.g. "Invitations") to include
  1811. // in API requests with the JSON null value. By default, fields with
  1812. // empty values are omitted from API requests. However, any field with
  1813. // an empty value appearing in NullFields will be sent to the server as
  1814. // null. It is an error if a field in this list has a non-empty value.
  1815. // This may be used to include null fields in Patch requests.
  1816. NullFields []string `json:"-"`
  1817. }
  1818. func (s *ListInvitationsResponse) MarshalJSON() ([]byte, error) {
  1819. type NoMethod ListInvitationsResponse
  1820. raw := NoMethod(*s)
  1821. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1822. }
  1823. // ListStudentSubmissionsResponse: Response when listing student
  1824. // submissions.
  1825. type ListStudentSubmissionsResponse struct {
  1826. // NextPageToken: Token identifying the next page of results to return.
  1827. // If empty, no further
  1828. // results are available.
  1829. NextPageToken string `json:"nextPageToken,omitempty"`
  1830. // StudentSubmissions: Student work that matches the request.
  1831. StudentSubmissions []*StudentSubmission `json:"studentSubmissions,omitempty"`
  1832. // ServerResponse contains the HTTP response code and headers from the
  1833. // server.
  1834. googleapi.ServerResponse `json:"-"`
  1835. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1836. // unconditionally include in API requests. By default, fields with
  1837. // empty values are omitted from API requests. However, any non-pointer,
  1838. // non-interface field appearing in ForceSendFields will be sent to the
  1839. // server regardless of whether the field is empty or not. This may be
  1840. // used to include empty fields in Patch requests.
  1841. ForceSendFields []string `json:"-"`
  1842. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1843. // in API requests with the JSON null value. By default, fields with
  1844. // empty values are omitted from API requests. However, any field with
  1845. // an empty value appearing in NullFields will be sent to the server as
  1846. // null. It is an error if a field in this list has a non-empty value.
  1847. // This may be used to include null fields in Patch requests.
  1848. NullFields []string `json:"-"`
  1849. }
  1850. func (s *ListStudentSubmissionsResponse) MarshalJSON() ([]byte, error) {
  1851. type NoMethod ListStudentSubmissionsResponse
  1852. raw := NoMethod(*s)
  1853. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1854. }
  1855. // ListStudentsResponse: Response when listing students.
  1856. type ListStudentsResponse struct {
  1857. // NextPageToken: Token identifying the next page of results to return.
  1858. // If empty, no further
  1859. // results are available.
  1860. NextPageToken string `json:"nextPageToken,omitempty"`
  1861. // Students: Students who match the list request.
  1862. Students []*Student `json:"students,omitempty"`
  1863. // ServerResponse contains the HTTP response code and headers from the
  1864. // server.
  1865. googleapi.ServerResponse `json:"-"`
  1866. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1867. // unconditionally include in API requests. By default, fields with
  1868. // empty values are omitted from API requests. However, any non-pointer,
  1869. // non-interface field appearing in ForceSendFields will be sent to the
  1870. // server regardless of whether the field is empty or not. This may be
  1871. // used to include empty fields in Patch requests.
  1872. ForceSendFields []string `json:"-"`
  1873. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1874. // in API requests with the JSON null value. By default, fields with
  1875. // empty values are omitted from API requests. However, any field with
  1876. // an empty value appearing in NullFields will be sent to the server as
  1877. // null. It is an error if a field in this list has a non-empty value.
  1878. // This may be used to include null fields in Patch requests.
  1879. NullFields []string `json:"-"`
  1880. }
  1881. func (s *ListStudentsResponse) MarshalJSON() ([]byte, error) {
  1882. type NoMethod ListStudentsResponse
  1883. raw := NoMethod(*s)
  1884. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1885. }
  1886. // ListTeachersResponse: Response when listing teachers.
  1887. type ListTeachersResponse struct {
  1888. // NextPageToken: Token identifying the next page of results to return.
  1889. // If empty, no further
  1890. // results are available.
  1891. NextPageToken string `json:"nextPageToken,omitempty"`
  1892. // Teachers: Teachers who match the list request.
  1893. Teachers []*Teacher `json:"teachers,omitempty"`
  1894. // ServerResponse contains the HTTP response code and headers from the
  1895. // server.
  1896. googleapi.ServerResponse `json:"-"`
  1897. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1898. // unconditionally include in API requests. By default, fields with
  1899. // empty values are omitted from API requests. However, any non-pointer,
  1900. // non-interface field appearing in ForceSendFields will be sent to the
  1901. // server regardless of whether the field is empty or not. This may be
  1902. // used to include empty fields in Patch requests.
  1903. ForceSendFields []string `json:"-"`
  1904. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1905. // in API requests with the JSON null value. By default, fields with
  1906. // empty values are omitted from API requests. However, any field with
  1907. // an empty value appearing in NullFields will be sent to the server as
  1908. // null. It is an error if a field in this list has a non-empty value.
  1909. // This may be used to include null fields in Patch requests.
  1910. NullFields []string `json:"-"`
  1911. }
  1912. func (s *ListTeachersResponse) MarshalJSON() ([]byte, error) {
  1913. type NoMethod ListTeachersResponse
  1914. raw := NoMethod(*s)
  1915. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1916. }
  1917. // Material: Material attached to course work.
  1918. //
  1919. // When creating attachments, setting the `form` field is not supported.
  1920. type Material struct {
  1921. // DriveFile: Google Drive file material.
  1922. DriveFile *SharedDriveFile `json:"driveFile,omitempty"`
  1923. // Form: Google Forms material.
  1924. Form *Form `json:"form,omitempty"`
  1925. // Link: Link material. On creation, will be upgraded to a more
  1926. // appropriate type
  1927. // if possible, and this will be reflected in the response.
  1928. Link *Link `json:"link,omitempty"`
  1929. // YoutubeVideo: YouTube video material.
  1930. YoutubeVideo *YouTubeVideo `json:"youtubeVideo,omitempty"`
  1931. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  1932. // unconditionally include in API requests. By default, fields with
  1933. // empty values are omitted from API requests. However, any non-pointer,
  1934. // non-interface field appearing in ForceSendFields will be sent to the
  1935. // server regardless of whether the field is empty or not. This may be
  1936. // used to include empty fields in Patch requests.
  1937. ForceSendFields []string `json:"-"`
  1938. // NullFields is a list of field names (e.g. "DriveFile") to include in
  1939. // API requests with the JSON null value. By default, fields with empty
  1940. // values are omitted from API requests. However, any field with an
  1941. // empty value appearing in NullFields will be sent to the server as
  1942. // null. It is an error if a field in this list has a non-empty value.
  1943. // This may be used to include null fields in Patch requests.
  1944. NullFields []string `json:"-"`
  1945. }
  1946. func (s *Material) MarshalJSON() ([]byte, error) {
  1947. type NoMethod Material
  1948. raw := NoMethod(*s)
  1949. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1950. }
  1951. // ModifyAnnouncementAssigneesRequest: Request to modify assignee mode
  1952. // and options of an announcement.
  1953. type ModifyAnnouncementAssigneesRequest struct {
  1954. // AssigneeMode: Mode of the announcement describing whether it will be
  1955. // accessible by all
  1956. // students or specified individual students.
  1957. //
  1958. // Possible values:
  1959. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  1960. // returned.
  1961. // "ALL_STUDENTS" - All students can see the item.
  1962. // This is the default state.
  1963. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  1964. AssigneeMode string `json:"assigneeMode,omitempty"`
  1965. // ModifyIndividualStudentsOptions: Set which students can view or
  1966. // cannot view the announcement.
  1967. // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  1968. ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"`
  1969. // ForceSendFields is a list of field names (e.g. "AssigneeMode") to
  1970. // unconditionally include in API requests. By default, fields with
  1971. // empty values are omitted from API requests. However, any non-pointer,
  1972. // non-interface field appearing in ForceSendFields will be sent to the
  1973. // server regardless of whether the field is empty or not. This may be
  1974. // used to include empty fields in Patch requests.
  1975. ForceSendFields []string `json:"-"`
  1976. // NullFields is a list of field names (e.g. "AssigneeMode") to include
  1977. // in API requests with the JSON null value. By default, fields with
  1978. // empty values are omitted from API requests. However, any field with
  1979. // an empty value appearing in NullFields will be sent to the server as
  1980. // null. It is an error if a field in this list has a non-empty value.
  1981. // This may be used to include null fields in Patch requests.
  1982. NullFields []string `json:"-"`
  1983. }
  1984. func (s *ModifyAnnouncementAssigneesRequest) MarshalJSON() ([]byte, error) {
  1985. type NoMethod ModifyAnnouncementAssigneesRequest
  1986. raw := NoMethod(*s)
  1987. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1988. }
  1989. // ModifyAttachmentsRequest: Request to modify the attachments of a
  1990. // student submission.
  1991. type ModifyAttachmentsRequest struct {
  1992. // AddAttachments: Attachments to add.
  1993. // A student submission may not have more than 20 attachments.
  1994. //
  1995. // Form attachments are not supported.
  1996. AddAttachments []*Attachment `json:"addAttachments,omitempty"`
  1997. // ForceSendFields is a list of field names (e.g. "AddAttachments") to
  1998. // unconditionally include in API requests. By default, fields with
  1999. // empty values are omitted from API requests. However, any non-pointer,
  2000. // non-interface field appearing in ForceSendFields will be sent to the
  2001. // server regardless of whether the field is empty or not. This may be
  2002. // used to include empty fields in Patch requests.
  2003. ForceSendFields []string `json:"-"`
  2004. // NullFields is a list of field names (e.g. "AddAttachments") to
  2005. // include in API requests with the JSON null value. By default, fields
  2006. // with empty values are omitted from API requests. However, any field
  2007. // with an empty value appearing in NullFields will be sent to the
  2008. // server as null. It is an error if a field in this list has a
  2009. // non-empty value. This may be used to include null fields in Patch
  2010. // requests.
  2011. NullFields []string `json:"-"`
  2012. }
  2013. func (s *ModifyAttachmentsRequest) MarshalJSON() ([]byte, error) {
  2014. type NoMethod ModifyAttachmentsRequest
  2015. raw := NoMethod(*s)
  2016. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2017. }
  2018. // ModifyCourseWorkAssigneesRequest: Request to modify assignee mode and
  2019. // options of a coursework.
  2020. type ModifyCourseWorkAssigneesRequest struct {
  2021. // AssigneeMode: Mode of the coursework describing whether it will be
  2022. // assigned to all
  2023. // students or specified individual students.
  2024. //
  2025. // Possible values:
  2026. // "ASSIGNEE_MODE_UNSPECIFIED" - No mode specified. This is never
  2027. // returned.
  2028. // "ALL_STUDENTS" - All students can see the item.
  2029. // This is the default state.
  2030. // "INDIVIDUAL_STUDENTS" - A subset of the students can see the item.
  2031. AssigneeMode string `json:"assigneeMode,omitempty"`
  2032. // ModifyIndividualStudentsOptions: Set which students are assigned or
  2033. // not assigned to the coursework.
  2034. // Must be specified only when `assigneeMode` is `INDIVIDUAL_STUDENTS`.
  2035. ModifyIndividualStudentsOptions *ModifyIndividualStudentsOptions `json:"modifyIndividualStudentsOptions,omitempty"`
  2036. // ForceSendFields is a list of field names (e.g. "AssigneeMode") to
  2037. // unconditionally include in API requests. By default, fields with
  2038. // empty values are omitted from API requests. However, any non-pointer,
  2039. // non-interface field appearing in ForceSendFields will be sent to the
  2040. // server regardless of whether the field is empty or not. This may be
  2041. // used to include empty fields in Patch requests.
  2042. ForceSendFields []string `json:"-"`
  2043. // NullFields is a list of field names (e.g. "AssigneeMode") to include
  2044. // in API requests with the JSON null value. By default, fields with
  2045. // empty values are omitted from API requests. However, any field with
  2046. // an empty value appearing in NullFields will be sent to the server as
  2047. // null. It is an error if a field in this list has a non-empty value.
  2048. // This may be used to include null fields in Patch requests.
  2049. NullFields []string `json:"-"`
  2050. }
  2051. func (s *ModifyCourseWorkAssigneesRequest) MarshalJSON() ([]byte, error) {
  2052. type NoMethod ModifyCourseWorkAssigneesRequest
  2053. raw := NoMethod(*s)
  2054. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2055. }
  2056. // ModifyIndividualStudentsOptions: Contains fields to add or remove
  2057. // students from a course work or announcement
  2058. // where the `assigneeMode` is set to `INDIVIDUAL_STUDENTS`.
  2059. type ModifyIndividualStudentsOptions struct {
  2060. // AddStudentIds: Ids of students to be added as having access to
  2061. // this
  2062. // coursework/announcement.
  2063. AddStudentIds []string `json:"addStudentIds,omitempty"`
  2064. // RemoveStudentIds: Ids of students to be removed from having access to
  2065. // this
  2066. // coursework/announcement.
  2067. RemoveStudentIds []string `json:"removeStudentIds,omitempty"`
  2068. // ForceSendFields is a list of field names (e.g. "AddStudentIds") to
  2069. // unconditionally include in API requests. By default, fields with
  2070. // empty values are omitted from API requests. However, any non-pointer,
  2071. // non-interface field appearing in ForceSendFields will be sent to the
  2072. // server regardless of whether the field is empty or not. This may be
  2073. // used to include empty fields in Patch requests.
  2074. ForceSendFields []string `json:"-"`
  2075. // NullFields is a list of field names (e.g. "AddStudentIds") to include
  2076. // in API requests with the JSON null value. By default, fields with
  2077. // empty values are omitted from API requests. However, any field with
  2078. // an empty value appearing in NullFields will be sent to the server as
  2079. // null. It is an error if a field in this list has a non-empty value.
  2080. // This may be used to include null fields in Patch requests.
  2081. NullFields []string `json:"-"`
  2082. }
  2083. func (s *ModifyIndividualStudentsOptions) MarshalJSON() ([]byte, error) {
  2084. type NoMethod ModifyIndividualStudentsOptions
  2085. raw := NoMethod(*s)
  2086. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2087. }
  2088. // MultipleChoiceQuestion: Additional details for multiple-choice
  2089. // questions.
  2090. type MultipleChoiceQuestion struct {
  2091. // Choices: Possible choices.
  2092. Choices []string `json:"choices,omitempty"`
  2093. // ForceSendFields is a list of field names (e.g. "Choices") to
  2094. // unconditionally include in API requests. By default, fields with
  2095. // empty values are omitted from API requests. However, any non-pointer,
  2096. // non-interface field appearing in ForceSendFields will be sent to the
  2097. // server regardless of whether the field is empty or not. This may be
  2098. // used to include empty fields in Patch requests.
  2099. ForceSendFields []string `json:"-"`
  2100. // NullFields is a list of field names (e.g. "Choices") to include in
  2101. // API requests with the JSON null value. By default, fields with empty
  2102. // values are omitted from API requests. However, any field with an
  2103. // empty value appearing in NullFields will be sent to the server as
  2104. // null. It is an error if a field in this list has a non-empty value.
  2105. // This may be used to include null fields in Patch requests.
  2106. NullFields []string `json:"-"`
  2107. }
  2108. func (s *MultipleChoiceQuestion) MarshalJSON() ([]byte, error) {
  2109. type NoMethod MultipleChoiceQuestion
  2110. raw := NoMethod(*s)
  2111. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2112. }
  2113. // MultipleChoiceSubmission: Student work for a multiple-choice
  2114. // question.
  2115. type MultipleChoiceSubmission struct {
  2116. // Answer: Student's select choice.
  2117. Answer string `json:"answer,omitempty"`
  2118. // ForceSendFields is a list of field names (e.g. "Answer") to
  2119. // unconditionally include in API requests. By default, fields with
  2120. // empty values are omitted from API requests. However, any non-pointer,
  2121. // non-interface field appearing in ForceSendFields will be sent to the
  2122. // server regardless of whether the field is empty or not. This may be
  2123. // used to include empty fields in Patch requests.
  2124. ForceSendFields []string `json:"-"`
  2125. // NullFields is a list of field names (e.g. "Answer") to include in API
  2126. // requests with the JSON null value. By default, fields with empty
  2127. // values are omitted from API requests. However, any field with an
  2128. // empty value appearing in NullFields will be sent to the server as
  2129. // null. It is an error if a field in this list has a non-empty value.
  2130. // This may be used to include null fields in Patch requests.
  2131. NullFields []string `json:"-"`
  2132. }
  2133. func (s *MultipleChoiceSubmission) MarshalJSON() ([]byte, error) {
  2134. type NoMethod MultipleChoiceSubmission
  2135. raw := NoMethod(*s)
  2136. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2137. }
  2138. // Name: Details of the user's name.
  2139. type Name struct {
  2140. // FamilyName: The user's last name.
  2141. //
  2142. // Read-only.
  2143. FamilyName string `json:"familyName,omitempty"`
  2144. // FullName: The user's full name formed by concatenating the first and
  2145. // last name
  2146. // values.
  2147. //
  2148. // Read-only.
  2149. FullName string `json:"fullName,omitempty"`
  2150. // GivenName: The user's first name.
  2151. //
  2152. // Read-only.
  2153. GivenName string `json:"givenName,omitempty"`
  2154. // ForceSendFields is a list of field names (e.g. "FamilyName") to
  2155. // unconditionally include in API requests. By default, fields with
  2156. // empty values are omitted from API requests. However, any non-pointer,
  2157. // non-interface field appearing in ForceSendFields will be sent to the
  2158. // server regardless of whether the field is empty or not. This may be
  2159. // used to include empty fields in Patch requests.
  2160. ForceSendFields []string `json:"-"`
  2161. // NullFields is a list of field names (e.g. "FamilyName") to include in
  2162. // API requests with the JSON null value. By default, fields with empty
  2163. // values are omitted from API requests. However, any field with an
  2164. // empty value appearing in NullFields will be sent to the server as
  2165. // null. It is an error if a field in this list has a non-empty value.
  2166. // This may be used to include null fields in Patch requests.
  2167. NullFields []string `json:"-"`
  2168. }
  2169. func (s *Name) MarshalJSON() ([]byte, error) {
  2170. type NoMethod Name
  2171. raw := NoMethod(*s)
  2172. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2173. }
  2174. // ReclaimStudentSubmissionRequest: Request to reclaim a student
  2175. // submission.
  2176. type ReclaimStudentSubmissionRequest struct {
  2177. }
  2178. // Registration: An instruction to Classroom to send notifications from
  2179. // the `feed` to the
  2180. // provided destination.
  2181. type Registration struct {
  2182. // CloudPubsubTopic: The Cloud Pub/Sub topic that notifications are to
  2183. // be sent to.
  2184. CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"`
  2185. // ExpiryTime: The time until which the `Registration` is
  2186. // effective.
  2187. //
  2188. // This is a read-only field assigned by the server.
  2189. ExpiryTime string `json:"expiryTime,omitempty"`
  2190. // Feed: Specification for the class of notifications that Classroom
  2191. // should deliver
  2192. // to the destination.
  2193. Feed *Feed `json:"feed,omitempty"`
  2194. // RegistrationId: A server-generated unique identifier for this
  2195. // `Registration`.
  2196. //
  2197. // Read-only.
  2198. RegistrationId string `json:"registrationId,omitempty"`
  2199. // ServerResponse contains the HTTP response code and headers from the
  2200. // server.
  2201. googleapi.ServerResponse `json:"-"`
  2202. // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to
  2203. // unconditionally include in API requests. By default, fields with
  2204. // empty values are omitted from API requests. However, any non-pointer,
  2205. // non-interface field appearing in ForceSendFields will be sent to the
  2206. // server regardless of whether the field is empty or not. This may be
  2207. // used to include empty fields in Patch requests.
  2208. ForceSendFields []string `json:"-"`
  2209. // NullFields is a list of field names (e.g. "CloudPubsubTopic") to
  2210. // include in API requests with the JSON null value. By default, fields
  2211. // with empty values are omitted from API requests. However, any field
  2212. // with an empty value appearing in NullFields will be sent to the
  2213. // server as null. It is an error if a field in this list has a
  2214. // non-empty value. This may be used to include null fields in Patch
  2215. // requests.
  2216. NullFields []string `json:"-"`
  2217. }
  2218. func (s *Registration) MarshalJSON() ([]byte, error) {
  2219. type NoMethod Registration
  2220. raw := NoMethod(*s)
  2221. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2222. }
  2223. // ReturnStudentSubmissionRequest: Request to return a student
  2224. // submission.
  2225. type ReturnStudentSubmissionRequest struct {
  2226. }
  2227. // SharedDriveFile: Drive file that is used as material for course work.
  2228. type SharedDriveFile struct {
  2229. // DriveFile: Drive file details.
  2230. DriveFile *DriveFile `json:"driveFile,omitempty"`
  2231. // ShareMode: Mechanism by which students access the Drive item.
  2232. //
  2233. // Possible values:
  2234. // "UNKNOWN_SHARE_MODE" - No sharing mode specified. This should never
  2235. // be returned.
  2236. // "VIEW" - Students can view the shared file.
  2237. // "EDIT" - Students can edit the shared file.
  2238. // "STUDENT_COPY" - Students have a personal copy of the shared file.
  2239. ShareMode string `json:"shareMode,omitempty"`
  2240. // ForceSendFields is a list of field names (e.g. "DriveFile") to
  2241. // unconditionally include in API requests. By default, fields with
  2242. // empty values are omitted from API requests. However, any non-pointer,
  2243. // non-interface field appearing in ForceSendFields will be sent to the
  2244. // server regardless of whether the field is empty or not. This may be
  2245. // used to include empty fields in Patch requests.
  2246. ForceSendFields []string `json:"-"`
  2247. // NullFields is a list of field names (e.g. "DriveFile") to include in
  2248. // API requests with the JSON null value. By default, fields with empty
  2249. // values are omitted from API requests. However, any field with an
  2250. // empty value appearing in NullFields will be sent to the server as
  2251. // null. It is an error if a field in this list has a non-empty value.
  2252. // This may be used to include null fields in Patch requests.
  2253. NullFields []string `json:"-"`
  2254. }
  2255. func (s *SharedDriveFile) MarshalJSON() ([]byte, error) {
  2256. type NoMethod SharedDriveFile
  2257. raw := NoMethod(*s)
  2258. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2259. }
  2260. // ShortAnswerSubmission: Student work for a short answer question.
  2261. type ShortAnswerSubmission struct {
  2262. // Answer: Student response to a short-answer question.
  2263. Answer string `json:"answer,omitempty"`
  2264. // ForceSendFields is a list of field names (e.g. "Answer") to
  2265. // unconditionally include in API requests. By default, fields with
  2266. // empty values are omitted from API requests. However, any non-pointer,
  2267. // non-interface field appearing in ForceSendFields will be sent to the
  2268. // server regardless of whether the field is empty or not. This may be
  2269. // used to include empty fields in Patch requests.
  2270. ForceSendFields []string `json:"-"`
  2271. // NullFields is a list of field names (e.g. "Answer") to include in API
  2272. // requests with the JSON null value. By default, fields with empty
  2273. // values are omitted from API requests. However, any field with an
  2274. // empty value appearing in NullFields will be sent to the server as
  2275. // null. It is an error if a field in this list has a non-empty value.
  2276. // This may be used to include null fields in Patch requests.
  2277. NullFields []string `json:"-"`
  2278. }
  2279. func (s *ShortAnswerSubmission) MarshalJSON() ([]byte, error) {
  2280. type NoMethod ShortAnswerSubmission
  2281. raw := NoMethod(*s)
  2282. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2283. }
  2284. // StateHistory: The history of each state this submission has been in.
  2285. type StateHistory struct {
  2286. // ActorUserId: The teacher or student who made the change
  2287. ActorUserId string `json:"actorUserId,omitempty"`
  2288. // State: The workflow pipeline stage.
  2289. //
  2290. // Possible values:
  2291. // "STATE_UNSPECIFIED" - No state specified. This should never be
  2292. // returned.
  2293. // "CREATED" - The Submission has been created.
  2294. // "TURNED_IN" - The student has turned in an assigned document, which
  2295. // may or may not be
  2296. // a template.
  2297. // "RETURNED" - The teacher has returned the assigned document to the
  2298. // student.
  2299. // "RECLAIMED_BY_STUDENT" - The student turned in the assigned
  2300. // document, and then chose to
  2301. // "unsubmit" the assignment, giving the student control again as
  2302. // the
  2303. // owner.
  2304. // "STUDENT_EDITED_AFTER_TURN_IN" - The student edited their
  2305. // submission after turning it in. Currently,
  2306. // only used by Questions, when the student edits their answer.
  2307. State string `json:"state,omitempty"`
  2308. // StateTimestamp: When the submission entered this state.
  2309. StateTimestamp string `json:"stateTimestamp,omitempty"`
  2310. // ForceSendFields is a list of field names (e.g. "ActorUserId") to
  2311. // unconditionally include in API requests. By default, fields with
  2312. // empty values are omitted from API requests. However, any non-pointer,
  2313. // non-interface field appearing in ForceSendFields will be sent to the
  2314. // server regardless of whether the field is empty or not. This may be
  2315. // used to include empty fields in Patch requests.
  2316. ForceSendFields []string `json:"-"`
  2317. // NullFields is a list of field names (e.g. "ActorUserId") to include
  2318. // in API requests with the JSON null value. By default, fields with
  2319. // empty values are omitted from API requests. However, any field with
  2320. // an empty value appearing in NullFields will be sent to the server as
  2321. // null. It is an error if a field in this list has a non-empty value.
  2322. // This may be used to include null fields in Patch requests.
  2323. NullFields []string `json:"-"`
  2324. }
  2325. func (s *StateHistory) MarshalJSON() ([]byte, error) {
  2326. type NoMethod StateHistory
  2327. raw := NoMethod(*s)
  2328. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2329. }
  2330. // Student: Student in a course.
  2331. type Student struct {
  2332. // CourseId: Identifier of the course.
  2333. //
  2334. // Read-only.
  2335. CourseId string `json:"courseId,omitempty"`
  2336. // Profile: Global user information for the student.
  2337. //
  2338. // Read-only.
  2339. Profile *UserProfile `json:"profile,omitempty"`
  2340. // StudentWorkFolder: Information about a Drive Folder for this
  2341. // student's work in this course.
  2342. // Only visible to the student and domain administrators.
  2343. //
  2344. // Read-only.
  2345. StudentWorkFolder *DriveFolder `json:"studentWorkFolder,omitempty"`
  2346. // UserId: Identifier of the user.
  2347. //
  2348. // When specified as a parameter of a request, this identifier can be
  2349. // one of
  2350. // the following:
  2351. //
  2352. // * the numeric identifier for the user
  2353. // * the email address of the user
  2354. // * the string literal "me", indicating the requesting user
  2355. UserId string `json:"userId,omitempty"`
  2356. // ServerResponse contains the HTTP response code and headers from the
  2357. // server.
  2358. googleapi.ServerResponse `json:"-"`
  2359. // ForceSendFields is a list of field names (e.g. "CourseId") to
  2360. // unconditionally include in API requests. By default, fields with
  2361. // empty values are omitted from API requests. However, any non-pointer,
  2362. // non-interface field appearing in ForceSendFields will be sent to the
  2363. // server regardless of whether the field is empty or not. This may be
  2364. // used to include empty fields in Patch requests.
  2365. ForceSendFields []string `json:"-"`
  2366. // NullFields is a list of field names (e.g. "CourseId") to include in
  2367. // API requests with the JSON null value. By default, fields with empty
  2368. // values are omitted from API requests. However, any field with an
  2369. // empty value appearing in NullFields will be sent to the server as
  2370. // null. It is an error if a field in this list has a non-empty value.
  2371. // This may be used to include null fields in Patch requests.
  2372. NullFields []string `json:"-"`
  2373. }
  2374. func (s *Student) MarshalJSON() ([]byte, error) {
  2375. type NoMethod Student
  2376. raw := NoMethod(*s)
  2377. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2378. }
  2379. // StudentSubmission: Student submission for course
  2380. // work.
  2381. //
  2382. // StudentSubmission items are generated when a CourseWork item is
  2383. // created.
  2384. //
  2385. // StudentSubmissions that have never been accessed (i.e. with `state` =
  2386. // NEW)
  2387. // may not have a creation time or update time.
  2388. type StudentSubmission struct {
  2389. // AlternateLink: Absolute link to the submission in the Classroom web
  2390. // UI.
  2391. //
  2392. // Read-only.
  2393. AlternateLink string `json:"alternateLink,omitempty"`
  2394. // AssignedGrade: Optional grade. If unset, no grade was set.
  2395. // This value must be non-negative. Decimal (i.e. non-integer) values
  2396. // are
  2397. // allowed, but will be rounded to two decimal places.
  2398. //
  2399. // This may be modified only by course teachers.
  2400. AssignedGrade float64 `json:"assignedGrade,omitempty"`
  2401. // AssignmentSubmission: Submission content when course_work_type is
  2402. // ASSIGNMENT.
  2403. //
  2404. // Students can modify this content
  2405. // using
  2406. // google.classroom.Work.ModifyAttachments.
  2407. AssignmentSubmission *AssignmentSubmission `json:"assignmentSubmission,omitempty"`
  2408. // AssociatedWithDeveloper: Whether this student submission is
  2409. // associated with the Developer Console
  2410. // project making the request.
  2411. //
  2412. // See google.classroom.Work.CreateCourseWork for
  2413. // more
  2414. // details.
  2415. //
  2416. // Read-only.
  2417. AssociatedWithDeveloper bool `json:"associatedWithDeveloper,omitempty"`
  2418. // CourseId: Identifier of the course.
  2419. //
  2420. // Read-only.
  2421. CourseId string `json:"courseId,omitempty"`
  2422. // CourseWorkId: Identifier for the course work this corresponds
  2423. // to.
  2424. //
  2425. // Read-only.
  2426. CourseWorkId string `json:"courseWorkId,omitempty"`
  2427. // CourseWorkType: Type of course work this submission is
  2428. // for.
  2429. //
  2430. // Read-only.
  2431. //
  2432. // Possible values:
  2433. // "COURSE_WORK_TYPE_UNSPECIFIED" - No work type specified. This is
  2434. // never returned.
  2435. // "ASSIGNMENT" - An assignment.
  2436. // "SHORT_ANSWER_QUESTION" - A short answer question.
  2437. // "MULTIPLE_CHOICE_QUESTION" - A multiple-choice question.
  2438. CourseWorkType string `json:"courseWorkType,omitempty"`
  2439. // CreationTime: Creation time of this submission.
  2440. // This may be unset if the student has not accessed this
  2441. // item.
  2442. //
  2443. // Read-only.
  2444. CreationTime string `json:"creationTime,omitempty"`
  2445. // DraftGrade: Optional pending grade. If unset, no grade was set.
  2446. // This value must be non-negative. Decimal (i.e. non-integer) values
  2447. // are
  2448. // allowed, but will be rounded to two decimal places.
  2449. //
  2450. // This is only visible to and modifiable by course teachers.
  2451. DraftGrade float64 `json:"draftGrade,omitempty"`
  2452. // Id: Classroom-assigned Identifier for the student submission.
  2453. // This is unique among submissions for the relevant course
  2454. // work.
  2455. //
  2456. // Read-only.
  2457. Id string `json:"id,omitempty"`
  2458. // Late: Whether this submission is late.
  2459. //
  2460. // Read-only.
  2461. Late bool `json:"late,omitempty"`
  2462. // MultipleChoiceSubmission: Submission content when course_work_type is
  2463. // MULTIPLE_CHOICE_QUESTION.
  2464. MultipleChoiceSubmission *MultipleChoiceSubmission `json:"multipleChoiceSubmission,omitempty"`
  2465. // ShortAnswerSubmission: Submission content when course_work_type is
  2466. // SHORT_ANSWER_QUESTION.
  2467. ShortAnswerSubmission *ShortAnswerSubmission `json:"shortAnswerSubmission,omitempty"`
  2468. // State: State of this submission.
  2469. //
  2470. // Read-only.
  2471. //
  2472. // Possible values:
  2473. // "SUBMISSION_STATE_UNSPECIFIED" - No state specified. This should
  2474. // never be returned.
  2475. // "NEW" - The student has never accessed this submission. Attachments
  2476. // are not
  2477. // returned and timestamps is not set.
  2478. // "CREATED" - Has been created.
  2479. // "TURNED_IN" - Has been turned in to the teacher.
  2480. // "RETURNED" - Has been returned to the student.
  2481. // "RECLAIMED_BY_STUDENT" - Student chose to "unsubmit" the
  2482. // assignment.
  2483. State string `json:"state,omitempty"`
  2484. // SubmissionHistory: The history of the submission (includes state and
  2485. // grade histories).
  2486. //
  2487. // Read-only.
  2488. SubmissionHistory []*SubmissionHistory `json:"submissionHistory,omitempty"`
  2489. // UpdateTime: Last update time of this submission.
  2490. // This may be unset if the student has not accessed this
  2491. // item.
  2492. //
  2493. // Read-only.
  2494. UpdateTime string `json:"updateTime,omitempty"`
  2495. // UserId: Identifier for the student that owns this
  2496. // submission.
  2497. //
  2498. // Read-only.
  2499. UserId string `json:"userId,omitempty"`
  2500. // ServerResponse contains the HTTP response code and headers from the
  2501. // server.
  2502. googleapi.ServerResponse `json:"-"`
  2503. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  2504. // unconditionally include in API requests. By default, fields with
  2505. // empty values are omitted from API requests. However, any non-pointer,
  2506. // non-interface field appearing in ForceSendFields will be sent to the
  2507. // server regardless of whether the field is empty or not. This may be
  2508. // used to include empty fields in Patch requests.
  2509. ForceSendFields []string `json:"-"`
  2510. // NullFields is a list of field names (e.g. "AlternateLink") to include
  2511. // in API requests with the JSON null value. By default, fields with
  2512. // empty values are omitted from API requests. However, any field with
  2513. // an empty value appearing in NullFields will be sent to the server as
  2514. // null. It is an error if a field in this list has a non-empty value.
  2515. // This may be used to include null fields in Patch requests.
  2516. NullFields []string `json:"-"`
  2517. }
  2518. func (s *StudentSubmission) MarshalJSON() ([]byte, error) {
  2519. type NoMethod StudentSubmission
  2520. raw := NoMethod(*s)
  2521. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2522. }
  2523. func (s *StudentSubmission) UnmarshalJSON(data []byte) error {
  2524. type NoMethod StudentSubmission
  2525. var s1 struct {
  2526. AssignedGrade gensupport.JSONFloat64 `json:"assignedGrade"`
  2527. DraftGrade gensupport.JSONFloat64 `json:"draftGrade"`
  2528. *NoMethod
  2529. }
  2530. s1.NoMethod = (*NoMethod)(s)
  2531. if err := json.Unmarshal(data, &s1); err != nil {
  2532. return err
  2533. }
  2534. s.AssignedGrade = float64(s1.AssignedGrade)
  2535. s.DraftGrade = float64(s1.DraftGrade)
  2536. return nil
  2537. }
  2538. // SubmissionHistory: The history of the submission. This currently
  2539. // includes state and grade
  2540. // histories.
  2541. type SubmissionHistory struct {
  2542. // GradeHistory: The grade history information of the submission, if
  2543. // present.
  2544. GradeHistory *GradeHistory `json:"gradeHistory,omitempty"`
  2545. // StateHistory: The state history information of the submission, if
  2546. // present.
  2547. StateHistory *StateHistory `json:"stateHistory,omitempty"`
  2548. // ForceSendFields is a list of field names (e.g. "GradeHistory") to
  2549. // unconditionally include in API requests. By default, fields with
  2550. // empty values are omitted from API requests. However, any non-pointer,
  2551. // non-interface field appearing in ForceSendFields will be sent to the
  2552. // server regardless of whether the field is empty or not. This may be
  2553. // used to include empty fields in Patch requests.
  2554. ForceSendFields []string `json:"-"`
  2555. // NullFields is a list of field names (e.g. "GradeHistory") to include
  2556. // in API requests with the JSON null value. By default, fields with
  2557. // empty values are omitted from API requests. However, any field with
  2558. // an empty value appearing in NullFields will be sent to the server as
  2559. // null. It is an error if a field in this list has a non-empty value.
  2560. // This may be used to include null fields in Patch requests.
  2561. NullFields []string `json:"-"`
  2562. }
  2563. func (s *SubmissionHistory) MarshalJSON() ([]byte, error) {
  2564. type NoMethod SubmissionHistory
  2565. raw := NoMethod(*s)
  2566. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2567. }
  2568. // Teacher: Teacher of a course.
  2569. type Teacher struct {
  2570. // CourseId: Identifier of the course.
  2571. //
  2572. // Read-only.
  2573. CourseId string `json:"courseId,omitempty"`
  2574. // Profile: Global user information for the teacher.
  2575. //
  2576. // Read-only.
  2577. Profile *UserProfile `json:"profile,omitempty"`
  2578. // UserId: Identifier of the user.
  2579. //
  2580. // When specified as a parameter of a request, this identifier can be
  2581. // one of
  2582. // the following:
  2583. //
  2584. // * the numeric identifier for the user
  2585. // * the email address of the user
  2586. // * the string literal "me", indicating the requesting user
  2587. UserId string `json:"userId,omitempty"`
  2588. // ServerResponse contains the HTTP response code and headers from the
  2589. // server.
  2590. googleapi.ServerResponse `json:"-"`
  2591. // ForceSendFields is a list of field names (e.g. "CourseId") to
  2592. // unconditionally include in API requests. By default, fields with
  2593. // empty values are omitted from API requests. However, any non-pointer,
  2594. // non-interface field appearing in ForceSendFields will be sent to the
  2595. // server regardless of whether the field is empty or not. This may be
  2596. // used to include empty fields in Patch requests.
  2597. ForceSendFields []string `json:"-"`
  2598. // NullFields is a list of field names (e.g. "CourseId") to include in
  2599. // API requests with the JSON null value. By default, fields with empty
  2600. // values are omitted from API requests. However, any field with an
  2601. // empty value appearing in NullFields will be sent to the server as
  2602. // null. It is an error if a field in this list has a non-empty value.
  2603. // This may be used to include null fields in Patch requests.
  2604. NullFields []string `json:"-"`
  2605. }
  2606. func (s *Teacher) MarshalJSON() ([]byte, error) {
  2607. type NoMethod Teacher
  2608. raw := NoMethod(*s)
  2609. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2610. }
  2611. // TimeOfDay: Represents a time of day. The date and time zone are
  2612. // either not significant
  2613. // or are specified elsewhere. An API may choose to allow leap seconds.
  2614. // Related
  2615. // types are google.type.Date and `google.protobuf.Timestamp`.
  2616. type TimeOfDay struct {
  2617. // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API
  2618. // may choose
  2619. // to allow the value "24:00:00" for scenarios like business closing
  2620. // time.
  2621. Hours int64 `json:"hours,omitempty"`
  2622. // Minutes: Minutes of hour of day. Must be from 0 to 59.
  2623. Minutes int64 `json:"minutes,omitempty"`
  2624. // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to
  2625. // 999,999,999.
  2626. Nanos int64 `json:"nanos,omitempty"`
  2627. // Seconds: Seconds of minutes of the time. Must normally be from 0 to
  2628. // 59. An API may
  2629. // allow the value 60 if it allows leap-seconds.
  2630. Seconds int64 `json:"seconds,omitempty"`
  2631. // ForceSendFields is a list of field names (e.g. "Hours") to
  2632. // unconditionally include in API requests. By default, fields with
  2633. // empty values are omitted from API requests. However, any non-pointer,
  2634. // non-interface field appearing in ForceSendFields will be sent to the
  2635. // server regardless of whether the field is empty or not. This may be
  2636. // used to include empty fields in Patch requests.
  2637. ForceSendFields []string `json:"-"`
  2638. // NullFields is a list of field names (e.g. "Hours") to include in API
  2639. // requests with the JSON null value. By default, fields with empty
  2640. // values are omitted from API requests. However, any field with an
  2641. // empty value appearing in NullFields will be sent to the server as
  2642. // null. It is an error if a field in this list has a non-empty value.
  2643. // This may be used to include null fields in Patch requests.
  2644. NullFields []string `json:"-"`
  2645. }
  2646. func (s *TimeOfDay) MarshalJSON() ([]byte, error) {
  2647. type NoMethod TimeOfDay
  2648. raw := NoMethod(*s)
  2649. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2650. }
  2651. // TurnInStudentSubmissionRequest: Request to turn in a student
  2652. // submission.
  2653. type TurnInStudentSubmissionRequest struct {
  2654. }
  2655. // UserProfile: Global information for a user.
  2656. type UserProfile struct {
  2657. // EmailAddress: Email address of the user.
  2658. //
  2659. // Read-only.
  2660. EmailAddress string `json:"emailAddress,omitempty"`
  2661. // Id: Identifier of the user.
  2662. //
  2663. // Read-only.
  2664. Id string `json:"id,omitempty"`
  2665. // Name: Name of the user.
  2666. //
  2667. // Read-only.
  2668. Name *Name `json:"name,omitempty"`
  2669. // Permissions: Global permissions of the user.
  2670. //
  2671. // Read-only.
  2672. Permissions []*GlobalPermission `json:"permissions,omitempty"`
  2673. // PhotoUrl: URL of user's profile photo.
  2674. //
  2675. // Read-only.
  2676. PhotoUrl string `json:"photoUrl,omitempty"`
  2677. // VerifiedTeacher: Represents whether a G Suite for Education user's
  2678. // domain administrator has
  2679. // explicitly verified them as being a teacher. If the user is not a
  2680. // member of
  2681. // a G Suite for Education domain, than this field will always be
  2682. // false.
  2683. //
  2684. // Read-only
  2685. VerifiedTeacher bool `json:"verifiedTeacher,omitempty"`
  2686. // ServerResponse contains the HTTP response code and headers from the
  2687. // server.
  2688. googleapi.ServerResponse `json:"-"`
  2689. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  2690. // unconditionally include in API requests. By default, fields with
  2691. // empty values are omitted from API requests. However, any non-pointer,
  2692. // non-interface field appearing in ForceSendFields will be sent to the
  2693. // server regardless of whether the field is empty or not. This may be
  2694. // used to include empty fields in Patch requests.
  2695. ForceSendFields []string `json:"-"`
  2696. // NullFields is a list of field names (e.g. "EmailAddress") to include
  2697. // in API requests with the JSON null value. By default, fields with
  2698. // empty values are omitted from API requests. However, any field with
  2699. // an empty value appearing in NullFields will be sent to the server as
  2700. // null. It is an error if a field in this list has a non-empty value.
  2701. // This may be used to include null fields in Patch requests.
  2702. NullFields []string `json:"-"`
  2703. }
  2704. func (s *UserProfile) MarshalJSON() ([]byte, error) {
  2705. type NoMethod UserProfile
  2706. raw := NoMethod(*s)
  2707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2708. }
  2709. // YouTubeVideo: YouTube video item.
  2710. type YouTubeVideo struct {
  2711. // AlternateLink: URL that can be used to view the YouTube
  2712. // video.
  2713. //
  2714. // Read-only.
  2715. AlternateLink string `json:"alternateLink,omitempty"`
  2716. // Id: YouTube API resource ID.
  2717. Id string `json:"id,omitempty"`
  2718. // ThumbnailUrl: URL of a thumbnail image of the YouTube
  2719. // video.
  2720. //
  2721. // Read-only.
  2722. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  2723. // Title: Title of the YouTube video.
  2724. //
  2725. // Read-only.
  2726. Title string `json:"title,omitempty"`
  2727. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  2728. // unconditionally include in API requests. By default, fields with
  2729. // empty values are omitted from API requests. However, any non-pointer,
  2730. // non-interface field appearing in ForceSendFields will be sent to the
  2731. // server regardless of whether the field is empty or not. This may be
  2732. // used to include empty fields in Patch requests.
  2733. ForceSendFields []string `json:"-"`
  2734. // NullFields is a list of field names (e.g. "AlternateLink") to include
  2735. // in API requests with the JSON null value. By default, fields with
  2736. // empty values are omitted from API requests. However, any field with
  2737. // an empty value appearing in NullFields will be sent to the server as
  2738. // null. It is an error if a field in this list has a non-empty value.
  2739. // This may be used to include null fields in Patch requests.
  2740. NullFields []string `json:"-"`
  2741. }
  2742. func (s *YouTubeVideo) MarshalJSON() ([]byte, error) {
  2743. type NoMethod YouTubeVideo
  2744. raw := NoMethod(*s)
  2745. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2746. }
  2747. // method id "classroom.courses.create":
  2748. type CoursesCreateCall struct {
  2749. s *Service
  2750. course *Course
  2751. urlParams_ gensupport.URLParams
  2752. ctx_ context.Context
  2753. header_ http.Header
  2754. }
  2755. // Create: Creates a course.
  2756. //
  2757. // The user specified in `ownerId` is the owner of the created
  2758. // course
  2759. // and added as a teacher.
  2760. //
  2761. // This method returns the following error codes:
  2762. //
  2763. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  2764. // create
  2765. // courses or for access errors.
  2766. // * `NOT_FOUND` if the primary teacher is not a valid user.
  2767. // * `FAILED_PRECONDITION` if the course owner's account is disabled or
  2768. // for
  2769. // the following request errors:
  2770. // * UserGroupsMembershipLimitReached
  2771. // * `ALREADY_EXISTS` if an alias was specified in the `id` and
  2772. // already exists.
  2773. func (r *CoursesService) Create(course *Course) *CoursesCreateCall {
  2774. c := &CoursesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2775. c.course = course
  2776. return c
  2777. }
  2778. // Fields allows partial responses to be retrieved. See
  2779. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2780. // for more information.
  2781. func (c *CoursesCreateCall) Fields(s ...googleapi.Field) *CoursesCreateCall {
  2782. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2783. return c
  2784. }
  2785. // Context sets the context to be used in this call's Do method. Any
  2786. // pending HTTP request will be aborted if the provided context is
  2787. // canceled.
  2788. func (c *CoursesCreateCall) Context(ctx context.Context) *CoursesCreateCall {
  2789. c.ctx_ = ctx
  2790. return c
  2791. }
  2792. // Header returns an http.Header that can be modified by the caller to
  2793. // add HTTP headers to the request.
  2794. func (c *CoursesCreateCall) Header() http.Header {
  2795. if c.header_ == nil {
  2796. c.header_ = make(http.Header)
  2797. }
  2798. return c.header_
  2799. }
  2800. func (c *CoursesCreateCall) doRequest(alt string) (*http.Response, error) {
  2801. reqHeaders := make(http.Header)
  2802. for k, v := range c.header_ {
  2803. reqHeaders[k] = v
  2804. }
  2805. reqHeaders.Set("User-Agent", c.s.userAgent())
  2806. var body io.Reader = nil
  2807. body, err := googleapi.WithoutDataWrapper.JSONReader(c.course)
  2808. if err != nil {
  2809. return nil, err
  2810. }
  2811. reqHeaders.Set("Content-Type", "application/json")
  2812. c.urlParams_.Set("alt", alt)
  2813. c.urlParams_.Set("prettyPrint", "false")
  2814. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses")
  2815. urls += "?" + c.urlParams_.Encode()
  2816. req, err := http.NewRequest("POST", urls, body)
  2817. if err != nil {
  2818. return nil, err
  2819. }
  2820. req.Header = reqHeaders
  2821. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2822. }
  2823. // Do executes the "classroom.courses.create" call.
  2824. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  2825. // code is an error. Response headers are in either
  2826. // *Course.ServerResponse.Header or (if a response was returned at all)
  2827. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2828. // check whether the returned error was because http.StatusNotModified
  2829. // was returned.
  2830. func (c *CoursesCreateCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  2831. gensupport.SetOptions(c.urlParams_, opts...)
  2832. res, err := c.doRequest("json")
  2833. if res != nil && res.StatusCode == http.StatusNotModified {
  2834. if res.Body != nil {
  2835. res.Body.Close()
  2836. }
  2837. return nil, &googleapi.Error{
  2838. Code: res.StatusCode,
  2839. Header: res.Header,
  2840. }
  2841. }
  2842. if err != nil {
  2843. return nil, err
  2844. }
  2845. defer googleapi.CloseBody(res)
  2846. if err := googleapi.CheckResponse(res); err != nil {
  2847. return nil, err
  2848. }
  2849. ret := &Course{
  2850. ServerResponse: googleapi.ServerResponse{
  2851. Header: res.Header,
  2852. HTTPStatusCode: res.StatusCode,
  2853. },
  2854. }
  2855. target := &ret
  2856. if err := gensupport.DecodeResponse(target, res); err != nil {
  2857. return nil, err
  2858. }
  2859. return ret, nil
  2860. // {
  2861. // "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.",
  2862. // "flatPath": "v1/courses",
  2863. // "httpMethod": "POST",
  2864. // "id": "classroom.courses.create",
  2865. // "parameterOrder": [],
  2866. // "parameters": {},
  2867. // "path": "v1/courses",
  2868. // "request": {
  2869. // "$ref": "Course"
  2870. // },
  2871. // "response": {
  2872. // "$ref": "Course"
  2873. // },
  2874. // "scopes": [
  2875. // "https://www.googleapis.com/auth/classroom.courses"
  2876. // ]
  2877. // }
  2878. }
  2879. // method id "classroom.courses.delete":
  2880. type CoursesDeleteCall struct {
  2881. s *Service
  2882. id string
  2883. urlParams_ gensupport.URLParams
  2884. ctx_ context.Context
  2885. header_ http.Header
  2886. }
  2887. // Delete: Deletes a course.
  2888. //
  2889. // This method returns the following error codes:
  2890. //
  2891. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  2892. // delete the
  2893. // requested course or for access errors.
  2894. // * `NOT_FOUND` if no course exists with the requested ID.
  2895. func (r *CoursesService) Delete(id string) *CoursesDeleteCall {
  2896. c := &CoursesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2897. c.id = id
  2898. return c
  2899. }
  2900. // Fields allows partial responses to be retrieved. See
  2901. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2902. // for more information.
  2903. func (c *CoursesDeleteCall) Fields(s ...googleapi.Field) *CoursesDeleteCall {
  2904. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2905. return c
  2906. }
  2907. // Context sets the context to be used in this call's Do method. Any
  2908. // pending HTTP request will be aborted if the provided context is
  2909. // canceled.
  2910. func (c *CoursesDeleteCall) Context(ctx context.Context) *CoursesDeleteCall {
  2911. c.ctx_ = ctx
  2912. return c
  2913. }
  2914. // Header returns an http.Header that can be modified by the caller to
  2915. // add HTTP headers to the request.
  2916. func (c *CoursesDeleteCall) Header() http.Header {
  2917. if c.header_ == nil {
  2918. c.header_ = make(http.Header)
  2919. }
  2920. return c.header_
  2921. }
  2922. func (c *CoursesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2923. reqHeaders := make(http.Header)
  2924. for k, v := range c.header_ {
  2925. reqHeaders[k] = v
  2926. }
  2927. reqHeaders.Set("User-Agent", c.s.userAgent())
  2928. var body io.Reader = nil
  2929. c.urlParams_.Set("alt", alt)
  2930. c.urlParams_.Set("prettyPrint", "false")
  2931. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  2932. urls += "?" + c.urlParams_.Encode()
  2933. req, err := http.NewRequest("DELETE", urls, body)
  2934. if err != nil {
  2935. return nil, err
  2936. }
  2937. req.Header = reqHeaders
  2938. googleapi.Expand(req.URL, map[string]string{
  2939. "id": c.id,
  2940. })
  2941. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2942. }
  2943. // Do executes the "classroom.courses.delete" call.
  2944. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2945. // code is an error. Response headers are in either
  2946. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2947. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2948. // check whether the returned error was because http.StatusNotModified
  2949. // was returned.
  2950. func (c *CoursesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2951. gensupport.SetOptions(c.urlParams_, opts...)
  2952. res, err := c.doRequest("json")
  2953. if res != nil && res.StatusCode == http.StatusNotModified {
  2954. if res.Body != nil {
  2955. res.Body.Close()
  2956. }
  2957. return nil, &googleapi.Error{
  2958. Code: res.StatusCode,
  2959. Header: res.Header,
  2960. }
  2961. }
  2962. if err != nil {
  2963. return nil, err
  2964. }
  2965. defer googleapi.CloseBody(res)
  2966. if err := googleapi.CheckResponse(res); err != nil {
  2967. return nil, err
  2968. }
  2969. ret := &Empty{
  2970. ServerResponse: googleapi.ServerResponse{
  2971. Header: res.Header,
  2972. HTTPStatusCode: res.StatusCode,
  2973. },
  2974. }
  2975. target := &ret
  2976. if err := gensupport.DecodeResponse(target, res); err != nil {
  2977. return nil, err
  2978. }
  2979. return ret, nil
  2980. // {
  2981. // "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.",
  2982. // "flatPath": "v1/courses/{id}",
  2983. // "httpMethod": "DELETE",
  2984. // "id": "classroom.courses.delete",
  2985. // "parameterOrder": [
  2986. // "id"
  2987. // ],
  2988. // "parameters": {
  2989. // "id": {
  2990. // "description": "Identifier of the course to delete.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  2991. // "location": "path",
  2992. // "required": true,
  2993. // "type": "string"
  2994. // }
  2995. // },
  2996. // "path": "v1/courses/{id}",
  2997. // "response": {
  2998. // "$ref": "Empty"
  2999. // },
  3000. // "scopes": [
  3001. // "https://www.googleapis.com/auth/classroom.courses"
  3002. // ]
  3003. // }
  3004. }
  3005. // method id "classroom.courses.get":
  3006. type CoursesGetCall struct {
  3007. s *Service
  3008. id string
  3009. urlParams_ gensupport.URLParams
  3010. ifNoneMatch_ string
  3011. ctx_ context.Context
  3012. header_ http.Header
  3013. }
  3014. // Get: Returns a course.
  3015. //
  3016. // This method returns the following error codes:
  3017. //
  3018. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3019. // access the
  3020. // requested course or for access errors.
  3021. // * `NOT_FOUND` if no course exists with the requested ID.
  3022. func (r *CoursesService) Get(id string) *CoursesGetCall {
  3023. c := &CoursesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3024. c.id = id
  3025. return c
  3026. }
  3027. // Fields allows partial responses to be retrieved. See
  3028. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3029. // for more information.
  3030. func (c *CoursesGetCall) Fields(s ...googleapi.Field) *CoursesGetCall {
  3031. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3032. return c
  3033. }
  3034. // IfNoneMatch sets the optional parameter which makes the operation
  3035. // fail if the object's ETag matches the given value. This is useful for
  3036. // getting updates only after the object has changed since the last
  3037. // request. Use googleapi.IsNotModified to check whether the response
  3038. // error from Do is the result of In-None-Match.
  3039. func (c *CoursesGetCall) IfNoneMatch(entityTag string) *CoursesGetCall {
  3040. c.ifNoneMatch_ = entityTag
  3041. return c
  3042. }
  3043. // Context sets the context to be used in this call's Do method. Any
  3044. // pending HTTP request will be aborted if the provided context is
  3045. // canceled.
  3046. func (c *CoursesGetCall) Context(ctx context.Context) *CoursesGetCall {
  3047. c.ctx_ = ctx
  3048. return c
  3049. }
  3050. // Header returns an http.Header that can be modified by the caller to
  3051. // add HTTP headers to the request.
  3052. func (c *CoursesGetCall) Header() http.Header {
  3053. if c.header_ == nil {
  3054. c.header_ = make(http.Header)
  3055. }
  3056. return c.header_
  3057. }
  3058. func (c *CoursesGetCall) doRequest(alt string) (*http.Response, error) {
  3059. reqHeaders := make(http.Header)
  3060. for k, v := range c.header_ {
  3061. reqHeaders[k] = v
  3062. }
  3063. reqHeaders.Set("User-Agent", c.s.userAgent())
  3064. if c.ifNoneMatch_ != "" {
  3065. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3066. }
  3067. var body io.Reader = nil
  3068. c.urlParams_.Set("alt", alt)
  3069. c.urlParams_.Set("prettyPrint", "false")
  3070. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  3071. urls += "?" + c.urlParams_.Encode()
  3072. req, err := http.NewRequest("GET", urls, body)
  3073. if err != nil {
  3074. return nil, err
  3075. }
  3076. req.Header = reqHeaders
  3077. googleapi.Expand(req.URL, map[string]string{
  3078. "id": c.id,
  3079. })
  3080. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3081. }
  3082. // Do executes the "classroom.courses.get" call.
  3083. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  3084. // code is an error. Response headers are in either
  3085. // *Course.ServerResponse.Header or (if a response was returned at all)
  3086. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3087. // check whether the returned error was because http.StatusNotModified
  3088. // was returned.
  3089. func (c *CoursesGetCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  3090. gensupport.SetOptions(c.urlParams_, opts...)
  3091. res, err := c.doRequest("json")
  3092. if res != nil && res.StatusCode == http.StatusNotModified {
  3093. if res.Body != nil {
  3094. res.Body.Close()
  3095. }
  3096. return nil, &googleapi.Error{
  3097. Code: res.StatusCode,
  3098. Header: res.Header,
  3099. }
  3100. }
  3101. if err != nil {
  3102. return nil, err
  3103. }
  3104. defer googleapi.CloseBody(res)
  3105. if err := googleapi.CheckResponse(res); err != nil {
  3106. return nil, err
  3107. }
  3108. ret := &Course{
  3109. ServerResponse: googleapi.ServerResponse{
  3110. Header: res.Header,
  3111. HTTPStatusCode: res.StatusCode,
  3112. },
  3113. }
  3114. target := &ret
  3115. if err := gensupport.DecodeResponse(target, res); err != nil {
  3116. return nil, err
  3117. }
  3118. return ret, nil
  3119. // {
  3120. // "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.",
  3121. // "flatPath": "v1/courses/{id}",
  3122. // "httpMethod": "GET",
  3123. // "id": "classroom.courses.get",
  3124. // "parameterOrder": [
  3125. // "id"
  3126. // ],
  3127. // "parameters": {
  3128. // "id": {
  3129. // "description": "Identifier of the course to return.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3130. // "location": "path",
  3131. // "required": true,
  3132. // "type": "string"
  3133. // }
  3134. // },
  3135. // "path": "v1/courses/{id}",
  3136. // "response": {
  3137. // "$ref": "Course"
  3138. // },
  3139. // "scopes": [
  3140. // "https://www.googleapis.com/auth/classroom.courses",
  3141. // "https://www.googleapis.com/auth/classroom.courses.readonly"
  3142. // ]
  3143. // }
  3144. }
  3145. // method id "classroom.courses.list":
  3146. type CoursesListCall struct {
  3147. s *Service
  3148. urlParams_ gensupport.URLParams
  3149. ifNoneMatch_ string
  3150. ctx_ context.Context
  3151. header_ http.Header
  3152. }
  3153. // List: Returns a list of courses that the requesting user is permitted
  3154. // to view,
  3155. // restricted to those that match the request. Returned courses are
  3156. // ordered by
  3157. // creation time, with the most recently created coming first.
  3158. //
  3159. // This method returns the following error codes:
  3160. //
  3161. // * `PERMISSION_DENIED` for access errors.
  3162. // * `INVALID_ARGUMENT` if the query argument is malformed.
  3163. // * `NOT_FOUND` if any users specified in the query arguments do not
  3164. // exist.
  3165. func (r *CoursesService) List() *CoursesListCall {
  3166. c := &CoursesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3167. return c
  3168. }
  3169. // CourseStates sets the optional parameter "courseStates": Restricts
  3170. // returned courses to those in one of the specified states
  3171. // The default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.
  3172. //
  3173. // Possible values:
  3174. // "COURSE_STATE_UNSPECIFIED"
  3175. // "ACTIVE"
  3176. // "ARCHIVED"
  3177. // "PROVISIONED"
  3178. // "DECLINED"
  3179. // "SUSPENDED"
  3180. func (c *CoursesListCall) CourseStates(courseStates ...string) *CoursesListCall {
  3181. c.urlParams_.SetMulti("courseStates", append([]string{}, courseStates...))
  3182. return c
  3183. }
  3184. // PageSize sets the optional parameter "pageSize": Maximum number of
  3185. // items to return. Zero or unspecified indicates that the
  3186. // server may assign a maximum.
  3187. //
  3188. // The server may return fewer than the specified number of results.
  3189. func (c *CoursesListCall) PageSize(pageSize int64) *CoursesListCall {
  3190. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3191. return c
  3192. }
  3193. // PageToken sets the optional parameter "pageToken":
  3194. // nextPageToken
  3195. // value returned from a previous
  3196. // list call,
  3197. // indicating that the subsequent page of results should be
  3198. // returned.
  3199. //
  3200. // The list request must be
  3201. // otherwise identical to the one that resulted in this token.
  3202. func (c *CoursesListCall) PageToken(pageToken string) *CoursesListCall {
  3203. c.urlParams_.Set("pageToken", pageToken)
  3204. return c
  3205. }
  3206. // StudentId sets the optional parameter "studentId": Restricts returned
  3207. // courses to those having a student with the specified
  3208. // identifier. The identifier can be one of the following:
  3209. //
  3210. // * the numeric identifier for the user
  3211. // * the email address of the user
  3212. // * the string literal "me", indicating the requesting user
  3213. func (c *CoursesListCall) StudentId(studentId string) *CoursesListCall {
  3214. c.urlParams_.Set("studentId", studentId)
  3215. return c
  3216. }
  3217. // TeacherId sets the optional parameter "teacherId": Restricts returned
  3218. // courses to those having a teacher with the specified
  3219. // identifier. The identifier can be one of the following:
  3220. //
  3221. // * the numeric identifier for the user
  3222. // * the email address of the user
  3223. // * the string literal "me", indicating the requesting user
  3224. func (c *CoursesListCall) TeacherId(teacherId string) *CoursesListCall {
  3225. c.urlParams_.Set("teacherId", teacherId)
  3226. return c
  3227. }
  3228. // Fields allows partial responses to be retrieved. See
  3229. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3230. // for more information.
  3231. func (c *CoursesListCall) Fields(s ...googleapi.Field) *CoursesListCall {
  3232. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3233. return c
  3234. }
  3235. // IfNoneMatch sets the optional parameter which makes the operation
  3236. // fail if the object's ETag matches the given value. This is useful for
  3237. // getting updates only after the object has changed since the last
  3238. // request. Use googleapi.IsNotModified to check whether the response
  3239. // error from Do is the result of In-None-Match.
  3240. func (c *CoursesListCall) IfNoneMatch(entityTag string) *CoursesListCall {
  3241. c.ifNoneMatch_ = entityTag
  3242. return c
  3243. }
  3244. // Context sets the context to be used in this call's Do method. Any
  3245. // pending HTTP request will be aborted if the provided context is
  3246. // canceled.
  3247. func (c *CoursesListCall) Context(ctx context.Context) *CoursesListCall {
  3248. c.ctx_ = ctx
  3249. return c
  3250. }
  3251. // Header returns an http.Header that can be modified by the caller to
  3252. // add HTTP headers to the request.
  3253. func (c *CoursesListCall) Header() http.Header {
  3254. if c.header_ == nil {
  3255. c.header_ = make(http.Header)
  3256. }
  3257. return c.header_
  3258. }
  3259. func (c *CoursesListCall) doRequest(alt string) (*http.Response, error) {
  3260. reqHeaders := make(http.Header)
  3261. for k, v := range c.header_ {
  3262. reqHeaders[k] = v
  3263. }
  3264. reqHeaders.Set("User-Agent", c.s.userAgent())
  3265. if c.ifNoneMatch_ != "" {
  3266. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3267. }
  3268. var body io.Reader = nil
  3269. c.urlParams_.Set("alt", alt)
  3270. c.urlParams_.Set("prettyPrint", "false")
  3271. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses")
  3272. urls += "?" + c.urlParams_.Encode()
  3273. req, err := http.NewRequest("GET", urls, body)
  3274. if err != nil {
  3275. return nil, err
  3276. }
  3277. req.Header = reqHeaders
  3278. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3279. }
  3280. // Do executes the "classroom.courses.list" call.
  3281. // Exactly one of *ListCoursesResponse or error will be non-nil. Any
  3282. // non-2xx status code is an error. Response headers are in either
  3283. // *ListCoursesResponse.ServerResponse.Header or (if a response was
  3284. // returned at all) in error.(*googleapi.Error).Header. Use
  3285. // googleapi.IsNotModified to check whether the returned error was
  3286. // because http.StatusNotModified was returned.
  3287. func (c *CoursesListCall) Do(opts ...googleapi.CallOption) (*ListCoursesResponse, error) {
  3288. gensupport.SetOptions(c.urlParams_, opts...)
  3289. res, err := c.doRequest("json")
  3290. if res != nil && res.StatusCode == http.StatusNotModified {
  3291. if res.Body != nil {
  3292. res.Body.Close()
  3293. }
  3294. return nil, &googleapi.Error{
  3295. Code: res.StatusCode,
  3296. Header: res.Header,
  3297. }
  3298. }
  3299. if err != nil {
  3300. return nil, err
  3301. }
  3302. defer googleapi.CloseBody(res)
  3303. if err := googleapi.CheckResponse(res); err != nil {
  3304. return nil, err
  3305. }
  3306. ret := &ListCoursesResponse{
  3307. ServerResponse: googleapi.ServerResponse{
  3308. Header: res.Header,
  3309. HTTPStatusCode: res.StatusCode,
  3310. },
  3311. }
  3312. target := &ret
  3313. if err := gensupport.DecodeResponse(target, res); err != nil {
  3314. return nil, err
  3315. }
  3316. return ret, nil
  3317. // {
  3318. // "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.",
  3319. // "flatPath": "v1/courses",
  3320. // "httpMethod": "GET",
  3321. // "id": "classroom.courses.list",
  3322. // "parameterOrder": [],
  3323. // "parameters": {
  3324. // "courseStates": {
  3325. // "description": "Restricts returned courses to those in one of the specified states\nThe default value is ACTIVE, ARCHIVED, PROVISIONED, DECLINED.",
  3326. // "enum": [
  3327. // "COURSE_STATE_UNSPECIFIED",
  3328. // "ACTIVE",
  3329. // "ARCHIVED",
  3330. // "PROVISIONED",
  3331. // "DECLINED",
  3332. // "SUSPENDED"
  3333. // ],
  3334. // "location": "query",
  3335. // "repeated": true,
  3336. // "type": "string"
  3337. // },
  3338. // "pageSize": {
  3339. // "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.",
  3340. // "format": "int32",
  3341. // "location": "query",
  3342. // "type": "integer"
  3343. // },
  3344. // "pageToken": {
  3345. // "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.",
  3346. // "location": "query",
  3347. // "type": "string"
  3348. // },
  3349. // "studentId": {
  3350. // "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",
  3351. // "location": "query",
  3352. // "type": "string"
  3353. // },
  3354. // "teacherId": {
  3355. // "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",
  3356. // "location": "query",
  3357. // "type": "string"
  3358. // }
  3359. // },
  3360. // "path": "v1/courses",
  3361. // "response": {
  3362. // "$ref": "ListCoursesResponse"
  3363. // },
  3364. // "scopes": [
  3365. // "https://www.googleapis.com/auth/classroom.courses",
  3366. // "https://www.googleapis.com/auth/classroom.courses.readonly"
  3367. // ]
  3368. // }
  3369. }
  3370. // Pages invokes f for each page of results.
  3371. // A non-nil error returned from f will halt the iteration.
  3372. // The provided context supersedes any context provided to the Context method.
  3373. func (c *CoursesListCall) Pages(ctx context.Context, f func(*ListCoursesResponse) error) error {
  3374. c.ctx_ = ctx
  3375. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3376. for {
  3377. x, err := c.Do()
  3378. if err != nil {
  3379. return err
  3380. }
  3381. if err := f(x); err != nil {
  3382. return err
  3383. }
  3384. if x.NextPageToken == "" {
  3385. return nil
  3386. }
  3387. c.PageToken(x.NextPageToken)
  3388. }
  3389. }
  3390. // method id "classroom.courses.patch":
  3391. type CoursesPatchCall struct {
  3392. s *Service
  3393. id string
  3394. course *Course
  3395. urlParams_ gensupport.URLParams
  3396. ctx_ context.Context
  3397. header_ http.Header
  3398. }
  3399. // Patch: Updates one or more fields in a course.
  3400. //
  3401. // This method returns the following error codes:
  3402. //
  3403. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3404. // modify the
  3405. // requested course or for access errors.
  3406. // * `NOT_FOUND` if no course exists with the requested ID.
  3407. // * `INVALID_ARGUMENT` if invalid fields are specified in the update
  3408. // mask or
  3409. // if no update mask is supplied.
  3410. // * `FAILED_PRECONDITION` for the following request errors:
  3411. // * CourseNotModifiable
  3412. func (r *CoursesService) Patch(id string, course *Course) *CoursesPatchCall {
  3413. c := &CoursesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3414. c.id = id
  3415. c.course = course
  3416. return c
  3417. }
  3418. // UpdateMask sets the optional parameter "updateMask": Mask that
  3419. // identifies which fields on the course to update.
  3420. // This field is required to do an update. The update will fail if
  3421. // invalid
  3422. // fields are specified. The following fields are valid:
  3423. //
  3424. // * `name`
  3425. // * `section`
  3426. // * `descriptionHeading`
  3427. // * `description`
  3428. // * `room`
  3429. // * `courseState`
  3430. // * `ownerId`
  3431. //
  3432. // Note: patches to ownerId are treated as being effective immediately,
  3433. // but in
  3434. // practice it may take some time for the ownership transfer of all
  3435. // affected
  3436. // resources to complete.
  3437. //
  3438. // When set in a query parameter, this field should be specified
  3439. // as
  3440. //
  3441. // `updateMask=<field1>,<field2>,...`
  3442. func (c *CoursesPatchCall) UpdateMask(updateMask string) *CoursesPatchCall {
  3443. c.urlParams_.Set("updateMask", updateMask)
  3444. return c
  3445. }
  3446. // Fields allows partial responses to be retrieved. See
  3447. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3448. // for more information.
  3449. func (c *CoursesPatchCall) Fields(s ...googleapi.Field) *CoursesPatchCall {
  3450. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3451. return c
  3452. }
  3453. // Context sets the context to be used in this call's Do method. Any
  3454. // pending HTTP request will be aborted if the provided context is
  3455. // canceled.
  3456. func (c *CoursesPatchCall) Context(ctx context.Context) *CoursesPatchCall {
  3457. c.ctx_ = ctx
  3458. return c
  3459. }
  3460. // Header returns an http.Header that can be modified by the caller to
  3461. // add HTTP headers to the request.
  3462. func (c *CoursesPatchCall) Header() http.Header {
  3463. if c.header_ == nil {
  3464. c.header_ = make(http.Header)
  3465. }
  3466. return c.header_
  3467. }
  3468. func (c *CoursesPatchCall) doRequest(alt string) (*http.Response, error) {
  3469. reqHeaders := make(http.Header)
  3470. for k, v := range c.header_ {
  3471. reqHeaders[k] = v
  3472. }
  3473. reqHeaders.Set("User-Agent", c.s.userAgent())
  3474. var body io.Reader = nil
  3475. body, err := googleapi.WithoutDataWrapper.JSONReader(c.course)
  3476. if err != nil {
  3477. return nil, err
  3478. }
  3479. reqHeaders.Set("Content-Type", "application/json")
  3480. c.urlParams_.Set("alt", alt)
  3481. c.urlParams_.Set("prettyPrint", "false")
  3482. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  3483. urls += "?" + c.urlParams_.Encode()
  3484. req, err := http.NewRequest("PATCH", urls, body)
  3485. if err != nil {
  3486. return nil, err
  3487. }
  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.patch" 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 *CoursesPatchCall) 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 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",
  3533. // "flatPath": "v1/courses/{id}",
  3534. // "httpMethod": "PATCH",
  3535. // "id": "classroom.courses.patch",
  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. // "updateMask": {
  3547. // "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,...`",
  3548. // "format": "google-fieldmask",
  3549. // "location": "query",
  3550. // "type": "string"
  3551. // }
  3552. // },
  3553. // "path": "v1/courses/{id}",
  3554. // "request": {
  3555. // "$ref": "Course"
  3556. // },
  3557. // "response": {
  3558. // "$ref": "Course"
  3559. // },
  3560. // "scopes": [
  3561. // "https://www.googleapis.com/auth/classroom.courses"
  3562. // ]
  3563. // }
  3564. }
  3565. // method id "classroom.courses.update":
  3566. type CoursesUpdateCall struct {
  3567. s *Service
  3568. id string
  3569. course *Course
  3570. urlParams_ gensupport.URLParams
  3571. ctx_ context.Context
  3572. header_ http.Header
  3573. }
  3574. // Update: Updates a course.
  3575. //
  3576. // This method returns the following error codes:
  3577. //
  3578. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3579. // modify the
  3580. // requested course or for access errors.
  3581. // * `NOT_FOUND` if no course exists with the requested ID.
  3582. // * `FAILED_PRECONDITION` for the following request errors:
  3583. // * CourseNotModifiable
  3584. func (r *CoursesService) Update(id string, course *Course) *CoursesUpdateCall {
  3585. c := &CoursesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3586. c.id = id
  3587. c.course = course
  3588. return c
  3589. }
  3590. // Fields allows partial responses to be retrieved. See
  3591. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3592. // for more information.
  3593. func (c *CoursesUpdateCall) Fields(s ...googleapi.Field) *CoursesUpdateCall {
  3594. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3595. return c
  3596. }
  3597. // Context sets the context to be used in this call's Do method. Any
  3598. // pending HTTP request will be aborted if the provided context is
  3599. // canceled.
  3600. func (c *CoursesUpdateCall) Context(ctx context.Context) *CoursesUpdateCall {
  3601. c.ctx_ = ctx
  3602. return c
  3603. }
  3604. // Header returns an http.Header that can be modified by the caller to
  3605. // add HTTP headers to the request.
  3606. func (c *CoursesUpdateCall) Header() http.Header {
  3607. if c.header_ == nil {
  3608. c.header_ = make(http.Header)
  3609. }
  3610. return c.header_
  3611. }
  3612. func (c *CoursesUpdateCall) doRequest(alt string) (*http.Response, error) {
  3613. reqHeaders := make(http.Header)
  3614. for k, v := range c.header_ {
  3615. reqHeaders[k] = v
  3616. }
  3617. reqHeaders.Set("User-Agent", c.s.userAgent())
  3618. var body io.Reader = nil
  3619. body, err := googleapi.WithoutDataWrapper.JSONReader(c.course)
  3620. if err != nil {
  3621. return nil, err
  3622. }
  3623. reqHeaders.Set("Content-Type", "application/json")
  3624. c.urlParams_.Set("alt", alt)
  3625. c.urlParams_.Set("prettyPrint", "false")
  3626. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{id}")
  3627. urls += "?" + c.urlParams_.Encode()
  3628. req, err := http.NewRequest("PUT", urls, body)
  3629. if err != nil {
  3630. return nil, err
  3631. }
  3632. req.Header = reqHeaders
  3633. googleapi.Expand(req.URL, map[string]string{
  3634. "id": c.id,
  3635. })
  3636. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3637. }
  3638. // Do executes the "classroom.courses.update" call.
  3639. // Exactly one of *Course or error will be non-nil. Any non-2xx status
  3640. // code is an error. Response headers are in either
  3641. // *Course.ServerResponse.Header or (if a response was returned at all)
  3642. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3643. // check whether the returned error was because http.StatusNotModified
  3644. // was returned.
  3645. func (c *CoursesUpdateCall) Do(opts ...googleapi.CallOption) (*Course, error) {
  3646. gensupport.SetOptions(c.urlParams_, opts...)
  3647. res, err := c.doRequest("json")
  3648. if res != nil && res.StatusCode == http.StatusNotModified {
  3649. if res.Body != nil {
  3650. res.Body.Close()
  3651. }
  3652. return nil, &googleapi.Error{
  3653. Code: res.StatusCode,
  3654. Header: res.Header,
  3655. }
  3656. }
  3657. if err != nil {
  3658. return nil, err
  3659. }
  3660. defer googleapi.CloseBody(res)
  3661. if err := googleapi.CheckResponse(res); err != nil {
  3662. return nil, err
  3663. }
  3664. ret := &Course{
  3665. ServerResponse: googleapi.ServerResponse{
  3666. Header: res.Header,
  3667. HTTPStatusCode: res.StatusCode,
  3668. },
  3669. }
  3670. target := &ret
  3671. if err := gensupport.DecodeResponse(target, res); err != nil {
  3672. return nil, err
  3673. }
  3674. return ret, nil
  3675. // {
  3676. // "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",
  3677. // "flatPath": "v1/courses/{id}",
  3678. // "httpMethod": "PUT",
  3679. // "id": "classroom.courses.update",
  3680. // "parameterOrder": [
  3681. // "id"
  3682. // ],
  3683. // "parameters": {
  3684. // "id": {
  3685. // "description": "Identifier of the course to update.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3686. // "location": "path",
  3687. // "required": true,
  3688. // "type": "string"
  3689. // }
  3690. // },
  3691. // "path": "v1/courses/{id}",
  3692. // "request": {
  3693. // "$ref": "Course"
  3694. // },
  3695. // "response": {
  3696. // "$ref": "Course"
  3697. // },
  3698. // "scopes": [
  3699. // "https://www.googleapis.com/auth/classroom.courses"
  3700. // ]
  3701. // }
  3702. }
  3703. // method id "classroom.courses.aliases.create":
  3704. type CoursesAliasesCreateCall struct {
  3705. s *Service
  3706. courseId string
  3707. coursealias *CourseAlias
  3708. urlParams_ gensupport.URLParams
  3709. ctx_ context.Context
  3710. header_ http.Header
  3711. }
  3712. // Create: Creates an alias for a course.
  3713. //
  3714. // This method returns the following error codes:
  3715. //
  3716. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3717. // create the
  3718. // alias or for access errors.
  3719. // * `NOT_FOUND` if the course does not exist.
  3720. // * `ALREADY_EXISTS` if the alias already exists.
  3721. // * `FAILED_PRECONDITION` if the alias requested does not make sense
  3722. // for the
  3723. // requesting user or course (for example, if a user not in a domain
  3724. // attempts to access a domain-scoped alias).
  3725. func (r *CoursesAliasesService) Create(courseId string, coursealias *CourseAlias) *CoursesAliasesCreateCall {
  3726. c := &CoursesAliasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3727. c.courseId = courseId
  3728. c.coursealias = coursealias
  3729. return c
  3730. }
  3731. // Fields allows partial responses to be retrieved. See
  3732. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3733. // for more information.
  3734. func (c *CoursesAliasesCreateCall) Fields(s ...googleapi.Field) *CoursesAliasesCreateCall {
  3735. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3736. return c
  3737. }
  3738. // Context sets the context to be used in this call's Do method. Any
  3739. // pending HTTP request will be aborted if the provided context is
  3740. // canceled.
  3741. func (c *CoursesAliasesCreateCall) Context(ctx context.Context) *CoursesAliasesCreateCall {
  3742. c.ctx_ = ctx
  3743. return c
  3744. }
  3745. // Header returns an http.Header that can be modified by the caller to
  3746. // add HTTP headers to the request.
  3747. func (c *CoursesAliasesCreateCall) Header() http.Header {
  3748. if c.header_ == nil {
  3749. c.header_ = make(http.Header)
  3750. }
  3751. return c.header_
  3752. }
  3753. func (c *CoursesAliasesCreateCall) doRequest(alt string) (*http.Response, error) {
  3754. reqHeaders := make(http.Header)
  3755. for k, v := range c.header_ {
  3756. reqHeaders[k] = v
  3757. }
  3758. reqHeaders.Set("User-Agent", c.s.userAgent())
  3759. var body io.Reader = nil
  3760. body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursealias)
  3761. if err != nil {
  3762. return nil, err
  3763. }
  3764. reqHeaders.Set("Content-Type", "application/json")
  3765. c.urlParams_.Set("alt", alt)
  3766. c.urlParams_.Set("prettyPrint", "false")
  3767. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases")
  3768. urls += "?" + c.urlParams_.Encode()
  3769. req, err := http.NewRequest("POST", urls, body)
  3770. if err != nil {
  3771. return nil, err
  3772. }
  3773. req.Header = reqHeaders
  3774. googleapi.Expand(req.URL, map[string]string{
  3775. "courseId": c.courseId,
  3776. })
  3777. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3778. }
  3779. // Do executes the "classroom.courses.aliases.create" call.
  3780. // Exactly one of *CourseAlias or error will be non-nil. Any non-2xx
  3781. // status code is an error. Response headers are in either
  3782. // *CourseAlias.ServerResponse.Header or (if a response was returned at
  3783. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3784. // to check whether the returned error was because
  3785. // http.StatusNotModified was returned.
  3786. func (c *CoursesAliasesCreateCall) Do(opts ...googleapi.CallOption) (*CourseAlias, error) {
  3787. gensupport.SetOptions(c.urlParams_, opts...)
  3788. res, err := c.doRequest("json")
  3789. if res != nil && res.StatusCode == http.StatusNotModified {
  3790. if res.Body != nil {
  3791. res.Body.Close()
  3792. }
  3793. return nil, &googleapi.Error{
  3794. Code: res.StatusCode,
  3795. Header: res.Header,
  3796. }
  3797. }
  3798. if err != nil {
  3799. return nil, err
  3800. }
  3801. defer googleapi.CloseBody(res)
  3802. if err := googleapi.CheckResponse(res); err != nil {
  3803. return nil, err
  3804. }
  3805. ret := &CourseAlias{
  3806. ServerResponse: googleapi.ServerResponse{
  3807. Header: res.Header,
  3808. HTTPStatusCode: res.StatusCode,
  3809. },
  3810. }
  3811. target := &ret
  3812. if err := gensupport.DecodeResponse(target, res); err != nil {
  3813. return nil, err
  3814. }
  3815. return ret, nil
  3816. // {
  3817. // "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).",
  3818. // "flatPath": "v1/courses/{courseId}/aliases",
  3819. // "httpMethod": "POST",
  3820. // "id": "classroom.courses.aliases.create",
  3821. // "parameterOrder": [
  3822. // "courseId"
  3823. // ],
  3824. // "parameters": {
  3825. // "courseId": {
  3826. // "description": "Identifier of the course to alias.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3827. // "location": "path",
  3828. // "required": true,
  3829. // "type": "string"
  3830. // }
  3831. // },
  3832. // "path": "v1/courses/{courseId}/aliases",
  3833. // "request": {
  3834. // "$ref": "CourseAlias"
  3835. // },
  3836. // "response": {
  3837. // "$ref": "CourseAlias"
  3838. // },
  3839. // "scopes": [
  3840. // "https://www.googleapis.com/auth/classroom.courses"
  3841. // ]
  3842. // }
  3843. }
  3844. // method id "classroom.courses.aliases.delete":
  3845. type CoursesAliasesDeleteCall struct {
  3846. s *Service
  3847. courseId string
  3848. aliasid string
  3849. urlParams_ gensupport.URLParams
  3850. ctx_ context.Context
  3851. header_ http.Header
  3852. }
  3853. // Delete: Deletes an alias of a course.
  3854. //
  3855. // This method returns the following error codes:
  3856. //
  3857. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3858. // remove the
  3859. // alias or for access errors.
  3860. // * `NOT_FOUND` if the alias does not exist.
  3861. // * `FAILED_PRECONDITION` if the alias requested does not make sense
  3862. // for the
  3863. // requesting user or course (for example, if a user not in a domain
  3864. // attempts to delete a domain-scoped alias).
  3865. func (r *CoursesAliasesService) Delete(courseId string, aliasid string) *CoursesAliasesDeleteCall {
  3866. c := &CoursesAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3867. c.courseId = courseId
  3868. c.aliasid = aliasid
  3869. return c
  3870. }
  3871. // Fields allows partial responses to be retrieved. See
  3872. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3873. // for more information.
  3874. func (c *CoursesAliasesDeleteCall) Fields(s ...googleapi.Field) *CoursesAliasesDeleteCall {
  3875. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3876. return c
  3877. }
  3878. // Context sets the context to be used in this call's Do method. Any
  3879. // pending HTTP request will be aborted if the provided context is
  3880. // canceled.
  3881. func (c *CoursesAliasesDeleteCall) Context(ctx context.Context) *CoursesAliasesDeleteCall {
  3882. c.ctx_ = ctx
  3883. return c
  3884. }
  3885. // Header returns an http.Header that can be modified by the caller to
  3886. // add HTTP headers to the request.
  3887. func (c *CoursesAliasesDeleteCall) Header() http.Header {
  3888. if c.header_ == nil {
  3889. c.header_ = make(http.Header)
  3890. }
  3891. return c.header_
  3892. }
  3893. func (c *CoursesAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3894. reqHeaders := make(http.Header)
  3895. for k, v := range c.header_ {
  3896. reqHeaders[k] = v
  3897. }
  3898. reqHeaders.Set("User-Agent", c.s.userAgent())
  3899. var body io.Reader = nil
  3900. c.urlParams_.Set("alt", alt)
  3901. c.urlParams_.Set("prettyPrint", "false")
  3902. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases/{alias}")
  3903. urls += "?" + c.urlParams_.Encode()
  3904. req, err := http.NewRequest("DELETE", urls, body)
  3905. if err != nil {
  3906. return nil, err
  3907. }
  3908. req.Header = reqHeaders
  3909. googleapi.Expand(req.URL, map[string]string{
  3910. "courseId": c.courseId,
  3911. "alias": c.aliasid,
  3912. })
  3913. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3914. }
  3915. // Do executes the "classroom.courses.aliases.delete" call.
  3916. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3917. // code is an error. Response headers are in either
  3918. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3919. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3920. // check whether the returned error was because http.StatusNotModified
  3921. // was returned.
  3922. func (c *CoursesAliasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3923. gensupport.SetOptions(c.urlParams_, opts...)
  3924. res, err := c.doRequest("json")
  3925. if res != nil && res.StatusCode == http.StatusNotModified {
  3926. if res.Body != nil {
  3927. res.Body.Close()
  3928. }
  3929. return nil, &googleapi.Error{
  3930. Code: res.StatusCode,
  3931. Header: res.Header,
  3932. }
  3933. }
  3934. if err != nil {
  3935. return nil, err
  3936. }
  3937. defer googleapi.CloseBody(res)
  3938. if err := googleapi.CheckResponse(res); err != nil {
  3939. return nil, err
  3940. }
  3941. ret := &Empty{
  3942. ServerResponse: googleapi.ServerResponse{
  3943. Header: res.Header,
  3944. HTTPStatusCode: res.StatusCode,
  3945. },
  3946. }
  3947. target := &ret
  3948. if err := gensupport.DecodeResponse(target, res); err != nil {
  3949. return nil, err
  3950. }
  3951. return ret, nil
  3952. // {
  3953. // "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).",
  3954. // "flatPath": "v1/courses/{courseId}/aliases/{alias}",
  3955. // "httpMethod": "DELETE",
  3956. // "id": "classroom.courses.aliases.delete",
  3957. // "parameterOrder": [
  3958. // "courseId",
  3959. // "alias"
  3960. // ],
  3961. // "parameters": {
  3962. // "alias": {
  3963. // "description": "Alias to delete.\nThis may not be the Classroom-assigned identifier.",
  3964. // "location": "path",
  3965. // "required": true,
  3966. // "type": "string"
  3967. // },
  3968. // "courseId": {
  3969. // "description": "Identifier of the course whose alias should be deleted.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  3970. // "location": "path",
  3971. // "required": true,
  3972. // "type": "string"
  3973. // }
  3974. // },
  3975. // "path": "v1/courses/{courseId}/aliases/{alias}",
  3976. // "response": {
  3977. // "$ref": "Empty"
  3978. // },
  3979. // "scopes": [
  3980. // "https://www.googleapis.com/auth/classroom.courses"
  3981. // ]
  3982. // }
  3983. }
  3984. // method id "classroom.courses.aliases.list":
  3985. type CoursesAliasesListCall struct {
  3986. s *Service
  3987. courseId string
  3988. urlParams_ gensupport.URLParams
  3989. ifNoneMatch_ string
  3990. ctx_ context.Context
  3991. header_ http.Header
  3992. }
  3993. // List: Returns a list of aliases for a course.
  3994. //
  3995. // This method returns the following error codes:
  3996. //
  3997. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  3998. // access the
  3999. // course or for access errors.
  4000. // * `NOT_FOUND` if the course does not exist.
  4001. func (r *CoursesAliasesService) List(courseId string) *CoursesAliasesListCall {
  4002. c := &CoursesAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4003. c.courseId = courseId
  4004. return c
  4005. }
  4006. // PageSize sets the optional parameter "pageSize": Maximum number of
  4007. // items to return. Zero or unspecified indicates that the
  4008. // server may assign a maximum.
  4009. //
  4010. // The server may return fewer than the specified number of results.
  4011. func (c *CoursesAliasesListCall) PageSize(pageSize int64) *CoursesAliasesListCall {
  4012. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4013. return c
  4014. }
  4015. // PageToken sets the optional parameter "pageToken":
  4016. // nextPageToken
  4017. // value returned from a previous
  4018. // list call,
  4019. // indicating that the subsequent page of results should be
  4020. // returned.
  4021. //
  4022. // The list request
  4023. // must be otherwise identical to the one that resulted in this token.
  4024. func (c *CoursesAliasesListCall) PageToken(pageToken string) *CoursesAliasesListCall {
  4025. c.urlParams_.Set("pageToken", pageToken)
  4026. return c
  4027. }
  4028. // Fields allows partial responses to be retrieved. See
  4029. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4030. // for more information.
  4031. func (c *CoursesAliasesListCall) Fields(s ...googleapi.Field) *CoursesAliasesListCall {
  4032. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4033. return c
  4034. }
  4035. // IfNoneMatch sets the optional parameter which makes the operation
  4036. // fail if the object's ETag matches the given value. This is useful for
  4037. // getting updates only after the object has changed since the last
  4038. // request. Use googleapi.IsNotModified to check whether the response
  4039. // error from Do is the result of In-None-Match.
  4040. func (c *CoursesAliasesListCall) IfNoneMatch(entityTag string) *CoursesAliasesListCall {
  4041. c.ifNoneMatch_ = entityTag
  4042. return c
  4043. }
  4044. // Context sets the context to be used in this call's Do method. Any
  4045. // pending HTTP request will be aborted if the provided context is
  4046. // canceled.
  4047. func (c *CoursesAliasesListCall) Context(ctx context.Context) *CoursesAliasesListCall {
  4048. c.ctx_ = ctx
  4049. return c
  4050. }
  4051. // Header returns an http.Header that can be modified by the caller to
  4052. // add HTTP headers to the request.
  4053. func (c *CoursesAliasesListCall) Header() http.Header {
  4054. if c.header_ == nil {
  4055. c.header_ = make(http.Header)
  4056. }
  4057. return c.header_
  4058. }
  4059. func (c *CoursesAliasesListCall) doRequest(alt string) (*http.Response, error) {
  4060. reqHeaders := make(http.Header)
  4061. for k, v := range c.header_ {
  4062. reqHeaders[k] = v
  4063. }
  4064. reqHeaders.Set("User-Agent", c.s.userAgent())
  4065. if c.ifNoneMatch_ != "" {
  4066. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4067. }
  4068. var body io.Reader = nil
  4069. c.urlParams_.Set("alt", alt)
  4070. c.urlParams_.Set("prettyPrint", "false")
  4071. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/aliases")
  4072. urls += "?" + c.urlParams_.Encode()
  4073. req, err := http.NewRequest("GET", urls, body)
  4074. if err != nil {
  4075. return nil, err
  4076. }
  4077. req.Header = reqHeaders
  4078. googleapi.Expand(req.URL, map[string]string{
  4079. "courseId": c.courseId,
  4080. })
  4081. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4082. }
  4083. // Do executes the "classroom.courses.aliases.list" call.
  4084. // Exactly one of *ListCourseAliasesResponse or error will be non-nil.
  4085. // Any non-2xx status code is an error. Response headers are in either
  4086. // *ListCourseAliasesResponse.ServerResponse.Header or (if a response
  4087. // was returned at all) in error.(*googleapi.Error).Header. Use
  4088. // googleapi.IsNotModified to check whether the returned error was
  4089. // because http.StatusNotModified was returned.
  4090. func (c *CoursesAliasesListCall) Do(opts ...googleapi.CallOption) (*ListCourseAliasesResponse, error) {
  4091. gensupport.SetOptions(c.urlParams_, opts...)
  4092. res, err := c.doRequest("json")
  4093. if res != nil && res.StatusCode == http.StatusNotModified {
  4094. if res.Body != nil {
  4095. res.Body.Close()
  4096. }
  4097. return nil, &googleapi.Error{
  4098. Code: res.StatusCode,
  4099. Header: res.Header,
  4100. }
  4101. }
  4102. if err != nil {
  4103. return nil, err
  4104. }
  4105. defer googleapi.CloseBody(res)
  4106. if err := googleapi.CheckResponse(res); err != nil {
  4107. return nil, err
  4108. }
  4109. ret := &ListCourseAliasesResponse{
  4110. ServerResponse: googleapi.ServerResponse{
  4111. Header: res.Header,
  4112. HTTPStatusCode: res.StatusCode,
  4113. },
  4114. }
  4115. target := &ret
  4116. if err := gensupport.DecodeResponse(target, res); err != nil {
  4117. return nil, err
  4118. }
  4119. return ret, nil
  4120. // {
  4121. // "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.",
  4122. // "flatPath": "v1/courses/{courseId}/aliases",
  4123. // "httpMethod": "GET",
  4124. // "id": "classroom.courses.aliases.list",
  4125. // "parameterOrder": [
  4126. // "courseId"
  4127. // ],
  4128. // "parameters": {
  4129. // "courseId": {
  4130. // "description": "The identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4131. // "location": "path",
  4132. // "required": true,
  4133. // "type": "string"
  4134. // },
  4135. // "pageSize": {
  4136. // "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.",
  4137. // "format": "int32",
  4138. // "location": "query",
  4139. // "type": "integer"
  4140. // },
  4141. // "pageToken": {
  4142. // "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.",
  4143. // "location": "query",
  4144. // "type": "string"
  4145. // }
  4146. // },
  4147. // "path": "v1/courses/{courseId}/aliases",
  4148. // "response": {
  4149. // "$ref": "ListCourseAliasesResponse"
  4150. // },
  4151. // "scopes": [
  4152. // "https://www.googleapis.com/auth/classroom.courses",
  4153. // "https://www.googleapis.com/auth/classroom.courses.readonly"
  4154. // ]
  4155. // }
  4156. }
  4157. // Pages invokes f for each page of results.
  4158. // A non-nil error returned from f will halt the iteration.
  4159. // The provided context supersedes any context provided to the Context method.
  4160. func (c *CoursesAliasesListCall) Pages(ctx context.Context, f func(*ListCourseAliasesResponse) error) error {
  4161. c.ctx_ = ctx
  4162. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4163. for {
  4164. x, err := c.Do()
  4165. if err != nil {
  4166. return err
  4167. }
  4168. if err := f(x); err != nil {
  4169. return err
  4170. }
  4171. if x.NextPageToken == "" {
  4172. return nil
  4173. }
  4174. c.PageToken(x.NextPageToken)
  4175. }
  4176. }
  4177. // method id "classroom.courses.announcements.create":
  4178. type CoursesAnnouncementsCreateCall struct {
  4179. s *Service
  4180. courseId string
  4181. announcement *Announcement
  4182. urlParams_ gensupport.URLParams
  4183. ctx_ context.Context
  4184. header_ http.Header
  4185. }
  4186. // Create: Creates an announcement.
  4187. //
  4188. // This method returns the following error codes:
  4189. //
  4190. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4191. // access the
  4192. // requested course, create announcements in the requested course, share
  4193. // a
  4194. // Drive attachment, or for access errors.
  4195. // * `INVALID_ARGUMENT` if the request is malformed.
  4196. // * `NOT_FOUND` if the requested course does not exist.
  4197. // * `FAILED_PRECONDITION` for the following request error:
  4198. // * AttachmentNotVisible
  4199. func (r *CoursesAnnouncementsService) Create(courseId string, announcement *Announcement) *CoursesAnnouncementsCreateCall {
  4200. c := &CoursesAnnouncementsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4201. c.courseId = courseId
  4202. c.announcement = announcement
  4203. return c
  4204. }
  4205. // Fields allows partial responses to be retrieved. See
  4206. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4207. // for more information.
  4208. func (c *CoursesAnnouncementsCreateCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsCreateCall {
  4209. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4210. return c
  4211. }
  4212. // Context sets the context to be used in this call's Do method. Any
  4213. // pending HTTP request will be aborted if the provided context is
  4214. // canceled.
  4215. func (c *CoursesAnnouncementsCreateCall) Context(ctx context.Context) *CoursesAnnouncementsCreateCall {
  4216. c.ctx_ = ctx
  4217. return c
  4218. }
  4219. // Header returns an http.Header that can be modified by the caller to
  4220. // add HTTP headers to the request.
  4221. func (c *CoursesAnnouncementsCreateCall) Header() http.Header {
  4222. if c.header_ == nil {
  4223. c.header_ = make(http.Header)
  4224. }
  4225. return c.header_
  4226. }
  4227. func (c *CoursesAnnouncementsCreateCall) doRequest(alt string) (*http.Response, error) {
  4228. reqHeaders := make(http.Header)
  4229. for k, v := range c.header_ {
  4230. reqHeaders[k] = v
  4231. }
  4232. reqHeaders.Set("User-Agent", c.s.userAgent())
  4233. var body io.Reader = nil
  4234. body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement)
  4235. if err != nil {
  4236. return nil, err
  4237. }
  4238. reqHeaders.Set("Content-Type", "application/json")
  4239. c.urlParams_.Set("alt", alt)
  4240. c.urlParams_.Set("prettyPrint", "false")
  4241. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements")
  4242. urls += "?" + c.urlParams_.Encode()
  4243. req, err := http.NewRequest("POST", urls, body)
  4244. if err != nil {
  4245. return nil, err
  4246. }
  4247. req.Header = reqHeaders
  4248. googleapi.Expand(req.URL, map[string]string{
  4249. "courseId": c.courseId,
  4250. })
  4251. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4252. }
  4253. // Do executes the "classroom.courses.announcements.create" call.
  4254. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4255. // status code is an error. Response headers are in either
  4256. // *Announcement.ServerResponse.Header or (if a response was returned at
  4257. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4258. // to check whether the returned error was because
  4259. // http.StatusNotModified was returned.
  4260. func (c *CoursesAnnouncementsCreateCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4261. gensupport.SetOptions(c.urlParams_, opts...)
  4262. res, err := c.doRequest("json")
  4263. if res != nil && res.StatusCode == http.StatusNotModified {
  4264. if res.Body != nil {
  4265. res.Body.Close()
  4266. }
  4267. return nil, &googleapi.Error{
  4268. Code: res.StatusCode,
  4269. Header: res.Header,
  4270. }
  4271. }
  4272. if err != nil {
  4273. return nil, err
  4274. }
  4275. defer googleapi.CloseBody(res)
  4276. if err := googleapi.CheckResponse(res); err != nil {
  4277. return nil, err
  4278. }
  4279. ret := &Announcement{
  4280. ServerResponse: googleapi.ServerResponse{
  4281. Header: res.Header,
  4282. HTTPStatusCode: res.StatusCode,
  4283. },
  4284. }
  4285. target := &ret
  4286. if err := gensupport.DecodeResponse(target, res); err != nil {
  4287. return nil, err
  4288. }
  4289. return ret, nil
  4290. // {
  4291. // "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",
  4292. // "flatPath": "v1/courses/{courseId}/announcements",
  4293. // "httpMethod": "POST",
  4294. // "id": "classroom.courses.announcements.create",
  4295. // "parameterOrder": [
  4296. // "courseId"
  4297. // ],
  4298. // "parameters": {
  4299. // "courseId": {
  4300. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4301. // "location": "path",
  4302. // "required": true,
  4303. // "type": "string"
  4304. // }
  4305. // },
  4306. // "path": "v1/courses/{courseId}/announcements",
  4307. // "request": {
  4308. // "$ref": "Announcement"
  4309. // },
  4310. // "response": {
  4311. // "$ref": "Announcement"
  4312. // },
  4313. // "scopes": [
  4314. // "https://www.googleapis.com/auth/classroom.announcements"
  4315. // ]
  4316. // }
  4317. }
  4318. // method id "classroom.courses.announcements.delete":
  4319. type CoursesAnnouncementsDeleteCall struct {
  4320. s *Service
  4321. courseId string
  4322. id string
  4323. urlParams_ gensupport.URLParams
  4324. ctx_ context.Context
  4325. header_ http.Header
  4326. }
  4327. // Delete: Deletes an announcement.
  4328. //
  4329. // This request must be made by the Developer Console project of
  4330. // the
  4331. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  4332. // used to
  4333. // create the corresponding announcement item.
  4334. //
  4335. // This method returns the following error codes:
  4336. //
  4337. // * `PERMISSION_DENIED` if the requesting developer project did not
  4338. // create
  4339. // the corresponding announcement, if the requesting user is not
  4340. // permitted
  4341. // to delete the requested course or for access errors.
  4342. // * `FAILED_PRECONDITION` if the requested announcement has already
  4343. // been
  4344. // deleted.
  4345. // * `NOT_FOUND` if no course exists with the requested ID.
  4346. func (r *CoursesAnnouncementsService) Delete(courseId string, id string) *CoursesAnnouncementsDeleteCall {
  4347. c := &CoursesAnnouncementsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4348. c.courseId = courseId
  4349. c.id = id
  4350. return c
  4351. }
  4352. // Fields allows partial responses to be retrieved. See
  4353. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4354. // for more information.
  4355. func (c *CoursesAnnouncementsDeleteCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsDeleteCall {
  4356. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4357. return c
  4358. }
  4359. // Context sets the context to be used in this call's Do method. Any
  4360. // pending HTTP request will be aborted if the provided context is
  4361. // canceled.
  4362. func (c *CoursesAnnouncementsDeleteCall) Context(ctx context.Context) *CoursesAnnouncementsDeleteCall {
  4363. c.ctx_ = ctx
  4364. return c
  4365. }
  4366. // Header returns an http.Header that can be modified by the caller to
  4367. // add HTTP headers to the request.
  4368. func (c *CoursesAnnouncementsDeleteCall) Header() http.Header {
  4369. if c.header_ == nil {
  4370. c.header_ = make(http.Header)
  4371. }
  4372. return c.header_
  4373. }
  4374. func (c *CoursesAnnouncementsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4375. reqHeaders := make(http.Header)
  4376. for k, v := range c.header_ {
  4377. reqHeaders[k] = v
  4378. }
  4379. reqHeaders.Set("User-Agent", c.s.userAgent())
  4380. var body io.Reader = nil
  4381. c.urlParams_.Set("alt", alt)
  4382. c.urlParams_.Set("prettyPrint", "false")
  4383. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}")
  4384. urls += "?" + c.urlParams_.Encode()
  4385. req, err := http.NewRequest("DELETE", urls, body)
  4386. if err != nil {
  4387. return nil, err
  4388. }
  4389. req.Header = reqHeaders
  4390. googleapi.Expand(req.URL, map[string]string{
  4391. "courseId": c.courseId,
  4392. "id": c.id,
  4393. })
  4394. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4395. }
  4396. // Do executes the "classroom.courses.announcements.delete" call.
  4397. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4398. // code is an error. Response headers are in either
  4399. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4400. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4401. // check whether the returned error was because http.StatusNotModified
  4402. // was returned.
  4403. func (c *CoursesAnnouncementsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4404. gensupport.SetOptions(c.urlParams_, opts...)
  4405. res, err := c.doRequest("json")
  4406. if res != nil && res.StatusCode == http.StatusNotModified {
  4407. if res.Body != nil {
  4408. res.Body.Close()
  4409. }
  4410. return nil, &googleapi.Error{
  4411. Code: res.StatusCode,
  4412. Header: res.Header,
  4413. }
  4414. }
  4415. if err != nil {
  4416. return nil, err
  4417. }
  4418. defer googleapi.CloseBody(res)
  4419. if err := googleapi.CheckResponse(res); err != nil {
  4420. return nil, err
  4421. }
  4422. ret := &Empty{
  4423. ServerResponse: googleapi.ServerResponse{
  4424. Header: res.Header,
  4425. HTTPStatusCode: res.StatusCode,
  4426. },
  4427. }
  4428. target := &ret
  4429. if err := gensupport.DecodeResponse(target, res); err != nil {
  4430. return nil, err
  4431. }
  4432. return ret, nil
  4433. // {
  4434. // "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.",
  4435. // "flatPath": "v1/courses/{courseId}/announcements/{id}",
  4436. // "httpMethod": "DELETE",
  4437. // "id": "classroom.courses.announcements.delete",
  4438. // "parameterOrder": [
  4439. // "courseId",
  4440. // "id"
  4441. // ],
  4442. // "parameters": {
  4443. // "courseId": {
  4444. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4445. // "location": "path",
  4446. // "required": true,
  4447. // "type": "string"
  4448. // },
  4449. // "id": {
  4450. // "description": "Identifier of the announcement to delete.\nThis identifier is a Classroom-assigned identifier.",
  4451. // "location": "path",
  4452. // "required": true,
  4453. // "type": "string"
  4454. // }
  4455. // },
  4456. // "path": "v1/courses/{courseId}/announcements/{id}",
  4457. // "response": {
  4458. // "$ref": "Empty"
  4459. // },
  4460. // "scopes": [
  4461. // "https://www.googleapis.com/auth/classroom.announcements"
  4462. // ]
  4463. // }
  4464. }
  4465. // method id "classroom.courses.announcements.get":
  4466. type CoursesAnnouncementsGetCall struct {
  4467. s *Service
  4468. courseId string
  4469. id string
  4470. urlParams_ gensupport.URLParams
  4471. ifNoneMatch_ string
  4472. ctx_ context.Context
  4473. header_ http.Header
  4474. }
  4475. // Get: Returns an announcement.
  4476. //
  4477. // This method returns the following error codes:
  4478. //
  4479. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4480. // access the
  4481. // requested course or announcement, or for access errors.
  4482. // * `INVALID_ARGUMENT` if the request is malformed.
  4483. // * `NOT_FOUND` if the requested course or announcement does not exist.
  4484. func (r *CoursesAnnouncementsService) Get(courseId string, id string) *CoursesAnnouncementsGetCall {
  4485. c := &CoursesAnnouncementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4486. c.courseId = courseId
  4487. c.id = id
  4488. return c
  4489. }
  4490. // Fields allows partial responses to be retrieved. See
  4491. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4492. // for more information.
  4493. func (c *CoursesAnnouncementsGetCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsGetCall {
  4494. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4495. return c
  4496. }
  4497. // IfNoneMatch sets the optional parameter which makes the operation
  4498. // fail if the object's ETag matches the given value. This is useful for
  4499. // getting updates only after the object has changed since the last
  4500. // request. Use googleapi.IsNotModified to check whether the response
  4501. // error from Do is the result of In-None-Match.
  4502. func (c *CoursesAnnouncementsGetCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsGetCall {
  4503. c.ifNoneMatch_ = entityTag
  4504. return c
  4505. }
  4506. // Context sets the context to be used in this call's Do method. Any
  4507. // pending HTTP request will be aborted if the provided context is
  4508. // canceled.
  4509. func (c *CoursesAnnouncementsGetCall) Context(ctx context.Context) *CoursesAnnouncementsGetCall {
  4510. c.ctx_ = ctx
  4511. return c
  4512. }
  4513. // Header returns an http.Header that can be modified by the caller to
  4514. // add HTTP headers to the request.
  4515. func (c *CoursesAnnouncementsGetCall) Header() http.Header {
  4516. if c.header_ == nil {
  4517. c.header_ = make(http.Header)
  4518. }
  4519. return c.header_
  4520. }
  4521. func (c *CoursesAnnouncementsGetCall) doRequest(alt string) (*http.Response, error) {
  4522. reqHeaders := make(http.Header)
  4523. for k, v := range c.header_ {
  4524. reqHeaders[k] = v
  4525. }
  4526. reqHeaders.Set("User-Agent", c.s.userAgent())
  4527. if c.ifNoneMatch_ != "" {
  4528. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4529. }
  4530. var body io.Reader = nil
  4531. c.urlParams_.Set("alt", alt)
  4532. c.urlParams_.Set("prettyPrint", "false")
  4533. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}")
  4534. urls += "?" + c.urlParams_.Encode()
  4535. req, err := http.NewRequest("GET", urls, body)
  4536. if err != nil {
  4537. return nil, err
  4538. }
  4539. req.Header = reqHeaders
  4540. googleapi.Expand(req.URL, map[string]string{
  4541. "courseId": c.courseId,
  4542. "id": c.id,
  4543. })
  4544. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4545. }
  4546. // Do executes the "classroom.courses.announcements.get" call.
  4547. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4548. // status code is an error. Response headers are in either
  4549. // *Announcement.ServerResponse.Header or (if a response was returned at
  4550. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4551. // to check whether the returned error was because
  4552. // http.StatusNotModified was returned.
  4553. func (c *CoursesAnnouncementsGetCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4554. gensupport.SetOptions(c.urlParams_, opts...)
  4555. res, err := c.doRequest("json")
  4556. if res != nil && res.StatusCode == http.StatusNotModified {
  4557. if res.Body != nil {
  4558. res.Body.Close()
  4559. }
  4560. return nil, &googleapi.Error{
  4561. Code: res.StatusCode,
  4562. Header: res.Header,
  4563. }
  4564. }
  4565. if err != nil {
  4566. return nil, err
  4567. }
  4568. defer googleapi.CloseBody(res)
  4569. if err := googleapi.CheckResponse(res); err != nil {
  4570. return nil, err
  4571. }
  4572. ret := &Announcement{
  4573. ServerResponse: googleapi.ServerResponse{
  4574. Header: res.Header,
  4575. HTTPStatusCode: res.StatusCode,
  4576. },
  4577. }
  4578. target := &ret
  4579. if err := gensupport.DecodeResponse(target, res); err != nil {
  4580. return nil, err
  4581. }
  4582. return ret, nil
  4583. // {
  4584. // "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.",
  4585. // "flatPath": "v1/courses/{courseId}/announcements/{id}",
  4586. // "httpMethod": "GET",
  4587. // "id": "classroom.courses.announcements.get",
  4588. // "parameterOrder": [
  4589. // "courseId",
  4590. // "id"
  4591. // ],
  4592. // "parameters": {
  4593. // "courseId": {
  4594. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4595. // "location": "path",
  4596. // "required": true,
  4597. // "type": "string"
  4598. // },
  4599. // "id": {
  4600. // "description": "Identifier of the announcement.",
  4601. // "location": "path",
  4602. // "required": true,
  4603. // "type": "string"
  4604. // }
  4605. // },
  4606. // "path": "v1/courses/{courseId}/announcements/{id}",
  4607. // "response": {
  4608. // "$ref": "Announcement"
  4609. // },
  4610. // "scopes": [
  4611. // "https://www.googleapis.com/auth/classroom.announcements",
  4612. // "https://www.googleapis.com/auth/classroom.announcements.readonly"
  4613. // ]
  4614. // }
  4615. }
  4616. // method id "classroom.courses.announcements.list":
  4617. type CoursesAnnouncementsListCall struct {
  4618. s *Service
  4619. courseId string
  4620. urlParams_ gensupport.URLParams
  4621. ifNoneMatch_ string
  4622. ctx_ context.Context
  4623. header_ http.Header
  4624. }
  4625. // List: Returns a list of announcements that the requester is permitted
  4626. // to view.
  4627. //
  4628. // Course students may only view `PUBLISHED` announcements. Course
  4629. // teachers
  4630. // and domain administrators may view all announcements.
  4631. //
  4632. // This method returns the following error codes:
  4633. //
  4634. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4635. // access
  4636. // the requested course or for access errors.
  4637. // * `INVALID_ARGUMENT` if the request is malformed.
  4638. // * `NOT_FOUND` if the requested course does not exist.
  4639. func (r *CoursesAnnouncementsService) List(courseId string) *CoursesAnnouncementsListCall {
  4640. c := &CoursesAnnouncementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4641. c.courseId = courseId
  4642. return c
  4643. }
  4644. // AnnouncementStates sets the optional parameter "announcementStates":
  4645. // Restriction on the `state` of announcements returned.
  4646. // If this argument is left unspecified, the default value is
  4647. // `PUBLISHED`.
  4648. //
  4649. // Possible values:
  4650. // "ANNOUNCEMENT_STATE_UNSPECIFIED"
  4651. // "PUBLISHED"
  4652. // "DRAFT"
  4653. // "DELETED"
  4654. func (c *CoursesAnnouncementsListCall) AnnouncementStates(announcementStates ...string) *CoursesAnnouncementsListCall {
  4655. c.urlParams_.SetMulti("announcementStates", append([]string{}, announcementStates...))
  4656. return c
  4657. }
  4658. // OrderBy sets the optional parameter "orderBy": Optional sort ordering
  4659. // for results. A comma-separated list of fields with
  4660. // an optional sort direction keyword. Supported field is
  4661. // `updateTime`.
  4662. // Supported direction keywords are `asc` and `desc`.
  4663. // If not specified, `updateTime desc` is the default
  4664. // behavior.
  4665. // Examples: `updateTime asc`, `updateTime`
  4666. func (c *CoursesAnnouncementsListCall) OrderBy(orderBy string) *CoursesAnnouncementsListCall {
  4667. c.urlParams_.Set("orderBy", orderBy)
  4668. return c
  4669. }
  4670. // PageSize sets the optional parameter "pageSize": Maximum number of
  4671. // items to return. Zero or unspecified indicates that the
  4672. // server may assign a maximum.
  4673. //
  4674. // The server may return fewer than the specified number of results.
  4675. func (c *CoursesAnnouncementsListCall) PageSize(pageSize int64) *CoursesAnnouncementsListCall {
  4676. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4677. return c
  4678. }
  4679. // PageToken sets the optional parameter "pageToken":
  4680. // nextPageToken
  4681. // value returned from a previous
  4682. // list call,
  4683. // indicating that the subsequent page of results should be
  4684. // returned.
  4685. //
  4686. // The list request
  4687. // must be otherwise identical to the one that resulted in this token.
  4688. func (c *CoursesAnnouncementsListCall) PageToken(pageToken string) *CoursesAnnouncementsListCall {
  4689. c.urlParams_.Set("pageToken", pageToken)
  4690. return c
  4691. }
  4692. // Fields allows partial responses to be retrieved. See
  4693. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4694. // for more information.
  4695. func (c *CoursesAnnouncementsListCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsListCall {
  4696. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4697. return c
  4698. }
  4699. // IfNoneMatch sets the optional parameter which makes the operation
  4700. // fail if the object's ETag matches the given value. This is useful for
  4701. // getting updates only after the object has changed since the last
  4702. // request. Use googleapi.IsNotModified to check whether the response
  4703. // error from Do is the result of In-None-Match.
  4704. func (c *CoursesAnnouncementsListCall) IfNoneMatch(entityTag string) *CoursesAnnouncementsListCall {
  4705. c.ifNoneMatch_ = entityTag
  4706. return c
  4707. }
  4708. // Context sets the context to be used in this call's Do method. Any
  4709. // pending HTTP request will be aborted if the provided context is
  4710. // canceled.
  4711. func (c *CoursesAnnouncementsListCall) Context(ctx context.Context) *CoursesAnnouncementsListCall {
  4712. c.ctx_ = ctx
  4713. return c
  4714. }
  4715. // Header returns an http.Header that can be modified by the caller to
  4716. // add HTTP headers to the request.
  4717. func (c *CoursesAnnouncementsListCall) Header() http.Header {
  4718. if c.header_ == nil {
  4719. c.header_ = make(http.Header)
  4720. }
  4721. return c.header_
  4722. }
  4723. func (c *CoursesAnnouncementsListCall) doRequest(alt string) (*http.Response, error) {
  4724. reqHeaders := make(http.Header)
  4725. for k, v := range c.header_ {
  4726. reqHeaders[k] = v
  4727. }
  4728. reqHeaders.Set("User-Agent", c.s.userAgent())
  4729. if c.ifNoneMatch_ != "" {
  4730. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4731. }
  4732. var body io.Reader = nil
  4733. c.urlParams_.Set("alt", alt)
  4734. c.urlParams_.Set("prettyPrint", "false")
  4735. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements")
  4736. urls += "?" + c.urlParams_.Encode()
  4737. req, err := http.NewRequest("GET", urls, body)
  4738. if err != nil {
  4739. return nil, err
  4740. }
  4741. req.Header = reqHeaders
  4742. googleapi.Expand(req.URL, map[string]string{
  4743. "courseId": c.courseId,
  4744. })
  4745. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4746. }
  4747. // Do executes the "classroom.courses.announcements.list" call.
  4748. // Exactly one of *ListAnnouncementsResponse or error will be non-nil.
  4749. // Any non-2xx status code is an error. Response headers are in either
  4750. // *ListAnnouncementsResponse.ServerResponse.Header or (if a response
  4751. // was returned at all) in error.(*googleapi.Error).Header. Use
  4752. // googleapi.IsNotModified to check whether the returned error was
  4753. // because http.StatusNotModified was returned.
  4754. func (c *CoursesAnnouncementsListCall) Do(opts ...googleapi.CallOption) (*ListAnnouncementsResponse, error) {
  4755. gensupport.SetOptions(c.urlParams_, opts...)
  4756. res, err := c.doRequest("json")
  4757. if res != nil && res.StatusCode == http.StatusNotModified {
  4758. if res.Body != nil {
  4759. res.Body.Close()
  4760. }
  4761. return nil, &googleapi.Error{
  4762. Code: res.StatusCode,
  4763. Header: res.Header,
  4764. }
  4765. }
  4766. if err != nil {
  4767. return nil, err
  4768. }
  4769. defer googleapi.CloseBody(res)
  4770. if err := googleapi.CheckResponse(res); err != nil {
  4771. return nil, err
  4772. }
  4773. ret := &ListAnnouncementsResponse{
  4774. ServerResponse: googleapi.ServerResponse{
  4775. Header: res.Header,
  4776. HTTPStatusCode: res.StatusCode,
  4777. },
  4778. }
  4779. target := &ret
  4780. if err := gensupport.DecodeResponse(target, res); err != nil {
  4781. return nil, err
  4782. }
  4783. return ret, nil
  4784. // {
  4785. // "description": "Returns a list of 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.",
  4786. // "flatPath": "v1/courses/{courseId}/announcements",
  4787. // "httpMethod": "GET",
  4788. // "id": "classroom.courses.announcements.list",
  4789. // "parameterOrder": [
  4790. // "courseId"
  4791. // ],
  4792. // "parameters": {
  4793. // "announcementStates": {
  4794. // "description": "Restriction on the `state` of announcements returned.\nIf this argument is left unspecified, the default value is `PUBLISHED`.",
  4795. // "enum": [
  4796. // "ANNOUNCEMENT_STATE_UNSPECIFIED",
  4797. // "PUBLISHED",
  4798. // "DRAFT",
  4799. // "DELETED"
  4800. // ],
  4801. // "location": "query",
  4802. // "repeated": true,
  4803. // "type": "string"
  4804. // },
  4805. // "courseId": {
  4806. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4807. // "location": "path",
  4808. // "required": true,
  4809. // "type": "string"
  4810. // },
  4811. // "orderBy": {
  4812. // "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`",
  4813. // "location": "query",
  4814. // "type": "string"
  4815. // },
  4816. // "pageSize": {
  4817. // "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.",
  4818. // "format": "int32",
  4819. // "location": "query",
  4820. // "type": "integer"
  4821. // },
  4822. // "pageToken": {
  4823. // "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.",
  4824. // "location": "query",
  4825. // "type": "string"
  4826. // }
  4827. // },
  4828. // "path": "v1/courses/{courseId}/announcements",
  4829. // "response": {
  4830. // "$ref": "ListAnnouncementsResponse"
  4831. // },
  4832. // "scopes": [
  4833. // "https://www.googleapis.com/auth/classroom.announcements",
  4834. // "https://www.googleapis.com/auth/classroom.announcements.readonly"
  4835. // ]
  4836. // }
  4837. }
  4838. // Pages invokes f for each page of results.
  4839. // A non-nil error returned from f will halt the iteration.
  4840. // The provided context supersedes any context provided to the Context method.
  4841. func (c *CoursesAnnouncementsListCall) Pages(ctx context.Context, f func(*ListAnnouncementsResponse) error) error {
  4842. c.ctx_ = ctx
  4843. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4844. for {
  4845. x, err := c.Do()
  4846. if err != nil {
  4847. return err
  4848. }
  4849. if err := f(x); err != nil {
  4850. return err
  4851. }
  4852. if x.NextPageToken == "" {
  4853. return nil
  4854. }
  4855. c.PageToken(x.NextPageToken)
  4856. }
  4857. }
  4858. // method id "classroom.courses.announcements.modifyAssignees":
  4859. type CoursesAnnouncementsModifyAssigneesCall struct {
  4860. s *Service
  4861. courseId string
  4862. id string
  4863. modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest
  4864. urlParams_ gensupport.URLParams
  4865. ctx_ context.Context
  4866. header_ http.Header
  4867. }
  4868. // ModifyAssignees: Modifies assignee mode and options of an
  4869. // announcement.
  4870. //
  4871. // Only a teacher of the course that contains the announcement may
  4872. // call this method.
  4873. //
  4874. // This method returns the following error codes:
  4875. //
  4876. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  4877. // access the
  4878. // requested course or course work or for access errors.
  4879. // * `INVALID_ARGUMENT` if the request is malformed.
  4880. // * `NOT_FOUND` if the requested course or course work does not exist.
  4881. func (r *CoursesAnnouncementsService) ModifyAssignees(courseId string, id string, modifyannouncementassigneesrequest *ModifyAnnouncementAssigneesRequest) *CoursesAnnouncementsModifyAssigneesCall {
  4882. c := &CoursesAnnouncementsModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4883. c.courseId = courseId
  4884. c.id = id
  4885. c.modifyannouncementassigneesrequest = modifyannouncementassigneesrequest
  4886. return c
  4887. }
  4888. // Fields allows partial responses to be retrieved. See
  4889. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4890. // for more information.
  4891. func (c *CoursesAnnouncementsModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsModifyAssigneesCall {
  4892. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4893. return c
  4894. }
  4895. // Context sets the context to be used in this call's Do method. Any
  4896. // pending HTTP request will be aborted if the provided context is
  4897. // canceled.
  4898. func (c *CoursesAnnouncementsModifyAssigneesCall) Context(ctx context.Context) *CoursesAnnouncementsModifyAssigneesCall {
  4899. c.ctx_ = ctx
  4900. return c
  4901. }
  4902. // Header returns an http.Header that can be modified by the caller to
  4903. // add HTTP headers to the request.
  4904. func (c *CoursesAnnouncementsModifyAssigneesCall) Header() http.Header {
  4905. if c.header_ == nil {
  4906. c.header_ = make(http.Header)
  4907. }
  4908. return c.header_
  4909. }
  4910. func (c *CoursesAnnouncementsModifyAssigneesCall) doRequest(alt string) (*http.Response, error) {
  4911. reqHeaders := make(http.Header)
  4912. for k, v := range c.header_ {
  4913. reqHeaders[k] = v
  4914. }
  4915. reqHeaders.Set("User-Agent", c.s.userAgent())
  4916. var body io.Reader = nil
  4917. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyannouncementassigneesrequest)
  4918. if err != nil {
  4919. return nil, err
  4920. }
  4921. reqHeaders.Set("Content-Type", "application/json")
  4922. c.urlParams_.Set("alt", alt)
  4923. c.urlParams_.Set("prettyPrint", "false")
  4924. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}:modifyAssignees")
  4925. urls += "?" + c.urlParams_.Encode()
  4926. req, err := http.NewRequest("POST", urls, body)
  4927. if err != nil {
  4928. return nil, err
  4929. }
  4930. req.Header = reqHeaders
  4931. googleapi.Expand(req.URL, map[string]string{
  4932. "courseId": c.courseId,
  4933. "id": c.id,
  4934. })
  4935. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4936. }
  4937. // Do executes the "classroom.courses.announcements.modifyAssignees" call.
  4938. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  4939. // status code is an error. Response headers are in either
  4940. // *Announcement.ServerResponse.Header or (if a response was returned at
  4941. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4942. // to check whether the returned error was because
  4943. // http.StatusNotModified was returned.
  4944. func (c *CoursesAnnouncementsModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  4945. gensupport.SetOptions(c.urlParams_, opts...)
  4946. res, err := c.doRequest("json")
  4947. if res != nil && res.StatusCode == http.StatusNotModified {
  4948. if res.Body != nil {
  4949. res.Body.Close()
  4950. }
  4951. return nil, &googleapi.Error{
  4952. Code: res.StatusCode,
  4953. Header: res.Header,
  4954. }
  4955. }
  4956. if err != nil {
  4957. return nil, err
  4958. }
  4959. defer googleapi.CloseBody(res)
  4960. if err := googleapi.CheckResponse(res); err != nil {
  4961. return nil, err
  4962. }
  4963. ret := &Announcement{
  4964. ServerResponse: googleapi.ServerResponse{
  4965. Header: res.Header,
  4966. HTTPStatusCode: res.StatusCode,
  4967. },
  4968. }
  4969. target := &ret
  4970. if err := gensupport.DecodeResponse(target, res); err != nil {
  4971. return nil, err
  4972. }
  4973. return ret, nil
  4974. // {
  4975. // "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.",
  4976. // "flatPath": "v1/courses/{courseId}/announcements/{id}:modifyAssignees",
  4977. // "httpMethod": "POST",
  4978. // "id": "classroom.courses.announcements.modifyAssignees",
  4979. // "parameterOrder": [
  4980. // "courseId",
  4981. // "id"
  4982. // ],
  4983. // "parameters": {
  4984. // "courseId": {
  4985. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  4986. // "location": "path",
  4987. // "required": true,
  4988. // "type": "string"
  4989. // },
  4990. // "id": {
  4991. // "description": "Identifier of the announcement.",
  4992. // "location": "path",
  4993. // "required": true,
  4994. // "type": "string"
  4995. // }
  4996. // },
  4997. // "path": "v1/courses/{courseId}/announcements/{id}:modifyAssignees",
  4998. // "request": {
  4999. // "$ref": "ModifyAnnouncementAssigneesRequest"
  5000. // },
  5001. // "response": {
  5002. // "$ref": "Announcement"
  5003. // },
  5004. // "scopes": [
  5005. // "https://www.googleapis.com/auth/classroom.announcements"
  5006. // ]
  5007. // }
  5008. }
  5009. // method id "classroom.courses.announcements.patch":
  5010. type CoursesAnnouncementsPatchCall struct {
  5011. s *Service
  5012. courseId string
  5013. id string
  5014. announcement *Announcement
  5015. urlParams_ gensupport.URLParams
  5016. ctx_ context.Context
  5017. header_ http.Header
  5018. }
  5019. // Patch: Updates one or more fields of an announcement.
  5020. //
  5021. // This method returns the following error codes:
  5022. //
  5023. // * `PERMISSION_DENIED` if the requesting developer project did not
  5024. // create
  5025. // the corresponding announcement or for access errors.
  5026. // * `INVALID_ARGUMENT` if the request is malformed.
  5027. // * `FAILED_PRECONDITION` if the requested announcement has already
  5028. // been
  5029. // deleted.
  5030. // * `NOT_FOUND` if the requested course or announcement does not exist
  5031. func (r *CoursesAnnouncementsService) Patch(courseId string, id string, announcement *Announcement) *CoursesAnnouncementsPatchCall {
  5032. c := &CoursesAnnouncementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5033. c.courseId = courseId
  5034. c.id = id
  5035. c.announcement = announcement
  5036. return c
  5037. }
  5038. // UpdateMask sets the optional parameter "updateMask": Mask that
  5039. // identifies which fields on the announcement to update.
  5040. // This field is required to do an update. The update fails if
  5041. // invalid
  5042. // fields are specified. If a field supports empty values, it can be
  5043. // cleared
  5044. // by specifying it in the update mask and not in the Announcement
  5045. // object. If
  5046. // a field that does not support empty values is included in the update
  5047. // mask
  5048. // and not set in the Announcement object, an `INVALID_ARGUMENT` error
  5049. // will be
  5050. // returned.
  5051. //
  5052. // The following fields may be specified by teachers:
  5053. //
  5054. // * `text`
  5055. // * `state`
  5056. // * `scheduled_time`
  5057. func (c *CoursesAnnouncementsPatchCall) UpdateMask(updateMask string) *CoursesAnnouncementsPatchCall {
  5058. c.urlParams_.Set("updateMask", updateMask)
  5059. return c
  5060. }
  5061. // Fields allows partial responses to be retrieved. See
  5062. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5063. // for more information.
  5064. func (c *CoursesAnnouncementsPatchCall) Fields(s ...googleapi.Field) *CoursesAnnouncementsPatchCall {
  5065. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5066. return c
  5067. }
  5068. // Context sets the context to be used in this call's Do method. Any
  5069. // pending HTTP request will be aborted if the provided context is
  5070. // canceled.
  5071. func (c *CoursesAnnouncementsPatchCall) Context(ctx context.Context) *CoursesAnnouncementsPatchCall {
  5072. c.ctx_ = ctx
  5073. return c
  5074. }
  5075. // Header returns an http.Header that can be modified by the caller to
  5076. // add HTTP headers to the request.
  5077. func (c *CoursesAnnouncementsPatchCall) Header() http.Header {
  5078. if c.header_ == nil {
  5079. c.header_ = make(http.Header)
  5080. }
  5081. return c.header_
  5082. }
  5083. func (c *CoursesAnnouncementsPatchCall) doRequest(alt string) (*http.Response, error) {
  5084. reqHeaders := make(http.Header)
  5085. for k, v := range c.header_ {
  5086. reqHeaders[k] = v
  5087. }
  5088. reqHeaders.Set("User-Agent", c.s.userAgent())
  5089. var body io.Reader = nil
  5090. body, err := googleapi.WithoutDataWrapper.JSONReader(c.announcement)
  5091. if err != nil {
  5092. return nil, err
  5093. }
  5094. reqHeaders.Set("Content-Type", "application/json")
  5095. c.urlParams_.Set("alt", alt)
  5096. c.urlParams_.Set("prettyPrint", "false")
  5097. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/announcements/{id}")
  5098. urls += "?" + c.urlParams_.Encode()
  5099. req, err := http.NewRequest("PATCH", urls, body)
  5100. if err != nil {
  5101. return nil, err
  5102. }
  5103. req.Header = reqHeaders
  5104. googleapi.Expand(req.URL, map[string]string{
  5105. "courseId": c.courseId,
  5106. "id": c.id,
  5107. })
  5108. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5109. }
  5110. // Do executes the "classroom.courses.announcements.patch" call.
  5111. // Exactly one of *Announcement or error will be non-nil. Any non-2xx
  5112. // status code is an error. Response headers are in either
  5113. // *Announcement.ServerResponse.Header or (if a response was returned at
  5114. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5115. // to check whether the returned error was because
  5116. // http.StatusNotModified was returned.
  5117. func (c *CoursesAnnouncementsPatchCall) Do(opts ...googleapi.CallOption) (*Announcement, error) {
  5118. gensupport.SetOptions(c.urlParams_, opts...)
  5119. res, err := c.doRequest("json")
  5120. if res != nil && res.StatusCode == http.StatusNotModified {
  5121. if res.Body != nil {
  5122. res.Body.Close()
  5123. }
  5124. return nil, &googleapi.Error{
  5125. Code: res.StatusCode,
  5126. Header: res.Header,
  5127. }
  5128. }
  5129. if err != nil {
  5130. return nil, err
  5131. }
  5132. defer googleapi.CloseBody(res)
  5133. if err := googleapi.CheckResponse(res); err != nil {
  5134. return nil, err
  5135. }
  5136. ret := &Announcement{
  5137. ServerResponse: googleapi.ServerResponse{
  5138. Header: res.Header,
  5139. HTTPStatusCode: res.StatusCode,
  5140. },
  5141. }
  5142. target := &ret
  5143. if err := gensupport.DecodeResponse(target, res); err != nil {
  5144. return nil, err
  5145. }
  5146. return ret, nil
  5147. // {
  5148. // "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",
  5149. // "flatPath": "v1/courses/{courseId}/announcements/{id}",
  5150. // "httpMethod": "PATCH",
  5151. // "id": "classroom.courses.announcements.patch",
  5152. // "parameterOrder": [
  5153. // "courseId",
  5154. // "id"
  5155. // ],
  5156. // "parameters": {
  5157. // "courseId": {
  5158. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5159. // "location": "path",
  5160. // "required": true,
  5161. // "type": "string"
  5162. // },
  5163. // "id": {
  5164. // "description": "Identifier of the announcement.",
  5165. // "location": "path",
  5166. // "required": true,
  5167. // "type": "string"
  5168. // },
  5169. // "updateMask": {
  5170. // "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`",
  5171. // "format": "google-fieldmask",
  5172. // "location": "query",
  5173. // "type": "string"
  5174. // }
  5175. // },
  5176. // "path": "v1/courses/{courseId}/announcements/{id}",
  5177. // "request": {
  5178. // "$ref": "Announcement"
  5179. // },
  5180. // "response": {
  5181. // "$ref": "Announcement"
  5182. // },
  5183. // "scopes": [
  5184. // "https://www.googleapis.com/auth/classroom.announcements"
  5185. // ]
  5186. // }
  5187. }
  5188. // method id "classroom.courses.courseWork.create":
  5189. type CoursesCourseWorkCreateCall struct {
  5190. s *Service
  5191. courseId string
  5192. coursework *CourseWork
  5193. urlParams_ gensupport.URLParams
  5194. ctx_ context.Context
  5195. header_ http.Header
  5196. }
  5197. // Create: Creates course work.
  5198. //
  5199. // The resulting course work (and corresponding student submissions)
  5200. // are
  5201. // associated with the Developer Console project of the
  5202. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  5203. // used to
  5204. // make the request. Classroom API requests to modify course work and
  5205. // student
  5206. // submissions must be made with an OAuth client ID from the
  5207. // associated
  5208. // Developer Console project.
  5209. //
  5210. // This method returns the following error codes:
  5211. //
  5212. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5213. // access the
  5214. // requested course, create course work in the requested course, share
  5215. // a
  5216. // Drive attachment, or for access errors.
  5217. // * `INVALID_ARGUMENT` if the request is malformed.
  5218. // * `NOT_FOUND` if the requested course does not exist.
  5219. // * `FAILED_PRECONDITION` for the following request error:
  5220. // * AttachmentNotVisible
  5221. func (r *CoursesCourseWorkService) Create(courseId string, coursework *CourseWork) *CoursesCourseWorkCreateCall {
  5222. c := &CoursesCourseWorkCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5223. c.courseId = courseId
  5224. c.coursework = coursework
  5225. return c
  5226. }
  5227. // Fields allows partial responses to be retrieved. See
  5228. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5229. // for more information.
  5230. func (c *CoursesCourseWorkCreateCall) Fields(s ...googleapi.Field) *CoursesCourseWorkCreateCall {
  5231. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5232. return c
  5233. }
  5234. // Context sets the context to be used in this call's Do method. Any
  5235. // pending HTTP request will be aborted if the provided context is
  5236. // canceled.
  5237. func (c *CoursesCourseWorkCreateCall) Context(ctx context.Context) *CoursesCourseWorkCreateCall {
  5238. c.ctx_ = ctx
  5239. return c
  5240. }
  5241. // Header returns an http.Header that can be modified by the caller to
  5242. // add HTTP headers to the request.
  5243. func (c *CoursesCourseWorkCreateCall) Header() http.Header {
  5244. if c.header_ == nil {
  5245. c.header_ = make(http.Header)
  5246. }
  5247. return c.header_
  5248. }
  5249. func (c *CoursesCourseWorkCreateCall) doRequest(alt string) (*http.Response, error) {
  5250. reqHeaders := make(http.Header)
  5251. for k, v := range c.header_ {
  5252. reqHeaders[k] = v
  5253. }
  5254. reqHeaders.Set("User-Agent", c.s.userAgent())
  5255. var body io.Reader = nil
  5256. body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework)
  5257. if err != nil {
  5258. return nil, err
  5259. }
  5260. reqHeaders.Set("Content-Type", "application/json")
  5261. c.urlParams_.Set("alt", alt)
  5262. c.urlParams_.Set("prettyPrint", "false")
  5263. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork")
  5264. urls += "?" + c.urlParams_.Encode()
  5265. req, err := http.NewRequest("POST", urls, body)
  5266. if err != nil {
  5267. return nil, err
  5268. }
  5269. req.Header = reqHeaders
  5270. googleapi.Expand(req.URL, map[string]string{
  5271. "courseId": c.courseId,
  5272. })
  5273. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5274. }
  5275. // Do executes the "classroom.courses.courseWork.create" call.
  5276. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5277. // status code is an error. Response headers are in either
  5278. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5279. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5280. // to check whether the returned error was because
  5281. // http.StatusNotModified was returned.
  5282. func (c *CoursesCourseWorkCreateCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5283. gensupport.SetOptions(c.urlParams_, opts...)
  5284. res, err := c.doRequest("json")
  5285. if res != nil && res.StatusCode == http.StatusNotModified {
  5286. if res.Body != nil {
  5287. res.Body.Close()
  5288. }
  5289. return nil, &googleapi.Error{
  5290. Code: res.StatusCode,
  5291. Header: res.Header,
  5292. }
  5293. }
  5294. if err != nil {
  5295. return nil, err
  5296. }
  5297. defer googleapi.CloseBody(res)
  5298. if err := googleapi.CheckResponse(res); err != nil {
  5299. return nil, err
  5300. }
  5301. ret := &CourseWork{
  5302. ServerResponse: googleapi.ServerResponse{
  5303. Header: res.Header,
  5304. HTTPStatusCode: res.StatusCode,
  5305. },
  5306. }
  5307. target := &ret
  5308. if err := gensupport.DecodeResponse(target, res); err != nil {
  5309. return nil, err
  5310. }
  5311. return ret, nil
  5312. // {
  5313. // "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",
  5314. // "flatPath": "v1/courses/{courseId}/courseWork",
  5315. // "httpMethod": "POST",
  5316. // "id": "classroom.courses.courseWork.create",
  5317. // "parameterOrder": [
  5318. // "courseId"
  5319. // ],
  5320. // "parameters": {
  5321. // "courseId": {
  5322. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5323. // "location": "path",
  5324. // "required": true,
  5325. // "type": "string"
  5326. // }
  5327. // },
  5328. // "path": "v1/courses/{courseId}/courseWork",
  5329. // "request": {
  5330. // "$ref": "CourseWork"
  5331. // },
  5332. // "response": {
  5333. // "$ref": "CourseWork"
  5334. // },
  5335. // "scopes": [
  5336. // "https://www.googleapis.com/auth/classroom.coursework.students"
  5337. // ]
  5338. // }
  5339. }
  5340. // method id "classroom.courses.courseWork.delete":
  5341. type CoursesCourseWorkDeleteCall struct {
  5342. s *Service
  5343. courseId string
  5344. id string
  5345. urlParams_ gensupport.URLParams
  5346. ctx_ context.Context
  5347. header_ http.Header
  5348. }
  5349. // Delete: Deletes a course work.
  5350. //
  5351. // This request must be made by the Developer Console project of
  5352. // the
  5353. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  5354. // used to
  5355. // create the corresponding course work item.
  5356. //
  5357. // This method returns the following error codes:
  5358. //
  5359. // * `PERMISSION_DENIED` if the requesting developer project did not
  5360. // create
  5361. // the corresponding course work, if the requesting user is not
  5362. // permitted
  5363. // to delete the requested course or for access errors.
  5364. // * `FAILED_PRECONDITION` if the requested course work has already
  5365. // been
  5366. // deleted.
  5367. // * `NOT_FOUND` if no course exists with the requested ID.
  5368. func (r *CoursesCourseWorkService) Delete(courseId string, id string) *CoursesCourseWorkDeleteCall {
  5369. c := &CoursesCourseWorkDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5370. c.courseId = courseId
  5371. c.id = id
  5372. return c
  5373. }
  5374. // Fields allows partial responses to be retrieved. See
  5375. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5376. // for more information.
  5377. func (c *CoursesCourseWorkDeleteCall) Fields(s ...googleapi.Field) *CoursesCourseWorkDeleteCall {
  5378. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5379. return c
  5380. }
  5381. // Context sets the context to be used in this call's Do method. Any
  5382. // pending HTTP request will be aborted if the provided context is
  5383. // canceled.
  5384. func (c *CoursesCourseWorkDeleteCall) Context(ctx context.Context) *CoursesCourseWorkDeleteCall {
  5385. c.ctx_ = ctx
  5386. return c
  5387. }
  5388. // Header returns an http.Header that can be modified by the caller to
  5389. // add HTTP headers to the request.
  5390. func (c *CoursesCourseWorkDeleteCall) Header() http.Header {
  5391. if c.header_ == nil {
  5392. c.header_ = make(http.Header)
  5393. }
  5394. return c.header_
  5395. }
  5396. func (c *CoursesCourseWorkDeleteCall) doRequest(alt string) (*http.Response, error) {
  5397. reqHeaders := make(http.Header)
  5398. for k, v := range c.header_ {
  5399. reqHeaders[k] = v
  5400. }
  5401. reqHeaders.Set("User-Agent", c.s.userAgent())
  5402. var body io.Reader = nil
  5403. c.urlParams_.Set("alt", alt)
  5404. c.urlParams_.Set("prettyPrint", "false")
  5405. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}")
  5406. urls += "?" + c.urlParams_.Encode()
  5407. req, err := http.NewRequest("DELETE", urls, body)
  5408. if err != nil {
  5409. return nil, err
  5410. }
  5411. req.Header = reqHeaders
  5412. googleapi.Expand(req.URL, map[string]string{
  5413. "courseId": c.courseId,
  5414. "id": c.id,
  5415. })
  5416. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5417. }
  5418. // Do executes the "classroom.courses.courseWork.delete" call.
  5419. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5420. // code is an error. Response headers are in either
  5421. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5422. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5423. // check whether the returned error was because http.StatusNotModified
  5424. // was returned.
  5425. func (c *CoursesCourseWorkDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5426. gensupport.SetOptions(c.urlParams_, opts...)
  5427. res, err := c.doRequest("json")
  5428. if res != nil && res.StatusCode == http.StatusNotModified {
  5429. if res.Body != nil {
  5430. res.Body.Close()
  5431. }
  5432. return nil, &googleapi.Error{
  5433. Code: res.StatusCode,
  5434. Header: res.Header,
  5435. }
  5436. }
  5437. if err != nil {
  5438. return nil, err
  5439. }
  5440. defer googleapi.CloseBody(res)
  5441. if err := googleapi.CheckResponse(res); err != nil {
  5442. return nil, err
  5443. }
  5444. ret := &Empty{
  5445. ServerResponse: googleapi.ServerResponse{
  5446. Header: res.Header,
  5447. HTTPStatusCode: res.StatusCode,
  5448. },
  5449. }
  5450. target := &ret
  5451. if err := gensupport.DecodeResponse(target, res); err != nil {
  5452. return nil, err
  5453. }
  5454. return ret, nil
  5455. // {
  5456. // "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.",
  5457. // "flatPath": "v1/courses/{courseId}/courseWork/{id}",
  5458. // "httpMethod": "DELETE",
  5459. // "id": "classroom.courses.courseWork.delete",
  5460. // "parameterOrder": [
  5461. // "courseId",
  5462. // "id"
  5463. // ],
  5464. // "parameters": {
  5465. // "courseId": {
  5466. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5467. // "location": "path",
  5468. // "required": true,
  5469. // "type": "string"
  5470. // },
  5471. // "id": {
  5472. // "description": "Identifier of the course work to delete.\nThis identifier is a Classroom-assigned identifier.",
  5473. // "location": "path",
  5474. // "required": true,
  5475. // "type": "string"
  5476. // }
  5477. // },
  5478. // "path": "v1/courses/{courseId}/courseWork/{id}",
  5479. // "response": {
  5480. // "$ref": "Empty"
  5481. // },
  5482. // "scopes": [
  5483. // "https://www.googleapis.com/auth/classroom.coursework.students"
  5484. // ]
  5485. // }
  5486. }
  5487. // method id "classroom.courses.courseWork.get":
  5488. type CoursesCourseWorkGetCall struct {
  5489. s *Service
  5490. courseId string
  5491. id string
  5492. urlParams_ gensupport.URLParams
  5493. ifNoneMatch_ string
  5494. ctx_ context.Context
  5495. header_ http.Header
  5496. }
  5497. // Get: Returns course work.
  5498. //
  5499. // This method returns the following error codes:
  5500. //
  5501. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5502. // access the
  5503. // requested course or course work, or for access errors.
  5504. // * `INVALID_ARGUMENT` if the request is malformed.
  5505. // * `NOT_FOUND` if the requested course or course work does not exist.
  5506. func (r *CoursesCourseWorkService) Get(courseId string, id string) *CoursesCourseWorkGetCall {
  5507. c := &CoursesCourseWorkGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5508. c.courseId = courseId
  5509. c.id = id
  5510. return c
  5511. }
  5512. // Fields allows partial responses to be retrieved. See
  5513. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5514. // for more information.
  5515. func (c *CoursesCourseWorkGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkGetCall {
  5516. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5517. return c
  5518. }
  5519. // IfNoneMatch sets the optional parameter which makes the operation
  5520. // fail if the object's ETag matches the given value. This is useful for
  5521. // getting updates only after the object has changed since the last
  5522. // request. Use googleapi.IsNotModified to check whether the response
  5523. // error from Do is the result of In-None-Match.
  5524. func (c *CoursesCourseWorkGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkGetCall {
  5525. c.ifNoneMatch_ = entityTag
  5526. return c
  5527. }
  5528. // Context sets the context to be used in this call's Do method. Any
  5529. // pending HTTP request will be aborted if the provided context is
  5530. // canceled.
  5531. func (c *CoursesCourseWorkGetCall) Context(ctx context.Context) *CoursesCourseWorkGetCall {
  5532. c.ctx_ = ctx
  5533. return c
  5534. }
  5535. // Header returns an http.Header that can be modified by the caller to
  5536. // add HTTP headers to the request.
  5537. func (c *CoursesCourseWorkGetCall) Header() http.Header {
  5538. if c.header_ == nil {
  5539. c.header_ = make(http.Header)
  5540. }
  5541. return c.header_
  5542. }
  5543. func (c *CoursesCourseWorkGetCall) doRequest(alt string) (*http.Response, error) {
  5544. reqHeaders := make(http.Header)
  5545. for k, v := range c.header_ {
  5546. reqHeaders[k] = v
  5547. }
  5548. reqHeaders.Set("User-Agent", c.s.userAgent())
  5549. if c.ifNoneMatch_ != "" {
  5550. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5551. }
  5552. var body io.Reader = nil
  5553. c.urlParams_.Set("alt", alt)
  5554. c.urlParams_.Set("prettyPrint", "false")
  5555. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}")
  5556. urls += "?" + c.urlParams_.Encode()
  5557. req, err := http.NewRequest("GET", urls, body)
  5558. if err != nil {
  5559. return nil, err
  5560. }
  5561. req.Header = reqHeaders
  5562. googleapi.Expand(req.URL, map[string]string{
  5563. "courseId": c.courseId,
  5564. "id": c.id,
  5565. })
  5566. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5567. }
  5568. // Do executes the "classroom.courses.courseWork.get" call.
  5569. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5570. // status code is an error. Response headers are in either
  5571. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5572. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5573. // to check whether the returned error was because
  5574. // http.StatusNotModified was returned.
  5575. func (c *CoursesCourseWorkGetCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5576. gensupport.SetOptions(c.urlParams_, opts...)
  5577. res, err := c.doRequest("json")
  5578. if res != nil && res.StatusCode == http.StatusNotModified {
  5579. if res.Body != nil {
  5580. res.Body.Close()
  5581. }
  5582. return nil, &googleapi.Error{
  5583. Code: res.StatusCode,
  5584. Header: res.Header,
  5585. }
  5586. }
  5587. if err != nil {
  5588. return nil, err
  5589. }
  5590. defer googleapi.CloseBody(res)
  5591. if err := googleapi.CheckResponse(res); err != nil {
  5592. return nil, err
  5593. }
  5594. ret := &CourseWork{
  5595. ServerResponse: googleapi.ServerResponse{
  5596. Header: res.Header,
  5597. HTTPStatusCode: res.StatusCode,
  5598. },
  5599. }
  5600. target := &ret
  5601. if err := gensupport.DecodeResponse(target, res); err != nil {
  5602. return nil, err
  5603. }
  5604. return ret, nil
  5605. // {
  5606. // "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.",
  5607. // "flatPath": "v1/courses/{courseId}/courseWork/{id}",
  5608. // "httpMethod": "GET",
  5609. // "id": "classroom.courses.courseWork.get",
  5610. // "parameterOrder": [
  5611. // "courseId",
  5612. // "id"
  5613. // ],
  5614. // "parameters": {
  5615. // "courseId": {
  5616. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5617. // "location": "path",
  5618. // "required": true,
  5619. // "type": "string"
  5620. // },
  5621. // "id": {
  5622. // "description": "Identifier of the course work.",
  5623. // "location": "path",
  5624. // "required": true,
  5625. // "type": "string"
  5626. // }
  5627. // },
  5628. // "path": "v1/courses/{courseId}/courseWork/{id}",
  5629. // "response": {
  5630. // "$ref": "CourseWork"
  5631. // },
  5632. // "scopes": [
  5633. // "https://www.googleapis.com/auth/classroom.coursework.me",
  5634. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  5635. // "https://www.googleapis.com/auth/classroom.coursework.students",
  5636. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly"
  5637. // ]
  5638. // }
  5639. }
  5640. // method id "classroom.courses.courseWork.list":
  5641. type CoursesCourseWorkListCall struct {
  5642. s *Service
  5643. courseId string
  5644. urlParams_ gensupport.URLParams
  5645. ifNoneMatch_ string
  5646. ctx_ context.Context
  5647. header_ http.Header
  5648. }
  5649. // List: Returns a list of course work that the requester is permitted
  5650. // to view.
  5651. //
  5652. // Course students may only view `PUBLISHED` course work. Course
  5653. // teachers
  5654. // and domain administrators may view all course work.
  5655. //
  5656. // This method returns the following error codes:
  5657. //
  5658. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5659. // access
  5660. // the requested course or for access errors.
  5661. // * `INVALID_ARGUMENT` if the request is malformed.
  5662. // * `NOT_FOUND` if the requested course does not exist.
  5663. func (r *CoursesCourseWorkService) List(courseId string) *CoursesCourseWorkListCall {
  5664. c := &CoursesCourseWorkListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5665. c.courseId = courseId
  5666. return c
  5667. }
  5668. // CourseWorkStates sets the optional parameter "courseWorkStates":
  5669. // Restriction on the work status to return. Only courseWork that
  5670. // matches
  5671. // is returned. If unspecified, items with a work status of
  5672. // `PUBLISHED`
  5673. // is returned.
  5674. //
  5675. // Possible values:
  5676. // "COURSE_WORK_STATE_UNSPECIFIED"
  5677. // "PUBLISHED"
  5678. // "DRAFT"
  5679. // "DELETED"
  5680. func (c *CoursesCourseWorkListCall) CourseWorkStates(courseWorkStates ...string) *CoursesCourseWorkListCall {
  5681. c.urlParams_.SetMulti("courseWorkStates", append([]string{}, courseWorkStates...))
  5682. return c
  5683. }
  5684. // OrderBy sets the optional parameter "orderBy": Optional sort ordering
  5685. // for results. A comma-separated list of fields with
  5686. // an optional sort direction keyword. Supported fields are
  5687. // `updateTime`
  5688. // and `dueDate`. Supported direction keywords are `asc` and `desc`.
  5689. // If not specified, `updateTime desc` is the default
  5690. // behavior.
  5691. // Examples: `dueDate asc,updateTime desc`, `updateTime,dueDate desc`
  5692. func (c *CoursesCourseWorkListCall) OrderBy(orderBy string) *CoursesCourseWorkListCall {
  5693. c.urlParams_.Set("orderBy", orderBy)
  5694. return c
  5695. }
  5696. // PageSize sets the optional parameter "pageSize": Maximum number of
  5697. // items to return. Zero or unspecified indicates that the
  5698. // server may assign a maximum.
  5699. //
  5700. // The server may return fewer than the specified number of results.
  5701. func (c *CoursesCourseWorkListCall) PageSize(pageSize int64) *CoursesCourseWorkListCall {
  5702. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5703. return c
  5704. }
  5705. // PageToken sets the optional parameter "pageToken":
  5706. // nextPageToken
  5707. // value returned from a previous
  5708. // list call,
  5709. // indicating that the subsequent page of results should be
  5710. // returned.
  5711. //
  5712. // The list request
  5713. // must be otherwise identical to the one that resulted in this token.
  5714. func (c *CoursesCourseWorkListCall) PageToken(pageToken string) *CoursesCourseWorkListCall {
  5715. c.urlParams_.Set("pageToken", pageToken)
  5716. return c
  5717. }
  5718. // Fields allows partial responses to be retrieved. See
  5719. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5720. // for more information.
  5721. func (c *CoursesCourseWorkListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkListCall {
  5722. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5723. return c
  5724. }
  5725. // IfNoneMatch sets the optional parameter which makes the operation
  5726. // fail if the object's ETag matches the given value. This is useful for
  5727. // getting updates only after the object has changed since the last
  5728. // request. Use googleapi.IsNotModified to check whether the response
  5729. // error from Do is the result of In-None-Match.
  5730. func (c *CoursesCourseWorkListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkListCall {
  5731. c.ifNoneMatch_ = entityTag
  5732. return c
  5733. }
  5734. // Context sets the context to be used in this call's Do method. Any
  5735. // pending HTTP request will be aborted if the provided context is
  5736. // canceled.
  5737. func (c *CoursesCourseWorkListCall) Context(ctx context.Context) *CoursesCourseWorkListCall {
  5738. c.ctx_ = ctx
  5739. return c
  5740. }
  5741. // Header returns an http.Header that can be modified by the caller to
  5742. // add HTTP headers to the request.
  5743. func (c *CoursesCourseWorkListCall) Header() http.Header {
  5744. if c.header_ == nil {
  5745. c.header_ = make(http.Header)
  5746. }
  5747. return c.header_
  5748. }
  5749. func (c *CoursesCourseWorkListCall) doRequest(alt string) (*http.Response, error) {
  5750. reqHeaders := make(http.Header)
  5751. for k, v := range c.header_ {
  5752. reqHeaders[k] = v
  5753. }
  5754. reqHeaders.Set("User-Agent", c.s.userAgent())
  5755. if c.ifNoneMatch_ != "" {
  5756. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5757. }
  5758. var body io.Reader = nil
  5759. c.urlParams_.Set("alt", alt)
  5760. c.urlParams_.Set("prettyPrint", "false")
  5761. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork")
  5762. urls += "?" + c.urlParams_.Encode()
  5763. req, err := http.NewRequest("GET", urls, body)
  5764. if err != nil {
  5765. return nil, err
  5766. }
  5767. req.Header = reqHeaders
  5768. googleapi.Expand(req.URL, map[string]string{
  5769. "courseId": c.courseId,
  5770. })
  5771. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5772. }
  5773. // Do executes the "classroom.courses.courseWork.list" call.
  5774. // Exactly one of *ListCourseWorkResponse or error will be non-nil. Any
  5775. // non-2xx status code is an error. Response headers are in either
  5776. // *ListCourseWorkResponse.ServerResponse.Header or (if a response was
  5777. // returned at all) in error.(*googleapi.Error).Header. Use
  5778. // googleapi.IsNotModified to check whether the returned error was
  5779. // because http.StatusNotModified was returned.
  5780. func (c *CoursesCourseWorkListCall) Do(opts ...googleapi.CallOption) (*ListCourseWorkResponse, error) {
  5781. gensupport.SetOptions(c.urlParams_, opts...)
  5782. res, err := c.doRequest("json")
  5783. if res != nil && res.StatusCode == http.StatusNotModified {
  5784. if res.Body != nil {
  5785. res.Body.Close()
  5786. }
  5787. return nil, &googleapi.Error{
  5788. Code: res.StatusCode,
  5789. Header: res.Header,
  5790. }
  5791. }
  5792. if err != nil {
  5793. return nil, err
  5794. }
  5795. defer googleapi.CloseBody(res)
  5796. if err := googleapi.CheckResponse(res); err != nil {
  5797. return nil, err
  5798. }
  5799. ret := &ListCourseWorkResponse{
  5800. ServerResponse: googleapi.ServerResponse{
  5801. Header: res.Header,
  5802. HTTPStatusCode: res.StatusCode,
  5803. },
  5804. }
  5805. target := &ret
  5806. if err := gensupport.DecodeResponse(target, res); err != nil {
  5807. return nil, err
  5808. }
  5809. return ret, nil
  5810. // {
  5811. // "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.",
  5812. // "flatPath": "v1/courses/{courseId}/courseWork",
  5813. // "httpMethod": "GET",
  5814. // "id": "classroom.courses.courseWork.list",
  5815. // "parameterOrder": [
  5816. // "courseId"
  5817. // ],
  5818. // "parameters": {
  5819. // "courseId": {
  5820. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  5821. // "location": "path",
  5822. // "required": true,
  5823. // "type": "string"
  5824. // },
  5825. // "courseWorkStates": {
  5826. // "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.",
  5827. // "enum": [
  5828. // "COURSE_WORK_STATE_UNSPECIFIED",
  5829. // "PUBLISHED",
  5830. // "DRAFT",
  5831. // "DELETED"
  5832. // ],
  5833. // "location": "query",
  5834. // "repeated": true,
  5835. // "type": "string"
  5836. // },
  5837. // "orderBy": {
  5838. // "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`",
  5839. // "location": "query",
  5840. // "type": "string"
  5841. // },
  5842. // "pageSize": {
  5843. // "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.",
  5844. // "format": "int32",
  5845. // "location": "query",
  5846. // "type": "integer"
  5847. // },
  5848. // "pageToken": {
  5849. // "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.",
  5850. // "location": "query",
  5851. // "type": "string"
  5852. // }
  5853. // },
  5854. // "path": "v1/courses/{courseId}/courseWork",
  5855. // "response": {
  5856. // "$ref": "ListCourseWorkResponse"
  5857. // },
  5858. // "scopes": [
  5859. // "https://www.googleapis.com/auth/classroom.coursework.me",
  5860. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  5861. // "https://www.googleapis.com/auth/classroom.coursework.students",
  5862. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly"
  5863. // ]
  5864. // }
  5865. }
  5866. // Pages invokes f for each page of results.
  5867. // A non-nil error returned from f will halt the iteration.
  5868. // The provided context supersedes any context provided to the Context method.
  5869. func (c *CoursesCourseWorkListCall) Pages(ctx context.Context, f func(*ListCourseWorkResponse) error) error {
  5870. c.ctx_ = ctx
  5871. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5872. for {
  5873. x, err := c.Do()
  5874. if err != nil {
  5875. return err
  5876. }
  5877. if err := f(x); err != nil {
  5878. return err
  5879. }
  5880. if x.NextPageToken == "" {
  5881. return nil
  5882. }
  5883. c.PageToken(x.NextPageToken)
  5884. }
  5885. }
  5886. // method id "classroom.courses.courseWork.modifyAssignees":
  5887. type CoursesCourseWorkModifyAssigneesCall struct {
  5888. s *Service
  5889. courseId string
  5890. id string
  5891. modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest
  5892. urlParams_ gensupport.URLParams
  5893. ctx_ context.Context
  5894. header_ http.Header
  5895. }
  5896. // ModifyAssignees: Modifies assignee mode and options of a
  5897. // coursework.
  5898. //
  5899. // Only a teacher of the course that contains the coursework may
  5900. // call this method.
  5901. //
  5902. // This method returns the following error codes:
  5903. //
  5904. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  5905. // access the
  5906. // requested course or course work or for access errors.
  5907. // * `INVALID_ARGUMENT` if the request is malformed.
  5908. // * `NOT_FOUND` if the requested course or course work does not exist.
  5909. func (r *CoursesCourseWorkService) ModifyAssignees(courseId string, id string, modifycourseworkassigneesrequest *ModifyCourseWorkAssigneesRequest) *CoursesCourseWorkModifyAssigneesCall {
  5910. c := &CoursesCourseWorkModifyAssigneesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5911. c.courseId = courseId
  5912. c.id = id
  5913. c.modifycourseworkassigneesrequest = modifycourseworkassigneesrequest
  5914. return c
  5915. }
  5916. // Fields allows partial responses to be retrieved. See
  5917. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5918. // for more information.
  5919. func (c *CoursesCourseWorkModifyAssigneesCall) Fields(s ...googleapi.Field) *CoursesCourseWorkModifyAssigneesCall {
  5920. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5921. return c
  5922. }
  5923. // Context sets the context to be used in this call's Do method. Any
  5924. // pending HTTP request will be aborted if the provided context is
  5925. // canceled.
  5926. func (c *CoursesCourseWorkModifyAssigneesCall) Context(ctx context.Context) *CoursesCourseWorkModifyAssigneesCall {
  5927. c.ctx_ = ctx
  5928. return c
  5929. }
  5930. // Header returns an http.Header that can be modified by the caller to
  5931. // add HTTP headers to the request.
  5932. func (c *CoursesCourseWorkModifyAssigneesCall) Header() http.Header {
  5933. if c.header_ == nil {
  5934. c.header_ = make(http.Header)
  5935. }
  5936. return c.header_
  5937. }
  5938. func (c *CoursesCourseWorkModifyAssigneesCall) doRequest(alt string) (*http.Response, error) {
  5939. reqHeaders := make(http.Header)
  5940. for k, v := range c.header_ {
  5941. reqHeaders[k] = v
  5942. }
  5943. reqHeaders.Set("User-Agent", c.s.userAgent())
  5944. var body io.Reader = nil
  5945. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycourseworkassigneesrequest)
  5946. if err != nil {
  5947. return nil, err
  5948. }
  5949. reqHeaders.Set("Content-Type", "application/json")
  5950. c.urlParams_.Set("alt", alt)
  5951. c.urlParams_.Set("prettyPrint", "false")
  5952. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}:modifyAssignees")
  5953. urls += "?" + c.urlParams_.Encode()
  5954. req, err := http.NewRequest("POST", urls, body)
  5955. if err != nil {
  5956. return nil, err
  5957. }
  5958. req.Header = reqHeaders
  5959. googleapi.Expand(req.URL, map[string]string{
  5960. "courseId": c.courseId,
  5961. "id": c.id,
  5962. })
  5963. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5964. }
  5965. // Do executes the "classroom.courses.courseWork.modifyAssignees" call.
  5966. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  5967. // status code is an error. Response headers are in either
  5968. // *CourseWork.ServerResponse.Header or (if a response was returned at
  5969. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5970. // to check whether the returned error was because
  5971. // http.StatusNotModified was returned.
  5972. func (c *CoursesCourseWorkModifyAssigneesCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  5973. gensupport.SetOptions(c.urlParams_, opts...)
  5974. res, err := c.doRequest("json")
  5975. if res != nil && res.StatusCode == http.StatusNotModified {
  5976. if res.Body != nil {
  5977. res.Body.Close()
  5978. }
  5979. return nil, &googleapi.Error{
  5980. Code: res.StatusCode,
  5981. Header: res.Header,
  5982. }
  5983. }
  5984. if err != nil {
  5985. return nil, err
  5986. }
  5987. defer googleapi.CloseBody(res)
  5988. if err := googleapi.CheckResponse(res); err != nil {
  5989. return nil, err
  5990. }
  5991. ret := &CourseWork{
  5992. ServerResponse: googleapi.ServerResponse{
  5993. Header: res.Header,
  5994. HTTPStatusCode: res.StatusCode,
  5995. },
  5996. }
  5997. target := &ret
  5998. if err := gensupport.DecodeResponse(target, res); err != nil {
  5999. return nil, err
  6000. }
  6001. return ret, nil
  6002. // {
  6003. // "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.",
  6004. // "flatPath": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees",
  6005. // "httpMethod": "POST",
  6006. // "id": "classroom.courses.courseWork.modifyAssignees",
  6007. // "parameterOrder": [
  6008. // "courseId",
  6009. // "id"
  6010. // ],
  6011. // "parameters": {
  6012. // "courseId": {
  6013. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6014. // "location": "path",
  6015. // "required": true,
  6016. // "type": "string"
  6017. // },
  6018. // "id": {
  6019. // "description": "Identifier of the coursework.",
  6020. // "location": "path",
  6021. // "required": true,
  6022. // "type": "string"
  6023. // }
  6024. // },
  6025. // "path": "v1/courses/{courseId}/courseWork/{id}:modifyAssignees",
  6026. // "request": {
  6027. // "$ref": "ModifyCourseWorkAssigneesRequest"
  6028. // },
  6029. // "response": {
  6030. // "$ref": "CourseWork"
  6031. // },
  6032. // "scopes": [
  6033. // "https://www.googleapis.com/auth/classroom.coursework.students"
  6034. // ]
  6035. // }
  6036. }
  6037. // method id "classroom.courses.courseWork.patch":
  6038. type CoursesCourseWorkPatchCall struct {
  6039. s *Service
  6040. courseId string
  6041. id string
  6042. coursework *CourseWork
  6043. urlParams_ gensupport.URLParams
  6044. ctx_ context.Context
  6045. header_ http.Header
  6046. }
  6047. // Patch: Updates one or more fields of a course work.
  6048. //
  6049. // See google.classroom.v1.CourseWork for details
  6050. // of which fields may be updated and who may change them.
  6051. //
  6052. // This request must be made by the Developer Console project of
  6053. // the
  6054. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  6055. // used to
  6056. // create the corresponding course work item.
  6057. //
  6058. // This method returns the following error codes:
  6059. //
  6060. // * `PERMISSION_DENIED` if the requesting developer project did not
  6061. // create
  6062. // the corresponding course work, if the user is not permitted to make
  6063. // the
  6064. // requested modification to the student submission, or for
  6065. // access errors.
  6066. // * `INVALID_ARGUMENT` if the request is malformed.
  6067. // * `FAILED_PRECONDITION` if the requested course work has already
  6068. // been
  6069. // deleted.
  6070. // * `NOT_FOUND` if the requested course, course work, or student
  6071. // submission
  6072. // does not exist.
  6073. func (r *CoursesCourseWorkService) Patch(courseId string, id string, coursework *CourseWork) *CoursesCourseWorkPatchCall {
  6074. c := &CoursesCourseWorkPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6075. c.courseId = courseId
  6076. c.id = id
  6077. c.coursework = coursework
  6078. return c
  6079. }
  6080. // UpdateMask sets the optional parameter "updateMask": Mask that
  6081. // identifies which fields on the course work to update.
  6082. // This field is required to do an update. The update fails if
  6083. // invalid
  6084. // fields are specified. If a field supports empty values, it can be
  6085. // cleared
  6086. // by specifying it in the update mask and not in the CourseWork object.
  6087. // If a
  6088. // field that does not support empty values is included in the update
  6089. // mask and
  6090. // not set in the CourseWork object, an `INVALID_ARGUMENT` error will
  6091. // be
  6092. // returned.
  6093. //
  6094. // The following fields may be specified by teachers:
  6095. //
  6096. // * `title`
  6097. // * `description`
  6098. // * `state`
  6099. // * `due_date`
  6100. // * `due_time`
  6101. // * `max_points`
  6102. // * `scheduled_time`
  6103. // * `submission_modification_mode`
  6104. func (c *CoursesCourseWorkPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkPatchCall {
  6105. c.urlParams_.Set("updateMask", updateMask)
  6106. return c
  6107. }
  6108. // Fields allows partial responses to be retrieved. See
  6109. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6110. // for more information.
  6111. func (c *CoursesCourseWorkPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkPatchCall {
  6112. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6113. return c
  6114. }
  6115. // Context sets the context to be used in this call's Do method. Any
  6116. // pending HTTP request will be aborted if the provided context is
  6117. // canceled.
  6118. func (c *CoursesCourseWorkPatchCall) Context(ctx context.Context) *CoursesCourseWorkPatchCall {
  6119. c.ctx_ = ctx
  6120. return c
  6121. }
  6122. // Header returns an http.Header that can be modified by the caller to
  6123. // add HTTP headers to the request.
  6124. func (c *CoursesCourseWorkPatchCall) Header() http.Header {
  6125. if c.header_ == nil {
  6126. c.header_ = make(http.Header)
  6127. }
  6128. return c.header_
  6129. }
  6130. func (c *CoursesCourseWorkPatchCall) doRequest(alt string) (*http.Response, error) {
  6131. reqHeaders := make(http.Header)
  6132. for k, v := range c.header_ {
  6133. reqHeaders[k] = v
  6134. }
  6135. reqHeaders.Set("User-Agent", c.s.userAgent())
  6136. var body io.Reader = nil
  6137. body, err := googleapi.WithoutDataWrapper.JSONReader(c.coursework)
  6138. if err != nil {
  6139. return nil, err
  6140. }
  6141. reqHeaders.Set("Content-Type", "application/json")
  6142. c.urlParams_.Set("alt", alt)
  6143. c.urlParams_.Set("prettyPrint", "false")
  6144. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{id}")
  6145. urls += "?" + c.urlParams_.Encode()
  6146. req, err := http.NewRequest("PATCH", urls, body)
  6147. if err != nil {
  6148. return nil, err
  6149. }
  6150. req.Header = reqHeaders
  6151. googleapi.Expand(req.URL, map[string]string{
  6152. "courseId": c.courseId,
  6153. "id": c.id,
  6154. })
  6155. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6156. }
  6157. // Do executes the "classroom.courses.courseWork.patch" call.
  6158. // Exactly one of *CourseWork or error will be non-nil. Any non-2xx
  6159. // status code is an error. Response headers are in either
  6160. // *CourseWork.ServerResponse.Header or (if a response was returned at
  6161. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6162. // to check whether the returned error was because
  6163. // http.StatusNotModified was returned.
  6164. func (c *CoursesCourseWorkPatchCall) Do(opts ...googleapi.CallOption) (*CourseWork, error) {
  6165. gensupport.SetOptions(c.urlParams_, opts...)
  6166. res, err := c.doRequest("json")
  6167. if res != nil && res.StatusCode == http.StatusNotModified {
  6168. if res.Body != nil {
  6169. res.Body.Close()
  6170. }
  6171. return nil, &googleapi.Error{
  6172. Code: res.StatusCode,
  6173. Header: res.Header,
  6174. }
  6175. }
  6176. if err != nil {
  6177. return nil, err
  6178. }
  6179. defer googleapi.CloseBody(res)
  6180. if err := googleapi.CheckResponse(res); err != nil {
  6181. return nil, err
  6182. }
  6183. ret := &CourseWork{
  6184. ServerResponse: googleapi.ServerResponse{
  6185. Header: res.Header,
  6186. HTTPStatusCode: res.StatusCode,
  6187. },
  6188. }
  6189. target := &ret
  6190. if err := gensupport.DecodeResponse(target, res); err != nil {
  6191. return nil, err
  6192. }
  6193. return ret, nil
  6194. // {
  6195. // "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.",
  6196. // "flatPath": "v1/courses/{courseId}/courseWork/{id}",
  6197. // "httpMethod": "PATCH",
  6198. // "id": "classroom.courses.courseWork.patch",
  6199. // "parameterOrder": [
  6200. // "courseId",
  6201. // "id"
  6202. // ],
  6203. // "parameters": {
  6204. // "courseId": {
  6205. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6206. // "location": "path",
  6207. // "required": true,
  6208. // "type": "string"
  6209. // },
  6210. // "id": {
  6211. // "description": "Identifier of the course work.",
  6212. // "location": "path",
  6213. // "required": true,
  6214. // "type": "string"
  6215. // },
  6216. // "updateMask": {
  6217. // "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`",
  6218. // "format": "google-fieldmask",
  6219. // "location": "query",
  6220. // "type": "string"
  6221. // }
  6222. // },
  6223. // "path": "v1/courses/{courseId}/courseWork/{id}",
  6224. // "request": {
  6225. // "$ref": "CourseWork"
  6226. // },
  6227. // "response": {
  6228. // "$ref": "CourseWork"
  6229. // },
  6230. // "scopes": [
  6231. // "https://www.googleapis.com/auth/classroom.coursework.students"
  6232. // ]
  6233. // }
  6234. }
  6235. // method id "classroom.courses.courseWork.studentSubmissions.get":
  6236. type CoursesCourseWorkStudentSubmissionsGetCall struct {
  6237. s *Service
  6238. courseId string
  6239. courseWorkId string
  6240. id string
  6241. urlParams_ gensupport.URLParams
  6242. ifNoneMatch_ string
  6243. ctx_ context.Context
  6244. header_ http.Header
  6245. }
  6246. // Get: Returns a student submission.
  6247. //
  6248. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6249. // access the
  6250. // requested course, course work, or student submission or for
  6251. // access errors.
  6252. // * `INVALID_ARGUMENT` if the request is malformed.
  6253. // * `NOT_FOUND` if the requested course, course work, or student
  6254. // submission
  6255. // does not exist.
  6256. func (r *CoursesCourseWorkStudentSubmissionsService) Get(courseId string, courseWorkId string, id string) *CoursesCourseWorkStudentSubmissionsGetCall {
  6257. c := &CoursesCourseWorkStudentSubmissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6258. c.courseId = courseId
  6259. c.courseWorkId = courseWorkId
  6260. c.id = id
  6261. return c
  6262. }
  6263. // Fields allows partial responses to be retrieved. See
  6264. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6265. // for more information.
  6266. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsGetCall {
  6267. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6268. return c
  6269. }
  6270. // IfNoneMatch sets the optional parameter which makes the operation
  6271. // fail if the object's ETag matches the given value. This is useful for
  6272. // getting updates only after the object has changed since the last
  6273. // request. Use googleapi.IsNotModified to check whether the response
  6274. // error from Do is the result of In-None-Match.
  6275. func (c *CoursesCourseWorkStudentSubmissionsGetCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsGetCall {
  6276. c.ifNoneMatch_ = entityTag
  6277. return c
  6278. }
  6279. // Context sets the context to be used in this call's Do method. Any
  6280. // pending HTTP request will be aborted if the provided context is
  6281. // canceled.
  6282. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsGetCall {
  6283. c.ctx_ = ctx
  6284. return c
  6285. }
  6286. // Header returns an http.Header that can be modified by the caller to
  6287. // add HTTP headers to the request.
  6288. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Header() http.Header {
  6289. if c.header_ == nil {
  6290. c.header_ = make(http.Header)
  6291. }
  6292. return c.header_
  6293. }
  6294. func (c *CoursesCourseWorkStudentSubmissionsGetCall) doRequest(alt string) (*http.Response, error) {
  6295. reqHeaders := make(http.Header)
  6296. for k, v := range c.header_ {
  6297. reqHeaders[k] = v
  6298. }
  6299. reqHeaders.Set("User-Agent", c.s.userAgent())
  6300. if c.ifNoneMatch_ != "" {
  6301. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6302. }
  6303. var body io.Reader = nil
  6304. c.urlParams_.Set("alt", alt)
  6305. c.urlParams_.Set("prettyPrint", "false")
  6306. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}")
  6307. urls += "?" + c.urlParams_.Encode()
  6308. req, err := http.NewRequest("GET", urls, body)
  6309. if err != nil {
  6310. return nil, err
  6311. }
  6312. req.Header = reqHeaders
  6313. googleapi.Expand(req.URL, map[string]string{
  6314. "courseId": c.courseId,
  6315. "courseWorkId": c.courseWorkId,
  6316. "id": c.id,
  6317. })
  6318. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6319. }
  6320. // Do executes the "classroom.courses.courseWork.studentSubmissions.get" call.
  6321. // Exactly one of *StudentSubmission or error will be non-nil. Any
  6322. // non-2xx status code is an error. Response headers are in either
  6323. // *StudentSubmission.ServerResponse.Header or (if a response was
  6324. // returned at all) in error.(*googleapi.Error).Header. Use
  6325. // googleapi.IsNotModified to check whether the returned error was
  6326. // because http.StatusNotModified was returned.
  6327. func (c *CoursesCourseWorkStudentSubmissionsGetCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) {
  6328. gensupport.SetOptions(c.urlParams_, opts...)
  6329. res, err := c.doRequest("json")
  6330. if res != nil && res.StatusCode == http.StatusNotModified {
  6331. if res.Body != nil {
  6332. res.Body.Close()
  6333. }
  6334. return nil, &googleapi.Error{
  6335. Code: res.StatusCode,
  6336. Header: res.Header,
  6337. }
  6338. }
  6339. if err != nil {
  6340. return nil, err
  6341. }
  6342. defer googleapi.CloseBody(res)
  6343. if err := googleapi.CheckResponse(res); err != nil {
  6344. return nil, err
  6345. }
  6346. ret := &StudentSubmission{
  6347. ServerResponse: googleapi.ServerResponse{
  6348. Header: res.Header,
  6349. HTTPStatusCode: res.StatusCode,
  6350. },
  6351. }
  6352. target := &ret
  6353. if err := gensupport.DecodeResponse(target, res); err != nil {
  6354. return nil, err
  6355. }
  6356. return ret, nil
  6357. // {
  6358. // "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.",
  6359. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  6360. // "httpMethod": "GET",
  6361. // "id": "classroom.courses.courseWork.studentSubmissions.get",
  6362. // "parameterOrder": [
  6363. // "courseId",
  6364. // "courseWorkId",
  6365. // "id"
  6366. // ],
  6367. // "parameters": {
  6368. // "courseId": {
  6369. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6370. // "location": "path",
  6371. // "required": true,
  6372. // "type": "string"
  6373. // },
  6374. // "courseWorkId": {
  6375. // "description": "Identifier of the course work.",
  6376. // "location": "path",
  6377. // "required": true,
  6378. // "type": "string"
  6379. // },
  6380. // "id": {
  6381. // "description": "Identifier of the student submission.",
  6382. // "location": "path",
  6383. // "required": true,
  6384. // "type": "string"
  6385. // }
  6386. // },
  6387. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  6388. // "response": {
  6389. // "$ref": "StudentSubmission"
  6390. // },
  6391. // "scopes": [
  6392. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6393. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  6394. // "https://www.googleapis.com/auth/classroom.coursework.students",
  6395. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly",
  6396. // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly",
  6397. // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly"
  6398. // ]
  6399. // }
  6400. }
  6401. // method id "classroom.courses.courseWork.studentSubmissions.list":
  6402. type CoursesCourseWorkStudentSubmissionsListCall struct {
  6403. s *Service
  6404. courseId string
  6405. courseWorkId string
  6406. urlParams_ gensupport.URLParams
  6407. ifNoneMatch_ string
  6408. ctx_ context.Context
  6409. header_ http.Header
  6410. }
  6411. // List: Returns a list of student submissions that the requester is
  6412. // permitted to
  6413. // view, factoring in the OAuth scopes of the request.
  6414. // `-` may be specified as the `course_work_id` to include
  6415. // student
  6416. // submissions for multiple course work items.
  6417. //
  6418. // Course students may only view their own work. Course teachers
  6419. // and domain administrators may view all student submissions.
  6420. //
  6421. // This method returns the following error codes:
  6422. //
  6423. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6424. // access the
  6425. // requested course or course work, or for access errors.
  6426. // * `INVALID_ARGUMENT` if the request is malformed.
  6427. // * `NOT_FOUND` if the requested course does not exist.
  6428. func (r *CoursesCourseWorkStudentSubmissionsService) List(courseId string, courseWorkId string) *CoursesCourseWorkStudentSubmissionsListCall {
  6429. c := &CoursesCourseWorkStudentSubmissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6430. c.courseId = courseId
  6431. c.courseWorkId = courseWorkId
  6432. return c
  6433. }
  6434. // Late sets the optional parameter "late": Requested lateness value. If
  6435. // specified, returned student submissions are
  6436. // restricted by the requested value.
  6437. // If unspecified, submissions are returned regardless of `late` value.
  6438. //
  6439. // Possible values:
  6440. // "LATE_VALUES_UNSPECIFIED"
  6441. // "LATE_ONLY"
  6442. // "NOT_LATE_ONLY"
  6443. func (c *CoursesCourseWorkStudentSubmissionsListCall) Late(late string) *CoursesCourseWorkStudentSubmissionsListCall {
  6444. c.urlParams_.Set("late", late)
  6445. return c
  6446. }
  6447. // PageSize sets the optional parameter "pageSize": Maximum number of
  6448. // items to return. Zero or unspecified indicates that the
  6449. // server may assign a maximum.
  6450. //
  6451. // The server may return fewer than the specified number of results.
  6452. func (c *CoursesCourseWorkStudentSubmissionsListCall) PageSize(pageSize int64) *CoursesCourseWorkStudentSubmissionsListCall {
  6453. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6454. return c
  6455. }
  6456. // PageToken sets the optional parameter "pageToken":
  6457. // nextPageToken
  6458. // value returned from a previous
  6459. // list call,
  6460. // indicating that the subsequent page of results should be
  6461. // returned.
  6462. //
  6463. // The list request
  6464. // must be otherwise identical to the one that resulted in this token.
  6465. func (c *CoursesCourseWorkStudentSubmissionsListCall) PageToken(pageToken string) *CoursesCourseWorkStudentSubmissionsListCall {
  6466. c.urlParams_.Set("pageToken", pageToken)
  6467. return c
  6468. }
  6469. // States sets the optional parameter "states": Requested submission
  6470. // states. If specified, returned student submissions
  6471. // match one of the specified submission states.
  6472. //
  6473. // Possible values:
  6474. // "SUBMISSION_STATE_UNSPECIFIED"
  6475. // "NEW"
  6476. // "CREATED"
  6477. // "TURNED_IN"
  6478. // "RETURNED"
  6479. // "RECLAIMED_BY_STUDENT"
  6480. func (c *CoursesCourseWorkStudentSubmissionsListCall) States(states ...string) *CoursesCourseWorkStudentSubmissionsListCall {
  6481. c.urlParams_.SetMulti("states", append([]string{}, states...))
  6482. return c
  6483. }
  6484. // UserId sets the optional parameter "userId": Optional argument to
  6485. // restrict returned student work to those owned by the
  6486. // student with the specified identifier. The identifier can be one of
  6487. // the
  6488. // following:
  6489. //
  6490. // * the numeric identifier for the user
  6491. // * the email address of the user
  6492. // * the string literal "me", indicating the requesting user
  6493. func (c *CoursesCourseWorkStudentSubmissionsListCall) UserId(userId string) *CoursesCourseWorkStudentSubmissionsListCall {
  6494. c.urlParams_.Set("userId", userId)
  6495. return c
  6496. }
  6497. // Fields allows partial responses to be retrieved. See
  6498. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6499. // for more information.
  6500. func (c *CoursesCourseWorkStudentSubmissionsListCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsListCall {
  6501. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6502. return c
  6503. }
  6504. // IfNoneMatch sets the optional parameter which makes the operation
  6505. // fail if the object's ETag matches the given value. This is useful for
  6506. // getting updates only after the object has changed since the last
  6507. // request. Use googleapi.IsNotModified to check whether the response
  6508. // error from Do is the result of In-None-Match.
  6509. func (c *CoursesCourseWorkStudentSubmissionsListCall) IfNoneMatch(entityTag string) *CoursesCourseWorkStudentSubmissionsListCall {
  6510. c.ifNoneMatch_ = entityTag
  6511. return c
  6512. }
  6513. // Context sets the context to be used in this call's Do method. Any
  6514. // pending HTTP request will be aborted if the provided context is
  6515. // canceled.
  6516. func (c *CoursesCourseWorkStudentSubmissionsListCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsListCall {
  6517. c.ctx_ = ctx
  6518. return c
  6519. }
  6520. // Header returns an http.Header that can be modified by the caller to
  6521. // add HTTP headers to the request.
  6522. func (c *CoursesCourseWorkStudentSubmissionsListCall) Header() http.Header {
  6523. if c.header_ == nil {
  6524. c.header_ = make(http.Header)
  6525. }
  6526. return c.header_
  6527. }
  6528. func (c *CoursesCourseWorkStudentSubmissionsListCall) doRequest(alt string) (*http.Response, error) {
  6529. reqHeaders := make(http.Header)
  6530. for k, v := range c.header_ {
  6531. reqHeaders[k] = v
  6532. }
  6533. reqHeaders.Set("User-Agent", c.s.userAgent())
  6534. if c.ifNoneMatch_ != "" {
  6535. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6536. }
  6537. var body io.Reader = nil
  6538. c.urlParams_.Set("alt", alt)
  6539. c.urlParams_.Set("prettyPrint", "false")
  6540. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions")
  6541. urls += "?" + c.urlParams_.Encode()
  6542. req, err := http.NewRequest("GET", urls, body)
  6543. if err != nil {
  6544. return nil, err
  6545. }
  6546. req.Header = reqHeaders
  6547. googleapi.Expand(req.URL, map[string]string{
  6548. "courseId": c.courseId,
  6549. "courseWorkId": c.courseWorkId,
  6550. })
  6551. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6552. }
  6553. // Do executes the "classroom.courses.courseWork.studentSubmissions.list" call.
  6554. // Exactly one of *ListStudentSubmissionsResponse or error will be
  6555. // non-nil. Any non-2xx status code is an error. Response headers are in
  6556. // either *ListStudentSubmissionsResponse.ServerResponse.Header or (if a
  6557. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6558. // googleapi.IsNotModified to check whether the returned error was
  6559. // because http.StatusNotModified was returned.
  6560. func (c *CoursesCourseWorkStudentSubmissionsListCall) Do(opts ...googleapi.CallOption) (*ListStudentSubmissionsResponse, error) {
  6561. gensupport.SetOptions(c.urlParams_, opts...)
  6562. res, err := c.doRequest("json")
  6563. if res != nil && res.StatusCode == http.StatusNotModified {
  6564. if res.Body != nil {
  6565. res.Body.Close()
  6566. }
  6567. return nil, &googleapi.Error{
  6568. Code: res.StatusCode,
  6569. Header: res.Header,
  6570. }
  6571. }
  6572. if err != nil {
  6573. return nil, err
  6574. }
  6575. defer googleapi.CloseBody(res)
  6576. if err := googleapi.CheckResponse(res); err != nil {
  6577. return nil, err
  6578. }
  6579. ret := &ListStudentSubmissionsResponse{
  6580. ServerResponse: googleapi.ServerResponse{
  6581. Header: res.Header,
  6582. HTTPStatusCode: res.StatusCode,
  6583. },
  6584. }
  6585. target := &ret
  6586. if err := gensupport.DecodeResponse(target, res); err != nil {
  6587. return nil, err
  6588. }
  6589. return ret, nil
  6590. // {
  6591. // "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.",
  6592. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions",
  6593. // "httpMethod": "GET",
  6594. // "id": "classroom.courses.courseWork.studentSubmissions.list",
  6595. // "parameterOrder": [
  6596. // "courseId",
  6597. // "courseWorkId"
  6598. // ],
  6599. // "parameters": {
  6600. // "courseId": {
  6601. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6602. // "location": "path",
  6603. // "required": true,
  6604. // "type": "string"
  6605. // },
  6606. // "courseWorkId": {
  6607. // "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.",
  6608. // "location": "path",
  6609. // "required": true,
  6610. // "type": "string"
  6611. // },
  6612. // "late": {
  6613. // "description": "Requested lateness value. If specified, returned student submissions are\nrestricted by the requested value.\nIf unspecified, submissions are returned regardless of `late` value.",
  6614. // "enum": [
  6615. // "LATE_VALUES_UNSPECIFIED",
  6616. // "LATE_ONLY",
  6617. // "NOT_LATE_ONLY"
  6618. // ],
  6619. // "location": "query",
  6620. // "type": "string"
  6621. // },
  6622. // "pageSize": {
  6623. // "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.",
  6624. // "format": "int32",
  6625. // "location": "query",
  6626. // "type": "integer"
  6627. // },
  6628. // "pageToken": {
  6629. // "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.",
  6630. // "location": "query",
  6631. // "type": "string"
  6632. // },
  6633. // "states": {
  6634. // "description": "Requested submission states. If specified, returned student submissions\nmatch one of the specified submission states.",
  6635. // "enum": [
  6636. // "SUBMISSION_STATE_UNSPECIFIED",
  6637. // "NEW",
  6638. // "CREATED",
  6639. // "TURNED_IN",
  6640. // "RETURNED",
  6641. // "RECLAIMED_BY_STUDENT"
  6642. // ],
  6643. // "location": "query",
  6644. // "repeated": true,
  6645. // "type": "string"
  6646. // },
  6647. // "userId": {
  6648. // "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",
  6649. // "location": "query",
  6650. // "type": "string"
  6651. // }
  6652. // },
  6653. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions",
  6654. // "response": {
  6655. // "$ref": "ListStudentSubmissionsResponse"
  6656. // },
  6657. // "scopes": [
  6658. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6659. // "https://www.googleapis.com/auth/classroom.coursework.me.readonly",
  6660. // "https://www.googleapis.com/auth/classroom.coursework.students",
  6661. // "https://www.googleapis.com/auth/classroom.coursework.students.readonly",
  6662. // "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly",
  6663. // "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly"
  6664. // ]
  6665. // }
  6666. }
  6667. // Pages invokes f for each page of results.
  6668. // A non-nil error returned from f will halt the iteration.
  6669. // The provided context supersedes any context provided to the Context method.
  6670. func (c *CoursesCourseWorkStudentSubmissionsListCall) Pages(ctx context.Context, f func(*ListStudentSubmissionsResponse) error) error {
  6671. c.ctx_ = ctx
  6672. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6673. for {
  6674. x, err := c.Do()
  6675. if err != nil {
  6676. return err
  6677. }
  6678. if err := f(x); err != nil {
  6679. return err
  6680. }
  6681. if x.NextPageToken == "" {
  6682. return nil
  6683. }
  6684. c.PageToken(x.NextPageToken)
  6685. }
  6686. }
  6687. // method id "classroom.courses.courseWork.studentSubmissions.modifyAttachments":
  6688. type CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall struct {
  6689. s *Service
  6690. courseId string
  6691. courseWorkId string
  6692. id string
  6693. modifyattachmentsrequest *ModifyAttachmentsRequest
  6694. urlParams_ gensupport.URLParams
  6695. ctx_ context.Context
  6696. header_ http.Header
  6697. }
  6698. // ModifyAttachments: Modifies attachments of student
  6699. // submission.
  6700. //
  6701. // Attachments may only be added to student submissions belonging to
  6702. // course
  6703. // work objects with a `workType` of `ASSIGNMENT`.
  6704. //
  6705. // This request must be made by the Developer Console project of
  6706. // the
  6707. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  6708. // used to
  6709. // create the corresponding course work item.
  6710. //
  6711. // This method returns the following error codes:
  6712. //
  6713. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  6714. // access the
  6715. // requested course or course work, if the user is not permitted to
  6716. // modify
  6717. // attachments on the requested student submission, or for
  6718. // access errors.
  6719. // * `INVALID_ARGUMENT` if the request is malformed.
  6720. // * `NOT_FOUND` if the requested course, course work, or student
  6721. // submission
  6722. // does not exist.
  6723. func (r *CoursesCourseWorkStudentSubmissionsService) ModifyAttachments(courseId string, courseWorkId string, id string, modifyattachmentsrequest *ModifyAttachmentsRequest) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall {
  6724. c := &CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6725. c.courseId = courseId
  6726. c.courseWorkId = courseWorkId
  6727. c.id = id
  6728. c.modifyattachmentsrequest = modifyattachmentsrequest
  6729. return c
  6730. }
  6731. // Fields allows partial responses to be retrieved. See
  6732. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6733. // for more information.
  6734. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall {
  6735. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6736. return c
  6737. }
  6738. // Context sets the context to be used in this call's Do method. Any
  6739. // pending HTTP request will be aborted if the provided context is
  6740. // canceled.
  6741. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall {
  6742. c.ctx_ = ctx
  6743. return c
  6744. }
  6745. // Header returns an http.Header that can be modified by the caller to
  6746. // add HTTP headers to the request.
  6747. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Header() http.Header {
  6748. if c.header_ == nil {
  6749. c.header_ = make(http.Header)
  6750. }
  6751. return c.header_
  6752. }
  6753. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) doRequest(alt string) (*http.Response, error) {
  6754. reqHeaders := make(http.Header)
  6755. for k, v := range c.header_ {
  6756. reqHeaders[k] = v
  6757. }
  6758. reqHeaders.Set("User-Agent", c.s.userAgent())
  6759. var body io.Reader = nil
  6760. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyattachmentsrequest)
  6761. if err != nil {
  6762. return nil, err
  6763. }
  6764. reqHeaders.Set("Content-Type", "application/json")
  6765. c.urlParams_.Set("alt", alt)
  6766. c.urlParams_.Set("prettyPrint", "false")
  6767. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments")
  6768. urls += "?" + c.urlParams_.Encode()
  6769. req, err := http.NewRequest("POST", urls, body)
  6770. if err != nil {
  6771. return nil, err
  6772. }
  6773. req.Header = reqHeaders
  6774. googleapi.Expand(req.URL, map[string]string{
  6775. "courseId": c.courseId,
  6776. "courseWorkId": c.courseWorkId,
  6777. "id": c.id,
  6778. })
  6779. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6780. }
  6781. // Do executes the "classroom.courses.courseWork.studentSubmissions.modifyAttachments" call.
  6782. // Exactly one of *StudentSubmission or error will be non-nil. Any
  6783. // non-2xx status code is an error. Response headers are in either
  6784. // *StudentSubmission.ServerResponse.Header or (if a response was
  6785. // returned at all) in error.(*googleapi.Error).Header. Use
  6786. // googleapi.IsNotModified to check whether the returned error was
  6787. // because http.StatusNotModified was returned.
  6788. func (c *CoursesCourseWorkStudentSubmissionsModifyAttachmentsCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) {
  6789. gensupport.SetOptions(c.urlParams_, opts...)
  6790. res, err := c.doRequest("json")
  6791. if res != nil && res.StatusCode == http.StatusNotModified {
  6792. if res.Body != nil {
  6793. res.Body.Close()
  6794. }
  6795. return nil, &googleapi.Error{
  6796. Code: res.StatusCode,
  6797. Header: res.Header,
  6798. }
  6799. }
  6800. if err != nil {
  6801. return nil, err
  6802. }
  6803. defer googleapi.CloseBody(res)
  6804. if err := googleapi.CheckResponse(res); err != nil {
  6805. return nil, err
  6806. }
  6807. ret := &StudentSubmission{
  6808. ServerResponse: googleapi.ServerResponse{
  6809. Header: res.Header,
  6810. HTTPStatusCode: res.StatusCode,
  6811. },
  6812. }
  6813. target := &ret
  6814. if err := gensupport.DecodeResponse(target, res); err != nil {
  6815. return nil, err
  6816. }
  6817. return ret, nil
  6818. // {
  6819. // "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.",
  6820. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments",
  6821. // "httpMethod": "POST",
  6822. // "id": "classroom.courses.courseWork.studentSubmissions.modifyAttachments",
  6823. // "parameterOrder": [
  6824. // "courseId",
  6825. // "courseWorkId",
  6826. // "id"
  6827. // ],
  6828. // "parameters": {
  6829. // "courseId": {
  6830. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  6831. // "location": "path",
  6832. // "required": true,
  6833. // "type": "string"
  6834. // },
  6835. // "courseWorkId": {
  6836. // "description": "Identifier of the course work.",
  6837. // "location": "path",
  6838. // "required": true,
  6839. // "type": "string"
  6840. // },
  6841. // "id": {
  6842. // "description": "Identifier of the student submission.",
  6843. // "location": "path",
  6844. // "required": true,
  6845. // "type": "string"
  6846. // }
  6847. // },
  6848. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:modifyAttachments",
  6849. // "request": {
  6850. // "$ref": "ModifyAttachmentsRequest"
  6851. // },
  6852. // "response": {
  6853. // "$ref": "StudentSubmission"
  6854. // },
  6855. // "scopes": [
  6856. // "https://www.googleapis.com/auth/classroom.coursework.me",
  6857. // "https://www.googleapis.com/auth/classroom.coursework.students"
  6858. // ]
  6859. // }
  6860. }
  6861. // method id "classroom.courses.courseWork.studentSubmissions.patch":
  6862. type CoursesCourseWorkStudentSubmissionsPatchCall struct {
  6863. s *Service
  6864. courseId string
  6865. courseWorkId string
  6866. id string
  6867. studentsubmission *StudentSubmission
  6868. urlParams_ gensupport.URLParams
  6869. ctx_ context.Context
  6870. header_ http.Header
  6871. }
  6872. // Patch: Updates one or more fields of a student submission.
  6873. //
  6874. // See google.classroom.v1.StudentSubmission for details
  6875. // of which fields may be updated and who may change them.
  6876. //
  6877. // This request must be made by the Developer Console project of
  6878. // the
  6879. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  6880. // used to
  6881. // create the corresponding course work item.
  6882. //
  6883. // This method returns the following error codes:
  6884. //
  6885. // * `PERMISSION_DENIED` if the requesting developer project did not
  6886. // create
  6887. // the corresponding course work, if the user is not permitted to make
  6888. // the
  6889. // requested modification to the student submission, or for
  6890. // access errors.
  6891. // * `INVALID_ARGUMENT` if the request is malformed.
  6892. // * `NOT_FOUND` if the requested course, course work, or student
  6893. // submission
  6894. // does not exist.
  6895. func (r *CoursesCourseWorkStudentSubmissionsService) Patch(courseId string, courseWorkId string, id string, studentsubmission *StudentSubmission) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6896. c := &CoursesCourseWorkStudentSubmissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6897. c.courseId = courseId
  6898. c.courseWorkId = courseWorkId
  6899. c.id = id
  6900. c.studentsubmission = studentsubmission
  6901. return c
  6902. }
  6903. // UpdateMask sets the optional parameter "updateMask": Mask that
  6904. // identifies which fields on the student submission to update.
  6905. // This field is required to do an update. The update fails if
  6906. // invalid
  6907. // fields are specified.
  6908. //
  6909. // The following fields may be specified by teachers:
  6910. //
  6911. // * `draft_grade`
  6912. // * `assigned_grade`
  6913. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) UpdateMask(updateMask string) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6914. c.urlParams_.Set("updateMask", updateMask)
  6915. return c
  6916. }
  6917. // Fields allows partial responses to be retrieved. See
  6918. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6919. // for more information.
  6920. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6921. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6922. return c
  6923. }
  6924. // Context sets the context to be used in this call's Do method. Any
  6925. // pending HTTP request will be aborted if the provided context is
  6926. // canceled.
  6927. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsPatchCall {
  6928. c.ctx_ = ctx
  6929. return c
  6930. }
  6931. // Header returns an http.Header that can be modified by the caller to
  6932. // add HTTP headers to the request.
  6933. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Header() http.Header {
  6934. if c.header_ == nil {
  6935. c.header_ = make(http.Header)
  6936. }
  6937. return c.header_
  6938. }
  6939. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) doRequest(alt string) (*http.Response, error) {
  6940. reqHeaders := make(http.Header)
  6941. for k, v := range c.header_ {
  6942. reqHeaders[k] = v
  6943. }
  6944. reqHeaders.Set("User-Agent", c.s.userAgent())
  6945. var body io.Reader = nil
  6946. body, err := googleapi.WithoutDataWrapper.JSONReader(c.studentsubmission)
  6947. if err != nil {
  6948. return nil, err
  6949. }
  6950. reqHeaders.Set("Content-Type", "application/json")
  6951. c.urlParams_.Set("alt", alt)
  6952. c.urlParams_.Set("prettyPrint", "false")
  6953. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}")
  6954. urls += "?" + c.urlParams_.Encode()
  6955. req, err := http.NewRequest("PATCH", urls, body)
  6956. if err != nil {
  6957. return nil, err
  6958. }
  6959. req.Header = reqHeaders
  6960. googleapi.Expand(req.URL, map[string]string{
  6961. "courseId": c.courseId,
  6962. "courseWorkId": c.courseWorkId,
  6963. "id": c.id,
  6964. })
  6965. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6966. }
  6967. // Do executes the "classroom.courses.courseWork.studentSubmissions.patch" call.
  6968. // Exactly one of *StudentSubmission or error will be non-nil. Any
  6969. // non-2xx status code is an error. Response headers are in either
  6970. // *StudentSubmission.ServerResponse.Header or (if a response was
  6971. // returned at all) in error.(*googleapi.Error).Header. Use
  6972. // googleapi.IsNotModified to check whether the returned error was
  6973. // because http.StatusNotModified was returned.
  6974. func (c *CoursesCourseWorkStudentSubmissionsPatchCall) Do(opts ...googleapi.CallOption) (*StudentSubmission, error) {
  6975. gensupport.SetOptions(c.urlParams_, opts...)
  6976. res, err := c.doRequest("json")
  6977. if res != nil && res.StatusCode == http.StatusNotModified {
  6978. if res.Body != nil {
  6979. res.Body.Close()
  6980. }
  6981. return nil, &googleapi.Error{
  6982. Code: res.StatusCode,
  6983. Header: res.Header,
  6984. }
  6985. }
  6986. if err != nil {
  6987. return nil, err
  6988. }
  6989. defer googleapi.CloseBody(res)
  6990. if err := googleapi.CheckResponse(res); err != nil {
  6991. return nil, err
  6992. }
  6993. ret := &StudentSubmission{
  6994. ServerResponse: googleapi.ServerResponse{
  6995. Header: res.Header,
  6996. HTTPStatusCode: res.StatusCode,
  6997. },
  6998. }
  6999. target := &ret
  7000. if err := gensupport.DecodeResponse(target, res); err != nil {
  7001. return nil, err
  7002. }
  7003. return ret, nil
  7004. // {
  7005. // "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.",
  7006. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  7007. // "httpMethod": "PATCH",
  7008. // "id": "classroom.courses.courseWork.studentSubmissions.patch",
  7009. // "parameterOrder": [
  7010. // "courseId",
  7011. // "courseWorkId",
  7012. // "id"
  7013. // ],
  7014. // "parameters": {
  7015. // "courseId": {
  7016. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7017. // "location": "path",
  7018. // "required": true,
  7019. // "type": "string"
  7020. // },
  7021. // "courseWorkId": {
  7022. // "description": "Identifier of the course work.",
  7023. // "location": "path",
  7024. // "required": true,
  7025. // "type": "string"
  7026. // },
  7027. // "id": {
  7028. // "description": "Identifier of the student submission.",
  7029. // "location": "path",
  7030. // "required": true,
  7031. // "type": "string"
  7032. // },
  7033. // "updateMask": {
  7034. // "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`",
  7035. // "format": "google-fieldmask",
  7036. // "location": "query",
  7037. // "type": "string"
  7038. // }
  7039. // },
  7040. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}",
  7041. // "request": {
  7042. // "$ref": "StudentSubmission"
  7043. // },
  7044. // "response": {
  7045. // "$ref": "StudentSubmission"
  7046. // },
  7047. // "scopes": [
  7048. // "https://www.googleapis.com/auth/classroom.coursework.me",
  7049. // "https://www.googleapis.com/auth/classroom.coursework.students"
  7050. // ]
  7051. // }
  7052. }
  7053. // method id "classroom.courses.courseWork.studentSubmissions.reclaim":
  7054. type CoursesCourseWorkStudentSubmissionsReclaimCall struct {
  7055. s *Service
  7056. courseId string
  7057. courseWorkId string
  7058. id string
  7059. reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest
  7060. urlParams_ gensupport.URLParams
  7061. ctx_ context.Context
  7062. header_ http.Header
  7063. }
  7064. // Reclaim: Reclaims a student submission on behalf of the student that
  7065. // owns it.
  7066. //
  7067. // Reclaiming a student submission transfers ownership of attached
  7068. // Drive
  7069. // files to the student and updates the submission state.
  7070. //
  7071. // Only the student that owns the requested student submission may call
  7072. // this
  7073. // method, and only for a student submission that has been turned
  7074. // in.
  7075. //
  7076. // This request must be made by the Developer Console project of
  7077. // the
  7078. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  7079. // used to
  7080. // create the corresponding course work item.
  7081. //
  7082. // This method returns the following error codes:
  7083. //
  7084. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7085. // access the
  7086. // requested course or course work, unsubmit the requested student
  7087. // submission,
  7088. // or for access errors.
  7089. // * `FAILED_PRECONDITION` if the student submission has not been turned
  7090. // in.
  7091. // * `INVALID_ARGUMENT` if the request is malformed.
  7092. // * `NOT_FOUND` if the requested course, course work, or student
  7093. // submission
  7094. // does not exist.
  7095. func (r *CoursesCourseWorkStudentSubmissionsService) Reclaim(courseId string, courseWorkId string, id string, reclaimstudentsubmissionrequest *ReclaimStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReclaimCall {
  7096. c := &CoursesCourseWorkStudentSubmissionsReclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7097. c.courseId = courseId
  7098. c.courseWorkId = courseWorkId
  7099. c.id = id
  7100. c.reclaimstudentsubmissionrequest = reclaimstudentsubmissionrequest
  7101. return c
  7102. }
  7103. // Fields allows partial responses to be retrieved. See
  7104. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7105. // for more information.
  7106. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReclaimCall {
  7107. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7108. return c
  7109. }
  7110. // Context sets the context to be used in this call's Do method. Any
  7111. // pending HTTP request will be aborted if the provided context is
  7112. // canceled.
  7113. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReclaimCall {
  7114. c.ctx_ = ctx
  7115. return c
  7116. }
  7117. // Header returns an http.Header that can be modified by the caller to
  7118. // add HTTP headers to the request.
  7119. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Header() http.Header {
  7120. if c.header_ == nil {
  7121. c.header_ = make(http.Header)
  7122. }
  7123. return c.header_
  7124. }
  7125. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) doRequest(alt string) (*http.Response, error) {
  7126. reqHeaders := make(http.Header)
  7127. for k, v := range c.header_ {
  7128. reqHeaders[k] = v
  7129. }
  7130. reqHeaders.Set("User-Agent", c.s.userAgent())
  7131. var body io.Reader = nil
  7132. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reclaimstudentsubmissionrequest)
  7133. if err != nil {
  7134. return nil, err
  7135. }
  7136. reqHeaders.Set("Content-Type", "application/json")
  7137. c.urlParams_.Set("alt", alt)
  7138. c.urlParams_.Set("prettyPrint", "false")
  7139. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim")
  7140. urls += "?" + c.urlParams_.Encode()
  7141. req, err := http.NewRequest("POST", urls, body)
  7142. if err != nil {
  7143. return nil, err
  7144. }
  7145. req.Header = reqHeaders
  7146. googleapi.Expand(req.URL, map[string]string{
  7147. "courseId": c.courseId,
  7148. "courseWorkId": c.courseWorkId,
  7149. "id": c.id,
  7150. })
  7151. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7152. }
  7153. // Do executes the "classroom.courses.courseWork.studentSubmissions.reclaim" call.
  7154. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7155. // code is an error. Response headers are in either
  7156. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7157. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7158. // check whether the returned error was because http.StatusNotModified
  7159. // was returned.
  7160. func (c *CoursesCourseWorkStudentSubmissionsReclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7161. gensupport.SetOptions(c.urlParams_, opts...)
  7162. res, err := c.doRequest("json")
  7163. if res != nil && res.StatusCode == http.StatusNotModified {
  7164. if res.Body != nil {
  7165. res.Body.Close()
  7166. }
  7167. return nil, &googleapi.Error{
  7168. Code: res.StatusCode,
  7169. Header: res.Header,
  7170. }
  7171. }
  7172. if err != nil {
  7173. return nil, err
  7174. }
  7175. defer googleapi.CloseBody(res)
  7176. if err := googleapi.CheckResponse(res); err != nil {
  7177. return nil, err
  7178. }
  7179. ret := &Empty{
  7180. ServerResponse: googleapi.ServerResponse{
  7181. Header: res.Header,
  7182. HTTPStatusCode: res.StatusCode,
  7183. },
  7184. }
  7185. target := &ret
  7186. if err := gensupport.DecodeResponse(target, res); err != nil {
  7187. return nil, err
  7188. }
  7189. return ret, nil
  7190. // {
  7191. // "description": "Reclaims a student submission on behalf of the student that owns it.\n\nReclaiming a student submission transfers ownership of attached Drive\nfiles to the student and updates the submission state.\n\nOnly the student that owns the requested student submission may call this\nmethod, and only for a student submission that has been turned in.\n\nThis request must be made by the Developer Console project of the\n[OAuth client ID](https://support.google.com/cloud/answer/6158849) used to\ncreate the corresponding course work item.\n\nThis method returns the following error codes:\n\n* `PERMISSION_DENIED` if the requesting user is not permitted to access the\nrequested course or course work, unsubmit the requested student submission,\nor for access errors.\n* `FAILED_PRECONDITION` if the student submission has not been turned in.\n* `INVALID_ARGUMENT` if the request is malformed.\n* `NOT_FOUND` if the requested course, course work, or student submission\ndoes not exist.",
  7192. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim",
  7193. // "httpMethod": "POST",
  7194. // "id": "classroom.courses.courseWork.studentSubmissions.reclaim",
  7195. // "parameterOrder": [
  7196. // "courseId",
  7197. // "courseWorkId",
  7198. // "id"
  7199. // ],
  7200. // "parameters": {
  7201. // "courseId": {
  7202. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7203. // "location": "path",
  7204. // "required": true,
  7205. // "type": "string"
  7206. // },
  7207. // "courseWorkId": {
  7208. // "description": "Identifier of the course work.",
  7209. // "location": "path",
  7210. // "required": true,
  7211. // "type": "string"
  7212. // },
  7213. // "id": {
  7214. // "description": "Identifier of the student submission.",
  7215. // "location": "path",
  7216. // "required": true,
  7217. // "type": "string"
  7218. // }
  7219. // },
  7220. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim",
  7221. // "request": {
  7222. // "$ref": "ReclaimStudentSubmissionRequest"
  7223. // },
  7224. // "response": {
  7225. // "$ref": "Empty"
  7226. // },
  7227. // "scopes": [
  7228. // "https://www.googleapis.com/auth/classroom.coursework.me"
  7229. // ]
  7230. // }
  7231. }
  7232. // method id "classroom.courses.courseWork.studentSubmissions.return":
  7233. type CoursesCourseWorkStudentSubmissionsReturnCall struct {
  7234. s *Service
  7235. courseId string
  7236. courseWorkId string
  7237. id string
  7238. returnstudentsubmissionrequest *ReturnStudentSubmissionRequest
  7239. urlParams_ gensupport.URLParams
  7240. ctx_ context.Context
  7241. header_ http.Header
  7242. }
  7243. // Return: Returns a student submission.
  7244. //
  7245. // Returning a student submission transfers ownership of attached
  7246. // Drive
  7247. // files to the student and may also update the submission state.
  7248. // Unlike the Classroom application, returning a student submission does
  7249. // not
  7250. // set assignedGrade to the draftGrade value.
  7251. //
  7252. // Only a teacher of the course that contains the requested student
  7253. // submission
  7254. // may call this method.
  7255. //
  7256. // This request must be made by the Developer Console project of
  7257. // the
  7258. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  7259. // used to
  7260. // create the corresponding course work item.
  7261. //
  7262. // This method returns the following error codes:
  7263. //
  7264. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7265. // access the
  7266. // requested course or course work, return the requested student
  7267. // submission,
  7268. // or for access errors.
  7269. // * `INVALID_ARGUMENT` if the request is malformed.
  7270. // * `NOT_FOUND` if the requested course, course work, or student
  7271. // submission
  7272. // does not exist.
  7273. func (r *CoursesCourseWorkStudentSubmissionsService) Return(courseId string, courseWorkId string, id string, returnstudentsubmissionrequest *ReturnStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsReturnCall {
  7274. c := &CoursesCourseWorkStudentSubmissionsReturnCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7275. c.courseId = courseId
  7276. c.courseWorkId = courseWorkId
  7277. c.id = id
  7278. c.returnstudentsubmissionrequest = returnstudentsubmissionrequest
  7279. return c
  7280. }
  7281. // Fields allows partial responses to be retrieved. See
  7282. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7283. // for more information.
  7284. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsReturnCall {
  7285. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7286. return c
  7287. }
  7288. // Context sets the context to be used in this call's Do method. Any
  7289. // pending HTTP request will be aborted if the provided context is
  7290. // canceled.
  7291. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsReturnCall {
  7292. c.ctx_ = ctx
  7293. return c
  7294. }
  7295. // Header returns an http.Header that can be modified by the caller to
  7296. // add HTTP headers to the request.
  7297. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Header() http.Header {
  7298. if c.header_ == nil {
  7299. c.header_ = make(http.Header)
  7300. }
  7301. return c.header_
  7302. }
  7303. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) doRequest(alt string) (*http.Response, error) {
  7304. reqHeaders := make(http.Header)
  7305. for k, v := range c.header_ {
  7306. reqHeaders[k] = v
  7307. }
  7308. reqHeaders.Set("User-Agent", c.s.userAgent())
  7309. var body io.Reader = nil
  7310. body, err := googleapi.WithoutDataWrapper.JSONReader(c.returnstudentsubmissionrequest)
  7311. if err != nil {
  7312. return nil, err
  7313. }
  7314. reqHeaders.Set("Content-Type", "application/json")
  7315. c.urlParams_.Set("alt", alt)
  7316. c.urlParams_.Set("prettyPrint", "false")
  7317. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return")
  7318. urls += "?" + c.urlParams_.Encode()
  7319. req, err := http.NewRequest("POST", urls, body)
  7320. if err != nil {
  7321. return nil, err
  7322. }
  7323. req.Header = reqHeaders
  7324. googleapi.Expand(req.URL, map[string]string{
  7325. "courseId": c.courseId,
  7326. "courseWorkId": c.courseWorkId,
  7327. "id": c.id,
  7328. })
  7329. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7330. }
  7331. // Do executes the "classroom.courses.courseWork.studentSubmissions.return" call.
  7332. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7333. // code is an error. Response headers are in either
  7334. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7335. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7336. // check whether the returned error was because http.StatusNotModified
  7337. // was returned.
  7338. func (c *CoursesCourseWorkStudentSubmissionsReturnCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7339. gensupport.SetOptions(c.urlParams_, opts...)
  7340. res, err := c.doRequest("json")
  7341. if res != nil && res.StatusCode == http.StatusNotModified {
  7342. if res.Body != nil {
  7343. res.Body.Close()
  7344. }
  7345. return nil, &googleapi.Error{
  7346. Code: res.StatusCode,
  7347. Header: res.Header,
  7348. }
  7349. }
  7350. if err != nil {
  7351. return nil, err
  7352. }
  7353. defer googleapi.CloseBody(res)
  7354. if err := googleapi.CheckResponse(res); err != nil {
  7355. return nil, err
  7356. }
  7357. ret := &Empty{
  7358. ServerResponse: googleapi.ServerResponse{
  7359. Header: res.Header,
  7360. HTTPStatusCode: res.StatusCode,
  7361. },
  7362. }
  7363. target := &ret
  7364. if err := gensupport.DecodeResponse(target, res); err != nil {
  7365. return nil, err
  7366. }
  7367. return ret, nil
  7368. // {
  7369. // "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.",
  7370. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return",
  7371. // "httpMethod": "POST",
  7372. // "id": "classroom.courses.courseWork.studentSubmissions.return",
  7373. // "parameterOrder": [
  7374. // "courseId",
  7375. // "courseWorkId",
  7376. // "id"
  7377. // ],
  7378. // "parameters": {
  7379. // "courseId": {
  7380. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7381. // "location": "path",
  7382. // "required": true,
  7383. // "type": "string"
  7384. // },
  7385. // "courseWorkId": {
  7386. // "description": "Identifier of the course work.",
  7387. // "location": "path",
  7388. // "required": true,
  7389. // "type": "string"
  7390. // },
  7391. // "id": {
  7392. // "description": "Identifier of the student submission.",
  7393. // "location": "path",
  7394. // "required": true,
  7395. // "type": "string"
  7396. // }
  7397. // },
  7398. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:return",
  7399. // "request": {
  7400. // "$ref": "ReturnStudentSubmissionRequest"
  7401. // },
  7402. // "response": {
  7403. // "$ref": "Empty"
  7404. // },
  7405. // "scopes": [
  7406. // "https://www.googleapis.com/auth/classroom.coursework.students"
  7407. // ]
  7408. // }
  7409. }
  7410. // method id "classroom.courses.courseWork.studentSubmissions.turnIn":
  7411. type CoursesCourseWorkStudentSubmissionsTurnInCall struct {
  7412. s *Service
  7413. courseId string
  7414. courseWorkId string
  7415. id string
  7416. turninstudentsubmissionrequest *TurnInStudentSubmissionRequest
  7417. urlParams_ gensupport.URLParams
  7418. ctx_ context.Context
  7419. header_ http.Header
  7420. }
  7421. // TurnIn: Turns in a student submission.
  7422. //
  7423. // Turning in a student submission transfers ownership of attached
  7424. // Drive
  7425. // files to the teacher and may also update the submission state.
  7426. //
  7427. // This may only be called by the student that owns the specified
  7428. // student
  7429. // submission.
  7430. //
  7431. // This request must be made by the Developer Console project of
  7432. // the
  7433. // [OAuth client ID](https://support.google.com/cloud/answer/6158849)
  7434. // used to
  7435. // create the corresponding course work item.
  7436. //
  7437. // This method returns the following error codes:
  7438. //
  7439. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7440. // access the
  7441. // requested course or course work, turn in the requested student
  7442. // submission,
  7443. // or for access errors.
  7444. // * `INVALID_ARGUMENT` if the request is malformed.
  7445. // * `NOT_FOUND` if the requested course, course work, or student
  7446. // submission
  7447. // does not exist.
  7448. func (r *CoursesCourseWorkStudentSubmissionsService) TurnIn(courseId string, courseWorkId string, id string, turninstudentsubmissionrequest *TurnInStudentSubmissionRequest) *CoursesCourseWorkStudentSubmissionsTurnInCall {
  7449. c := &CoursesCourseWorkStudentSubmissionsTurnInCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7450. c.courseId = courseId
  7451. c.courseWorkId = courseWorkId
  7452. c.id = id
  7453. c.turninstudentsubmissionrequest = turninstudentsubmissionrequest
  7454. return c
  7455. }
  7456. // Fields allows partial responses to be retrieved. See
  7457. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7458. // for more information.
  7459. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Fields(s ...googleapi.Field) *CoursesCourseWorkStudentSubmissionsTurnInCall {
  7460. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7461. return c
  7462. }
  7463. // Context sets the context to be used in this call's Do method. Any
  7464. // pending HTTP request will be aborted if the provided context is
  7465. // canceled.
  7466. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Context(ctx context.Context) *CoursesCourseWorkStudentSubmissionsTurnInCall {
  7467. c.ctx_ = ctx
  7468. return c
  7469. }
  7470. // Header returns an http.Header that can be modified by the caller to
  7471. // add HTTP headers to the request.
  7472. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Header() http.Header {
  7473. if c.header_ == nil {
  7474. c.header_ = make(http.Header)
  7475. }
  7476. return c.header_
  7477. }
  7478. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) doRequest(alt string) (*http.Response, error) {
  7479. reqHeaders := make(http.Header)
  7480. for k, v := range c.header_ {
  7481. reqHeaders[k] = v
  7482. }
  7483. reqHeaders.Set("User-Agent", c.s.userAgent())
  7484. var body io.Reader = nil
  7485. body, err := googleapi.WithoutDataWrapper.JSONReader(c.turninstudentsubmissionrequest)
  7486. if err != nil {
  7487. return nil, err
  7488. }
  7489. reqHeaders.Set("Content-Type", "application/json")
  7490. c.urlParams_.Set("alt", alt)
  7491. c.urlParams_.Set("prettyPrint", "false")
  7492. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn")
  7493. urls += "?" + c.urlParams_.Encode()
  7494. req, err := http.NewRequest("POST", urls, body)
  7495. if err != nil {
  7496. return nil, err
  7497. }
  7498. req.Header = reqHeaders
  7499. googleapi.Expand(req.URL, map[string]string{
  7500. "courseId": c.courseId,
  7501. "courseWorkId": c.courseWorkId,
  7502. "id": c.id,
  7503. })
  7504. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7505. }
  7506. // Do executes the "classroom.courses.courseWork.studentSubmissions.turnIn" call.
  7507. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7508. // code is an error. Response headers are in either
  7509. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7510. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7511. // check whether the returned error was because http.StatusNotModified
  7512. // was returned.
  7513. func (c *CoursesCourseWorkStudentSubmissionsTurnInCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7514. gensupport.SetOptions(c.urlParams_, opts...)
  7515. res, err := c.doRequest("json")
  7516. if res != nil && res.StatusCode == http.StatusNotModified {
  7517. if res.Body != nil {
  7518. res.Body.Close()
  7519. }
  7520. return nil, &googleapi.Error{
  7521. Code: res.StatusCode,
  7522. Header: res.Header,
  7523. }
  7524. }
  7525. if err != nil {
  7526. return nil, err
  7527. }
  7528. defer googleapi.CloseBody(res)
  7529. if err := googleapi.CheckResponse(res); err != nil {
  7530. return nil, err
  7531. }
  7532. ret := &Empty{
  7533. ServerResponse: googleapi.ServerResponse{
  7534. Header: res.Header,
  7535. HTTPStatusCode: res.StatusCode,
  7536. },
  7537. }
  7538. target := &ret
  7539. if err := gensupport.DecodeResponse(target, res); err != nil {
  7540. return nil, err
  7541. }
  7542. return ret, nil
  7543. // {
  7544. // "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.",
  7545. // "flatPath": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn",
  7546. // "httpMethod": "POST",
  7547. // "id": "classroom.courses.courseWork.studentSubmissions.turnIn",
  7548. // "parameterOrder": [
  7549. // "courseId",
  7550. // "courseWorkId",
  7551. // "id"
  7552. // ],
  7553. // "parameters": {
  7554. // "courseId": {
  7555. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7556. // "location": "path",
  7557. // "required": true,
  7558. // "type": "string"
  7559. // },
  7560. // "courseWorkId": {
  7561. // "description": "Identifier of the course work.",
  7562. // "location": "path",
  7563. // "required": true,
  7564. // "type": "string"
  7565. // },
  7566. // "id": {
  7567. // "description": "Identifier of the student submission.",
  7568. // "location": "path",
  7569. // "required": true,
  7570. // "type": "string"
  7571. // }
  7572. // },
  7573. // "path": "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:turnIn",
  7574. // "request": {
  7575. // "$ref": "TurnInStudentSubmissionRequest"
  7576. // },
  7577. // "response": {
  7578. // "$ref": "Empty"
  7579. // },
  7580. // "scopes": [
  7581. // "https://www.googleapis.com/auth/classroom.coursework.me"
  7582. // ]
  7583. // }
  7584. }
  7585. // method id "classroom.courses.students.create":
  7586. type CoursesStudentsCreateCall struct {
  7587. s *Service
  7588. courseId string
  7589. student *Student
  7590. urlParams_ gensupport.URLParams
  7591. ctx_ context.Context
  7592. header_ http.Header
  7593. }
  7594. // Create: Adds a user as a student of a course.
  7595. //
  7596. // This method returns the following error codes:
  7597. //
  7598. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7599. // create
  7600. // students in this course or for access errors.
  7601. // * `NOT_FOUND` if the requested course ID does not exist.
  7602. // * `FAILED_PRECONDITION` if the requested user's account is
  7603. // disabled,
  7604. // for the following request errors:
  7605. // * CourseMemberLimitReached
  7606. // * CourseNotModifiable
  7607. // * UserGroupsMembershipLimitReached
  7608. // * `ALREADY_EXISTS` if the user is already a student or teacher in
  7609. // the
  7610. // course.
  7611. func (r *CoursesStudentsService) Create(courseId string, student *Student) *CoursesStudentsCreateCall {
  7612. c := &CoursesStudentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7613. c.courseId = courseId
  7614. c.student = student
  7615. return c
  7616. }
  7617. // EnrollmentCode sets the optional parameter "enrollmentCode":
  7618. // Enrollment code of the course to create the student in.
  7619. // This code is required if userId
  7620. // corresponds to the requesting user; it may be omitted if the
  7621. // requesting
  7622. // user has administrative permissions to create students for any user.
  7623. func (c *CoursesStudentsCreateCall) EnrollmentCode(enrollmentCode string) *CoursesStudentsCreateCall {
  7624. c.urlParams_.Set("enrollmentCode", enrollmentCode)
  7625. return c
  7626. }
  7627. // Fields allows partial responses to be retrieved. See
  7628. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7629. // for more information.
  7630. func (c *CoursesStudentsCreateCall) Fields(s ...googleapi.Field) *CoursesStudentsCreateCall {
  7631. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7632. return c
  7633. }
  7634. // Context sets the context to be used in this call's Do method. Any
  7635. // pending HTTP request will be aborted if the provided context is
  7636. // canceled.
  7637. func (c *CoursesStudentsCreateCall) Context(ctx context.Context) *CoursesStudentsCreateCall {
  7638. c.ctx_ = ctx
  7639. return c
  7640. }
  7641. // Header returns an http.Header that can be modified by the caller to
  7642. // add HTTP headers to the request.
  7643. func (c *CoursesStudentsCreateCall) Header() http.Header {
  7644. if c.header_ == nil {
  7645. c.header_ = make(http.Header)
  7646. }
  7647. return c.header_
  7648. }
  7649. func (c *CoursesStudentsCreateCall) doRequest(alt string) (*http.Response, error) {
  7650. reqHeaders := make(http.Header)
  7651. for k, v := range c.header_ {
  7652. reqHeaders[k] = v
  7653. }
  7654. reqHeaders.Set("User-Agent", c.s.userAgent())
  7655. var body io.Reader = nil
  7656. body, err := googleapi.WithoutDataWrapper.JSONReader(c.student)
  7657. if err != nil {
  7658. return nil, err
  7659. }
  7660. reqHeaders.Set("Content-Type", "application/json")
  7661. c.urlParams_.Set("alt", alt)
  7662. c.urlParams_.Set("prettyPrint", "false")
  7663. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students")
  7664. urls += "?" + c.urlParams_.Encode()
  7665. req, err := http.NewRequest("POST", urls, body)
  7666. if err != nil {
  7667. return nil, err
  7668. }
  7669. req.Header = reqHeaders
  7670. googleapi.Expand(req.URL, map[string]string{
  7671. "courseId": c.courseId,
  7672. })
  7673. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7674. }
  7675. // Do executes the "classroom.courses.students.create" call.
  7676. // Exactly one of *Student or error will be non-nil. Any non-2xx status
  7677. // code is an error. Response headers are in either
  7678. // *Student.ServerResponse.Header or (if a response was returned at all)
  7679. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7680. // check whether the returned error was because http.StatusNotModified
  7681. // was returned.
  7682. func (c *CoursesStudentsCreateCall) Do(opts ...googleapi.CallOption) (*Student, error) {
  7683. gensupport.SetOptions(c.urlParams_, opts...)
  7684. res, err := c.doRequest("json")
  7685. if res != nil && res.StatusCode == http.StatusNotModified {
  7686. if res.Body != nil {
  7687. res.Body.Close()
  7688. }
  7689. return nil, &googleapi.Error{
  7690. Code: res.StatusCode,
  7691. Header: res.Header,
  7692. }
  7693. }
  7694. if err != nil {
  7695. return nil, err
  7696. }
  7697. defer googleapi.CloseBody(res)
  7698. if err := googleapi.CheckResponse(res); err != nil {
  7699. return nil, err
  7700. }
  7701. ret := &Student{
  7702. ServerResponse: googleapi.ServerResponse{
  7703. Header: res.Header,
  7704. HTTPStatusCode: res.StatusCode,
  7705. },
  7706. }
  7707. target := &ret
  7708. if err := gensupport.DecodeResponse(target, res); err != nil {
  7709. return nil, err
  7710. }
  7711. return ret, nil
  7712. // {
  7713. // "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.",
  7714. // "flatPath": "v1/courses/{courseId}/students",
  7715. // "httpMethod": "POST",
  7716. // "id": "classroom.courses.students.create",
  7717. // "parameterOrder": [
  7718. // "courseId"
  7719. // ],
  7720. // "parameters": {
  7721. // "courseId": {
  7722. // "description": "Identifier of the course to create the student in.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7723. // "location": "path",
  7724. // "required": true,
  7725. // "type": "string"
  7726. // },
  7727. // "enrollmentCode": {
  7728. // "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.",
  7729. // "location": "query",
  7730. // "type": "string"
  7731. // }
  7732. // },
  7733. // "path": "v1/courses/{courseId}/students",
  7734. // "request": {
  7735. // "$ref": "Student"
  7736. // },
  7737. // "response": {
  7738. // "$ref": "Student"
  7739. // },
  7740. // "scopes": [
  7741. // "https://www.googleapis.com/auth/classroom.profile.emails",
  7742. // "https://www.googleapis.com/auth/classroom.profile.photos",
  7743. // "https://www.googleapis.com/auth/classroom.rosters"
  7744. // ]
  7745. // }
  7746. }
  7747. // method id "classroom.courses.students.delete":
  7748. type CoursesStudentsDeleteCall struct {
  7749. s *Service
  7750. courseId string
  7751. userId string
  7752. urlParams_ gensupport.URLParams
  7753. ctx_ context.Context
  7754. header_ http.Header
  7755. }
  7756. // Delete: Deletes a student of a course.
  7757. //
  7758. // This method returns the following error codes:
  7759. //
  7760. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7761. // delete
  7762. // students of this course or for access errors.
  7763. // * `NOT_FOUND` if no student of this course has the requested ID or if
  7764. // the
  7765. // course does not exist.
  7766. func (r *CoursesStudentsService) Delete(courseId string, userId string) *CoursesStudentsDeleteCall {
  7767. c := &CoursesStudentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7768. c.courseId = courseId
  7769. c.userId = userId
  7770. return c
  7771. }
  7772. // Fields allows partial responses to be retrieved. See
  7773. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7774. // for more information.
  7775. func (c *CoursesStudentsDeleteCall) Fields(s ...googleapi.Field) *CoursesStudentsDeleteCall {
  7776. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7777. return c
  7778. }
  7779. // Context sets the context to be used in this call's Do method. Any
  7780. // pending HTTP request will be aborted if the provided context is
  7781. // canceled.
  7782. func (c *CoursesStudentsDeleteCall) Context(ctx context.Context) *CoursesStudentsDeleteCall {
  7783. c.ctx_ = ctx
  7784. return c
  7785. }
  7786. // Header returns an http.Header that can be modified by the caller to
  7787. // add HTTP headers to the request.
  7788. func (c *CoursesStudentsDeleteCall) Header() http.Header {
  7789. if c.header_ == nil {
  7790. c.header_ = make(http.Header)
  7791. }
  7792. return c.header_
  7793. }
  7794. func (c *CoursesStudentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7795. reqHeaders := make(http.Header)
  7796. for k, v := range c.header_ {
  7797. reqHeaders[k] = v
  7798. }
  7799. reqHeaders.Set("User-Agent", c.s.userAgent())
  7800. var body io.Reader = nil
  7801. c.urlParams_.Set("alt", alt)
  7802. c.urlParams_.Set("prettyPrint", "false")
  7803. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}")
  7804. urls += "?" + c.urlParams_.Encode()
  7805. req, err := http.NewRequest("DELETE", urls, body)
  7806. if err != nil {
  7807. return nil, err
  7808. }
  7809. req.Header = reqHeaders
  7810. googleapi.Expand(req.URL, map[string]string{
  7811. "courseId": c.courseId,
  7812. "userId": c.userId,
  7813. })
  7814. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7815. }
  7816. // Do executes the "classroom.courses.students.delete" call.
  7817. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7818. // code is an error. Response headers are in either
  7819. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7820. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7821. // check whether the returned error was because http.StatusNotModified
  7822. // was returned.
  7823. func (c *CoursesStudentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7824. gensupport.SetOptions(c.urlParams_, opts...)
  7825. res, err := c.doRequest("json")
  7826. if res != nil && res.StatusCode == http.StatusNotModified {
  7827. if res.Body != nil {
  7828. res.Body.Close()
  7829. }
  7830. return nil, &googleapi.Error{
  7831. Code: res.StatusCode,
  7832. Header: res.Header,
  7833. }
  7834. }
  7835. if err != nil {
  7836. return nil, err
  7837. }
  7838. defer googleapi.CloseBody(res)
  7839. if err := googleapi.CheckResponse(res); err != nil {
  7840. return nil, err
  7841. }
  7842. ret := &Empty{
  7843. ServerResponse: googleapi.ServerResponse{
  7844. Header: res.Header,
  7845. HTTPStatusCode: res.StatusCode,
  7846. },
  7847. }
  7848. target := &ret
  7849. if err := gensupport.DecodeResponse(target, res); err != nil {
  7850. return nil, err
  7851. }
  7852. return ret, nil
  7853. // {
  7854. // "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.",
  7855. // "flatPath": "v1/courses/{courseId}/students/{userId}",
  7856. // "httpMethod": "DELETE",
  7857. // "id": "classroom.courses.students.delete",
  7858. // "parameterOrder": [
  7859. // "courseId",
  7860. // "userId"
  7861. // ],
  7862. // "parameters": {
  7863. // "courseId": {
  7864. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  7865. // "location": "path",
  7866. // "required": true,
  7867. // "type": "string"
  7868. // },
  7869. // "userId": {
  7870. // "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",
  7871. // "location": "path",
  7872. // "required": true,
  7873. // "type": "string"
  7874. // }
  7875. // },
  7876. // "path": "v1/courses/{courseId}/students/{userId}",
  7877. // "response": {
  7878. // "$ref": "Empty"
  7879. // },
  7880. // "scopes": [
  7881. // "https://www.googleapis.com/auth/classroom.rosters"
  7882. // ]
  7883. // }
  7884. }
  7885. // method id "classroom.courses.students.get":
  7886. type CoursesStudentsGetCall struct {
  7887. s *Service
  7888. courseId string
  7889. userId string
  7890. urlParams_ gensupport.URLParams
  7891. ifNoneMatch_ string
  7892. ctx_ context.Context
  7893. header_ http.Header
  7894. }
  7895. // Get: Returns a student of a course.
  7896. //
  7897. // This method returns the following error codes:
  7898. //
  7899. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  7900. // view
  7901. // students of this course or for access errors.
  7902. // * `NOT_FOUND` if no student of this course has the requested ID or if
  7903. // the
  7904. // course does not exist.
  7905. func (r *CoursesStudentsService) Get(courseId string, userId string) *CoursesStudentsGetCall {
  7906. c := &CoursesStudentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7907. c.courseId = courseId
  7908. c.userId = userId
  7909. return c
  7910. }
  7911. // Fields allows partial responses to be retrieved. See
  7912. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7913. // for more information.
  7914. func (c *CoursesStudentsGetCall) Fields(s ...googleapi.Field) *CoursesStudentsGetCall {
  7915. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7916. return c
  7917. }
  7918. // IfNoneMatch sets the optional parameter which makes the operation
  7919. // fail if the object's ETag matches the given value. This is useful for
  7920. // getting updates only after the object has changed since the last
  7921. // request. Use googleapi.IsNotModified to check whether the response
  7922. // error from Do is the result of In-None-Match.
  7923. func (c *CoursesStudentsGetCall) IfNoneMatch(entityTag string) *CoursesStudentsGetCall {
  7924. c.ifNoneMatch_ = entityTag
  7925. return c
  7926. }
  7927. // Context sets the context to be used in this call's Do method. Any
  7928. // pending HTTP request will be aborted if the provided context is
  7929. // canceled.
  7930. func (c *CoursesStudentsGetCall) Context(ctx context.Context) *CoursesStudentsGetCall {
  7931. c.ctx_ = ctx
  7932. return c
  7933. }
  7934. // Header returns an http.Header that can be modified by the caller to
  7935. // add HTTP headers to the request.
  7936. func (c *CoursesStudentsGetCall) Header() http.Header {
  7937. if c.header_ == nil {
  7938. c.header_ = make(http.Header)
  7939. }
  7940. return c.header_
  7941. }
  7942. func (c *CoursesStudentsGetCall) doRequest(alt string) (*http.Response, error) {
  7943. reqHeaders := make(http.Header)
  7944. for k, v := range c.header_ {
  7945. reqHeaders[k] = v
  7946. }
  7947. reqHeaders.Set("User-Agent", c.s.userAgent())
  7948. if c.ifNoneMatch_ != "" {
  7949. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7950. }
  7951. var body io.Reader = nil
  7952. c.urlParams_.Set("alt", alt)
  7953. c.urlParams_.Set("prettyPrint", "false")
  7954. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students/{userId}")
  7955. urls += "?" + c.urlParams_.Encode()
  7956. req, err := http.NewRequest("GET", urls, body)
  7957. if err != nil {
  7958. return nil, err
  7959. }
  7960. req.Header = reqHeaders
  7961. googleapi.Expand(req.URL, map[string]string{
  7962. "courseId": c.courseId,
  7963. "userId": c.userId,
  7964. })
  7965. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7966. }
  7967. // Do executes the "classroom.courses.students.get" call.
  7968. // Exactly one of *Student or error will be non-nil. Any non-2xx status
  7969. // code is an error. Response headers are in either
  7970. // *Student.ServerResponse.Header or (if a response was returned at all)
  7971. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7972. // check whether the returned error was because http.StatusNotModified
  7973. // was returned.
  7974. func (c *CoursesStudentsGetCall) Do(opts ...googleapi.CallOption) (*Student, error) {
  7975. gensupport.SetOptions(c.urlParams_, opts...)
  7976. res, err := c.doRequest("json")
  7977. if res != nil && res.StatusCode == http.StatusNotModified {
  7978. if res.Body != nil {
  7979. res.Body.Close()
  7980. }
  7981. return nil, &googleapi.Error{
  7982. Code: res.StatusCode,
  7983. Header: res.Header,
  7984. }
  7985. }
  7986. if err != nil {
  7987. return nil, err
  7988. }
  7989. defer googleapi.CloseBody(res)
  7990. if err := googleapi.CheckResponse(res); err != nil {
  7991. return nil, err
  7992. }
  7993. ret := &Student{
  7994. ServerResponse: googleapi.ServerResponse{
  7995. Header: res.Header,
  7996. HTTPStatusCode: res.StatusCode,
  7997. },
  7998. }
  7999. target := &ret
  8000. if err := gensupport.DecodeResponse(target, res); err != nil {
  8001. return nil, err
  8002. }
  8003. return ret, nil
  8004. // {
  8005. // "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.",
  8006. // "flatPath": "v1/courses/{courseId}/students/{userId}",
  8007. // "httpMethod": "GET",
  8008. // "id": "classroom.courses.students.get",
  8009. // "parameterOrder": [
  8010. // "courseId",
  8011. // "userId"
  8012. // ],
  8013. // "parameters": {
  8014. // "courseId": {
  8015. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8016. // "location": "path",
  8017. // "required": true,
  8018. // "type": "string"
  8019. // },
  8020. // "userId": {
  8021. // "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",
  8022. // "location": "path",
  8023. // "required": true,
  8024. // "type": "string"
  8025. // }
  8026. // },
  8027. // "path": "v1/courses/{courseId}/students/{userId}",
  8028. // "response": {
  8029. // "$ref": "Student"
  8030. // },
  8031. // "scopes": [
  8032. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8033. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8034. // "https://www.googleapis.com/auth/classroom.rosters",
  8035. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  8036. // ]
  8037. // }
  8038. }
  8039. // method id "classroom.courses.students.list":
  8040. type CoursesStudentsListCall struct {
  8041. s *Service
  8042. courseId string
  8043. urlParams_ gensupport.URLParams
  8044. ifNoneMatch_ string
  8045. ctx_ context.Context
  8046. header_ http.Header
  8047. }
  8048. // List: Returns a list of students of this course that the requester
  8049. // is permitted to view.
  8050. //
  8051. // This method returns the following error codes:
  8052. //
  8053. // * `NOT_FOUND` if the course does not exist.
  8054. // * `PERMISSION_DENIED` for access errors.
  8055. func (r *CoursesStudentsService) List(courseId string) *CoursesStudentsListCall {
  8056. c := &CoursesStudentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8057. c.courseId = courseId
  8058. return c
  8059. }
  8060. // PageSize sets the optional parameter "pageSize": Maximum number of
  8061. // items to return. Zero means no maximum.
  8062. //
  8063. // The server may return fewer than the specified number of results.
  8064. func (c *CoursesStudentsListCall) PageSize(pageSize int64) *CoursesStudentsListCall {
  8065. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8066. return c
  8067. }
  8068. // PageToken sets the optional parameter "pageToken":
  8069. // nextPageToken
  8070. // value returned from a previous
  8071. // list call, indicating that
  8072. // the subsequent page of results should be returned.
  8073. //
  8074. // The list request must be
  8075. // otherwise identical to the one that resulted in this token.
  8076. func (c *CoursesStudentsListCall) PageToken(pageToken string) *CoursesStudentsListCall {
  8077. c.urlParams_.Set("pageToken", pageToken)
  8078. return c
  8079. }
  8080. // Fields allows partial responses to be retrieved. See
  8081. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8082. // for more information.
  8083. func (c *CoursesStudentsListCall) Fields(s ...googleapi.Field) *CoursesStudentsListCall {
  8084. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8085. return c
  8086. }
  8087. // IfNoneMatch sets the optional parameter which makes the operation
  8088. // fail if the object's ETag matches the given value. This is useful for
  8089. // getting updates only after the object has changed since the last
  8090. // request. Use googleapi.IsNotModified to check whether the response
  8091. // error from Do is the result of In-None-Match.
  8092. func (c *CoursesStudentsListCall) IfNoneMatch(entityTag string) *CoursesStudentsListCall {
  8093. c.ifNoneMatch_ = entityTag
  8094. return c
  8095. }
  8096. // Context sets the context to be used in this call's Do method. Any
  8097. // pending HTTP request will be aborted if the provided context is
  8098. // canceled.
  8099. func (c *CoursesStudentsListCall) Context(ctx context.Context) *CoursesStudentsListCall {
  8100. c.ctx_ = ctx
  8101. return c
  8102. }
  8103. // Header returns an http.Header that can be modified by the caller to
  8104. // add HTTP headers to the request.
  8105. func (c *CoursesStudentsListCall) Header() http.Header {
  8106. if c.header_ == nil {
  8107. c.header_ = make(http.Header)
  8108. }
  8109. return c.header_
  8110. }
  8111. func (c *CoursesStudentsListCall) doRequest(alt string) (*http.Response, error) {
  8112. reqHeaders := make(http.Header)
  8113. for k, v := range c.header_ {
  8114. reqHeaders[k] = v
  8115. }
  8116. reqHeaders.Set("User-Agent", c.s.userAgent())
  8117. if c.ifNoneMatch_ != "" {
  8118. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8119. }
  8120. var body io.Reader = nil
  8121. c.urlParams_.Set("alt", alt)
  8122. c.urlParams_.Set("prettyPrint", "false")
  8123. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/students")
  8124. urls += "?" + c.urlParams_.Encode()
  8125. req, err := http.NewRequest("GET", urls, body)
  8126. if err != nil {
  8127. return nil, err
  8128. }
  8129. req.Header = reqHeaders
  8130. googleapi.Expand(req.URL, map[string]string{
  8131. "courseId": c.courseId,
  8132. })
  8133. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8134. }
  8135. // Do executes the "classroom.courses.students.list" call.
  8136. // Exactly one of *ListStudentsResponse or error will be non-nil. Any
  8137. // non-2xx status code is an error. Response headers are in either
  8138. // *ListStudentsResponse.ServerResponse.Header or (if a response was
  8139. // returned at all) in error.(*googleapi.Error).Header. Use
  8140. // googleapi.IsNotModified to check whether the returned error was
  8141. // because http.StatusNotModified was returned.
  8142. func (c *CoursesStudentsListCall) Do(opts ...googleapi.CallOption) (*ListStudentsResponse, error) {
  8143. gensupport.SetOptions(c.urlParams_, opts...)
  8144. res, err := c.doRequest("json")
  8145. if res != nil && res.StatusCode == http.StatusNotModified {
  8146. if res.Body != nil {
  8147. res.Body.Close()
  8148. }
  8149. return nil, &googleapi.Error{
  8150. Code: res.StatusCode,
  8151. Header: res.Header,
  8152. }
  8153. }
  8154. if err != nil {
  8155. return nil, err
  8156. }
  8157. defer googleapi.CloseBody(res)
  8158. if err := googleapi.CheckResponse(res); err != nil {
  8159. return nil, err
  8160. }
  8161. ret := &ListStudentsResponse{
  8162. ServerResponse: googleapi.ServerResponse{
  8163. Header: res.Header,
  8164. HTTPStatusCode: res.StatusCode,
  8165. },
  8166. }
  8167. target := &ret
  8168. if err := gensupport.DecodeResponse(target, res); err != nil {
  8169. return nil, err
  8170. }
  8171. return ret, nil
  8172. // {
  8173. // "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.",
  8174. // "flatPath": "v1/courses/{courseId}/students",
  8175. // "httpMethod": "GET",
  8176. // "id": "classroom.courses.students.list",
  8177. // "parameterOrder": [
  8178. // "courseId"
  8179. // ],
  8180. // "parameters": {
  8181. // "courseId": {
  8182. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8183. // "location": "path",
  8184. // "required": true,
  8185. // "type": "string"
  8186. // },
  8187. // "pageSize": {
  8188. // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.",
  8189. // "format": "int32",
  8190. // "location": "query",
  8191. // "type": "integer"
  8192. // },
  8193. // "pageToken": {
  8194. // "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.",
  8195. // "location": "query",
  8196. // "type": "string"
  8197. // }
  8198. // },
  8199. // "path": "v1/courses/{courseId}/students",
  8200. // "response": {
  8201. // "$ref": "ListStudentsResponse"
  8202. // },
  8203. // "scopes": [
  8204. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8205. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8206. // "https://www.googleapis.com/auth/classroom.rosters",
  8207. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  8208. // ]
  8209. // }
  8210. }
  8211. // Pages invokes f for each page of results.
  8212. // A non-nil error returned from f will halt the iteration.
  8213. // The provided context supersedes any context provided to the Context method.
  8214. func (c *CoursesStudentsListCall) Pages(ctx context.Context, f func(*ListStudentsResponse) error) error {
  8215. c.ctx_ = ctx
  8216. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8217. for {
  8218. x, err := c.Do()
  8219. if err != nil {
  8220. return err
  8221. }
  8222. if err := f(x); err != nil {
  8223. return err
  8224. }
  8225. if x.NextPageToken == "" {
  8226. return nil
  8227. }
  8228. c.PageToken(x.NextPageToken)
  8229. }
  8230. }
  8231. // method id "classroom.courses.teachers.create":
  8232. type CoursesTeachersCreateCall struct {
  8233. s *Service
  8234. courseId string
  8235. teacher *Teacher
  8236. urlParams_ gensupport.URLParams
  8237. ctx_ context.Context
  8238. header_ http.Header
  8239. }
  8240. // Create: Creates a teacher of a course.
  8241. //
  8242. // This method returns the following error codes:
  8243. //
  8244. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8245. // create
  8246. // teachers in this course or for access errors.
  8247. // * `NOT_FOUND` if the requested course ID does not exist.
  8248. // * `FAILED_PRECONDITION` if the requested user's account is
  8249. // disabled,
  8250. // for the following request errors:
  8251. // * CourseMemberLimitReached
  8252. // * CourseNotModifiable
  8253. // * CourseTeacherLimitReached
  8254. // * UserGroupsMembershipLimitReached
  8255. // * `ALREADY_EXISTS` if the user is already a teacher or student in
  8256. // the
  8257. // course.
  8258. func (r *CoursesTeachersService) Create(courseId string, teacher *Teacher) *CoursesTeachersCreateCall {
  8259. c := &CoursesTeachersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8260. c.courseId = courseId
  8261. c.teacher = teacher
  8262. return c
  8263. }
  8264. // Fields allows partial responses to be retrieved. See
  8265. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8266. // for more information.
  8267. func (c *CoursesTeachersCreateCall) Fields(s ...googleapi.Field) *CoursesTeachersCreateCall {
  8268. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8269. return c
  8270. }
  8271. // Context sets the context to be used in this call's Do method. Any
  8272. // pending HTTP request will be aborted if the provided context is
  8273. // canceled.
  8274. func (c *CoursesTeachersCreateCall) Context(ctx context.Context) *CoursesTeachersCreateCall {
  8275. c.ctx_ = ctx
  8276. return c
  8277. }
  8278. // Header returns an http.Header that can be modified by the caller to
  8279. // add HTTP headers to the request.
  8280. func (c *CoursesTeachersCreateCall) Header() http.Header {
  8281. if c.header_ == nil {
  8282. c.header_ = make(http.Header)
  8283. }
  8284. return c.header_
  8285. }
  8286. func (c *CoursesTeachersCreateCall) doRequest(alt string) (*http.Response, error) {
  8287. reqHeaders := make(http.Header)
  8288. for k, v := range c.header_ {
  8289. reqHeaders[k] = v
  8290. }
  8291. reqHeaders.Set("User-Agent", c.s.userAgent())
  8292. var body io.Reader = nil
  8293. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teacher)
  8294. if err != nil {
  8295. return nil, err
  8296. }
  8297. reqHeaders.Set("Content-Type", "application/json")
  8298. c.urlParams_.Set("alt", alt)
  8299. c.urlParams_.Set("prettyPrint", "false")
  8300. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers")
  8301. urls += "?" + c.urlParams_.Encode()
  8302. req, err := http.NewRequest("POST", urls, body)
  8303. if err != nil {
  8304. return nil, err
  8305. }
  8306. req.Header = reqHeaders
  8307. googleapi.Expand(req.URL, map[string]string{
  8308. "courseId": c.courseId,
  8309. })
  8310. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8311. }
  8312. // Do executes the "classroom.courses.teachers.create" call.
  8313. // Exactly one of *Teacher or error will be non-nil. Any non-2xx status
  8314. // code is an error. Response headers are in either
  8315. // *Teacher.ServerResponse.Header or (if a response was returned at all)
  8316. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8317. // check whether the returned error was because http.StatusNotModified
  8318. // was returned.
  8319. func (c *CoursesTeachersCreateCall) Do(opts ...googleapi.CallOption) (*Teacher, error) {
  8320. gensupport.SetOptions(c.urlParams_, opts...)
  8321. res, err := c.doRequest("json")
  8322. if res != nil && res.StatusCode == http.StatusNotModified {
  8323. if res.Body != nil {
  8324. res.Body.Close()
  8325. }
  8326. return nil, &googleapi.Error{
  8327. Code: res.StatusCode,
  8328. Header: res.Header,
  8329. }
  8330. }
  8331. if err != nil {
  8332. return nil, err
  8333. }
  8334. defer googleapi.CloseBody(res)
  8335. if err := googleapi.CheckResponse(res); err != nil {
  8336. return nil, err
  8337. }
  8338. ret := &Teacher{
  8339. ServerResponse: googleapi.ServerResponse{
  8340. Header: res.Header,
  8341. HTTPStatusCode: res.StatusCode,
  8342. },
  8343. }
  8344. target := &ret
  8345. if err := gensupport.DecodeResponse(target, res); err != nil {
  8346. return nil, err
  8347. }
  8348. return ret, nil
  8349. // {
  8350. // "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.",
  8351. // "flatPath": "v1/courses/{courseId}/teachers",
  8352. // "httpMethod": "POST",
  8353. // "id": "classroom.courses.teachers.create",
  8354. // "parameterOrder": [
  8355. // "courseId"
  8356. // ],
  8357. // "parameters": {
  8358. // "courseId": {
  8359. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8360. // "location": "path",
  8361. // "required": true,
  8362. // "type": "string"
  8363. // }
  8364. // },
  8365. // "path": "v1/courses/{courseId}/teachers",
  8366. // "request": {
  8367. // "$ref": "Teacher"
  8368. // },
  8369. // "response": {
  8370. // "$ref": "Teacher"
  8371. // },
  8372. // "scopes": [
  8373. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8374. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8375. // "https://www.googleapis.com/auth/classroom.rosters"
  8376. // ]
  8377. // }
  8378. }
  8379. // method id "classroom.courses.teachers.delete":
  8380. type CoursesTeachersDeleteCall struct {
  8381. s *Service
  8382. courseId string
  8383. userId string
  8384. urlParams_ gensupport.URLParams
  8385. ctx_ context.Context
  8386. header_ http.Header
  8387. }
  8388. // Delete: Deletes a teacher of a course.
  8389. //
  8390. // This method returns the following error codes:
  8391. //
  8392. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8393. // delete
  8394. // teachers of this course or for access errors.
  8395. // * `NOT_FOUND` if no teacher of this course has the requested ID or if
  8396. // the
  8397. // course does not exist.
  8398. // * `FAILED_PRECONDITION` if the requested ID belongs to the primary
  8399. // teacher
  8400. // of this course.
  8401. func (r *CoursesTeachersService) Delete(courseId string, userId string) *CoursesTeachersDeleteCall {
  8402. c := &CoursesTeachersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8403. c.courseId = courseId
  8404. c.userId = userId
  8405. return c
  8406. }
  8407. // Fields allows partial responses to be retrieved. See
  8408. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8409. // for more information.
  8410. func (c *CoursesTeachersDeleteCall) Fields(s ...googleapi.Field) *CoursesTeachersDeleteCall {
  8411. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8412. return c
  8413. }
  8414. // Context sets the context to be used in this call's Do method. Any
  8415. // pending HTTP request will be aborted if the provided context is
  8416. // canceled.
  8417. func (c *CoursesTeachersDeleteCall) Context(ctx context.Context) *CoursesTeachersDeleteCall {
  8418. c.ctx_ = ctx
  8419. return c
  8420. }
  8421. // Header returns an http.Header that can be modified by the caller to
  8422. // add HTTP headers to the request.
  8423. func (c *CoursesTeachersDeleteCall) Header() http.Header {
  8424. if c.header_ == nil {
  8425. c.header_ = make(http.Header)
  8426. }
  8427. return c.header_
  8428. }
  8429. func (c *CoursesTeachersDeleteCall) doRequest(alt string) (*http.Response, error) {
  8430. reqHeaders := make(http.Header)
  8431. for k, v := range c.header_ {
  8432. reqHeaders[k] = v
  8433. }
  8434. reqHeaders.Set("User-Agent", c.s.userAgent())
  8435. var body io.Reader = nil
  8436. c.urlParams_.Set("alt", alt)
  8437. c.urlParams_.Set("prettyPrint", "false")
  8438. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}")
  8439. urls += "?" + c.urlParams_.Encode()
  8440. req, err := http.NewRequest("DELETE", urls, body)
  8441. if err != nil {
  8442. return nil, err
  8443. }
  8444. req.Header = reqHeaders
  8445. googleapi.Expand(req.URL, map[string]string{
  8446. "courseId": c.courseId,
  8447. "userId": c.userId,
  8448. })
  8449. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8450. }
  8451. // Do executes the "classroom.courses.teachers.delete" call.
  8452. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8453. // code is an error. Response headers are in either
  8454. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8455. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8456. // check whether the returned error was because http.StatusNotModified
  8457. // was returned.
  8458. func (c *CoursesTeachersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8459. gensupport.SetOptions(c.urlParams_, opts...)
  8460. res, err := c.doRequest("json")
  8461. if res != nil && res.StatusCode == http.StatusNotModified {
  8462. if res.Body != nil {
  8463. res.Body.Close()
  8464. }
  8465. return nil, &googleapi.Error{
  8466. Code: res.StatusCode,
  8467. Header: res.Header,
  8468. }
  8469. }
  8470. if err != nil {
  8471. return nil, err
  8472. }
  8473. defer googleapi.CloseBody(res)
  8474. if err := googleapi.CheckResponse(res); err != nil {
  8475. return nil, err
  8476. }
  8477. ret := &Empty{
  8478. ServerResponse: googleapi.ServerResponse{
  8479. Header: res.Header,
  8480. HTTPStatusCode: res.StatusCode,
  8481. },
  8482. }
  8483. target := &ret
  8484. if err := gensupport.DecodeResponse(target, res); err != nil {
  8485. return nil, err
  8486. }
  8487. return ret, nil
  8488. // {
  8489. // "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.",
  8490. // "flatPath": "v1/courses/{courseId}/teachers/{userId}",
  8491. // "httpMethod": "DELETE",
  8492. // "id": "classroom.courses.teachers.delete",
  8493. // "parameterOrder": [
  8494. // "courseId",
  8495. // "userId"
  8496. // ],
  8497. // "parameters": {
  8498. // "courseId": {
  8499. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8500. // "location": "path",
  8501. // "required": true,
  8502. // "type": "string"
  8503. // },
  8504. // "userId": {
  8505. // "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",
  8506. // "location": "path",
  8507. // "required": true,
  8508. // "type": "string"
  8509. // }
  8510. // },
  8511. // "path": "v1/courses/{courseId}/teachers/{userId}",
  8512. // "response": {
  8513. // "$ref": "Empty"
  8514. // },
  8515. // "scopes": [
  8516. // "https://www.googleapis.com/auth/classroom.rosters"
  8517. // ]
  8518. // }
  8519. }
  8520. // method id "classroom.courses.teachers.get":
  8521. type CoursesTeachersGetCall struct {
  8522. s *Service
  8523. courseId string
  8524. userId string
  8525. urlParams_ gensupport.URLParams
  8526. ifNoneMatch_ string
  8527. ctx_ context.Context
  8528. header_ http.Header
  8529. }
  8530. // Get: Returns a teacher of a course.
  8531. //
  8532. // This method returns the following error codes:
  8533. //
  8534. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8535. // view
  8536. // teachers of this course or for access errors.
  8537. // * `NOT_FOUND` if no teacher of this course has the requested ID or if
  8538. // the
  8539. // course does not exist.
  8540. func (r *CoursesTeachersService) Get(courseId string, userId string) *CoursesTeachersGetCall {
  8541. c := &CoursesTeachersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8542. c.courseId = courseId
  8543. c.userId = userId
  8544. return c
  8545. }
  8546. // Fields allows partial responses to be retrieved. See
  8547. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8548. // for more information.
  8549. func (c *CoursesTeachersGetCall) Fields(s ...googleapi.Field) *CoursesTeachersGetCall {
  8550. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8551. return c
  8552. }
  8553. // IfNoneMatch sets the optional parameter which makes the operation
  8554. // fail if the object's ETag matches the given value. This is useful for
  8555. // getting updates only after the object has changed since the last
  8556. // request. Use googleapi.IsNotModified to check whether the response
  8557. // error from Do is the result of In-None-Match.
  8558. func (c *CoursesTeachersGetCall) IfNoneMatch(entityTag string) *CoursesTeachersGetCall {
  8559. c.ifNoneMatch_ = entityTag
  8560. return c
  8561. }
  8562. // Context sets the context to be used in this call's Do method. Any
  8563. // pending HTTP request will be aborted if the provided context is
  8564. // canceled.
  8565. func (c *CoursesTeachersGetCall) Context(ctx context.Context) *CoursesTeachersGetCall {
  8566. c.ctx_ = ctx
  8567. return c
  8568. }
  8569. // Header returns an http.Header that can be modified by the caller to
  8570. // add HTTP headers to the request.
  8571. func (c *CoursesTeachersGetCall) Header() http.Header {
  8572. if c.header_ == nil {
  8573. c.header_ = make(http.Header)
  8574. }
  8575. return c.header_
  8576. }
  8577. func (c *CoursesTeachersGetCall) doRequest(alt string) (*http.Response, error) {
  8578. reqHeaders := make(http.Header)
  8579. for k, v := range c.header_ {
  8580. reqHeaders[k] = v
  8581. }
  8582. reqHeaders.Set("User-Agent", c.s.userAgent())
  8583. if c.ifNoneMatch_ != "" {
  8584. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8585. }
  8586. var body io.Reader = nil
  8587. c.urlParams_.Set("alt", alt)
  8588. c.urlParams_.Set("prettyPrint", "false")
  8589. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers/{userId}")
  8590. urls += "?" + c.urlParams_.Encode()
  8591. req, err := http.NewRequest("GET", urls, body)
  8592. if err != nil {
  8593. return nil, err
  8594. }
  8595. req.Header = reqHeaders
  8596. googleapi.Expand(req.URL, map[string]string{
  8597. "courseId": c.courseId,
  8598. "userId": c.userId,
  8599. })
  8600. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8601. }
  8602. // Do executes the "classroom.courses.teachers.get" call.
  8603. // Exactly one of *Teacher or error will be non-nil. Any non-2xx status
  8604. // code is an error. Response headers are in either
  8605. // *Teacher.ServerResponse.Header or (if a response was returned at all)
  8606. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8607. // check whether the returned error was because http.StatusNotModified
  8608. // was returned.
  8609. func (c *CoursesTeachersGetCall) Do(opts ...googleapi.CallOption) (*Teacher, error) {
  8610. gensupport.SetOptions(c.urlParams_, opts...)
  8611. res, err := c.doRequest("json")
  8612. if res != nil && res.StatusCode == http.StatusNotModified {
  8613. if res.Body != nil {
  8614. res.Body.Close()
  8615. }
  8616. return nil, &googleapi.Error{
  8617. Code: res.StatusCode,
  8618. Header: res.Header,
  8619. }
  8620. }
  8621. if err != nil {
  8622. return nil, err
  8623. }
  8624. defer googleapi.CloseBody(res)
  8625. if err := googleapi.CheckResponse(res); err != nil {
  8626. return nil, err
  8627. }
  8628. ret := &Teacher{
  8629. ServerResponse: googleapi.ServerResponse{
  8630. Header: res.Header,
  8631. HTTPStatusCode: res.StatusCode,
  8632. },
  8633. }
  8634. target := &ret
  8635. if err := gensupport.DecodeResponse(target, res); err != nil {
  8636. return nil, err
  8637. }
  8638. return ret, nil
  8639. // {
  8640. // "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.",
  8641. // "flatPath": "v1/courses/{courseId}/teachers/{userId}",
  8642. // "httpMethod": "GET",
  8643. // "id": "classroom.courses.teachers.get",
  8644. // "parameterOrder": [
  8645. // "courseId",
  8646. // "userId"
  8647. // ],
  8648. // "parameters": {
  8649. // "courseId": {
  8650. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8651. // "location": "path",
  8652. // "required": true,
  8653. // "type": "string"
  8654. // },
  8655. // "userId": {
  8656. // "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",
  8657. // "location": "path",
  8658. // "required": true,
  8659. // "type": "string"
  8660. // }
  8661. // },
  8662. // "path": "v1/courses/{courseId}/teachers/{userId}",
  8663. // "response": {
  8664. // "$ref": "Teacher"
  8665. // },
  8666. // "scopes": [
  8667. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8668. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8669. // "https://www.googleapis.com/auth/classroom.rosters",
  8670. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  8671. // ]
  8672. // }
  8673. }
  8674. // method id "classroom.courses.teachers.list":
  8675. type CoursesTeachersListCall struct {
  8676. s *Service
  8677. courseId string
  8678. urlParams_ gensupport.URLParams
  8679. ifNoneMatch_ string
  8680. ctx_ context.Context
  8681. header_ http.Header
  8682. }
  8683. // List: Returns a list of teachers of this course that the requester
  8684. // is permitted to view.
  8685. //
  8686. // This method returns the following error codes:
  8687. //
  8688. // * `NOT_FOUND` if the course does not exist.
  8689. // * `PERMISSION_DENIED` for access errors.
  8690. func (r *CoursesTeachersService) List(courseId string) *CoursesTeachersListCall {
  8691. c := &CoursesTeachersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8692. c.courseId = courseId
  8693. return c
  8694. }
  8695. // PageSize sets the optional parameter "pageSize": Maximum number of
  8696. // items to return. Zero means no maximum.
  8697. //
  8698. // The server may return fewer than the specified number of results.
  8699. func (c *CoursesTeachersListCall) PageSize(pageSize int64) *CoursesTeachersListCall {
  8700. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8701. return c
  8702. }
  8703. // PageToken sets the optional parameter "pageToken":
  8704. // nextPageToken
  8705. // value returned from a previous
  8706. // list call, indicating that
  8707. // the subsequent page of results should be returned.
  8708. //
  8709. // The list request must be
  8710. // otherwise identical to the one that resulted in this token.
  8711. func (c *CoursesTeachersListCall) PageToken(pageToken string) *CoursesTeachersListCall {
  8712. c.urlParams_.Set("pageToken", pageToken)
  8713. return c
  8714. }
  8715. // Fields allows partial responses to be retrieved. See
  8716. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8717. // for more information.
  8718. func (c *CoursesTeachersListCall) Fields(s ...googleapi.Field) *CoursesTeachersListCall {
  8719. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8720. return c
  8721. }
  8722. // IfNoneMatch sets the optional parameter which makes the operation
  8723. // fail if the object's ETag matches the given value. This is useful for
  8724. // getting updates only after the object has changed since the last
  8725. // request. Use googleapi.IsNotModified to check whether the response
  8726. // error from Do is the result of In-None-Match.
  8727. func (c *CoursesTeachersListCall) IfNoneMatch(entityTag string) *CoursesTeachersListCall {
  8728. c.ifNoneMatch_ = entityTag
  8729. return c
  8730. }
  8731. // Context sets the context to be used in this call's Do method. Any
  8732. // pending HTTP request will be aborted if the provided context is
  8733. // canceled.
  8734. func (c *CoursesTeachersListCall) Context(ctx context.Context) *CoursesTeachersListCall {
  8735. c.ctx_ = ctx
  8736. return c
  8737. }
  8738. // Header returns an http.Header that can be modified by the caller to
  8739. // add HTTP headers to the request.
  8740. func (c *CoursesTeachersListCall) Header() http.Header {
  8741. if c.header_ == nil {
  8742. c.header_ = make(http.Header)
  8743. }
  8744. return c.header_
  8745. }
  8746. func (c *CoursesTeachersListCall) doRequest(alt string) (*http.Response, error) {
  8747. reqHeaders := make(http.Header)
  8748. for k, v := range c.header_ {
  8749. reqHeaders[k] = v
  8750. }
  8751. reqHeaders.Set("User-Agent", c.s.userAgent())
  8752. if c.ifNoneMatch_ != "" {
  8753. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8754. }
  8755. var body io.Reader = nil
  8756. c.urlParams_.Set("alt", alt)
  8757. c.urlParams_.Set("prettyPrint", "false")
  8758. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/courses/{courseId}/teachers")
  8759. urls += "?" + c.urlParams_.Encode()
  8760. req, err := http.NewRequest("GET", urls, body)
  8761. if err != nil {
  8762. return nil, err
  8763. }
  8764. req.Header = reqHeaders
  8765. googleapi.Expand(req.URL, map[string]string{
  8766. "courseId": c.courseId,
  8767. })
  8768. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8769. }
  8770. // Do executes the "classroom.courses.teachers.list" call.
  8771. // Exactly one of *ListTeachersResponse or error will be non-nil. Any
  8772. // non-2xx status code is an error. Response headers are in either
  8773. // *ListTeachersResponse.ServerResponse.Header or (if a response was
  8774. // returned at all) in error.(*googleapi.Error).Header. Use
  8775. // googleapi.IsNotModified to check whether the returned error was
  8776. // because http.StatusNotModified was returned.
  8777. func (c *CoursesTeachersListCall) Do(opts ...googleapi.CallOption) (*ListTeachersResponse, error) {
  8778. gensupport.SetOptions(c.urlParams_, opts...)
  8779. res, err := c.doRequest("json")
  8780. if res != nil && res.StatusCode == http.StatusNotModified {
  8781. if res.Body != nil {
  8782. res.Body.Close()
  8783. }
  8784. return nil, &googleapi.Error{
  8785. Code: res.StatusCode,
  8786. Header: res.Header,
  8787. }
  8788. }
  8789. if err != nil {
  8790. return nil, err
  8791. }
  8792. defer googleapi.CloseBody(res)
  8793. if err := googleapi.CheckResponse(res); err != nil {
  8794. return nil, err
  8795. }
  8796. ret := &ListTeachersResponse{
  8797. ServerResponse: googleapi.ServerResponse{
  8798. Header: res.Header,
  8799. HTTPStatusCode: res.StatusCode,
  8800. },
  8801. }
  8802. target := &ret
  8803. if err := gensupport.DecodeResponse(target, res); err != nil {
  8804. return nil, err
  8805. }
  8806. return ret, nil
  8807. // {
  8808. // "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.",
  8809. // "flatPath": "v1/courses/{courseId}/teachers",
  8810. // "httpMethod": "GET",
  8811. // "id": "classroom.courses.teachers.list",
  8812. // "parameterOrder": [
  8813. // "courseId"
  8814. // ],
  8815. // "parameters": {
  8816. // "courseId": {
  8817. // "description": "Identifier of the course.\nThis identifier can be either the Classroom-assigned identifier or an\nalias.",
  8818. // "location": "path",
  8819. // "required": true,
  8820. // "type": "string"
  8821. // },
  8822. // "pageSize": {
  8823. // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.",
  8824. // "format": "int32",
  8825. // "location": "query",
  8826. // "type": "integer"
  8827. // },
  8828. // "pageToken": {
  8829. // "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.",
  8830. // "location": "query",
  8831. // "type": "string"
  8832. // }
  8833. // },
  8834. // "path": "v1/courses/{courseId}/teachers",
  8835. // "response": {
  8836. // "$ref": "ListTeachersResponse"
  8837. // },
  8838. // "scopes": [
  8839. // "https://www.googleapis.com/auth/classroom.profile.emails",
  8840. // "https://www.googleapis.com/auth/classroom.profile.photos",
  8841. // "https://www.googleapis.com/auth/classroom.rosters",
  8842. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  8843. // ]
  8844. // }
  8845. }
  8846. // Pages invokes f for each page of results.
  8847. // A non-nil error returned from f will halt the iteration.
  8848. // The provided context supersedes any context provided to the Context method.
  8849. func (c *CoursesTeachersListCall) Pages(ctx context.Context, f func(*ListTeachersResponse) error) error {
  8850. c.ctx_ = ctx
  8851. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8852. for {
  8853. x, err := c.Do()
  8854. if err != nil {
  8855. return err
  8856. }
  8857. if err := f(x); err != nil {
  8858. return err
  8859. }
  8860. if x.NextPageToken == "" {
  8861. return nil
  8862. }
  8863. c.PageToken(x.NextPageToken)
  8864. }
  8865. }
  8866. // method id "classroom.invitations.accept":
  8867. type InvitationsAcceptCall struct {
  8868. s *Service
  8869. id string
  8870. urlParams_ gensupport.URLParams
  8871. ctx_ context.Context
  8872. header_ http.Header
  8873. }
  8874. // Accept: Accepts an invitation, removing it and adding the invited
  8875. // user to the
  8876. // teachers or students (as appropriate) of the specified course. Only
  8877. // the
  8878. // invited user may accept an invitation.
  8879. //
  8880. // This method returns the following error codes:
  8881. //
  8882. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  8883. // accept the
  8884. // requested invitation or for access errors.
  8885. // * `FAILED_PRECONDITION` for the following request errors:
  8886. // * CourseMemberLimitReached
  8887. // * CourseNotModifiable
  8888. // * CourseTeacherLimitReached
  8889. // * UserGroupsMembershipLimitReached
  8890. // * `NOT_FOUND` if no invitation exists with the requested ID.
  8891. func (r *InvitationsService) Accept(id string) *InvitationsAcceptCall {
  8892. c := &InvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8893. c.id = id
  8894. return c
  8895. }
  8896. // Fields allows partial responses to be retrieved. See
  8897. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8898. // for more information.
  8899. func (c *InvitationsAcceptCall) Fields(s ...googleapi.Field) *InvitationsAcceptCall {
  8900. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8901. return c
  8902. }
  8903. // Context sets the context to be used in this call's Do method. Any
  8904. // pending HTTP request will be aborted if the provided context is
  8905. // canceled.
  8906. func (c *InvitationsAcceptCall) Context(ctx context.Context) *InvitationsAcceptCall {
  8907. c.ctx_ = ctx
  8908. return c
  8909. }
  8910. // Header returns an http.Header that can be modified by the caller to
  8911. // add HTTP headers to the request.
  8912. func (c *InvitationsAcceptCall) Header() http.Header {
  8913. if c.header_ == nil {
  8914. c.header_ = make(http.Header)
  8915. }
  8916. return c.header_
  8917. }
  8918. func (c *InvitationsAcceptCall) doRequest(alt string) (*http.Response, error) {
  8919. reqHeaders := make(http.Header)
  8920. for k, v := range c.header_ {
  8921. reqHeaders[k] = v
  8922. }
  8923. reqHeaders.Set("User-Agent", c.s.userAgent())
  8924. var body io.Reader = nil
  8925. c.urlParams_.Set("alt", alt)
  8926. c.urlParams_.Set("prettyPrint", "false")
  8927. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}:accept")
  8928. urls += "?" + c.urlParams_.Encode()
  8929. req, err := http.NewRequest("POST", urls, body)
  8930. if err != nil {
  8931. return nil, err
  8932. }
  8933. req.Header = reqHeaders
  8934. googleapi.Expand(req.URL, map[string]string{
  8935. "id": c.id,
  8936. })
  8937. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8938. }
  8939. // Do executes the "classroom.invitations.accept" call.
  8940. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8941. // code is an error. Response headers are in either
  8942. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8943. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8944. // check whether the returned error was because http.StatusNotModified
  8945. // was returned.
  8946. func (c *InvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8947. gensupport.SetOptions(c.urlParams_, opts...)
  8948. res, err := c.doRequest("json")
  8949. if res != nil && res.StatusCode == http.StatusNotModified {
  8950. if res.Body != nil {
  8951. res.Body.Close()
  8952. }
  8953. return nil, &googleapi.Error{
  8954. Code: res.StatusCode,
  8955. Header: res.Header,
  8956. }
  8957. }
  8958. if err != nil {
  8959. return nil, err
  8960. }
  8961. defer googleapi.CloseBody(res)
  8962. if err := googleapi.CheckResponse(res); err != nil {
  8963. return nil, err
  8964. }
  8965. ret := &Empty{
  8966. ServerResponse: googleapi.ServerResponse{
  8967. Header: res.Header,
  8968. HTTPStatusCode: res.StatusCode,
  8969. },
  8970. }
  8971. target := &ret
  8972. if err := gensupport.DecodeResponse(target, res); err != nil {
  8973. return nil, err
  8974. }
  8975. return ret, nil
  8976. // {
  8977. // "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.",
  8978. // "flatPath": "v1/invitations/{id}:accept",
  8979. // "httpMethod": "POST",
  8980. // "id": "classroom.invitations.accept",
  8981. // "parameterOrder": [
  8982. // "id"
  8983. // ],
  8984. // "parameters": {
  8985. // "id": {
  8986. // "description": "Identifier of the invitation to accept.",
  8987. // "location": "path",
  8988. // "required": true,
  8989. // "type": "string"
  8990. // }
  8991. // },
  8992. // "path": "v1/invitations/{id}:accept",
  8993. // "response": {
  8994. // "$ref": "Empty"
  8995. // },
  8996. // "scopes": [
  8997. // "https://www.googleapis.com/auth/classroom.rosters"
  8998. // ]
  8999. // }
  9000. }
  9001. // method id "classroom.invitations.create":
  9002. type InvitationsCreateCall struct {
  9003. s *Service
  9004. invitation *Invitation
  9005. urlParams_ gensupport.URLParams
  9006. ctx_ context.Context
  9007. header_ http.Header
  9008. }
  9009. // Create: Creates an invitation. Only one invitation for a user and
  9010. // course may exist
  9011. // at a time. Delete and re-create an invitation to make changes.
  9012. //
  9013. // This method returns the following error codes:
  9014. //
  9015. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  9016. // create
  9017. // invitations for this course or for access errors.
  9018. // * `NOT_FOUND` if the course or the user does not exist.
  9019. // * `FAILED_PRECONDITION` if the requested user's account is disabled
  9020. // or if
  9021. // the user already has this role or a role with greater permissions.
  9022. // * `ALREADY_EXISTS` if an invitation for the specified user and
  9023. // course
  9024. // already exists.
  9025. func (r *InvitationsService) Create(invitation *Invitation) *InvitationsCreateCall {
  9026. c := &InvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9027. c.invitation = invitation
  9028. return c
  9029. }
  9030. // Fields allows partial responses to be retrieved. See
  9031. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9032. // for more information.
  9033. func (c *InvitationsCreateCall) Fields(s ...googleapi.Field) *InvitationsCreateCall {
  9034. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9035. return c
  9036. }
  9037. // Context sets the context to be used in this call's Do method. Any
  9038. // pending HTTP request will be aborted if the provided context is
  9039. // canceled.
  9040. func (c *InvitationsCreateCall) Context(ctx context.Context) *InvitationsCreateCall {
  9041. c.ctx_ = ctx
  9042. return c
  9043. }
  9044. // Header returns an http.Header that can be modified by the caller to
  9045. // add HTTP headers to the request.
  9046. func (c *InvitationsCreateCall) Header() http.Header {
  9047. if c.header_ == nil {
  9048. c.header_ = make(http.Header)
  9049. }
  9050. return c.header_
  9051. }
  9052. func (c *InvitationsCreateCall) doRequest(alt string) (*http.Response, error) {
  9053. reqHeaders := make(http.Header)
  9054. for k, v := range c.header_ {
  9055. reqHeaders[k] = v
  9056. }
  9057. reqHeaders.Set("User-Agent", c.s.userAgent())
  9058. var body io.Reader = nil
  9059. body, err := googleapi.WithoutDataWrapper.JSONReader(c.invitation)
  9060. if err != nil {
  9061. return nil, err
  9062. }
  9063. reqHeaders.Set("Content-Type", "application/json")
  9064. c.urlParams_.Set("alt", alt)
  9065. c.urlParams_.Set("prettyPrint", "false")
  9066. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations")
  9067. urls += "?" + c.urlParams_.Encode()
  9068. req, err := http.NewRequest("POST", urls, body)
  9069. if err != nil {
  9070. return nil, err
  9071. }
  9072. req.Header = reqHeaders
  9073. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9074. }
  9075. // Do executes the "classroom.invitations.create" call.
  9076. // Exactly one of *Invitation or error will be non-nil. Any non-2xx
  9077. // status code is an error. Response headers are in either
  9078. // *Invitation.ServerResponse.Header or (if a response was returned at
  9079. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9080. // to check whether the returned error was because
  9081. // http.StatusNotModified was returned.
  9082. func (c *InvitationsCreateCall) Do(opts ...googleapi.CallOption) (*Invitation, error) {
  9083. gensupport.SetOptions(c.urlParams_, opts...)
  9084. res, err := c.doRequest("json")
  9085. if res != nil && res.StatusCode == http.StatusNotModified {
  9086. if res.Body != nil {
  9087. res.Body.Close()
  9088. }
  9089. return nil, &googleapi.Error{
  9090. Code: res.StatusCode,
  9091. Header: res.Header,
  9092. }
  9093. }
  9094. if err != nil {
  9095. return nil, err
  9096. }
  9097. defer googleapi.CloseBody(res)
  9098. if err := googleapi.CheckResponse(res); err != nil {
  9099. return nil, err
  9100. }
  9101. ret := &Invitation{
  9102. ServerResponse: googleapi.ServerResponse{
  9103. Header: res.Header,
  9104. HTTPStatusCode: res.StatusCode,
  9105. },
  9106. }
  9107. target := &ret
  9108. if err := gensupport.DecodeResponse(target, res); err != nil {
  9109. return nil, err
  9110. }
  9111. return ret, nil
  9112. // {
  9113. // "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.",
  9114. // "flatPath": "v1/invitations",
  9115. // "httpMethod": "POST",
  9116. // "id": "classroom.invitations.create",
  9117. // "parameterOrder": [],
  9118. // "parameters": {},
  9119. // "path": "v1/invitations",
  9120. // "request": {
  9121. // "$ref": "Invitation"
  9122. // },
  9123. // "response": {
  9124. // "$ref": "Invitation"
  9125. // },
  9126. // "scopes": [
  9127. // "https://www.googleapis.com/auth/classroom.rosters"
  9128. // ]
  9129. // }
  9130. }
  9131. // method id "classroom.invitations.delete":
  9132. type InvitationsDeleteCall struct {
  9133. s *Service
  9134. id string
  9135. urlParams_ gensupport.URLParams
  9136. ctx_ context.Context
  9137. header_ http.Header
  9138. }
  9139. // Delete: Deletes an invitation.
  9140. //
  9141. // This method returns the following error codes:
  9142. //
  9143. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  9144. // delete the
  9145. // requested invitation or for access errors.
  9146. // * `NOT_FOUND` if no invitation exists with the requested ID.
  9147. func (r *InvitationsService) Delete(id string) *InvitationsDeleteCall {
  9148. c := &InvitationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9149. c.id = id
  9150. return c
  9151. }
  9152. // Fields allows partial responses to be retrieved. See
  9153. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9154. // for more information.
  9155. func (c *InvitationsDeleteCall) Fields(s ...googleapi.Field) *InvitationsDeleteCall {
  9156. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9157. return c
  9158. }
  9159. // Context sets the context to be used in this call's Do method. Any
  9160. // pending HTTP request will be aborted if the provided context is
  9161. // canceled.
  9162. func (c *InvitationsDeleteCall) Context(ctx context.Context) *InvitationsDeleteCall {
  9163. c.ctx_ = ctx
  9164. return c
  9165. }
  9166. // Header returns an http.Header that can be modified by the caller to
  9167. // add HTTP headers to the request.
  9168. func (c *InvitationsDeleteCall) Header() http.Header {
  9169. if c.header_ == nil {
  9170. c.header_ = make(http.Header)
  9171. }
  9172. return c.header_
  9173. }
  9174. func (c *InvitationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9175. reqHeaders := make(http.Header)
  9176. for k, v := range c.header_ {
  9177. reqHeaders[k] = v
  9178. }
  9179. reqHeaders.Set("User-Agent", c.s.userAgent())
  9180. var body io.Reader = nil
  9181. c.urlParams_.Set("alt", alt)
  9182. c.urlParams_.Set("prettyPrint", "false")
  9183. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}")
  9184. urls += "?" + c.urlParams_.Encode()
  9185. req, err := http.NewRequest("DELETE", urls, body)
  9186. if err != nil {
  9187. return nil, err
  9188. }
  9189. req.Header = reqHeaders
  9190. googleapi.Expand(req.URL, map[string]string{
  9191. "id": c.id,
  9192. })
  9193. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9194. }
  9195. // Do executes the "classroom.invitations.delete" call.
  9196. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9197. // code is an error. Response headers are in either
  9198. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9199. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9200. // check whether the returned error was because http.StatusNotModified
  9201. // was returned.
  9202. func (c *InvitationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9203. gensupport.SetOptions(c.urlParams_, opts...)
  9204. res, err := c.doRequest("json")
  9205. if res != nil && res.StatusCode == http.StatusNotModified {
  9206. if res.Body != nil {
  9207. res.Body.Close()
  9208. }
  9209. return nil, &googleapi.Error{
  9210. Code: res.StatusCode,
  9211. Header: res.Header,
  9212. }
  9213. }
  9214. if err != nil {
  9215. return nil, err
  9216. }
  9217. defer googleapi.CloseBody(res)
  9218. if err := googleapi.CheckResponse(res); err != nil {
  9219. return nil, err
  9220. }
  9221. ret := &Empty{
  9222. ServerResponse: googleapi.ServerResponse{
  9223. Header: res.Header,
  9224. HTTPStatusCode: res.StatusCode,
  9225. },
  9226. }
  9227. target := &ret
  9228. if err := gensupport.DecodeResponse(target, res); err != nil {
  9229. return nil, err
  9230. }
  9231. return ret, nil
  9232. // {
  9233. // "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.",
  9234. // "flatPath": "v1/invitations/{id}",
  9235. // "httpMethod": "DELETE",
  9236. // "id": "classroom.invitations.delete",
  9237. // "parameterOrder": [
  9238. // "id"
  9239. // ],
  9240. // "parameters": {
  9241. // "id": {
  9242. // "description": "Identifier of the invitation to delete.",
  9243. // "location": "path",
  9244. // "required": true,
  9245. // "type": "string"
  9246. // }
  9247. // },
  9248. // "path": "v1/invitations/{id}",
  9249. // "response": {
  9250. // "$ref": "Empty"
  9251. // },
  9252. // "scopes": [
  9253. // "https://www.googleapis.com/auth/classroom.rosters"
  9254. // ]
  9255. // }
  9256. }
  9257. // method id "classroom.invitations.get":
  9258. type InvitationsGetCall struct {
  9259. s *Service
  9260. id string
  9261. urlParams_ gensupport.URLParams
  9262. ifNoneMatch_ string
  9263. ctx_ context.Context
  9264. header_ http.Header
  9265. }
  9266. // Get: Returns an invitation.
  9267. //
  9268. // This method returns the following error codes:
  9269. //
  9270. // * `PERMISSION_DENIED` if the requesting user is not permitted to view
  9271. // the
  9272. // requested invitation or for access errors.
  9273. // * `NOT_FOUND` if no invitation exists with the requested ID.
  9274. func (r *InvitationsService) Get(id string) *InvitationsGetCall {
  9275. c := &InvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9276. c.id = id
  9277. return c
  9278. }
  9279. // Fields allows partial responses to be retrieved. See
  9280. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9281. // for more information.
  9282. func (c *InvitationsGetCall) Fields(s ...googleapi.Field) *InvitationsGetCall {
  9283. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9284. return c
  9285. }
  9286. // IfNoneMatch sets the optional parameter which makes the operation
  9287. // fail if the object's ETag matches the given value. This is useful for
  9288. // getting updates only after the object has changed since the last
  9289. // request. Use googleapi.IsNotModified to check whether the response
  9290. // error from Do is the result of In-None-Match.
  9291. func (c *InvitationsGetCall) IfNoneMatch(entityTag string) *InvitationsGetCall {
  9292. c.ifNoneMatch_ = entityTag
  9293. return c
  9294. }
  9295. // Context sets the context to be used in this call's Do method. Any
  9296. // pending HTTP request will be aborted if the provided context is
  9297. // canceled.
  9298. func (c *InvitationsGetCall) Context(ctx context.Context) *InvitationsGetCall {
  9299. c.ctx_ = ctx
  9300. return c
  9301. }
  9302. // Header returns an http.Header that can be modified by the caller to
  9303. // add HTTP headers to the request.
  9304. func (c *InvitationsGetCall) Header() http.Header {
  9305. if c.header_ == nil {
  9306. c.header_ = make(http.Header)
  9307. }
  9308. return c.header_
  9309. }
  9310. func (c *InvitationsGetCall) doRequest(alt string) (*http.Response, error) {
  9311. reqHeaders := make(http.Header)
  9312. for k, v := range c.header_ {
  9313. reqHeaders[k] = v
  9314. }
  9315. reqHeaders.Set("User-Agent", c.s.userAgent())
  9316. if c.ifNoneMatch_ != "" {
  9317. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9318. }
  9319. var body io.Reader = nil
  9320. c.urlParams_.Set("alt", alt)
  9321. c.urlParams_.Set("prettyPrint", "false")
  9322. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations/{id}")
  9323. urls += "?" + c.urlParams_.Encode()
  9324. req, err := http.NewRequest("GET", urls, body)
  9325. if err != nil {
  9326. return nil, err
  9327. }
  9328. req.Header = reqHeaders
  9329. googleapi.Expand(req.URL, map[string]string{
  9330. "id": c.id,
  9331. })
  9332. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9333. }
  9334. // Do executes the "classroom.invitations.get" call.
  9335. // Exactly one of *Invitation or error will be non-nil. Any non-2xx
  9336. // status code is an error. Response headers are in either
  9337. // *Invitation.ServerResponse.Header or (if a response was returned at
  9338. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9339. // to check whether the returned error was because
  9340. // http.StatusNotModified was returned.
  9341. func (c *InvitationsGetCall) Do(opts ...googleapi.CallOption) (*Invitation, error) {
  9342. gensupport.SetOptions(c.urlParams_, opts...)
  9343. res, err := c.doRequest("json")
  9344. if res != nil && res.StatusCode == http.StatusNotModified {
  9345. if res.Body != nil {
  9346. res.Body.Close()
  9347. }
  9348. return nil, &googleapi.Error{
  9349. Code: res.StatusCode,
  9350. Header: res.Header,
  9351. }
  9352. }
  9353. if err != nil {
  9354. return nil, err
  9355. }
  9356. defer googleapi.CloseBody(res)
  9357. if err := googleapi.CheckResponse(res); err != nil {
  9358. return nil, err
  9359. }
  9360. ret := &Invitation{
  9361. ServerResponse: googleapi.ServerResponse{
  9362. Header: res.Header,
  9363. HTTPStatusCode: res.StatusCode,
  9364. },
  9365. }
  9366. target := &ret
  9367. if err := gensupport.DecodeResponse(target, res); err != nil {
  9368. return nil, err
  9369. }
  9370. return ret, nil
  9371. // {
  9372. // "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.",
  9373. // "flatPath": "v1/invitations/{id}",
  9374. // "httpMethod": "GET",
  9375. // "id": "classroom.invitations.get",
  9376. // "parameterOrder": [
  9377. // "id"
  9378. // ],
  9379. // "parameters": {
  9380. // "id": {
  9381. // "description": "Identifier of the invitation to return.",
  9382. // "location": "path",
  9383. // "required": true,
  9384. // "type": "string"
  9385. // }
  9386. // },
  9387. // "path": "v1/invitations/{id}",
  9388. // "response": {
  9389. // "$ref": "Invitation"
  9390. // },
  9391. // "scopes": [
  9392. // "https://www.googleapis.com/auth/classroom.rosters",
  9393. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  9394. // ]
  9395. // }
  9396. }
  9397. // method id "classroom.invitations.list":
  9398. type InvitationsListCall struct {
  9399. s *Service
  9400. urlParams_ gensupport.URLParams
  9401. ifNoneMatch_ string
  9402. ctx_ context.Context
  9403. header_ http.Header
  9404. }
  9405. // List: Returns a list of invitations that the requesting user is
  9406. // permitted to
  9407. // view, restricted to those that match the list request.
  9408. //
  9409. // *Note:* At least one of `user_id` or `course_id` must be supplied.
  9410. // Both
  9411. // fields can be supplied.
  9412. //
  9413. // This method returns the following error codes:
  9414. //
  9415. // * `PERMISSION_DENIED` for access errors.
  9416. func (r *InvitationsService) List() *InvitationsListCall {
  9417. c := &InvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9418. return c
  9419. }
  9420. // CourseId sets the optional parameter "courseId": Restricts returned
  9421. // invitations to those for a course with the specified
  9422. // identifier.
  9423. func (c *InvitationsListCall) CourseId(courseId string) *InvitationsListCall {
  9424. c.urlParams_.Set("courseId", courseId)
  9425. return c
  9426. }
  9427. // PageSize sets the optional parameter "pageSize": Maximum number of
  9428. // items to return. Zero means no maximum.
  9429. //
  9430. // The server may return fewer than the specified number of results.
  9431. func (c *InvitationsListCall) PageSize(pageSize int64) *InvitationsListCall {
  9432. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9433. return c
  9434. }
  9435. // PageToken sets the optional parameter "pageToken":
  9436. // nextPageToken
  9437. // value returned from a previous
  9438. // list call, indicating
  9439. // that the subsequent page of results should be returned.
  9440. //
  9441. // The list request must be
  9442. // otherwise identical to the one that resulted in this token.
  9443. func (c *InvitationsListCall) PageToken(pageToken string) *InvitationsListCall {
  9444. c.urlParams_.Set("pageToken", pageToken)
  9445. return c
  9446. }
  9447. // UserId sets the optional parameter "userId": Restricts returned
  9448. // invitations to those for a specific user. The identifier
  9449. // can be one of the following:
  9450. //
  9451. // * the numeric identifier for the user
  9452. // * the email address of the user
  9453. // * the string literal "me", indicating the requesting user
  9454. func (c *InvitationsListCall) UserId(userId string) *InvitationsListCall {
  9455. c.urlParams_.Set("userId", userId)
  9456. return c
  9457. }
  9458. // Fields allows partial responses to be retrieved. See
  9459. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9460. // for more information.
  9461. func (c *InvitationsListCall) Fields(s ...googleapi.Field) *InvitationsListCall {
  9462. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9463. return c
  9464. }
  9465. // IfNoneMatch sets the optional parameter which makes the operation
  9466. // fail if the object's ETag matches the given value. This is useful for
  9467. // getting updates only after the object has changed since the last
  9468. // request. Use googleapi.IsNotModified to check whether the response
  9469. // error from Do is the result of In-None-Match.
  9470. func (c *InvitationsListCall) IfNoneMatch(entityTag string) *InvitationsListCall {
  9471. c.ifNoneMatch_ = entityTag
  9472. return c
  9473. }
  9474. // Context sets the context to be used in this call's Do method. Any
  9475. // pending HTTP request will be aborted if the provided context is
  9476. // canceled.
  9477. func (c *InvitationsListCall) Context(ctx context.Context) *InvitationsListCall {
  9478. c.ctx_ = ctx
  9479. return c
  9480. }
  9481. // Header returns an http.Header that can be modified by the caller to
  9482. // add HTTP headers to the request.
  9483. func (c *InvitationsListCall) Header() http.Header {
  9484. if c.header_ == nil {
  9485. c.header_ = make(http.Header)
  9486. }
  9487. return c.header_
  9488. }
  9489. func (c *InvitationsListCall) doRequest(alt string) (*http.Response, error) {
  9490. reqHeaders := make(http.Header)
  9491. for k, v := range c.header_ {
  9492. reqHeaders[k] = v
  9493. }
  9494. reqHeaders.Set("User-Agent", c.s.userAgent())
  9495. if c.ifNoneMatch_ != "" {
  9496. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9497. }
  9498. var body io.Reader = nil
  9499. c.urlParams_.Set("alt", alt)
  9500. c.urlParams_.Set("prettyPrint", "false")
  9501. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/invitations")
  9502. urls += "?" + c.urlParams_.Encode()
  9503. req, err := http.NewRequest("GET", urls, body)
  9504. if err != nil {
  9505. return nil, err
  9506. }
  9507. req.Header = reqHeaders
  9508. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9509. }
  9510. // Do executes the "classroom.invitations.list" call.
  9511. // Exactly one of *ListInvitationsResponse or error will be non-nil. Any
  9512. // non-2xx status code is an error. Response headers are in either
  9513. // *ListInvitationsResponse.ServerResponse.Header or (if a response was
  9514. // returned at all) in error.(*googleapi.Error).Header. Use
  9515. // googleapi.IsNotModified to check whether the returned error was
  9516. // because http.StatusNotModified was returned.
  9517. func (c *InvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) {
  9518. gensupport.SetOptions(c.urlParams_, opts...)
  9519. res, err := c.doRequest("json")
  9520. if res != nil && res.StatusCode == http.StatusNotModified {
  9521. if res.Body != nil {
  9522. res.Body.Close()
  9523. }
  9524. return nil, &googleapi.Error{
  9525. Code: res.StatusCode,
  9526. Header: res.Header,
  9527. }
  9528. }
  9529. if err != nil {
  9530. return nil, err
  9531. }
  9532. defer googleapi.CloseBody(res)
  9533. if err := googleapi.CheckResponse(res); err != nil {
  9534. return nil, err
  9535. }
  9536. ret := &ListInvitationsResponse{
  9537. ServerResponse: googleapi.ServerResponse{
  9538. Header: res.Header,
  9539. HTTPStatusCode: res.StatusCode,
  9540. },
  9541. }
  9542. target := &ret
  9543. if err := gensupport.DecodeResponse(target, res); err != nil {
  9544. return nil, err
  9545. }
  9546. return ret, nil
  9547. // {
  9548. // "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.",
  9549. // "flatPath": "v1/invitations",
  9550. // "httpMethod": "GET",
  9551. // "id": "classroom.invitations.list",
  9552. // "parameterOrder": [],
  9553. // "parameters": {
  9554. // "courseId": {
  9555. // "description": "Restricts returned invitations to those for a course with the specified\nidentifier.",
  9556. // "location": "query",
  9557. // "type": "string"
  9558. // },
  9559. // "pageSize": {
  9560. // "description": "Maximum number of items to return. Zero means no maximum.\n\nThe server may return fewer than the specified number of results.",
  9561. // "format": "int32",
  9562. // "location": "query",
  9563. // "type": "integer"
  9564. // },
  9565. // "pageToken": {
  9566. // "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.",
  9567. // "location": "query",
  9568. // "type": "string"
  9569. // },
  9570. // "userId": {
  9571. // "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",
  9572. // "location": "query",
  9573. // "type": "string"
  9574. // }
  9575. // },
  9576. // "path": "v1/invitations",
  9577. // "response": {
  9578. // "$ref": "ListInvitationsResponse"
  9579. // },
  9580. // "scopes": [
  9581. // "https://www.googleapis.com/auth/classroom.rosters",
  9582. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  9583. // ]
  9584. // }
  9585. }
  9586. // Pages invokes f for each page of results.
  9587. // A non-nil error returned from f will halt the iteration.
  9588. // The provided context supersedes any context provided to the Context method.
  9589. func (c *InvitationsListCall) Pages(ctx context.Context, f func(*ListInvitationsResponse) error) error {
  9590. c.ctx_ = ctx
  9591. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9592. for {
  9593. x, err := c.Do()
  9594. if err != nil {
  9595. return err
  9596. }
  9597. if err := f(x); err != nil {
  9598. return err
  9599. }
  9600. if x.NextPageToken == "" {
  9601. return nil
  9602. }
  9603. c.PageToken(x.NextPageToken)
  9604. }
  9605. }
  9606. // method id "classroom.registrations.create":
  9607. type RegistrationsCreateCall struct {
  9608. s *Service
  9609. registration *Registration
  9610. urlParams_ gensupport.URLParams
  9611. ctx_ context.Context
  9612. header_ http.Header
  9613. }
  9614. // Create: Creates a `Registration`, causing Classroom to start sending
  9615. // notifications
  9616. // from the provided `feed` to the destination provided in
  9617. // `cloudPubSubTopic`.
  9618. //
  9619. // Returns the created `Registration`. Currently, this will be the same
  9620. // as
  9621. // the argument, but with server-assigned fields such as `expiry_time`
  9622. // and
  9623. // `id` filled in.
  9624. //
  9625. // Note that any value specified for the `expiry_time` or `id` fields
  9626. // will be
  9627. // ignored.
  9628. //
  9629. // While Classroom may validate the `cloudPubSubTopic` and return errors
  9630. // on a
  9631. // best effort basis, it is the caller's responsibility to ensure that
  9632. // it
  9633. // exists and that Classroom has permission to publish to it.
  9634. //
  9635. // This method may return the following error codes:
  9636. //
  9637. // * `PERMISSION_DENIED` if:
  9638. // * the authenticated user does not have permission to receive
  9639. // notifications from the requested field; or
  9640. // * the credential provided does not include the appropriate scope
  9641. // for
  9642. // the requested feed.
  9643. // * another access error is encountered.
  9644. // * `INVALID_ARGUMENT` if:
  9645. // * no `cloudPubsubTopic` is specified, or the specified
  9646. // `cloudPubsubTopic` is not valid; or
  9647. // * no `feed` is specified, or the specified `feed` is not valid.
  9648. // * `NOT_FOUND` if:
  9649. // * the specified `feed` cannot be located, or the requesting user
  9650. // does
  9651. // not have permission to determine whether or not it exists; or
  9652. // * the specified `cloudPubsubTopic` cannot be located, or
  9653. // Classroom has
  9654. // not been granted permission to publish to it.
  9655. func (r *RegistrationsService) Create(registration *Registration) *RegistrationsCreateCall {
  9656. c := &RegistrationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9657. c.registration = registration
  9658. return c
  9659. }
  9660. // Fields allows partial responses to be retrieved. See
  9661. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9662. // for more information.
  9663. func (c *RegistrationsCreateCall) Fields(s ...googleapi.Field) *RegistrationsCreateCall {
  9664. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9665. return c
  9666. }
  9667. // Context sets the context to be used in this call's Do method. Any
  9668. // pending HTTP request will be aborted if the provided context is
  9669. // canceled.
  9670. func (c *RegistrationsCreateCall) Context(ctx context.Context) *RegistrationsCreateCall {
  9671. c.ctx_ = ctx
  9672. return c
  9673. }
  9674. // Header returns an http.Header that can be modified by the caller to
  9675. // add HTTP headers to the request.
  9676. func (c *RegistrationsCreateCall) Header() http.Header {
  9677. if c.header_ == nil {
  9678. c.header_ = make(http.Header)
  9679. }
  9680. return c.header_
  9681. }
  9682. func (c *RegistrationsCreateCall) doRequest(alt string) (*http.Response, error) {
  9683. reqHeaders := make(http.Header)
  9684. for k, v := range c.header_ {
  9685. reqHeaders[k] = v
  9686. }
  9687. reqHeaders.Set("User-Agent", c.s.userAgent())
  9688. var body io.Reader = nil
  9689. body, err := googleapi.WithoutDataWrapper.JSONReader(c.registration)
  9690. if err != nil {
  9691. return nil, err
  9692. }
  9693. reqHeaders.Set("Content-Type", "application/json")
  9694. c.urlParams_.Set("alt", alt)
  9695. c.urlParams_.Set("prettyPrint", "false")
  9696. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations")
  9697. urls += "?" + c.urlParams_.Encode()
  9698. req, err := http.NewRequest("POST", urls, body)
  9699. if err != nil {
  9700. return nil, err
  9701. }
  9702. req.Header = reqHeaders
  9703. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9704. }
  9705. // Do executes the "classroom.registrations.create" call.
  9706. // Exactly one of *Registration or error will be non-nil. Any non-2xx
  9707. // status code is an error. Response headers are in either
  9708. // *Registration.ServerResponse.Header or (if a response was returned at
  9709. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9710. // to check whether the returned error was because
  9711. // http.StatusNotModified was returned.
  9712. func (c *RegistrationsCreateCall) Do(opts ...googleapi.CallOption) (*Registration, error) {
  9713. gensupport.SetOptions(c.urlParams_, opts...)
  9714. res, err := c.doRequest("json")
  9715. if res != nil && res.StatusCode == http.StatusNotModified {
  9716. if res.Body != nil {
  9717. res.Body.Close()
  9718. }
  9719. return nil, &googleapi.Error{
  9720. Code: res.StatusCode,
  9721. Header: res.Header,
  9722. }
  9723. }
  9724. if err != nil {
  9725. return nil, err
  9726. }
  9727. defer googleapi.CloseBody(res)
  9728. if err := googleapi.CheckResponse(res); err != nil {
  9729. return nil, err
  9730. }
  9731. ret := &Registration{
  9732. ServerResponse: googleapi.ServerResponse{
  9733. Header: res.Header,
  9734. HTTPStatusCode: res.StatusCode,
  9735. },
  9736. }
  9737. target := &ret
  9738. if err := gensupport.DecodeResponse(target, res); err != nil {
  9739. return nil, err
  9740. }
  9741. return ret, nil
  9742. // {
  9743. // "description": "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.",
  9744. // "flatPath": "v1/registrations",
  9745. // "httpMethod": "POST",
  9746. // "id": "classroom.registrations.create",
  9747. // "parameterOrder": [],
  9748. // "parameters": {},
  9749. // "path": "v1/registrations",
  9750. // "request": {
  9751. // "$ref": "Registration"
  9752. // },
  9753. // "response": {
  9754. // "$ref": "Registration"
  9755. // },
  9756. // "scopes": [
  9757. // "https://www.googleapis.com/auth/classroom.push-notifications"
  9758. // ]
  9759. // }
  9760. }
  9761. // method id "classroom.registrations.delete":
  9762. type RegistrationsDeleteCall struct {
  9763. s *Service
  9764. registrationId string
  9765. urlParams_ gensupport.URLParams
  9766. ctx_ context.Context
  9767. header_ http.Header
  9768. }
  9769. // Delete: Deletes a `Registration`, causing Classroom to stop sending
  9770. // notifications
  9771. // for that `Registration`.
  9772. func (r *RegistrationsService) Delete(registrationId string) *RegistrationsDeleteCall {
  9773. c := &RegistrationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9774. c.registrationId = registrationId
  9775. return c
  9776. }
  9777. // Fields allows partial responses to be retrieved. See
  9778. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9779. // for more information.
  9780. func (c *RegistrationsDeleteCall) Fields(s ...googleapi.Field) *RegistrationsDeleteCall {
  9781. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9782. return c
  9783. }
  9784. // Context sets the context to be used in this call's Do method. Any
  9785. // pending HTTP request will be aborted if the provided context is
  9786. // canceled.
  9787. func (c *RegistrationsDeleteCall) Context(ctx context.Context) *RegistrationsDeleteCall {
  9788. c.ctx_ = ctx
  9789. return c
  9790. }
  9791. // Header returns an http.Header that can be modified by the caller to
  9792. // add HTTP headers to the request.
  9793. func (c *RegistrationsDeleteCall) Header() http.Header {
  9794. if c.header_ == nil {
  9795. c.header_ = make(http.Header)
  9796. }
  9797. return c.header_
  9798. }
  9799. func (c *RegistrationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9800. reqHeaders := make(http.Header)
  9801. for k, v := range c.header_ {
  9802. reqHeaders[k] = v
  9803. }
  9804. reqHeaders.Set("User-Agent", c.s.userAgent())
  9805. var body io.Reader = nil
  9806. c.urlParams_.Set("alt", alt)
  9807. c.urlParams_.Set("prettyPrint", "false")
  9808. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/registrations/{registrationId}")
  9809. urls += "?" + c.urlParams_.Encode()
  9810. req, err := http.NewRequest("DELETE", urls, body)
  9811. if err != nil {
  9812. return nil, err
  9813. }
  9814. req.Header = reqHeaders
  9815. googleapi.Expand(req.URL, map[string]string{
  9816. "registrationId": c.registrationId,
  9817. })
  9818. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9819. }
  9820. // Do executes the "classroom.registrations.delete" call.
  9821. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9822. // code is an error. Response headers are in either
  9823. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9824. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9825. // check whether the returned error was because http.StatusNotModified
  9826. // was returned.
  9827. func (c *RegistrationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9828. gensupport.SetOptions(c.urlParams_, opts...)
  9829. res, err := c.doRequest("json")
  9830. if res != nil && res.StatusCode == http.StatusNotModified {
  9831. if res.Body != nil {
  9832. res.Body.Close()
  9833. }
  9834. return nil, &googleapi.Error{
  9835. Code: res.StatusCode,
  9836. Header: res.Header,
  9837. }
  9838. }
  9839. if err != nil {
  9840. return nil, err
  9841. }
  9842. defer googleapi.CloseBody(res)
  9843. if err := googleapi.CheckResponse(res); err != nil {
  9844. return nil, err
  9845. }
  9846. ret := &Empty{
  9847. ServerResponse: googleapi.ServerResponse{
  9848. Header: res.Header,
  9849. HTTPStatusCode: res.StatusCode,
  9850. },
  9851. }
  9852. target := &ret
  9853. if err := gensupport.DecodeResponse(target, res); err != nil {
  9854. return nil, err
  9855. }
  9856. return ret, nil
  9857. // {
  9858. // "description": "Deletes a `Registration`, causing Classroom to stop sending notifications\nfor that `Registration`.",
  9859. // "flatPath": "v1/registrations/{registrationId}",
  9860. // "httpMethod": "DELETE",
  9861. // "id": "classroom.registrations.delete",
  9862. // "parameterOrder": [
  9863. // "registrationId"
  9864. // ],
  9865. // "parameters": {
  9866. // "registrationId": {
  9867. // "description": "The `registration_id` of the `Registration` to be deleted.",
  9868. // "location": "path",
  9869. // "required": true,
  9870. // "type": "string"
  9871. // }
  9872. // },
  9873. // "path": "v1/registrations/{registrationId}",
  9874. // "response": {
  9875. // "$ref": "Empty"
  9876. // },
  9877. // "scopes": [
  9878. // "https://www.googleapis.com/auth/classroom.push-notifications"
  9879. // ]
  9880. // }
  9881. }
  9882. // method id "classroom.userProfiles.get":
  9883. type UserProfilesGetCall struct {
  9884. s *Service
  9885. userId string
  9886. urlParams_ gensupport.URLParams
  9887. ifNoneMatch_ string
  9888. ctx_ context.Context
  9889. header_ http.Header
  9890. }
  9891. // Get: Returns a user profile.
  9892. //
  9893. // This method returns the following error codes:
  9894. //
  9895. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  9896. // access
  9897. // this user profile, if no profile exists with the requested ID, or
  9898. // for
  9899. // access errors.
  9900. func (r *UserProfilesService) Get(userId string) *UserProfilesGetCall {
  9901. c := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9902. c.userId = userId
  9903. return c
  9904. }
  9905. // Fields allows partial responses to be retrieved. See
  9906. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9907. // for more information.
  9908. func (c *UserProfilesGetCall) Fields(s ...googleapi.Field) *UserProfilesGetCall {
  9909. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9910. return c
  9911. }
  9912. // IfNoneMatch sets the optional parameter which makes the operation
  9913. // fail if the object's ETag matches the given value. This is useful for
  9914. // getting updates only after the object has changed since the last
  9915. // request. Use googleapi.IsNotModified to check whether the response
  9916. // error from Do is the result of In-None-Match.
  9917. func (c *UserProfilesGetCall) IfNoneMatch(entityTag string) *UserProfilesGetCall {
  9918. c.ifNoneMatch_ = entityTag
  9919. return c
  9920. }
  9921. // Context sets the context to be used in this call's Do method. Any
  9922. // pending HTTP request will be aborted if the provided context is
  9923. // canceled.
  9924. func (c *UserProfilesGetCall) Context(ctx context.Context) *UserProfilesGetCall {
  9925. c.ctx_ = ctx
  9926. return c
  9927. }
  9928. // Header returns an http.Header that can be modified by the caller to
  9929. // add HTTP headers to the request.
  9930. func (c *UserProfilesGetCall) Header() http.Header {
  9931. if c.header_ == nil {
  9932. c.header_ = make(http.Header)
  9933. }
  9934. return c.header_
  9935. }
  9936. func (c *UserProfilesGetCall) doRequest(alt string) (*http.Response, error) {
  9937. reqHeaders := make(http.Header)
  9938. for k, v := range c.header_ {
  9939. reqHeaders[k] = v
  9940. }
  9941. reqHeaders.Set("User-Agent", c.s.userAgent())
  9942. if c.ifNoneMatch_ != "" {
  9943. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9944. }
  9945. var body io.Reader = nil
  9946. c.urlParams_.Set("alt", alt)
  9947. c.urlParams_.Set("prettyPrint", "false")
  9948. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{userId}")
  9949. urls += "?" + c.urlParams_.Encode()
  9950. req, err := http.NewRequest("GET", urls, body)
  9951. if err != nil {
  9952. return nil, err
  9953. }
  9954. req.Header = reqHeaders
  9955. googleapi.Expand(req.URL, map[string]string{
  9956. "userId": c.userId,
  9957. })
  9958. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9959. }
  9960. // Do executes the "classroom.userProfiles.get" call.
  9961. // Exactly one of *UserProfile or error will be non-nil. Any non-2xx
  9962. // status code is an error. Response headers are in either
  9963. // *UserProfile.ServerResponse.Header or (if a response was returned at
  9964. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9965. // to check whether the returned error was because
  9966. // http.StatusNotModified was returned.
  9967. func (c *UserProfilesGetCall) Do(opts ...googleapi.CallOption) (*UserProfile, error) {
  9968. gensupport.SetOptions(c.urlParams_, opts...)
  9969. res, err := c.doRequest("json")
  9970. if res != nil && res.StatusCode == http.StatusNotModified {
  9971. if res.Body != nil {
  9972. res.Body.Close()
  9973. }
  9974. return nil, &googleapi.Error{
  9975. Code: res.StatusCode,
  9976. Header: res.Header,
  9977. }
  9978. }
  9979. if err != nil {
  9980. return nil, err
  9981. }
  9982. defer googleapi.CloseBody(res)
  9983. if err := googleapi.CheckResponse(res); err != nil {
  9984. return nil, err
  9985. }
  9986. ret := &UserProfile{
  9987. ServerResponse: googleapi.ServerResponse{
  9988. Header: res.Header,
  9989. HTTPStatusCode: res.StatusCode,
  9990. },
  9991. }
  9992. target := &ret
  9993. if err := gensupport.DecodeResponse(target, res); err != nil {
  9994. return nil, err
  9995. }
  9996. return ret, nil
  9997. // {
  9998. // "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.",
  9999. // "flatPath": "v1/userProfiles/{userId}",
  10000. // "httpMethod": "GET",
  10001. // "id": "classroom.userProfiles.get",
  10002. // "parameterOrder": [
  10003. // "userId"
  10004. // ],
  10005. // "parameters": {
  10006. // "userId": {
  10007. // "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",
  10008. // "location": "path",
  10009. // "required": true,
  10010. // "type": "string"
  10011. // }
  10012. // },
  10013. // "path": "v1/userProfiles/{userId}",
  10014. // "response": {
  10015. // "$ref": "UserProfile"
  10016. // },
  10017. // "scopes": [
  10018. // "https://www.googleapis.com/auth/classroom.profile.emails",
  10019. // "https://www.googleapis.com/auth/classroom.profile.photos",
  10020. // "https://www.googleapis.com/auth/classroom.rosters",
  10021. // "https://www.googleapis.com/auth/classroom.rosters.readonly"
  10022. // ]
  10023. // }
  10024. }
  10025. // method id "classroom.userProfiles.guardianInvitations.create":
  10026. type UserProfilesGuardianInvitationsCreateCall struct {
  10027. s *Service
  10028. studentId string
  10029. guardianinvitation *GuardianInvitation
  10030. urlParams_ gensupport.URLParams
  10031. ctx_ context.Context
  10032. header_ http.Header
  10033. }
  10034. // Create: Creates a guardian invitation, and sends an email to the
  10035. // guardian asking
  10036. // them to confirm that they are the student's guardian.
  10037. //
  10038. // Once the guardian accepts the invitation, their `state` will change
  10039. // to
  10040. // `COMPLETED` and they will start receiving guardian notifications.
  10041. // A
  10042. // `Guardian` resource will also be created to represent the active
  10043. // guardian.
  10044. //
  10045. // The request object must have the `student_id`
  10046. // and
  10047. // `invited_email_address` fields set. Failing to set these fields,
  10048. // or
  10049. // setting any other fields in the request, will result in an
  10050. // error.
  10051. //
  10052. // This method returns the following error codes:
  10053. //
  10054. // * `PERMISSION_DENIED` if the current user does not have permission
  10055. // to
  10056. // manage guardians, if the guardian in question has already rejected
  10057. // too many requests for that student, if guardians are not enabled
  10058. // for the
  10059. // domain in question, or for other access errors.
  10060. // * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the
  10061. // guardian
  10062. // link limit.
  10063. // * `INVALID_ARGUMENT` if the guardian email address is not valid (for
  10064. // example, if it is too long), or if the format of the student ID
  10065. // provided
  10066. // cannot be recognized (it is not an email address, nor a `user_id`
  10067. // from
  10068. // this API). This error will also be returned if read-only fields are
  10069. // set,
  10070. // or if the `state` field is set to to a value other than
  10071. // `PENDING`.
  10072. // * `NOT_FOUND` if the student ID provided is a valid student ID, but
  10073. // Classroom has no record of that student.
  10074. // * `ALREADY_EXISTS` if there is already a pending guardian invitation
  10075. // for
  10076. // the student and `invited_email_address` provided, or if the
  10077. // provided
  10078. // `invited_email_address` matches the Google account of an existing
  10079. // `Guardian` for this user.
  10080. func (r *UserProfilesGuardianInvitationsService) Create(studentId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsCreateCall {
  10081. c := &UserProfilesGuardianInvitationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10082. c.studentId = studentId
  10083. c.guardianinvitation = guardianinvitation
  10084. return c
  10085. }
  10086. // Fields allows partial responses to be retrieved. See
  10087. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10088. // for more information.
  10089. func (c *UserProfilesGuardianInvitationsCreateCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsCreateCall {
  10090. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10091. return c
  10092. }
  10093. // Context sets the context to be used in this call's Do method. Any
  10094. // pending HTTP request will be aborted if the provided context is
  10095. // canceled.
  10096. func (c *UserProfilesGuardianInvitationsCreateCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsCreateCall {
  10097. c.ctx_ = ctx
  10098. return c
  10099. }
  10100. // Header returns an http.Header that can be modified by the caller to
  10101. // add HTTP headers to the request.
  10102. func (c *UserProfilesGuardianInvitationsCreateCall) Header() http.Header {
  10103. if c.header_ == nil {
  10104. c.header_ = make(http.Header)
  10105. }
  10106. return c.header_
  10107. }
  10108. func (c *UserProfilesGuardianInvitationsCreateCall) doRequest(alt string) (*http.Response, error) {
  10109. reqHeaders := make(http.Header)
  10110. for k, v := range c.header_ {
  10111. reqHeaders[k] = v
  10112. }
  10113. reqHeaders.Set("User-Agent", c.s.userAgent())
  10114. var body io.Reader = nil
  10115. body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation)
  10116. if err != nil {
  10117. return nil, err
  10118. }
  10119. reqHeaders.Set("Content-Type", "application/json")
  10120. c.urlParams_.Set("alt", alt)
  10121. c.urlParams_.Set("prettyPrint", "false")
  10122. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations")
  10123. urls += "?" + c.urlParams_.Encode()
  10124. req, err := http.NewRequest("POST", urls, body)
  10125. if err != nil {
  10126. return nil, err
  10127. }
  10128. req.Header = reqHeaders
  10129. googleapi.Expand(req.URL, map[string]string{
  10130. "studentId": c.studentId,
  10131. })
  10132. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10133. }
  10134. // Do executes the "classroom.userProfiles.guardianInvitations.create" call.
  10135. // Exactly one of *GuardianInvitation or error will be non-nil. Any
  10136. // non-2xx status code is an error. Response headers are in either
  10137. // *GuardianInvitation.ServerResponse.Header or (if a response was
  10138. // returned at all) in error.(*googleapi.Error).Header. Use
  10139. // googleapi.IsNotModified to check whether the returned error was
  10140. // because http.StatusNotModified was returned.
  10141. func (c *UserProfilesGuardianInvitationsCreateCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) {
  10142. gensupport.SetOptions(c.urlParams_, opts...)
  10143. res, err := c.doRequest("json")
  10144. if res != nil && res.StatusCode == http.StatusNotModified {
  10145. if res.Body != nil {
  10146. res.Body.Close()
  10147. }
  10148. return nil, &googleapi.Error{
  10149. Code: res.StatusCode,
  10150. Header: res.Header,
  10151. }
  10152. }
  10153. if err != nil {
  10154. return nil, err
  10155. }
  10156. defer googleapi.CloseBody(res)
  10157. if err := googleapi.CheckResponse(res); err != nil {
  10158. return nil, err
  10159. }
  10160. ret := &GuardianInvitation{
  10161. ServerResponse: googleapi.ServerResponse{
  10162. Header: res.Header,
  10163. HTTPStatusCode: res.StatusCode,
  10164. },
  10165. }
  10166. target := &ret
  10167. if err := gensupport.DecodeResponse(target, res); err != nil {
  10168. return nil, err
  10169. }
  10170. return ret, nil
  10171. // {
  10172. // "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.",
  10173. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations",
  10174. // "httpMethod": "POST",
  10175. // "id": "classroom.userProfiles.guardianInvitations.create",
  10176. // "parameterOrder": [
  10177. // "studentId"
  10178. // ],
  10179. // "parameters": {
  10180. // "studentId": {
  10181. // "description": "ID of the student (in standard format)",
  10182. // "location": "path",
  10183. // "required": true,
  10184. // "type": "string"
  10185. // }
  10186. // },
  10187. // "path": "v1/userProfiles/{studentId}/guardianInvitations",
  10188. // "request": {
  10189. // "$ref": "GuardianInvitation"
  10190. // },
  10191. // "response": {
  10192. // "$ref": "GuardianInvitation"
  10193. // },
  10194. // "scopes": [
  10195. // "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  10196. // ]
  10197. // }
  10198. }
  10199. // method id "classroom.userProfiles.guardianInvitations.get":
  10200. type UserProfilesGuardianInvitationsGetCall struct {
  10201. s *Service
  10202. studentId string
  10203. invitationId string
  10204. urlParams_ gensupport.URLParams
  10205. ifNoneMatch_ string
  10206. ctx_ context.Context
  10207. header_ http.Header
  10208. }
  10209. // Get: Returns a specific guardian invitation.
  10210. //
  10211. // This method returns the following error codes:
  10212. //
  10213. // * `PERMISSION_DENIED` if the requesting user is not permitted to
  10214. // view
  10215. // guardian invitations for the student identified by the
  10216. // `student_id`, if
  10217. // guardians are not enabled for the domain in question, or for other
  10218. // access errors.
  10219. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10220. // cannot
  10221. // be recognized (it is not an email address, nor a `student_id` from
  10222. // the
  10223. // API, nor the literal string `me`).
  10224. // * `NOT_FOUND` if Classroom cannot find any record of the given
  10225. // student or
  10226. // `invitation_id`. May also be returned if the student exists, but
  10227. // the
  10228. // requesting user does not have access to see that student.
  10229. func (r *UserProfilesGuardianInvitationsService) Get(studentId string, invitationId string) *UserProfilesGuardianInvitationsGetCall {
  10230. c := &UserProfilesGuardianInvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10231. c.studentId = studentId
  10232. c.invitationId = invitationId
  10233. return c
  10234. }
  10235. // Fields allows partial responses to be retrieved. See
  10236. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10237. // for more information.
  10238. func (c *UserProfilesGuardianInvitationsGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsGetCall {
  10239. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10240. return c
  10241. }
  10242. // IfNoneMatch sets the optional parameter which makes the operation
  10243. // fail if the object's ETag matches the given value. This is useful for
  10244. // getting updates only after the object has changed since the last
  10245. // request. Use googleapi.IsNotModified to check whether the response
  10246. // error from Do is the result of In-None-Match.
  10247. func (c *UserProfilesGuardianInvitationsGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsGetCall {
  10248. c.ifNoneMatch_ = entityTag
  10249. return c
  10250. }
  10251. // Context sets the context to be used in this call's Do method. Any
  10252. // pending HTTP request will be aborted if the provided context is
  10253. // canceled.
  10254. func (c *UserProfilesGuardianInvitationsGetCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsGetCall {
  10255. c.ctx_ = ctx
  10256. return c
  10257. }
  10258. // Header returns an http.Header that can be modified by the caller to
  10259. // add HTTP headers to the request.
  10260. func (c *UserProfilesGuardianInvitationsGetCall) Header() http.Header {
  10261. if c.header_ == nil {
  10262. c.header_ = make(http.Header)
  10263. }
  10264. return c.header_
  10265. }
  10266. func (c *UserProfilesGuardianInvitationsGetCall) doRequest(alt string) (*http.Response, error) {
  10267. reqHeaders := make(http.Header)
  10268. for k, v := range c.header_ {
  10269. reqHeaders[k] = v
  10270. }
  10271. reqHeaders.Set("User-Agent", c.s.userAgent())
  10272. if c.ifNoneMatch_ != "" {
  10273. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10274. }
  10275. var body io.Reader = nil
  10276. c.urlParams_.Set("alt", alt)
  10277. c.urlParams_.Set("prettyPrint", "false")
  10278. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}")
  10279. urls += "?" + c.urlParams_.Encode()
  10280. req, err := http.NewRequest("GET", urls, body)
  10281. if err != nil {
  10282. return nil, err
  10283. }
  10284. req.Header = reqHeaders
  10285. googleapi.Expand(req.URL, map[string]string{
  10286. "studentId": c.studentId,
  10287. "invitationId": c.invitationId,
  10288. })
  10289. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10290. }
  10291. // Do executes the "classroom.userProfiles.guardianInvitations.get" call.
  10292. // Exactly one of *GuardianInvitation or error will be non-nil. Any
  10293. // non-2xx status code is an error. Response headers are in either
  10294. // *GuardianInvitation.ServerResponse.Header or (if a response was
  10295. // returned at all) in error.(*googleapi.Error).Header. Use
  10296. // googleapi.IsNotModified to check whether the returned error was
  10297. // because http.StatusNotModified was returned.
  10298. func (c *UserProfilesGuardianInvitationsGetCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) {
  10299. gensupport.SetOptions(c.urlParams_, opts...)
  10300. res, err := c.doRequest("json")
  10301. if res != nil && res.StatusCode == http.StatusNotModified {
  10302. if res.Body != nil {
  10303. res.Body.Close()
  10304. }
  10305. return nil, &googleapi.Error{
  10306. Code: res.StatusCode,
  10307. Header: res.Header,
  10308. }
  10309. }
  10310. if err != nil {
  10311. return nil, err
  10312. }
  10313. defer googleapi.CloseBody(res)
  10314. if err := googleapi.CheckResponse(res); err != nil {
  10315. return nil, err
  10316. }
  10317. ret := &GuardianInvitation{
  10318. ServerResponse: googleapi.ServerResponse{
  10319. Header: res.Header,
  10320. HTTPStatusCode: res.StatusCode,
  10321. },
  10322. }
  10323. target := &ret
  10324. if err := gensupport.DecodeResponse(target, res); err != nil {
  10325. return nil, err
  10326. }
  10327. return ret, nil
  10328. // {
  10329. // "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.",
  10330. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10331. // "httpMethod": "GET",
  10332. // "id": "classroom.userProfiles.guardianInvitations.get",
  10333. // "parameterOrder": [
  10334. // "studentId",
  10335. // "invitationId"
  10336. // ],
  10337. // "parameters": {
  10338. // "invitationId": {
  10339. // "description": "The `id` field of the `GuardianInvitation` being requested.",
  10340. // "location": "path",
  10341. // "required": true,
  10342. // "type": "string"
  10343. // },
  10344. // "studentId": {
  10345. // "description": "The ID of the student whose guardian invitation is being requested.",
  10346. // "location": "path",
  10347. // "required": true,
  10348. // "type": "string"
  10349. // }
  10350. // },
  10351. // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10352. // "response": {
  10353. // "$ref": "GuardianInvitation"
  10354. // },
  10355. // "scopes": [
  10356. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  10357. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  10358. // ]
  10359. // }
  10360. }
  10361. // method id "classroom.userProfiles.guardianInvitations.list":
  10362. type UserProfilesGuardianInvitationsListCall struct {
  10363. s *Service
  10364. studentId string
  10365. urlParams_ gensupport.URLParams
  10366. ifNoneMatch_ string
  10367. ctx_ context.Context
  10368. header_ http.Header
  10369. }
  10370. // List: Returns a list of guardian invitations that the requesting user
  10371. // is
  10372. // permitted to view, filtered by the parameters provided.
  10373. //
  10374. // This method returns the following error codes:
  10375. //
  10376. // * `PERMISSION_DENIED` if a `student_id` is specified, and the
  10377. // requesting
  10378. // user is not permitted to view guardian invitations for that
  10379. // student, if
  10380. // "-" is specified as the `student_id` and the user is not a
  10381. // domain
  10382. // administrator, if guardians are not enabled for the domain in
  10383. // question,
  10384. // or for other access errors.
  10385. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10386. // cannot
  10387. // be recognized (it is not an email address, nor a `student_id` from
  10388. // the
  10389. // API, nor the literal string `me`). May also be returned if an
  10390. // invalid
  10391. // `page_token` or `state` is provided.
  10392. // * `NOT_FOUND` if a `student_id` is specified, and its format can be
  10393. // recognized, but Classroom has no record of that student.
  10394. func (r *UserProfilesGuardianInvitationsService) List(studentId string) *UserProfilesGuardianInvitationsListCall {
  10395. c := &UserProfilesGuardianInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10396. c.studentId = studentId
  10397. return c
  10398. }
  10399. // InvitedEmailAddress sets the optional parameter
  10400. // "invitedEmailAddress": If specified, only results with the specified
  10401. // `invited_email_address`
  10402. // will be returned.
  10403. func (c *UserProfilesGuardianInvitationsListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardianInvitationsListCall {
  10404. c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress)
  10405. return c
  10406. }
  10407. // PageSize sets the optional parameter "pageSize": Maximum number of
  10408. // items to return. Zero or unspecified indicates that the
  10409. // server may assign a maximum.
  10410. //
  10411. // The server may return fewer than the specified number of results.
  10412. func (c *UserProfilesGuardianInvitationsListCall) PageSize(pageSize int64) *UserProfilesGuardianInvitationsListCall {
  10413. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  10414. return c
  10415. }
  10416. // PageToken sets the optional parameter "pageToken":
  10417. // nextPageToken
  10418. // value returned from a previous
  10419. // list call,
  10420. // indicating that the subsequent page of results should be
  10421. // returned.
  10422. //
  10423. // The list request
  10424. // must be otherwise identical to the one that resulted in this token.
  10425. func (c *UserProfilesGuardianInvitationsListCall) PageToken(pageToken string) *UserProfilesGuardianInvitationsListCall {
  10426. c.urlParams_.Set("pageToken", pageToken)
  10427. return c
  10428. }
  10429. // States sets the optional parameter "states": If specified, only
  10430. // results with the specified `state` values will be
  10431. // returned. Otherwise, results with a `state` of `PENDING` will be
  10432. // returned.
  10433. //
  10434. // Possible values:
  10435. // "GUARDIAN_INVITATION_STATE_UNSPECIFIED"
  10436. // "PENDING"
  10437. // "COMPLETE"
  10438. func (c *UserProfilesGuardianInvitationsListCall) States(states ...string) *UserProfilesGuardianInvitationsListCall {
  10439. c.urlParams_.SetMulti("states", append([]string{}, states...))
  10440. return c
  10441. }
  10442. // Fields allows partial responses to be retrieved. See
  10443. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10444. // for more information.
  10445. func (c *UserProfilesGuardianInvitationsListCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsListCall {
  10446. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10447. return c
  10448. }
  10449. // IfNoneMatch sets the optional parameter which makes the operation
  10450. // fail if the object's ETag matches the given value. This is useful for
  10451. // getting updates only after the object has changed since the last
  10452. // request. Use googleapi.IsNotModified to check whether the response
  10453. // error from Do is the result of In-None-Match.
  10454. func (c *UserProfilesGuardianInvitationsListCall) IfNoneMatch(entityTag string) *UserProfilesGuardianInvitationsListCall {
  10455. c.ifNoneMatch_ = entityTag
  10456. return c
  10457. }
  10458. // Context sets the context to be used in this call's Do method. Any
  10459. // pending HTTP request will be aborted if the provided context is
  10460. // canceled.
  10461. func (c *UserProfilesGuardianInvitationsListCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsListCall {
  10462. c.ctx_ = ctx
  10463. return c
  10464. }
  10465. // Header returns an http.Header that can be modified by the caller to
  10466. // add HTTP headers to the request.
  10467. func (c *UserProfilesGuardianInvitationsListCall) Header() http.Header {
  10468. if c.header_ == nil {
  10469. c.header_ = make(http.Header)
  10470. }
  10471. return c.header_
  10472. }
  10473. func (c *UserProfilesGuardianInvitationsListCall) doRequest(alt string) (*http.Response, error) {
  10474. reqHeaders := make(http.Header)
  10475. for k, v := range c.header_ {
  10476. reqHeaders[k] = v
  10477. }
  10478. reqHeaders.Set("User-Agent", c.s.userAgent())
  10479. if c.ifNoneMatch_ != "" {
  10480. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10481. }
  10482. var body io.Reader = nil
  10483. c.urlParams_.Set("alt", alt)
  10484. c.urlParams_.Set("prettyPrint", "false")
  10485. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations")
  10486. urls += "?" + c.urlParams_.Encode()
  10487. req, err := http.NewRequest("GET", urls, body)
  10488. if err != nil {
  10489. return nil, err
  10490. }
  10491. req.Header = reqHeaders
  10492. googleapi.Expand(req.URL, map[string]string{
  10493. "studentId": c.studentId,
  10494. })
  10495. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10496. }
  10497. // Do executes the "classroom.userProfiles.guardianInvitations.list" call.
  10498. // Exactly one of *ListGuardianInvitationsResponse or error will be
  10499. // non-nil. Any non-2xx status code is an error. Response headers are in
  10500. // either *ListGuardianInvitationsResponse.ServerResponse.Header or (if
  10501. // a response was returned at all) in error.(*googleapi.Error).Header.
  10502. // Use googleapi.IsNotModified to check whether the returned error was
  10503. // because http.StatusNotModified was returned.
  10504. func (c *UserProfilesGuardianInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListGuardianInvitationsResponse, error) {
  10505. gensupport.SetOptions(c.urlParams_, opts...)
  10506. res, err := c.doRequest("json")
  10507. if res != nil && res.StatusCode == http.StatusNotModified {
  10508. if res.Body != nil {
  10509. res.Body.Close()
  10510. }
  10511. return nil, &googleapi.Error{
  10512. Code: res.StatusCode,
  10513. Header: res.Header,
  10514. }
  10515. }
  10516. if err != nil {
  10517. return nil, err
  10518. }
  10519. defer googleapi.CloseBody(res)
  10520. if err := googleapi.CheckResponse(res); err != nil {
  10521. return nil, err
  10522. }
  10523. ret := &ListGuardianInvitationsResponse{
  10524. ServerResponse: googleapi.ServerResponse{
  10525. Header: res.Header,
  10526. HTTPStatusCode: res.StatusCode,
  10527. },
  10528. }
  10529. target := &ret
  10530. if err := gensupport.DecodeResponse(target, res); err != nil {
  10531. return nil, err
  10532. }
  10533. return ret, nil
  10534. // {
  10535. // "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.",
  10536. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations",
  10537. // "httpMethod": "GET",
  10538. // "id": "classroom.userProfiles.guardianInvitations.list",
  10539. // "parameterOrder": [
  10540. // "studentId"
  10541. // ],
  10542. // "parameters": {
  10543. // "invitedEmailAddress": {
  10544. // "description": "If specified, only results with the specified `invited_email_address`\nwill be returned.",
  10545. // "location": "query",
  10546. // "type": "string"
  10547. // },
  10548. // "pageSize": {
  10549. // "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.",
  10550. // "format": "int32",
  10551. // "location": "query",
  10552. // "type": "integer"
  10553. // },
  10554. // "pageToken": {
  10555. // "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.",
  10556. // "location": "query",
  10557. // "type": "string"
  10558. // },
  10559. // "states": {
  10560. // "description": "If specified, only results with the specified `state` values will be\nreturned. Otherwise, results with a `state` of `PENDING` will be returned.",
  10561. // "enum": [
  10562. // "GUARDIAN_INVITATION_STATE_UNSPECIFIED",
  10563. // "PENDING",
  10564. // "COMPLETE"
  10565. // ],
  10566. // "location": "query",
  10567. // "repeated": true,
  10568. // "type": "string"
  10569. // },
  10570. // "studentId": {
  10571. // "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.",
  10572. // "location": "path",
  10573. // "required": true,
  10574. // "type": "string"
  10575. // }
  10576. // },
  10577. // "path": "v1/userProfiles/{studentId}/guardianInvitations",
  10578. // "response": {
  10579. // "$ref": "ListGuardianInvitationsResponse"
  10580. // },
  10581. // "scopes": [
  10582. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  10583. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  10584. // ]
  10585. // }
  10586. }
  10587. // Pages invokes f for each page of results.
  10588. // A non-nil error returned from f will halt the iteration.
  10589. // The provided context supersedes any context provided to the Context method.
  10590. func (c *UserProfilesGuardianInvitationsListCall) Pages(ctx context.Context, f func(*ListGuardianInvitationsResponse) error) error {
  10591. c.ctx_ = ctx
  10592. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  10593. for {
  10594. x, err := c.Do()
  10595. if err != nil {
  10596. return err
  10597. }
  10598. if err := f(x); err != nil {
  10599. return err
  10600. }
  10601. if x.NextPageToken == "" {
  10602. return nil
  10603. }
  10604. c.PageToken(x.NextPageToken)
  10605. }
  10606. }
  10607. // method id "classroom.userProfiles.guardianInvitations.patch":
  10608. type UserProfilesGuardianInvitationsPatchCall struct {
  10609. s *Service
  10610. studentId string
  10611. invitationId string
  10612. guardianinvitation *GuardianInvitation
  10613. urlParams_ gensupport.URLParams
  10614. ctx_ context.Context
  10615. header_ http.Header
  10616. }
  10617. // Patch: Modifies a guardian invitation.
  10618. //
  10619. // Currently, the only valid modification is to change the `state`
  10620. // from
  10621. // `PENDING` to `COMPLETE`. This has the effect of withdrawing the
  10622. // invitation.
  10623. //
  10624. // This method returns the following error codes:
  10625. //
  10626. // * `PERMISSION_DENIED` if the current user does not have permission
  10627. // to
  10628. // manage guardians, if guardians are not enabled for the domain in
  10629. // question
  10630. // or for other access errors.
  10631. // * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING`
  10632. // state.
  10633. // * `INVALID_ARGUMENT` if the format of the student ID provided
  10634. // cannot be recognized (it is not an email address, nor a `user_id`
  10635. // from
  10636. // this API), or if the passed `GuardianInvitation` has a `state`
  10637. // other than
  10638. // `COMPLETE`, or if it modifies fields other than `state`.
  10639. // * `NOT_FOUND` if the student ID provided is a valid student ID, but
  10640. // Classroom has no record of that student, or if the `id` field does
  10641. // not
  10642. // refer to a guardian invitation known to Classroom.
  10643. func (r *UserProfilesGuardianInvitationsService) Patch(studentId string, invitationId string, guardianinvitation *GuardianInvitation) *UserProfilesGuardianInvitationsPatchCall {
  10644. c := &UserProfilesGuardianInvitationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10645. c.studentId = studentId
  10646. c.invitationId = invitationId
  10647. c.guardianinvitation = guardianinvitation
  10648. return c
  10649. }
  10650. // UpdateMask sets the optional parameter "updateMask": Mask that
  10651. // identifies which fields on the course to update.
  10652. // This field is required to do an update. The update will fail if
  10653. // invalid
  10654. // fields are specified. The following fields are valid:
  10655. //
  10656. // * `state`
  10657. //
  10658. // When set in a query parameter, this field should be specified
  10659. // as
  10660. //
  10661. // `updateMask=<field1>,<field2>,...`
  10662. func (c *UserProfilesGuardianInvitationsPatchCall) UpdateMask(updateMask string) *UserProfilesGuardianInvitationsPatchCall {
  10663. c.urlParams_.Set("updateMask", updateMask)
  10664. return c
  10665. }
  10666. // Fields allows partial responses to be retrieved. See
  10667. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10668. // for more information.
  10669. func (c *UserProfilesGuardianInvitationsPatchCall) Fields(s ...googleapi.Field) *UserProfilesGuardianInvitationsPatchCall {
  10670. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10671. return c
  10672. }
  10673. // Context sets the context to be used in this call's Do method. Any
  10674. // pending HTTP request will be aborted if the provided context is
  10675. // canceled.
  10676. func (c *UserProfilesGuardianInvitationsPatchCall) Context(ctx context.Context) *UserProfilesGuardianInvitationsPatchCall {
  10677. c.ctx_ = ctx
  10678. return c
  10679. }
  10680. // Header returns an http.Header that can be modified by the caller to
  10681. // add HTTP headers to the request.
  10682. func (c *UserProfilesGuardianInvitationsPatchCall) Header() http.Header {
  10683. if c.header_ == nil {
  10684. c.header_ = make(http.Header)
  10685. }
  10686. return c.header_
  10687. }
  10688. func (c *UserProfilesGuardianInvitationsPatchCall) doRequest(alt string) (*http.Response, error) {
  10689. reqHeaders := make(http.Header)
  10690. for k, v := range c.header_ {
  10691. reqHeaders[k] = v
  10692. }
  10693. reqHeaders.Set("User-Agent", c.s.userAgent())
  10694. var body io.Reader = nil
  10695. body, err := googleapi.WithoutDataWrapper.JSONReader(c.guardianinvitation)
  10696. if err != nil {
  10697. return nil, err
  10698. }
  10699. reqHeaders.Set("Content-Type", "application/json")
  10700. c.urlParams_.Set("alt", alt)
  10701. c.urlParams_.Set("prettyPrint", "false")
  10702. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}")
  10703. urls += "?" + c.urlParams_.Encode()
  10704. req, err := http.NewRequest("PATCH", urls, body)
  10705. if err != nil {
  10706. return nil, err
  10707. }
  10708. req.Header = reqHeaders
  10709. googleapi.Expand(req.URL, map[string]string{
  10710. "studentId": c.studentId,
  10711. "invitationId": c.invitationId,
  10712. })
  10713. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10714. }
  10715. // Do executes the "classroom.userProfiles.guardianInvitations.patch" call.
  10716. // Exactly one of *GuardianInvitation or error will be non-nil. Any
  10717. // non-2xx status code is an error. Response headers are in either
  10718. // *GuardianInvitation.ServerResponse.Header or (if a response was
  10719. // returned at all) in error.(*googleapi.Error).Header. Use
  10720. // googleapi.IsNotModified to check whether the returned error was
  10721. // because http.StatusNotModified was returned.
  10722. func (c *UserProfilesGuardianInvitationsPatchCall) Do(opts ...googleapi.CallOption) (*GuardianInvitation, error) {
  10723. gensupport.SetOptions(c.urlParams_, opts...)
  10724. res, err := c.doRequest("json")
  10725. if res != nil && res.StatusCode == http.StatusNotModified {
  10726. if res.Body != nil {
  10727. res.Body.Close()
  10728. }
  10729. return nil, &googleapi.Error{
  10730. Code: res.StatusCode,
  10731. Header: res.Header,
  10732. }
  10733. }
  10734. if err != nil {
  10735. return nil, err
  10736. }
  10737. defer googleapi.CloseBody(res)
  10738. if err := googleapi.CheckResponse(res); err != nil {
  10739. return nil, err
  10740. }
  10741. ret := &GuardianInvitation{
  10742. ServerResponse: googleapi.ServerResponse{
  10743. Header: res.Header,
  10744. HTTPStatusCode: res.StatusCode,
  10745. },
  10746. }
  10747. target := &ret
  10748. if err := gensupport.DecodeResponse(target, res); err != nil {
  10749. return nil, err
  10750. }
  10751. return ret, nil
  10752. // {
  10753. // "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.",
  10754. // "flatPath": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10755. // "httpMethod": "PATCH",
  10756. // "id": "classroom.userProfiles.guardianInvitations.patch",
  10757. // "parameterOrder": [
  10758. // "studentId",
  10759. // "invitationId"
  10760. // ],
  10761. // "parameters": {
  10762. // "invitationId": {
  10763. // "description": "The `id` field of the `GuardianInvitation` to be modified.",
  10764. // "location": "path",
  10765. // "required": true,
  10766. // "type": "string"
  10767. // },
  10768. // "studentId": {
  10769. // "description": "The ID of the student whose guardian invitation is to be modified.",
  10770. // "location": "path",
  10771. // "required": true,
  10772. // "type": "string"
  10773. // },
  10774. // "updateMask": {
  10775. // "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,...`",
  10776. // "format": "google-fieldmask",
  10777. // "location": "query",
  10778. // "type": "string"
  10779. // }
  10780. // },
  10781. // "path": "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}",
  10782. // "request": {
  10783. // "$ref": "GuardianInvitation"
  10784. // },
  10785. // "response": {
  10786. // "$ref": "GuardianInvitation"
  10787. // },
  10788. // "scopes": [
  10789. // "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  10790. // ]
  10791. // }
  10792. }
  10793. // method id "classroom.userProfiles.guardians.delete":
  10794. type UserProfilesGuardiansDeleteCall struct {
  10795. s *Service
  10796. studentId string
  10797. guardianId string
  10798. urlParams_ gensupport.URLParams
  10799. ctx_ context.Context
  10800. header_ http.Header
  10801. }
  10802. // Delete: Deletes a guardian.
  10803. //
  10804. // The guardian will no longer receive guardian notifications and the
  10805. // guardian
  10806. // will no longer be accessible via the API.
  10807. //
  10808. // This method returns the following error codes:
  10809. //
  10810. // * `PERMISSION_DENIED` if no user that matches the provided
  10811. // `student_id`
  10812. // is visible to the requesting user, if the requesting user is not
  10813. // permitted to manage guardians for the student identified by the
  10814. // `student_id`, if guardians are not enabled for the domain in
  10815. // question,
  10816. // or for other access errors.
  10817. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10818. // cannot
  10819. // be recognized (it is not an email address, nor a `student_id` from
  10820. // the
  10821. // API).
  10822. // * `NOT_FOUND` if the requesting user is permitted to modify guardians
  10823. // for
  10824. // the requested `student_id`, but no `Guardian` record exists for
  10825. // that
  10826. // student with the provided `guardian_id`.
  10827. func (r *UserProfilesGuardiansService) Delete(studentId string, guardianId string) *UserProfilesGuardiansDeleteCall {
  10828. c := &UserProfilesGuardiansDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10829. c.studentId = studentId
  10830. c.guardianId = guardianId
  10831. return c
  10832. }
  10833. // Fields allows partial responses to be retrieved. See
  10834. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10835. // for more information.
  10836. func (c *UserProfilesGuardiansDeleteCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansDeleteCall {
  10837. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10838. return c
  10839. }
  10840. // Context sets the context to be used in this call's Do method. Any
  10841. // pending HTTP request will be aborted if the provided context is
  10842. // canceled.
  10843. func (c *UserProfilesGuardiansDeleteCall) Context(ctx context.Context) *UserProfilesGuardiansDeleteCall {
  10844. c.ctx_ = ctx
  10845. return c
  10846. }
  10847. // Header returns an http.Header that can be modified by the caller to
  10848. // add HTTP headers to the request.
  10849. func (c *UserProfilesGuardiansDeleteCall) Header() http.Header {
  10850. if c.header_ == nil {
  10851. c.header_ = make(http.Header)
  10852. }
  10853. return c.header_
  10854. }
  10855. func (c *UserProfilesGuardiansDeleteCall) doRequest(alt string) (*http.Response, error) {
  10856. reqHeaders := make(http.Header)
  10857. for k, v := range c.header_ {
  10858. reqHeaders[k] = v
  10859. }
  10860. reqHeaders.Set("User-Agent", c.s.userAgent())
  10861. var body io.Reader = nil
  10862. c.urlParams_.Set("alt", alt)
  10863. c.urlParams_.Set("prettyPrint", "false")
  10864. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}")
  10865. urls += "?" + c.urlParams_.Encode()
  10866. req, err := http.NewRequest("DELETE", urls, body)
  10867. if err != nil {
  10868. return nil, err
  10869. }
  10870. req.Header = reqHeaders
  10871. googleapi.Expand(req.URL, map[string]string{
  10872. "studentId": c.studentId,
  10873. "guardianId": c.guardianId,
  10874. })
  10875. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10876. }
  10877. // Do executes the "classroom.userProfiles.guardians.delete" call.
  10878. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  10879. // code is an error. Response headers are in either
  10880. // *Empty.ServerResponse.Header or (if a response was returned at all)
  10881. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10882. // check whether the returned error was because http.StatusNotModified
  10883. // was returned.
  10884. func (c *UserProfilesGuardiansDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  10885. gensupport.SetOptions(c.urlParams_, opts...)
  10886. res, err := c.doRequest("json")
  10887. if res != nil && res.StatusCode == http.StatusNotModified {
  10888. if res.Body != nil {
  10889. res.Body.Close()
  10890. }
  10891. return nil, &googleapi.Error{
  10892. Code: res.StatusCode,
  10893. Header: res.Header,
  10894. }
  10895. }
  10896. if err != nil {
  10897. return nil, err
  10898. }
  10899. defer googleapi.CloseBody(res)
  10900. if err := googleapi.CheckResponse(res); err != nil {
  10901. return nil, err
  10902. }
  10903. ret := &Empty{
  10904. ServerResponse: googleapi.ServerResponse{
  10905. Header: res.Header,
  10906. HTTPStatusCode: res.StatusCode,
  10907. },
  10908. }
  10909. target := &ret
  10910. if err := gensupport.DecodeResponse(target, res); err != nil {
  10911. return nil, err
  10912. }
  10913. return ret, nil
  10914. // {
  10915. // "description": "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`.",
  10916. // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  10917. // "httpMethod": "DELETE",
  10918. // "id": "classroom.userProfiles.guardians.delete",
  10919. // "parameterOrder": [
  10920. // "studentId",
  10921. // "guardianId"
  10922. // ],
  10923. // "parameters": {
  10924. // "guardianId": {
  10925. // "description": "The `id` field from a `Guardian`.",
  10926. // "location": "path",
  10927. // "required": true,
  10928. // "type": "string"
  10929. // },
  10930. // "studentId": {
  10931. // "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",
  10932. // "location": "path",
  10933. // "required": true,
  10934. // "type": "string"
  10935. // }
  10936. // },
  10937. // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  10938. // "response": {
  10939. // "$ref": "Empty"
  10940. // },
  10941. // "scopes": [
  10942. // "https://www.googleapis.com/auth/classroom.guardianlinks.students"
  10943. // ]
  10944. // }
  10945. }
  10946. // method id "classroom.userProfiles.guardians.get":
  10947. type UserProfilesGuardiansGetCall struct {
  10948. s *Service
  10949. studentId string
  10950. guardianId string
  10951. urlParams_ gensupport.URLParams
  10952. ifNoneMatch_ string
  10953. ctx_ context.Context
  10954. header_ http.Header
  10955. }
  10956. // Get: Returns a specific guardian.
  10957. //
  10958. // This method returns the following error codes:
  10959. //
  10960. // * `PERMISSION_DENIED` if no user that matches the provided
  10961. // `student_id`
  10962. // is visible to the requesting user, if the requesting user is not
  10963. // permitted to view guardian information for the student identified
  10964. // by the
  10965. // `student_id`, if guardians are not enabled for the domain in
  10966. // question,
  10967. // or for other access errors.
  10968. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  10969. // cannot
  10970. // be recognized (it is not an email address, nor a `student_id` from
  10971. // the
  10972. // API, nor the literal string `me`).
  10973. // * `NOT_FOUND` if the requesting user is permitted to view guardians
  10974. // for
  10975. // the requested `student_id`, but no `Guardian` record exists for
  10976. // that
  10977. // student that matches the provided `guardian_id`.
  10978. func (r *UserProfilesGuardiansService) Get(studentId string, guardianId string) *UserProfilesGuardiansGetCall {
  10979. c := &UserProfilesGuardiansGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10980. c.studentId = studentId
  10981. c.guardianId = guardianId
  10982. return c
  10983. }
  10984. // Fields allows partial responses to be retrieved. See
  10985. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10986. // for more information.
  10987. func (c *UserProfilesGuardiansGetCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansGetCall {
  10988. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10989. return c
  10990. }
  10991. // IfNoneMatch sets the optional parameter which makes the operation
  10992. // fail if the object's ETag matches the given value. This is useful for
  10993. // getting updates only after the object has changed since the last
  10994. // request. Use googleapi.IsNotModified to check whether the response
  10995. // error from Do is the result of In-None-Match.
  10996. func (c *UserProfilesGuardiansGetCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansGetCall {
  10997. c.ifNoneMatch_ = entityTag
  10998. return c
  10999. }
  11000. // Context sets the context to be used in this call's Do method. Any
  11001. // pending HTTP request will be aborted if the provided context is
  11002. // canceled.
  11003. func (c *UserProfilesGuardiansGetCall) Context(ctx context.Context) *UserProfilesGuardiansGetCall {
  11004. c.ctx_ = ctx
  11005. return c
  11006. }
  11007. // Header returns an http.Header that can be modified by the caller to
  11008. // add HTTP headers to the request.
  11009. func (c *UserProfilesGuardiansGetCall) Header() http.Header {
  11010. if c.header_ == nil {
  11011. c.header_ = make(http.Header)
  11012. }
  11013. return c.header_
  11014. }
  11015. func (c *UserProfilesGuardiansGetCall) doRequest(alt string) (*http.Response, error) {
  11016. reqHeaders := make(http.Header)
  11017. for k, v := range c.header_ {
  11018. reqHeaders[k] = v
  11019. }
  11020. reqHeaders.Set("User-Agent", c.s.userAgent())
  11021. if c.ifNoneMatch_ != "" {
  11022. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11023. }
  11024. var body io.Reader = nil
  11025. c.urlParams_.Set("alt", alt)
  11026. c.urlParams_.Set("prettyPrint", "false")
  11027. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians/{guardianId}")
  11028. urls += "?" + c.urlParams_.Encode()
  11029. req, err := http.NewRequest("GET", urls, body)
  11030. if err != nil {
  11031. return nil, err
  11032. }
  11033. req.Header = reqHeaders
  11034. googleapi.Expand(req.URL, map[string]string{
  11035. "studentId": c.studentId,
  11036. "guardianId": c.guardianId,
  11037. })
  11038. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11039. }
  11040. // Do executes the "classroom.userProfiles.guardians.get" call.
  11041. // Exactly one of *Guardian or error will be non-nil. Any non-2xx status
  11042. // code is an error. Response headers are in either
  11043. // *Guardian.ServerResponse.Header or (if a response was returned at
  11044. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11045. // to check whether the returned error was because
  11046. // http.StatusNotModified was returned.
  11047. func (c *UserProfilesGuardiansGetCall) Do(opts ...googleapi.CallOption) (*Guardian, error) {
  11048. gensupport.SetOptions(c.urlParams_, opts...)
  11049. res, err := c.doRequest("json")
  11050. if res != nil && res.StatusCode == http.StatusNotModified {
  11051. if res.Body != nil {
  11052. res.Body.Close()
  11053. }
  11054. return nil, &googleapi.Error{
  11055. Code: res.StatusCode,
  11056. Header: res.Header,
  11057. }
  11058. }
  11059. if err != nil {
  11060. return nil, err
  11061. }
  11062. defer googleapi.CloseBody(res)
  11063. if err := googleapi.CheckResponse(res); err != nil {
  11064. return nil, err
  11065. }
  11066. ret := &Guardian{
  11067. ServerResponse: googleapi.ServerResponse{
  11068. Header: res.Header,
  11069. HTTPStatusCode: res.StatusCode,
  11070. },
  11071. }
  11072. target := &ret
  11073. if err := gensupport.DecodeResponse(target, res); err != nil {
  11074. return nil, err
  11075. }
  11076. return ret, nil
  11077. // {
  11078. // "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`.",
  11079. // "flatPath": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  11080. // "httpMethod": "GET",
  11081. // "id": "classroom.userProfiles.guardians.get",
  11082. // "parameterOrder": [
  11083. // "studentId",
  11084. // "guardianId"
  11085. // ],
  11086. // "parameters": {
  11087. // "guardianId": {
  11088. // "description": "The `id` field from a `Guardian`.",
  11089. // "location": "path",
  11090. // "required": true,
  11091. // "type": "string"
  11092. // },
  11093. // "studentId": {
  11094. // "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",
  11095. // "location": "path",
  11096. // "required": true,
  11097. // "type": "string"
  11098. // }
  11099. // },
  11100. // "path": "v1/userProfiles/{studentId}/guardians/{guardianId}",
  11101. // "response": {
  11102. // "$ref": "Guardian"
  11103. // },
  11104. // "scopes": [
  11105. // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly",
  11106. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  11107. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  11108. // ]
  11109. // }
  11110. }
  11111. // method id "classroom.userProfiles.guardians.list":
  11112. type UserProfilesGuardiansListCall struct {
  11113. s *Service
  11114. studentId string
  11115. urlParams_ gensupport.URLParams
  11116. ifNoneMatch_ string
  11117. ctx_ context.Context
  11118. header_ http.Header
  11119. }
  11120. // List: Returns a list of guardians that the requesting user is
  11121. // permitted to
  11122. // view, restricted to those that match the request.
  11123. //
  11124. // To list guardians for any student that the requesting user may
  11125. // view
  11126. // guardians for, use the literal character `-` for the student
  11127. // ID.
  11128. //
  11129. // This method returns the following error codes:
  11130. //
  11131. // * `PERMISSION_DENIED` if a `student_id` is specified, and the
  11132. // requesting
  11133. // user is not permitted to view guardian information for that
  11134. // student, if
  11135. // "-" is specified as the `student_id` and the user is not a
  11136. // domain
  11137. // administrator, if guardians are not enabled for the domain in
  11138. // question,
  11139. // if the `invited_email_address` filter is set by a user who is not
  11140. // a
  11141. // domain administrator, or for other access errors.
  11142. // * `INVALID_ARGUMENT` if a `student_id` is specified, but its format
  11143. // cannot
  11144. // be recognized (it is not an email address, nor a `student_id` from
  11145. // the
  11146. // API, nor the literal string `me`). May also be returned if an
  11147. // invalid
  11148. // `page_token` is provided.
  11149. // * `NOT_FOUND` if a `student_id` is specified, and its format can be
  11150. // recognized, but Classroom has no record of that student.
  11151. func (r *UserProfilesGuardiansService) List(studentId string) *UserProfilesGuardiansListCall {
  11152. c := &UserProfilesGuardiansListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11153. c.studentId = studentId
  11154. return c
  11155. }
  11156. // InvitedEmailAddress sets the optional parameter
  11157. // "invitedEmailAddress": Filter results by the email address that the
  11158. // original invitation was sent
  11159. // to, resulting in this guardian link.
  11160. // This filter can only be used by domain administrators.
  11161. func (c *UserProfilesGuardiansListCall) InvitedEmailAddress(invitedEmailAddress string) *UserProfilesGuardiansListCall {
  11162. c.urlParams_.Set("invitedEmailAddress", invitedEmailAddress)
  11163. return c
  11164. }
  11165. // PageSize sets the optional parameter "pageSize": Maximum number of
  11166. // items to return. Zero or unspecified indicates that the
  11167. // server may assign a maximum.
  11168. //
  11169. // The server may return fewer than the specified number of results.
  11170. func (c *UserProfilesGuardiansListCall) PageSize(pageSize int64) *UserProfilesGuardiansListCall {
  11171. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  11172. return c
  11173. }
  11174. // PageToken sets the optional parameter "pageToken":
  11175. // nextPageToken
  11176. // value returned from a previous
  11177. // list call,
  11178. // indicating that the subsequent page of results should be
  11179. // returned.
  11180. //
  11181. // The list request
  11182. // must be otherwise identical to the one that resulted in this token.
  11183. func (c *UserProfilesGuardiansListCall) PageToken(pageToken string) *UserProfilesGuardiansListCall {
  11184. c.urlParams_.Set("pageToken", pageToken)
  11185. return c
  11186. }
  11187. // Fields allows partial responses to be retrieved. See
  11188. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11189. // for more information.
  11190. func (c *UserProfilesGuardiansListCall) Fields(s ...googleapi.Field) *UserProfilesGuardiansListCall {
  11191. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11192. return c
  11193. }
  11194. // IfNoneMatch sets the optional parameter which makes the operation
  11195. // fail if the object's ETag matches the given value. This is useful for
  11196. // getting updates only after the object has changed since the last
  11197. // request. Use googleapi.IsNotModified to check whether the response
  11198. // error from Do is the result of In-None-Match.
  11199. func (c *UserProfilesGuardiansListCall) IfNoneMatch(entityTag string) *UserProfilesGuardiansListCall {
  11200. c.ifNoneMatch_ = entityTag
  11201. return c
  11202. }
  11203. // Context sets the context to be used in this call's Do method. Any
  11204. // pending HTTP request will be aborted if the provided context is
  11205. // canceled.
  11206. func (c *UserProfilesGuardiansListCall) Context(ctx context.Context) *UserProfilesGuardiansListCall {
  11207. c.ctx_ = ctx
  11208. return c
  11209. }
  11210. // Header returns an http.Header that can be modified by the caller to
  11211. // add HTTP headers to the request.
  11212. func (c *UserProfilesGuardiansListCall) Header() http.Header {
  11213. if c.header_ == nil {
  11214. c.header_ = make(http.Header)
  11215. }
  11216. return c.header_
  11217. }
  11218. func (c *UserProfilesGuardiansListCall) doRequest(alt string) (*http.Response, error) {
  11219. reqHeaders := make(http.Header)
  11220. for k, v := range c.header_ {
  11221. reqHeaders[k] = v
  11222. }
  11223. reqHeaders.Set("User-Agent", c.s.userAgent())
  11224. if c.ifNoneMatch_ != "" {
  11225. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11226. }
  11227. var body io.Reader = nil
  11228. c.urlParams_.Set("alt", alt)
  11229. c.urlParams_.Set("prettyPrint", "false")
  11230. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/userProfiles/{studentId}/guardians")
  11231. urls += "?" + c.urlParams_.Encode()
  11232. req, err := http.NewRequest("GET", urls, body)
  11233. if err != nil {
  11234. return nil, err
  11235. }
  11236. req.Header = reqHeaders
  11237. googleapi.Expand(req.URL, map[string]string{
  11238. "studentId": c.studentId,
  11239. })
  11240. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11241. }
  11242. // Do executes the "classroom.userProfiles.guardians.list" call.
  11243. // Exactly one of *ListGuardiansResponse or error will be non-nil. Any
  11244. // non-2xx status code is an error. Response headers are in either
  11245. // *ListGuardiansResponse.ServerResponse.Header or (if a response was
  11246. // returned at all) in error.(*googleapi.Error).Header. Use
  11247. // googleapi.IsNotModified to check whether the returned error was
  11248. // because http.StatusNotModified was returned.
  11249. func (c *UserProfilesGuardiansListCall) Do(opts ...googleapi.CallOption) (*ListGuardiansResponse, error) {
  11250. gensupport.SetOptions(c.urlParams_, opts...)
  11251. res, err := c.doRequest("json")
  11252. if res != nil && res.StatusCode == http.StatusNotModified {
  11253. if res.Body != nil {
  11254. res.Body.Close()
  11255. }
  11256. return nil, &googleapi.Error{
  11257. Code: res.StatusCode,
  11258. Header: res.Header,
  11259. }
  11260. }
  11261. if err != nil {
  11262. return nil, err
  11263. }
  11264. defer googleapi.CloseBody(res)
  11265. if err := googleapi.CheckResponse(res); err != nil {
  11266. return nil, err
  11267. }
  11268. ret := &ListGuardiansResponse{
  11269. ServerResponse: googleapi.ServerResponse{
  11270. Header: res.Header,
  11271. HTTPStatusCode: res.StatusCode,
  11272. },
  11273. }
  11274. target := &ret
  11275. if err := gensupport.DecodeResponse(target, res); err != nil {
  11276. return nil, err
  11277. }
  11278. return ret, nil
  11279. // {
  11280. // "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.",
  11281. // "flatPath": "v1/userProfiles/{studentId}/guardians",
  11282. // "httpMethod": "GET",
  11283. // "id": "classroom.userProfiles.guardians.list",
  11284. // "parameterOrder": [
  11285. // "studentId"
  11286. // ],
  11287. // "parameters": {
  11288. // "invitedEmailAddress": {
  11289. // "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.",
  11290. // "location": "query",
  11291. // "type": "string"
  11292. // },
  11293. // "pageSize": {
  11294. // "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.",
  11295. // "format": "int32",
  11296. // "location": "query",
  11297. // "type": "integer"
  11298. // },
  11299. // "pageToken": {
  11300. // "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.",
  11301. // "location": "query",
  11302. // "type": "string"
  11303. // },
  11304. // "studentId": {
  11305. // "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.",
  11306. // "location": "path",
  11307. // "required": true,
  11308. // "type": "string"
  11309. // }
  11310. // },
  11311. // "path": "v1/userProfiles/{studentId}/guardians",
  11312. // "response": {
  11313. // "$ref": "ListGuardiansResponse"
  11314. // },
  11315. // "scopes": [
  11316. // "https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly",
  11317. // "https://www.googleapis.com/auth/classroom.guardianlinks.students",
  11318. // "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly"
  11319. // ]
  11320. // }
  11321. }
  11322. // Pages invokes f for each page of results.
  11323. // A non-nil error returned from f will halt the iteration.
  11324. // The provided context supersedes any context provided to the Context method.
  11325. func (c *UserProfilesGuardiansListCall) Pages(ctx context.Context, f func(*ListGuardiansResponse) error) error {
  11326. c.ctx_ = ctx
  11327. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11328. for {
  11329. x, err := c.Do()
  11330. if err != nil {
  11331. return err
  11332. }
  11333. if err := f(x); err != nil {
  11334. return err
  11335. }
  11336. if x.NextPageToken == "" {
  11337. return nil
  11338. }
  11339. c.PageToken(x.NextPageToken)
  11340. }
  11341. }