Example #1
0
        /// <summary>
        /// Updates one or more fields of a student submission. See google.classroom.v1.StudentSubmission for details of which fields may be updated and who may change them. This request must be made by the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to create the corresponding course work item. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting developer project did not create the corresponding course work, if the user is not permitted to make the requested modification to the student submission, or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.
        /// Documentation https://developers.google.com/classroom/v1/reference/studentSubmissions/patch
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated classroom service.</param>
        /// <param name="courseId">Identifier of the course. This identifier can be either the Classroom-assigned identifier or an alias.</param>
        /// <param name="courseWorkId">Identifier of the course work.</param>
        /// <param name="id">Identifier of the student submission.</param>
        /// <param name="body">A valid classroom v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>StudentSubmissionResponse</returns>
        public static StudentSubmission Patch(classroomService service, string courseId, string courseWorkId, string id, StudentSubmission body, StudentSubmissionsPatchOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (courseId == null)
                {
                    throw new ArgumentNullException(courseId);
                }
                if (courseWorkId == null)
                {
                    throw new ArgumentNullException(courseWorkId);
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Building the initial request.
                var request = service.StudentSubmissions.Patch(body, courseId, courseWorkId, id);

                // Applying optional parameters to the request.
                request = (StudentSubmissionsResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request StudentSubmissions.Patch failed.", ex);
            }
        }
Example #2
0
        /// <summary>
        /// Modifies a guardian invitation. Currently, the only valid modification is to change the `state` from `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if guardians are not enabled for the domain in question or for other access errors. * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. * `INVALID_ARGUMENT` if the format of the student ID provided cannot be recognized (it is not an email address, nor a `user_id` from this API), or if the passed `GuardianInvitation` has a `state` other than `COMPLETE`, or if it modifies fields other than `state`. * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student, or if the `id` field does not refer to a guardian invitation known to Classroom.
        /// Documentation https://developers.google.com/classroom/v1/reference/guardianInvitations/patch
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated classroom service.</param>
        /// <param name="studentId">The ID of the student whose guardian invitation is to be modified.</param>
        /// <param name="invitationId">The `id` field of the `GuardianInvitation` to be modified.</param>
        /// <param name="body">A valid classroom v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>GuardianInvitationResponse</returns>
        public static GuardianInvitation Patch(classroomService service, string studentId, string invitationId, GuardianInvitation body, GuardianInvitationsPatchOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (studentId == null)
                {
                    throw new ArgumentNullException(studentId);
                }
                if (invitationId == null)
                {
                    throw new ArgumentNullException(invitationId);
                }

                // Building the initial request.
                var request = service.GuardianInvitations.Patch(body, studentId, invitationId);

                // Applying optional parameters to the request.
                request = (GuardianInvitationsResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request GuardianInvitations.Patch failed.", ex);
            }
        }
        /// <summary>
        /// Returns a list of invitations that the requesting user is permitted to view, restricted to those that match the list request. *Note:* At least one of `user_id` or `course_id` must be supplied. Both fields can be supplied. This method returns the following error codes: * `PERMISSION_DENIED` for access errors.
        /// Documentation https://developers.google.com/classroom/v1/reference/invitations/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated classroom service.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListInvitationsResponseResponse</returns>
        public static ListInvitationsResponse List(classroomService service, InvitationsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Invitations.List();

                // Applying optional parameters to the request.
                request = (InvitationsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Invitations.List failed.", ex);
            }
        }