Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List app installation requests endpoint #2012

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

anujhydrabadi
Copy link
Contributor

@anujhydrabadi anujhydrabadi commented Jan 17, 2025

Description

Adds a new endpoint.
Fixes #2011

Before submitting a PR:

  • Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, CONTRIBUTING.md for details.
  • Add JavaDocs and other comments explaining the behavior.
  • When adding or updating methods that fetch entities, add @link JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .
  • Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See CONTRIBUTING.md for details.
  • Run mvn -D enable-ci clean install site locally. If this command doesn't succeed, your change will not pass CI.
  • Push your changes to a branch other than main. You will create your PR from that branch.

When creating a PR:

  • Fill in the "Description" above with clear summary of the changes. This includes:
    • If this PR fixes one or more issues, include "Fixes #" lines for each issue.
    • Provide links to relevant documentation on https://docs.github.com/en/rest where possible. If not including links, explain why not.
  • All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
  • Enable "Allow edits from maintainers".

/**
* Obtains all the installation requests associated with this app.
* <p>
* You must use a JWT to access this endpoint.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The documentation does not mention that you must use a JWT explicitly for this endpoint, unlike other endpoints in this class, but I am assuming that is just a miss in their documentation.

Copy link
Member

@bitwiseman bitwiseman Jan 18, 2025

Choose a reason for hiding this comment

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

You might add a check that throws an exception or at least logs a warning when not using JWT credentials.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already get this: A JSON web token could not be decoded in the response. We can add a pre-check too if you think it would be useful. We'll have to add it to GitHub.getApp() too, as that one is called before listInstallationRequests(). Also, how would such a check look like? a simple authorization.startsWith("Bearer ") check?

@anujhydrabadi
Copy link
Contributor Author

anujhydrabadi commented Jan 17, 2025

Couple of things

  • I have used my personal orgs, users and apps to test and create test data, not hub4j-test org, as I would have needed multiple orgs anyway to test an installation request. Hope that is fine.
  • In GHPerson.getType, we call populate(), which assumes that if (getCreatedAt() == null), type would not be populated, and tries to call an API to fetch it. However, while testing this PR I noticed that in case of GHApp APIs (installations and installation requests), we get type, but not created_at. This might be a small bug, an unnecessary API would be called; should I create an issue to fix this? Happy to contribute a PR if a fix is obvious.

Edit: I see there is already an issue (#1816) created for the GHPerson.getType bug. You can ignore this.

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.61%. Comparing base (d37839b) to head (4947caa).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2012      +/-   ##
============================================
+ Coverage     83.60%   83.61%   +0.01%     
- Complexity     2377     2381       +4     
============================================
  Files           234      235       +1     
  Lines          7250     7257       +7     
  Branches        382      382              
============================================
+ Hits           6061     6068       +7     
  Misses          955      955              
  Partials        234      234              

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

@bitwiseman bitwiseman merged commit 33c39f3 into hub4j:main Jan 21, 2025
12 checks passed
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.

Support for /app/installation-requests
2 participants