Skip to content

Start consolodating Github REST API URLs into a central place#301

Draft
MoralCode wants to merge 6 commits into
mainfrom
ntdn/consolodate_github_rest_urls1
Draft

Start consolodating Github REST API URLs into a central place#301
MoralCode wants to merge 6 commits into
mainfrom
ntdn/consolodate_github_rest_urls1

Conversation

@MoralCode
Copy link
Copy Markdown
Contributor

@MoralCode MoralCode commented May 6, 2026

Description
ported from augurlabs/augur#3685 and takes inspiration from other PRs linked within that pr. This is a step towards resolving #110.

This pr:

  • refactors a few commonly reused functions that generate github API URLs (specifically for the issues, contributors, and user endpoints) so that the url building happens within the existing GithubDataAccess class.
  • creates a function that brings the fetching of github user API data into this class as well (a model for future plans for the other endpoints)
  • creates a user_endpoint_urls function that, given a username, can recreate the urls that the github API responds with. This change compliments #3747.
  • creates a currently-unused general-purpose function to generate URLs for querying Github's search API, removing the need to manually assemble the URL in an API-compliant way from clients that use it. clients just provide the query string as it would be typed into githubs search box. This change also enabled some current legacy facade code for doing these searches to be replaced with this general-purpose implementation.

Notes for Reviewers
Was tested under the prior repo and collection appears to run smoothly with this PR on my local dev instance, indicating this change doesn't cause breakage.

This depends on #306 merging first and Needs retesting due to the fork, so it is a draft

Signed commits

  • Yes, I signed my commits.

MoralCode added 6 commits May 18, 2026 14:52
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
@MoralCode MoralCode force-pushed the ntdn/consolodate_github_rest_urls1 branch from e973213 to 041dc80 Compare May 18, 2026 18:52
github_data_access = GithubDataAccess(key_auth, logger)

# Set the base of the url and place to hold contributors to insert
contributors_url = github_data_access.endpoint_url(f"repos/{owner}/{repo}/contributors", {"state": "all"})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
E0602: Undefined variable 'repo' (undefined-variable)

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.

1 participant