Skip to content

Commit

Permalink
Implement Check Runs API (#1847)
Browse files Browse the repository at this point in the history
* Add CheckRunEventPayload

* add CheckRunEventPayload into all the right places

* forgot integration tests for RepositoryId methods (+1 squashed commits)

Squashed commits:

[b2445bf3] Implement Create CheckRun methods for normal and observable clients including unit and integration tests and xmldoc comments

* Implement Update CheckRun method
Refactored NewCheckRun to inherit CheckRunUpdate since they share all fields except HeadSha

* Implement GetAllForReference method

* Implement GetAllForCheckSuite method

* tweak XmlDoc to match github documentation

* Implement Get method

* Implement GetAllAnnotations
Moved CheckRunAnnotation model from Request to Common and added a parameterless ctor, since it is now a response model as well as a request model

* Split common CheckRunAnnotation model into separate response and request models due to different field and ctor requirements
Rename other CheckRun request sub classes to be consistent with NewCheckRunAnnotation (eg NewCheckRunOutput, NewCheckRunImage, etc)

* add title field back into CheckRunAnnotation

* fix up XmlDocs

* fix mutable response property - hooray for convention tests!
  • Loading branch information
ryangribble authored Jul 18, 2018
1 parent 8407369 commit c5d5df5
Show file tree
Hide file tree
Showing 33 changed files with 4,566 additions and 17 deletions.
261 changes: 261 additions & 0 deletions Octokit.Reactive/Clients/IObservableCheckRunsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
using System;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Check Runs API
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/">Check Runs API documentation</a> for more information.
/// </remarks>
public interface IObservableCheckRunsClient
{
/// <summary>
/// Creates a new check run for a specific commit in a repository
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#create-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="newCheckRun">Details of the Check Run to create</param>
IObservable<CheckRun> Create(string owner, string name, NewCheckRun newCheckRun);

/// <summary>
/// Creates a new check run for a specific commit in a repository
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#create-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="newCheckRun">Details of the Check Run to create</param>
IObservable<CheckRun> Create(long repositoryId, NewCheckRun newCheckRun);

/// <summary>
/// Updates a check run for a specific commit in a repository
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#update-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
/// <param name="checkRunUpdate">The updates to the check run</param>
IObservable<CheckRun> Update(string owner, string name, long checkRunId, CheckRunUpdate checkRunUpdate);

/// <summary>
/// Updates a check run for a specific commit in a repository
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#update-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
/// <param name="checkRunUpdate">The updates to the check run</param>
IObservable<CheckRun> Update(long repositoryId, long checkRunId, CheckRunUpdate checkRunUpdate);

/// <summary>
/// Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="reference">The commit reference (can be a SHA, branch name, or a tag name)</param>
IObservable<CheckRunsResponse> GetAllForReference(string owner, string name, string reference);

/// <summary>
/// Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="reference">The commit reference (can be a SHA, branch name, or a tag name)</param>
IObservable<CheckRunsResponse> GetAllForReference(long repositoryId, string reference);

/// <summary>
/// Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="reference">The commit reference (can be a SHA, branch name, or a tag name)</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
IObservable<CheckRunsResponse> GetAllForReference(string owner, string name, string reference, CheckRunRequest checkRunRequest);

/// <summary>
/// Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="reference">The commit reference (can be a SHA, branch name, or a tag name)</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
IObservable<CheckRunsResponse> GetAllForReference(long repositoryId, string reference, CheckRunRequest checkRunRequest);

/// <summary>
/// Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="reference">The commit reference (can be a SHA, branch name, or a tag name)</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
/// <param name="options">Options to change the API response</param>
IObservable<CheckRunsResponse> GetAllForReference(string owner, string name, string reference, CheckRunRequest checkRunRequest, ApiOptions options);

/// <summary>
/// Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="reference">The commit reference (can be a SHA, branch name, or a tag name)</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
/// <param name="options">Options to change the API response</param>
IObservable<CheckRunsResponse> GetAllForReference(long repositoryId, string reference, CheckRunRequest checkRunRequest, ApiOptions options);

/// <summary>
/// Lists check runs for a check suite using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkSuiteId">The Id of the check suite</param>
IObservable<CheckRunsResponse> GetAllForCheckSuite(string owner, string name, long checkSuiteId);

/// <summary>
/// Lists check runs for a check suite using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkSuiteId">The Id of the check suite</param>
IObservable<CheckRunsResponse> GetAllForCheckSuite(long repositoryId, long checkSuiteId);

/// <summary>
/// Lists check runs for a check suite using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkSuiteId">The Id of the check suite</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
IObservable<CheckRunsResponse> GetAllForCheckSuite(string owner, string name, long checkSuiteId, CheckRunRequest checkRunRequest);

/// <summary>
/// Lists check runs for a check suite using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkSuiteId">The Id of the check suite</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
IObservable<CheckRunsResponse> GetAllForCheckSuite(long repositoryId, long checkSuiteId, CheckRunRequest checkRunRequest);

/// <summary>
/// Lists check runs for a check suite using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkSuiteId">The Id of the check suite</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
/// <param name="options">Options to change the API response</param>
IObservable<CheckRunsResponse> GetAllForCheckSuite(string owner, string name, long checkSuiteId, CheckRunRequest checkRunRequest, ApiOptions options);

/// <summary>
/// Lists check runs for a check suite using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkSuiteId">The Id of the check suite</param>
/// <param name="checkRunRequest">Details to filter the request, such as by check name</param>
/// <param name="options">Options to change the API response</param>
IObservable<CheckRunsResponse> GetAllForCheckSuite(long repositoryId, long checkSuiteId, CheckRunRequest checkRunRequest, ApiOptions options);

/// <summary>
/// Gets a single check run using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#get-a-single-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
IObservable<CheckRun> Get(string owner, string name, long checkRunId);

/// <summary>
/// Gets a single check run using its Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#get-a-single-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
IObservable<CheckRun> Get(long repositoryId, long checkRunId);

/// <summary>
/// Lists annotations for a check run using the check run Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
IObservable<CheckRunAnnotation> GetAllAnnotations(string owner, string name, long checkRunId);

/// <summary>
/// Lists annotations for a check run using the check run Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
/// <returns></returns>
IObservable<CheckRunAnnotation> GetAllAnnotations(long repositoryId, long checkRunId);

/// <summary>
/// Lists annotations for a check run using the check run Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
/// <param name="options">Options to change the API response</param>
IObservable<CheckRunAnnotation> GetAllAnnotations(string owner, string name, long checkRunId, ApiOptions options);

/// <summary>
/// Lists annotations for a check run using the check run Id
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run">Check Runs API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="checkRunId">The Id of the check run</param>
/// <param name="options">Options to change the API response</param>
IObservable<CheckRunAnnotation> GetAllAnnotations(long repositoryId, long checkRunId, ApiOptions options);
}
}
8 changes: 8 additions & 0 deletions Octokit.Reactive/Clients/IObservableChecksClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
/// </remarks>
public interface IObservableChecksClient
{
/// <summary>
/// A client for GitHub's Check Runs API.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/checks/runs/">Check Runs API documentation</a> for more information.
/// </remarks>
IObservableCheckRunsClient Run { get; }

/// <summary>
/// A client for GitHub's Check Suites API.
/// </summary>
Expand Down
Loading

0 comments on commit c5d5df5

Please sign in to comment.