/// <summary>
        /// Deletes a guardian. The guardian will no longer receive guardian notifications and the guardian will no longer be accessible via the API. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to manage guardians for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API). * `NOT_FOUND` if Classroom cannot find any record of the given `student_id` or `guardian_id`, or if the guardian has already been disabled.
        /// Documentation https://developers.google.com/classroom/v1/reference/guardians/delete
        /// 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 student whose guardian is to be deleted. One of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user</param>
        /// <param name="guardianId">The `id` field from a `Guardian`.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Delete(classroomService service, string studentId, string guardianId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (studentId == null)
                {
                    throw new ArgumentNullException(studentId);
                }
                if (guardianId == null)
                {
                    throw new ArgumentNullException(guardianId);
                }

                // Make the request.
                return(service.Guardians.Delete(studentId, guardianId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Guardians.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Returns a list of guardians that the requesting user is permitted to view, restricted to those that match the request. To list guardians for any student that the requesting user may view guardians for, use the literal character `-` for the student ID. This method returns the following error codes: * `PERMISSION_DENIED` if a `student_id` is specified, and the requesting user is not permitted to view guardian information for that student, if `"-"` is specified as the `student_id` and the user is not a domain administrator, if guardians are not enabled for the domain in question, if the `invited_email_address` filter is set by a user who is not a domain administrator, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). May also be returned if an invalid `page_token` is provided. * `NOT_FOUND` if a `student_id` is specified, and its format can be recognized, but Classroom has no record of that student.
        /// Documentation https://developers.google.com/classroom/v1/reference/guardians/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="studentId">Filter results by the student who the guardian is linked to. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user * the string literal `"-"`, indicating that results should be returned for all students that the requesting user has access to view.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListGuardiansResponseResponse</returns>
        public static ListGuardiansResponse List(classroomService service, string studentId, GuardiansListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (studentId == null)
                {
                    throw new ArgumentNullException(studentId);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Guardians.List failed.", ex);
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a guardian invitation, and sends an email to the guardian asking them to confirm that they are the student's guardian. Once the guardian accepts the invitation, their `state` will change to `COMPLETED` and they will start receiving guardian notifications. A `Guardian` resource will also be created to represent the active guardian. The request object must have the `student_id` and `invited_email_address` fields set. Failing to set these fields, or setting any other fields in the request, will result in an error. This method returns the following error codes: * `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if the guardian in question has already rejected too many requests for that student, if guardians are not enabled for the domain in question, or for other access errors. * `RESOURCE_EXHAUSTED` if the student or guardian has exceeded the guardian link limit. * `INVALID_ARGUMENT` if the guardian email address is not valid (for example, if it is too long), or if the format of the student ID provided cannot be recognized (it is not an email address, nor a `user_id` from this API). This error will also be returned if read-only fields are set, or if the `state` field is set to to a value other than `PENDING`. * `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student. * `ALREADY_EXISTS` if there is already a pending guardian invitation for the student and `invited_email_address` provided, or if the provided `invited_email_address` matches the Google account of an existing `Guardian` for this user.
        /// Documentation https://developers.google.com/classroom/v1/reference/guardianInvitations/create
        /// 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">ID of the student (in standard format)</param>
        /// <param name="body">A valid classroom v1 body.</param>
        /// <returns>GuardianInvitationResponse</returns>
        public static GuardianInvitation Create(classroomService service, string studentId, GuardianInvitation body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (studentId == null)
                {
                    throw new ArgumentNullException(studentId);
                }

                // Make the request.
                return(service.GuardianInvitations.Create(body, studentId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request GuardianInvitations.Create failed.", ex);
            }
        }
예제 #4
0
        /// <summary>
        /// Returns a student submission. * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, course work, or student submission or for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the requested course, course work, or student submission does not exist.
        /// Documentation https://developers.google.com/classroom/v1/reference/studentSubmissions/get
        /// 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>
        /// <returns>StudentSubmissionResponse</returns>
        public static StudentSubmission Get(classroomService service, string courseId, string courseWorkId, string id)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (courseId == null)
                {
                    throw new ArgumentNullException(courseId);
                }
                if (courseWorkId == null)
                {
                    throw new ArgumentNullException(courseWorkId);
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.StudentSubmissions.Get(courseId, courseWorkId, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request StudentSubmissions.Get failed.", ex);
            }
        }
예제 #5
0
        /// <summary>
        /// Returns a specific guardian invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view guardian invitations for the student identified by the `student_id`, if guardians are not enabled for the domain in question, or for other access errors. * `INVALID_ARGUMENT` if a `student_id` is specified, but its format cannot be recognized (it is not an email address, nor a `student_id` from the API, nor the literal string `me`). * `NOT_FOUND` if Classroom cannot find any record of the given student or `invitation_id`. May also be returned if the student exists, but the requesting user does not have access to see that student.
        /// Documentation https://developers.google.com/classroom/v1/reference/guardianInvitations/get
        /// 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 being requested.</param>
        /// <param name="invitationId">The `id` field of the `GuardianInvitation` being requested.</param>
        /// <returns>GuardianInvitationResponse</returns>
        public static GuardianInvitation Get(classroomService service, string studentId, string invitationId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (studentId == null)
                {
                    throw new ArgumentNullException(studentId);
                }
                if (invitationId == null)
                {
                    throw new ArgumentNullException(invitationId);
                }

                // Make the request.
                return(service.GuardianInvitations.Get(studentId, invitationId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request GuardianInvitations.Get failed.", ex);
            }
        }
예제 #6
0
        /// <summary>
        /// Adds a user as a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create students in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a student or teacher in the course.
        /// Documentation https://developers.google.com/classroom/v1/reference/students/create
        /// 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 to create the student in. This identifier can be either the Classroom-assigned identifier or an alias.</param>
        /// <param name="body">A valid classroom v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>StudentResponse</returns>
        public static Student Create(classroomService service, string courseId, Student body, StudentsCreateOptionalParms 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);
                }

                // Building the initial request.
                var request = service.Students.Create(body, courseId);

                // Applying optional parameters to the request.
                request = (StudentsResource.CreateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Students.Create failed.", ex);
            }
        }
예제 #7
0
        /// <summary>
        /// Deletes a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist.
        /// Documentation https://developers.google.com/classroom/v1/reference/students/delete
        /// 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="userId">Identifier of the student to delete. The identifier can be one of the following: * the numeric identifier for the user * the email address of the user * the string literal `"me"`, indicating the requesting user</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Delete(classroomService service, string courseId, string userId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (courseId == null)
                {
                    throw new ArgumentNullException(courseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.Students.Delete(courseId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Students.Delete failed.", ex);
            }
        }
예제 #8
0
        /// <summary>
        /// Creates a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create teachers in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a teacher or student in the course.
        /// Documentation https://developers.google.com/classroom/v1/reference/teachers/create
        /// 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="body">A valid classroom v1 body.</param>
        /// <returns>TeacherResponse</returns>
        public static Teacher Create(classroomService service, string courseId, Teacher body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (courseId == null)
                {
                    throw new ArgumentNullException(courseId);
                }

                // Make the request.
                return(service.Teachers.Create(body, courseId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Teachers.Create failed.", ex);
            }
        }
        /// <summary>
        /// Accepts an invitation, removing it and adding the invited user to the teachers or students (as appropriate) of the specified course. Only the invited user may accept an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to accept the requested invitation or for access errors. * `FAILED_PRECONDITION` for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `NOT_FOUND` if no invitation exists with the requested ID.
        /// Documentation https://developers.google.com/classroom/v1/reference/invitations/accept
        /// 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="id">Identifier of the invitation to accept.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Accept(classroomService service, string id)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Invitations.Accept(id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Invitations.Accept failed.", ex);
            }
        }