Skip to content

feat: Google Classroom support #71

@manascb1344

Description

@manascb1344

Feature Request: Google Classroom Support

Summary

Add comprehensive Google Classroom API support to gogcli, enabling teachers, students, and administrators to manage courses, rosters, assignments, submissions, announcements, topics, invitations, profiles, and guardians from the terminal. This feature supports all account types: Google Workspace for Education, personal Google accounts (with limited functionality), and service accounts with domain-wide delegation.

Motivation

Many educators use Google Workspace for Education and would benefit from a CLI workflow for:

  • Listing and managing courses (including web URL access)
  • Viewing course rosters (students/teachers) with filtering
  • Managing coursework and assignments (assignments + materials)
  • Viewing and grading student submissions
  • Posting and managing announcements
  • Organizing coursework with topics
  • Managing course invitations
  • Viewing user profiles
  • Managing student guardians

API Analysis

REST API

  • Endpoint: https://classroom.googleapis.com/v1
  • Go Client: google.golang.org/api/classroom/v1

OAuth Scopes

Scope Purpose
https://www.googleapis.com/auth/classroom.courses Manage courses
https://www.googleapis.com/auth/classroom.courses.readonly Read courses
https://www.googleapis.com/auth/classroom.rosters Manage students/teachers
https://www.googleapis.com/auth/classroom.rosters.readonly Read roster
https://www.googleapis.com/auth/classroom.coursework.students Manage coursework & submissions
https://www.googleapis.com/auth/classroom.announcements Manage announcements
https://www.googleapis.com/auth/classroom.topics Manage topics
https://www.googleapis.com/auth/classroom.profile.emails Access profile emails
https://www.googleapis.com/auth/classroom.profile.photos Access profile photos

Main Resources

  • courses - Course CRUD with URL generation
  • courses.students - Student roster management
  • courses.teachers - Teacher management
  • courses.courseWork - Assignments and materials
  • courses.courseWork.studentSubmissions - Student submissions and grading
  • courses.announcements - Announcements
  • courses.topics - Topic organization
  • invitations - Course invitations (accept, create, delete)
  • userProfiles - User profile information
  • userProfiles.guardians - Student guardian management

Account Restrictions

  • Workspace for Education: Full functionality
  • Personal Google accounts: Limited (only courses owned/enrolled in), but supported
  • Service accounts: Requires domain-wide delegation in Education domain

Unlike keep and groups which are Workspace-only, Classroom is marked user: true to support personal accounts with limited functionality.

Suggested Commands

Course Management

gog classroom courses                    # List enrolled/owned courses
gog classroom courses --role teacher     # Filter to courses you teach
gog classroom courses --role student     # Filter to courses you're enrolled in
gog classroom courses get <courseId>     # Get course details
gog classroom courses create --name "Math 101" --section "Period 1"
gog classroom courses update <courseId> --name "Math 102"
gog classroom courses url <courseId>     # Print web URL

Roster

gog classroom roster <courseId>                  # List all students & teachers
gog classroom roster <courseId> --students       # Students only
gog classroom roster <courseId> --teachers       # Teachers only
gog classroom roster add <courseId> --email student@school.edu --role student
gog classroom roster remove <courseId> --email student@school.edu --role student

Coursework & Assignments

gog classroom work <courseId>                    # List all coursework
gog classroom work <courseId> --type assignment  # Assignments only
gog classroom work <courseId> --type material    # Materials only
gog classroom work get <courseId> <workId>       # Get assignment details
gog classroom work create <courseId> \
  --title "Homework 1" \
  --description "Chapter 1 exercises" \
  --due "2025-02-01T23:59:00Z" \
  --points 100
gog classroom work update <courseId> <workId> --title "Updated Homework"
gog classroom work delete <courseId> <workId>

Submissions & Grading

gog classroom submissions <courseId> <workId>                    # List submissions
gog classroom submissions <courseId> <workId> --state TURNED_IN  # Filter by state
gog classroom submissions get <courseId> <workId> <subId>        # Get submission details
gog classroom submissions grade <courseId> <workId> <subId> --grade 95
gog classroom submissions grade <courseId> <workId> <subId> --grade 95 --return
gog classroom submissions return <courseId> <workId> <subId>
gog classroom submissions return <courseId> <workId> --all       # Return all

Announcements

gog classroom announcements <courseId>                   # List announcements
gog classroom announcements get <courseId> <annId>       # Get announcement details
gog classroom announcements create <courseId> --text "Welcome to class!"
gog classroom announcements update <courseId> <annId> --text "Updated text"
gog classroom announcements delete <courseId> <annId>

Topics

gog classroom topics <courseId>                          # List topics
gog classroom topics create <courseId> --name "Week 1"
gog classroom topics update <courseId> <topicId> --name "Week 2"
gog classroom topics delete <courseId> <topicId>

Invitations

gog classroom invitations                          # List pending invitations
gog classroom invitations --course <courseId>     # Filter by course
gog classroom invitations accept <invitationId>   # Accept invitation
gog classroom invitations create <courseId> --email student@school.edu --role student
gog classroom invitations delete <invitationId>

Profile

gog classroom profile              # Current user's profile
gog classroom profile <userId>     # Another user's profile

Guardians

gog classroom guardians <studentId>                             # List guardians
gog classroom guardians invite <studentId> --email parent@email.com
gog classroom guardians remove <studentId> <guardianId>

Implementation Notes

  • Service is marked user: true to support both Workspace Education and personal accounts
  • --readonly flag support for read-only scopes during authentication
  • Course aliases (d:domain_alias, p:project_alias) are supported in addition to numeric IDs
  • Web URL command (gog classroom courses url) follows pattern from gog gmail url and gog drive url
  • Follow existing patterns in internal/cmd/, internal/googleapi/, and internal/googleauth/service.go
  • Support for RFC3339 and relative date formats (e.g., "tomorrow", "next monday")
  • All commands support --json and --plain output modes
  • Destructive commands require --force or interactive confirmation

Dependencies

  • Add to go.mod: google.golang.org/api/classroom/v1
  • Enable Classroom API in Google Cloud Console

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions