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

Additional GitHub Apps APIs #1854

Merged
merged 31 commits into from
Sep 3, 2018
Merged

Additional GitHub Apps APIs #1854

merged 31 commits into from
Sep 3, 2018

Conversation

@StanleyGoldman StanleyGoldman changed the title Adding GitHub Apps: List installations for user Missing GitHub Apps APIs Aug 7, 2018
@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from 8acddd0 to b446b5a Compare August 7, 2018 19:19
@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from b446b5a to 87c2022 Compare August 7, 2018 19:20
@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from 1e5d95f to b4b1fe8 Compare August 7, 2018 19:38
@StanleyGoldman StanleyGoldman changed the title Missing GitHub Apps APIs Additional GitHub Apps APIs Aug 7, 2018
@ryangribble
Copy link
Contributor

👀

@StanleyGoldman
Copy link
Contributor Author

StanleyGoldman commented Aug 8, 2018

I'm still dogfooding these.
The documentation on these APIs kind of leave me a bit confused.
So yea, I need to actually test them all in order to understand what data they are really getting.

@StanleyGoldman
Copy link
Contributor Author

I'm noticing a nuanced difference in the way some responses are delivered that is throwing this off..

https://developer.github.com/v3/apps/installations/#response

image

https://developer.github.com/v3/repos/#response

image

@StanleyGoldman
Copy link
Contributor Author

cc: @shiftkey ☝️

@StanleyGoldman
Copy link
Contributor Author

Nvm, I learned things today...

@shiftkey
Copy link
Member

shiftkey commented Aug 9, 2018

@StanleyGoldman is this related to the total_count field (that feels a response from a search API, but /apps/installations/ doesn't seem to behave like one) or was there some other questions/curiosities you had?

@StanleyGoldman
Copy link
Contributor Author

Yea, I was just mentally unprepared for things to be different between api calls like that.

@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from 4b6cd2c to 40bd9dc Compare August 9, 2018 22:04
Copy link
Contributor

@ryangribble ryangribble left a comment

Choose a reason for hiding this comment

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

Hey @StanleyGoldman it's looking pretty good, ive made some reviwe comments/thoughts just on the Observable client since that was first in the list, but the comments apply to the regular client too.

In general

  • I havent marked up every XMlDoc inconsistency - we will need to get the comments and param entries right, but we can focus on that once we have the main code etc done

  • we should think about the naming of the mehtods corrresponding to "find" endpoints as im not sure Getxxx is the best for those. I suggested a couple of options - which do you think sounds better?

  • since the authentication for github apps, installations and user-to-server oauth is so complex, we probably need to indicate in the XmlDoc comments of every endpoint what type of auth it requires

  • any endpoint taking repo /repos/:owner/:name we also by convention, support the "undocumented" endpoint /repositories/:id/

Also im not sure of the historic reasons but the main client and interface for both the Observable and normal clients live in the top level folder with all sub clients in the Clients folder below there. I see you renamed/moved the Observable one into the Clients folder but didnt do the same thing for the normal client. In general id say we shouldnt move things since it makes tracing history more difficult, unless its a really good reason... and if you think it IS a good reason, we should at least be consistent and do it for normal and observable 😁

/// <remarks>
/// Refer to the API documentation for more information: https://developer.github.com/v3/apps/installations/
/// </remarks>
IObservableGitHubAppsInstallationsClient Installations { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

The property name should be singular, eg github.App.Installation.xxxx

/// <remarks>https://developer.github.com/v3/apps/#find-repository-installation</remarks>
/// <param name="owner">The owner of the repo</param>
/// <param name="repo">The name of the repo</param>
IObservable<Installation> GetRepositoryInstallation(string owner, string repo);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should be named GetRepositoryInstallationForCurrent() since it uses the currently authenticated GitHub App... or otherwise FindRepositoryInstallation()?

Copy link
Contributor

Choose a reason for hiding this comment

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

also we need to support the repositoryId version of this call in addition to the owner/repo version

IObservable<Installation> GetRepositoryInstallation(string owner, string repo);

/// <summary>
/// Enables an authenticated GitHub App to find the repository's installation information.
Copy link
Contributor

Choose a reason for hiding this comment

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

comment says repository but should be organization

/// Enables an authenticated GitHub App to find the repository's installation information.
/// </summary>
/// <remarks>https://developer.github.com/v3/apps/#find-organization-installation</remarks>
/// <param name="owner">The owner of the repo</param>
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect params

/// <remarks>https://developer.github.com/v3/apps/#find-organization-installation</remarks>
/// <param name="owner">The owner of the repo</param>
/// <param name="repo">The name of the repo</param>
IObservable<Installation> GetOrganizationInstallation(string organization);
Copy link
Contributor

Choose a reason for hiding this comment

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

GetOrganizationInstallationForCurrent or FindOrganizationInstallation?

/// <remarks>https://developer.github.com/v3/apps/#find-user-installation</remarks>
/// <param name="owner">The owner of the repo</param>
/// <param name="repo">The name of the repo</param>
IObservable<Installation> GetUserInstallation(string user);
Copy link
Contributor

Choose a reason for hiding this comment

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

GetUserInstallationForCurrent ? Or FindUserInstallation?

public interface IObservableGitHubAppsInstallationsClient
{
/// <summary>
/// List repositories of the authenticated GitHub App (requires GitHubApp JWT token auth).
Copy link
Contributor

Choose a reason for hiding this comment

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

The docs says this endpoint uses an installation token, not a JWT... and this would get repositories of an installation rather than a github app (which would have many installations each with potentially many repos)

So let's go with "List repositories of the authenticated installation (requires Installation Token auth)" or something similar

IObservable<RepositoriesResponse> GetAllRepositoriesForCurrent();

/// <summary>
/// List repositories of the authenticated GitHub App (requires GitHubApp JWT token auth).
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

IObservable<RepositoriesResponse> GetAllRepositoriesForCurrent(ApiOptions options);

/// <summary>
/// List repositories accessible to the user for an installation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment probably needs to indicate this requires a user to server OAuth token

@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from e3e1ade to 731bd2b Compare August 13, 2018 19:58
@StanleyGoldman
Copy link
Contributor Author

First off, sorry about my sloppiness, I was rushing so I can go and dogfood this. Thanks for reviewing.

  1. I'm gonna start up a new pull request that targets this one, and I'll go through all of the GitHub Apps docs and make sure they are correct and link out correctly.
  2. The ForCurrent moniker resonates better with me for some reason. I'll also wait for ☝️ to make sure they are consistent.
  3. I'll make sure the docs I add have relevant links to the auth pages in the api.
  4. Are there any other undocumented patters I should be looking for? 😼

@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from 579b1d7 to fc1461b Compare August 13, 2018 20:43
@StanleyGoldman
Copy link
Contributor Author

I was gonna send the latest changes in a separate pull request, but then i got lazy.

…to be consistent with single/plural naming conventions
@StanleyGoldman
Copy link
Contributor Author

Your changes so far get a 👍 from me.

@ryangribble
Copy link
Contributor

I think the last thing to do is unit tests for the observable client and ideally integration tests (at least for the things we can easily setup)

@ryangribble ryangribble added this to the GitHub Apps milestone Aug 27, 2018
@ryangribble
Copy link
Contributor

OK I think im done with adding unit and integration tests for EVERYTHING. Glad I did this too, as it found a few problems! 😀

@ryangribble
Copy link
Contributor

Hey @StanleyGoldman these latest changes I already had a separate PR for #1857 and I also did them in a way that keeps the old models working for GHE 2.14 since it won't get these changes

I think I did forget to add the start/end column members but we can just add that to the other PR and keep this one focused on the app/installation endpoints

@StanleyGoldman StanleyGoldman force-pushed the installations-for-user branch from e71cc85 to 86d4514 Compare August 30, 2018 22:02
@StanleyGoldman
Copy link
Contributor Author

Ah my bad, I was not aware of the nuance.

@ryangribble
Copy link
Contributor

release_notes: Implement additional endpoints for GitHub Apps to find installations for a given organization, repository or user

@ryangribble
Copy link
Contributor

release_notes: Implement GitHub Apps Installation API to allow listing all repositories a GitHub App Installation or GitHub App authenticated user has access to

@ryangribble
Copy link
Contributor

I think these are good to go!

LGTM

@ryangribble ryangribble merged commit 5f1421b into master Sep 3, 2018
@ryangribble ryangribble deleted the installations-for-user branch September 3, 2018 10:36
@nickfloyd nickfloyd added Type: Feature New feature or request and removed category: feature labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants