mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-25 07:34:57 +00:00
4df21a61de
* Check run request models * Check Run response models * Check run clients * Check run ApiUrls and AcceptHeaders * Pack it all together for now * Add missing accept headers to connection calls * Standardize class definitions * Standardize function names * Merge ICheckRunAnnotationsClient into ICheckRunsClient * Properly organize clients * Cleanup CheckRun response model * Fix slug check run urls * Add checks installation permission * Use StringEnums where appropriate * Cleanup check run output models * Flesh out CheckSuite model * Delete CheckRunsList * Remove a sealed, fix some line endings * Adding check suite models * Skeleton check suite client implementation * Add check suite ApiUrls * Flesh out check suites client * Add parameterless CheckRun constructor * Add DebuggerDisplay to checks models * Add observable checks interfaces * Add return values to POST and PATCH check clients * Fix some check suite client return values * Skeleton reactive checks implementation * Implement observable checks clients * Remove rogue tabs * Add CheckSuiteEventPayload * Add CheckRunEventPayload * Add DebuggerDisplay attributes to checks API payloads * Properly nullables check suite/run conclusion * Add CheckSuiteEventTests * Fix checks client accessor naming issues * Add missing Text field to CheckRunOutput * Marks CheckRunUpdate's conclusion as nullable * Fix reactive checks client naming * Today I learned DateTimeOffset is a struct Makes CheckRunUpdate's DateTimeOffsets nullable * Modify check clients to put slug version before repo id version * Add nullable to CheckRun.CompletedAt * Implement parameterless ICheckRunsClient.GetAllForReference and GetAllForCheckSuite * Add missing RequestParameters base to CheckSuiteRequest * Implement checks API GetAll methods * Bring parity to Reactive checks clients * fix project settings to get GitHubApp helper working again * remove un-needed InstallationId setting - provide helper method to find installation based on owner * fix up request object ctors based on required/optional parameters * fix up request object ctors based on required/optional parameters * add some initial integration tests for CheckSuites and CheckRuns including some helper methods * Add test for Request CheckSuite Fix Request CheckSuite to use correct Uri Fix Request CheckSuite return type as it doesnt return an object Fix CheckSuiteTriggerRequest ctor to make required fields mandatory * simplify Get CheckSuite test to not require as much data setup * Add test for CheckSuite GetAllForReference * Add test for CheckSuite UpdatePreferences * rename response models * rename CheckSuitesList to CheckSuitesResponse and use as response to the GetAll calls * Fix tests * Fix observable * fix model convention tests * remove CheckRuns so we can focus only on CheckSuites for now * naming things is hard * oh so many unit tests for CheckSuites methods * make client mockable * Fix issue with .Max() when no results returned * fix request parameter names * add Xml doc comments * Add XmlDoc comments to request/common model objects * rename class to match usage * tidy ups * xmldoc for observable clients * fix method order * add observable unit tests and get them passing * Add Observable unit tests and get them passing * add observable integration tests * tidy up ApiUrl method name * whitespace/using tidy ups * Ensure CheckSuiteEventPayload class is handled in deserializer and add to activity test * add response model XmlDoc comments * missed one xmldoc * add xmldoc to NewCheckSuite request and remove HeadBranch property as it doesnt exist anymore * add some extra check suites integration tests
101 lines
4.7 KiB
C#
101 lines
4.7 KiB
C#
using System;
|
|
|
|
namespace Octokit.Reactive
|
|
{
|
|
public class ObservableGitHubClient : IObservableGitHubClient
|
|
{
|
|
readonly IGitHubClient _gitHubClient;
|
|
|
|
public ObservableGitHubClient(ProductHeaderValue productInformation)
|
|
: this(new GitHubClient(productInformation))
|
|
{
|
|
}
|
|
|
|
public ObservableGitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore)
|
|
: this(new GitHubClient(productInformation, credentialStore))
|
|
{
|
|
}
|
|
|
|
public ObservableGitHubClient(ProductHeaderValue productInformation, Uri baseAddress)
|
|
: this(new GitHubClient(productInformation, baseAddress))
|
|
{
|
|
}
|
|
|
|
public ObservableGitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore, Uri baseAddress)
|
|
: this(new GitHubClient(productInformation, credentialStore, baseAddress))
|
|
{
|
|
}
|
|
|
|
public ObservableGitHubClient(IGitHubClient gitHubClient)
|
|
{
|
|
Ensure.ArgumentNotNull(gitHubClient, nameof(gitHubClient));
|
|
|
|
_gitHubClient = gitHubClient;
|
|
Authorization = new ObservableAuthorizationsClient(gitHubClient);
|
|
Activity = new ObservableActivitiesClient(gitHubClient);
|
|
GitHubApps = new ObservableGitHubAppsClient(gitHubClient);
|
|
Issue = new ObservableIssuesClient(gitHubClient);
|
|
Miscellaneous = new ObservableMiscellaneousClient(gitHubClient);
|
|
Oauth = new ObservableOauthClient(gitHubClient);
|
|
Organization = new ObservableOrganizationsClient(gitHubClient);
|
|
PullRequest = new ObservablePullRequestsClient(gitHubClient);
|
|
PullRequestReview = new ObservablePullRequestReviewsClient(gitHubClient);
|
|
Repository = new ObservableRepositoriesClient(gitHubClient);
|
|
User = new ObservableUsersClient(gitHubClient);
|
|
Git = new ObservableGitDatabaseClient(gitHubClient);
|
|
Gist = new ObservableGistsClient(gitHubClient);
|
|
Search = new ObservableSearchClient(gitHubClient);
|
|
Enterprise = new ObservableEnterpriseClient(gitHubClient);
|
|
Migration = new ObservableMigrationClient(gitHubClient);
|
|
Reaction = new ObservableReactionsClient(gitHubClient);
|
|
Check = new ObservableChecksClient(gitHubClient);
|
|
}
|
|
|
|
public IConnection Connection
|
|
{
|
|
get { return _gitHubClient.Connection; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set the GitHub Api request timeout.
|
|
/// Useful to set a specific timeout for lengthy operations, such as uploading release assets
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// See more information here: https://technet.microsoft.com/library/system.net.http.httpclient.timeout(v=vs.110).aspx
|
|
/// </remarks>
|
|
/// <param name="timeout">The Timeout value</param>
|
|
public void SetRequestTimeout(TimeSpan timeout)
|
|
{
|
|
_gitHubClient.SetRequestTimeout(timeout);
|
|
}
|
|
|
|
public IObservableAuthorizationsClient Authorization { get; private set; }
|
|
public IObservableActivitiesClient Activity { get; private set; }
|
|
public IObservableGitHubAppsClient GitHubApps { get; private set; }
|
|
public IObservableIssuesClient Issue { get; private set; }
|
|
public IObservableMiscellaneousClient Miscellaneous { get; private set; }
|
|
public IObservableOauthClient Oauth { get; private set; }
|
|
public IObservableOrganizationsClient Organization { get; private set; }
|
|
public IObservablePullRequestsClient PullRequest { get; private set; }
|
|
public IObservablePullRequestReviewsClient PullRequestReview { get; private set; }
|
|
public IObservableRepositoriesClient Repository { get; private set; }
|
|
public IObservableGistsClient Gist { get; private set; }
|
|
public IObservableUsersClient User { get; private set; }
|
|
public IObservableGitDatabaseClient Git { get; private set; }
|
|
public IObservableSearchClient Search { get; private set; }
|
|
public IObservableEnterpriseClient Enterprise { get; private set; }
|
|
public IObservableMigrationClient Migration { get; private set; }
|
|
public IObservableReactionsClient Reaction { get; private set; }
|
|
public IObservableChecksClient Check { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets the latest API Info - this will be null if no API calls have been made
|
|
/// </summary>
|
|
/// <returns><seealso cref="ApiInfo"/> representing the information returned as part of an Api call</returns>
|
|
public ApiInfo GetLastApiInfo()
|
|
{
|
|
return _gitHubClient.Connection.GetLastApiInfo();
|
|
}
|
|
}
|
|
}
|