mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
* Adding functionality to query installations for user * Rename method * Adding installation methods * Adding tests * Adding observable client methods * Adding InstallationResponse * Adding GitHub Apps Installations Client * Tweaking doc comments * Undoing unintentional changes and cleaning up * Reordering functions in clients to keep the same code look and feel * Making sure all methods are documented with their authentication requirements * Syntax error * Renaming methods and tests * Renaming property * Test cleanup * XmlDoc comment fixups and consistency * rename User -To-Server auth methods from xxxForUser to xxxForCurrentUser * rename GitHubAppsInstallationsClient to GitHubAppInstallationsClient to be consistent with single/plural naming conventions * make method order match the order on github docs site * tidy up usings * correct implementation of GetALlInstallationsForCurrent method to be consistent * Add missing unit and integration tests for ObservableGitHubAppsClient * fix renamed method in observable tests * Add EnsuresNonEmptyArguments tests and fixup asserts in GitHubAppsClient * Add tests for new Observable client methods and fixup Null/Empty asserts in Observable client * change non paginated call to call through to other method but with ApiOptions.None * add unit tests for observable client and fixup errors they found * add integration tests for new GitHubAppsClient methods, fixed an incorrect route that the tests found! * add integration tests for extra methods on observable client * add integration tests for new clients GitHubAppInstallationsClient and ObservableGitHubAppInstallationsClient * deprecate renamed method properly, to avoid breaking change
65 lines
3.2 KiB
C#
65 lines
3.2 KiB
C#
using System;
|
|
using Octokit.Reactive.Internal;
|
|
|
|
namespace Octokit.Reactive
|
|
{
|
|
/// <summary>
|
|
/// A client for GitHub Applications Installations API.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// See the <a href="http://developer.github.com/v3/apps/installations/">GitHub Apps Installations API documentation</a> for more information.
|
|
/// </remarks>
|
|
public class ObservableGitHubAppInstallationsClient : IObservableGitHubAppInstallationsClient
|
|
{
|
|
private IGitHubAppInstallationsClient _client;
|
|
private readonly IConnection _connection;
|
|
|
|
public ObservableGitHubAppInstallationsClient(IGitHubClient client)
|
|
{
|
|
Ensure.ArgumentNotNull(client, nameof(client));
|
|
|
|
_client = client.GitHubApps.Installation;
|
|
_connection = client.Connection;
|
|
}
|
|
|
|
/// <summary>
|
|
/// List repositories of the authenticated GitHub App Installation (requires GitHubApp Installation-Token auth).
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/apps/installations/#list-repositories</remarks>
|
|
public IObservable<RepositoriesResponse> GetAllRepositoriesForCurrent()
|
|
{
|
|
return GetAllRepositoriesForCurrent(ApiOptions.None);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List repositories of the authenticated GitHub App Installation (requires GitHubApp Installation-Token auth).
|
|
/// </summary>
|
|
/// <param name="options">Options for changing the API response</param>
|
|
/// <remarks>https://developer.github.com/v3/apps/installations/#list-repositories</remarks>
|
|
public IObservable<RepositoriesResponse> GetAllRepositoriesForCurrent(ApiOptions options)
|
|
{
|
|
return _connection.GetAndFlattenAllPages<RepositoriesResponse>(ApiUrls.InstallationRepositories(), null, AcceptHeaders.GitHubAppsPreview, options);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List repositories accessible to the user for an installation (requires GitHubApp User-To-Server Auth).
|
|
/// </summary>
|
|
/// <param name="installationId">The Id of the installation</param>
|
|
/// <remarks>https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation</remarks>
|
|
public IObservable<RepositoriesResponse> GetAllRepositoriesForCurrentUser(long installationId)
|
|
{
|
|
return GetAllRepositoriesForCurrentUser(installationId, ApiOptions.None);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List repositories accessible to the user for an installation (requires GitHubApp User-To-Server Auth).
|
|
/// </summary>
|
|
/// <param name="installationId">The Id of the installation</param>
|
|
/// <param name="options">Options for changing the API response</param>
|
|
/// <remarks>https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation</remarks>
|
|
public IObservable<RepositoriesResponse> GetAllRepositoriesForCurrentUser(long installationId, ApiOptions options)
|
|
{
|
|
return _connection.GetAndFlattenAllPages<RepositoriesResponse>(ApiUrls.UserInstallationRepositories(installationId), null, AcceptHeaders.GitHubAppsPreview, options);
|
|
}
|
|
}
|
|
} |