Skip to content

feat: Add some GitHub Classroom API endpoints - #3690

Merged
gmlewis merged 12 commits into
google:masterfrom
jferrl:jferrl-jferrl-3684
Sep 23, 2025
Merged

feat: Add some GitHub Classroom API endpoints#3690
gmlewis merged 12 commits into
google:masterfrom
jferrl:jferrl-jferrl-3684

Conversation

@jferrl

@jferrljferrl commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR implements some GitHub Classroom API endpoints support by adding three new methods to the ClassroomService and fixes a deprecation warning in the addOptions function.

Changes Made

✨ New Features

1. GetClassroom Method

  • Purpose: Retrieves a specific GitHub Classroom by ID for administrators
  • API Endpoint: GET /classrooms/{classroom_id}

2. ListClassrooms Method

  • Purpose: Lists all GitHub Classrooms for the current user
  • API Endpoint: GET /classrooms

3. ListClassroomAssignments Method

  • Purpose: Lists all assignments for a specific GitHub Classroom
  • API Endpoint: GET /classrooms/{classroom_id}/assignments

Refactor

4. Reflect.Ptr Deprecation Fix

  • Issue: Updated addOptions function to use reflect.Pointer instead of deprecated reflect.Ptr
  • Change: Replaced reflect.Ptr with reflect.Pointer in github/github.go
  • Benefit: Ensures compatibility with newer Go versions and removes deprecation warnings

Issue: #3684

Implements the GetClassroom method to retrieve a GitHub Classroom by ID if the user is an administrator. Adds corresponding unit tests to verify correct API interaction and response handling.
Updated the addOptions function to use reflect.Pointer instead of the deprecated reflect.Ptr for checking pointer kinds. This change ensures compatibility with newer Go versions.
Implements the ListClassrooms method to retrieve classrooms for the current user via the GitHub API. Adds corresponding tests to verify correct API interaction and response parsing.
Implements the ListClassroomAssignments method to fetch assignments for a classroom via the GitHub API. Includes comprehensive tests for the new method, covering normal operation and error handling.
@gmlewis

gmlewis commented Aug 18, 2025

Copy link
Copy Markdown
Collaborator

@jferri - just FYI - I lost write access to this repo and this may cause unexpected delays for which I apologize.
You can watch that other PR to check on the status.

@jferrl

Copy link
Copy Markdown
ContributorAuthor

@jferri - just FYI - I lost write access to this repo and this may cause unexpected delays for which I apologize. You can watch that other PR to check on the status.

No worries! 😃

jferrland others added 3 commits August 19, 2025 10:04
Updated the usage of reflect.Ptr to reflect.Pointer in the stringifyValue function to align with the latest Go reflect package conventions.
Replaces usage of http.MethodGet with the string literal "GET" in both the ClassroomService methods and their corresponding tests. Also removes the unused net/http import.
@codecov

codecovBot commented Sep 22, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.11%. Comparing base (ffc5df8) to head (863baf5).
⚠️ Report is 1 commits behind head on master.

Files with missing linesPatch %Lines
github/classroom.go86.66%4 Missing and 2 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## master #3690 +/- ##
==========================================
- Coverage 91.12% 91.11% -0.02% 
==========================================
Files 187 187 Lines 16640 16684 +44 ==========================================
+ Hits 15164 15202 +38 - Misses 1291 1295 +4 - Partials 185 187 +2 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jferrl!
Just a few tweaks, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.

@stevehipwell and/or @alexandear - might you have time for a code review? Thank you!

Comment threadgithub/classroom.go Outdated
Comment threadgithub/classroom.go Outdated
Comment threadgithub/classroom_test.go Outdated
@gmlewisgmlewis added the NeedsReview PR is awaiting a review before merging. label Sep 22, 2025
Revised comments in classroom.go to clarify method descriptions and improve wording for GetClassroom and ListClassrooms functions.
Replaces GitHub and GitHub Classroom URLs with example.com in classroom and assignment test cases for consistency and to avoid referencing real endpoints.
@jferrl
jferrl requested a review from gmlewisSeptember 23, 2025 07:12
@jferrl

Copy link
Copy Markdown
ContributorAuthor

Thank you, @jferrl! Just a few tweaks, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.

@stevehipwell and/or @alexandear - might you have time for a code review? Thank you!

@gmlewis changes done! 😃

@stevehipwellstevehipwell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Sep 23, 2025
Comment threadgithub/classroom_test.go
Comment threadgithub/classroom_test.go
Introduces test cases for invalid input options in GetAssignment, GetClassroom, ListClassrooms, and ListClassroomAssignments methods to improve error handling coverage.
@jferrl
jferrl requested a review from gmlewisSeptember 23, 2025 13:28

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jferrl and @stevehipwell!
LGTM.
Merging.

@gmlewis

Copy link
Copy Markdown
Collaborator

Fixes: #3684.

@gmlewis
gmlewis merged commit 7e700a7 into google:masterSep 23, 2025
5 of 7 checks passed
@jferrl
jferrl deleted the jferrl-jferrl-3684 branch September 24, 2025 07:59
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jferrl@gmlewis@stevehipwell