mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 19:11:30 +00:00
Implement Issue Timeline preview API (#1435)
* Implement Issue Timeline preview API * Add DebuggerDisplay to response models * Rename method * Add Observable Issue Timeline client * Add that missing property thing * Add teh comments * Added unit tests * Fix method names * Add missing event type enum and API preview accept header * Add integration tests for async client * Pass in API preview header * Add observable integration tests * Unbreak the broken tests... * Remove unnecessary usings * Add missing events * Fix API URLs * Add overloads for using repository Id instead of owner/repo and paging * Add tests for repository id overloads * Add paging tests * I'm clearly a bit rusty about this test thing here... * Missed a check for null argument * Added missing XMLDocs
This commit is contained in:
committed by
Ryan Gribble
parent
40a60d75b1
commit
23d9310133
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using Octokit.Reactive.Internal;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Issue Timeline API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/issues/timeline/">Issue Timeline API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
public class ObservableIssueTimelineClient : IObservableIssueTimelineClient
|
||||
{
|
||||
readonly IConnection _connection;
|
||||
|
||||
public ObservableIssueTimelineClient(IGitHubClient client)
|
||||
{
|
||||
Ensure.ArgumentNotNull(client, "client");
|
||||
|
||||
_connection = client.Connection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the various events that have occurred around an issue or pull request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="repo">The name of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
public IObservable<TimelineEventInfo> GetAllForIssue(string owner, string repo, int number)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repo, "repo");
|
||||
|
||||
return GetAllForIssue(owner, repo, number, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the various events that have occurred around an issue or pull request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="repo">The name of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
public IObservable<TimelineEventInfo> GetAllForIssue(string owner, string repo, int number, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(repo, "repo");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<TimelineEventInfo>(ApiUrls.IssueTimeline(owner, repo, number), null, AcceptHeaders.IssueTimelineApiPreview, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the various events that have occurred around an issue or pull request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
public IObservable<TimelineEventInfo> GetAllForIssue(int repositoryId, int number)
|
||||
{
|
||||
return GetAllForIssue(repositoryId, number, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the various events that have occurred around an issue or pull request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
public IObservable<TimelineEventInfo> GetAllForIssue(int repositoryId, int number, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<TimelineEventInfo>(ApiUrls.IssueTimeline(repositoryId, number), null, AcceptHeaders.IssueTimelineApiPreview, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user