Skip to content

Conversation

JoannaaKL
Copy link
Contributor

First chunk to support new GitHub Projects API

@alexandear
Copy link
Contributor

This PR won't be merged soon because the only one maintainer, @gmlewis, has lost access to the repo. See #3689 (comment)

So, let's wait when @google-admin grants access, and then proceed with adding the feature.

@JoannaaKL JoannaaKL marked this pull request as ready for review September 17, 2025 16:10
Copy link
Contributor

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @JoannaaKL!
One tiny tweak, please, and then LGTM.
Could you also please rename the PR from "Add projects" to "Add ProjectsService"?

@gmlewis
Copy link
Contributor

gmlewis commented Sep 18, 2025

Also, please note that I still don't have write access to this repo, but figure I might as well attempt to catch up on my code reviews (which I usually allow the linter to process first... ah, well).

// GitHub API docs: https://docs.github.com/rest/projects/projects#get-project-for-organization
//
//meta:operation GET /orgs/{org}/projectsV2/{project_id}
func (s *ProjectsService) GetByOrg(ctx context.Context, org string, projectID int64) (*ProjectV2, *Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe GetOrganizationProject is a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as below, GetByID is pretty common in this repo. GetOrganizationProject is redundant - this is the ProjectsService so it's logical it returns a Project. We should not repeat that.


func (p ProjectV2) String() string { return Stringify(p) }

// ListProjectsOptions specifies optional parameters to list organization projects.
Copy link
Contributor

Choose a reason for hiding this comment

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

This structure used not only in the list organization project method. So, the comment can be improved.

// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-projects-for-user
//
//meta:operation GET /users/{username}/projectsV2
func (s *ProjectsService) ListByUser(ctx context.Context, username string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe ListUserProjects is a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer longer name myself but I was following the existing convention - ListByUser, ListByIssue etc.

if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeProjectsPreview)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this header?

if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeProjectsPreview)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this header?

if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeProjectsPreview)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this header?

if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeProjectsPreview)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this header?

Co-authored-by: Glenn Lewis <[email protected]>
@JoannaaKL JoannaaKL changed the title Add projects Add ProjectsService Sep 19, 2025
@JoannaaKL
Copy link
Contributor Author

Hey hey @gmlewis 👋 . I renamed the pr, there's one more tiny change I need to do to this pr before it's ready - update the pagination parameters. I hope you get your access back soon!

@gmlewis
Copy link
Contributor

gmlewis commented Sep 19, 2025

Hey hey @gmlewis 👋 . I renamed the pr, there's one more tiny change I need to do to this pr before it's ready - update the pagination parameters. I hope you get your access back soon!

Thank you, @JoannaaKL! Me too!!! ❤️

Sign up for free to 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