mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-19 05:35:11 +00:00
Remove lists from observable issues comments client
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
@@ -27,7 +24,7 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="name">The name of the repository</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<IReadOnlyList<IssueComment>> GetForRepository(string owner, string name);
|
IObservable<IssueComment> GetForRepository(string owner, string name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets Issue Comments for a specified Issue.
|
/// Gets Issue Comments for a specified Issue.
|
||||||
@@ -37,7 +34,7 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="name">The name of the repository</param>
|
||||||
/// <param name="number">The issue number</param>
|
/// <param name="number">The issue number</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<IReadOnlyList<IssueComment>> GetForIssue(string owner, string name, int number);
|
IObservable<IssueComment> GetForIssue(string owner, string name, int number);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new Issue Comment for a specified Issue.
|
/// Creates a new Issue Comment for a specified Issue.
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableIssueCommentsClient : IObservableIssueCommentsClient
|
public class ObservableIssueCommentsClient : IObservableIssueCommentsClient
|
||||||
{
|
{
|
||||||
readonly IIssueCommentsClient _client;
|
readonly IIssueCommentsClient _client;
|
||||||
|
readonly IConnection _connection;
|
||||||
|
|
||||||
public ObservableIssueCommentsClient(IGitHubClient client)
|
public ObservableIssueCommentsClient(IGitHubClient client)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(client, "client");
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
_client = client.Issue.Comment;
|
_client = client.Issue.Comment;
|
||||||
|
_connection = client.Connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,12 +44,12 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="name">The name of the repository</param>
|
||||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Repository.</returns>
|
/// <returns>The list of <see cref="IssueComment"/>s for the specified Repository.</returns>
|
||||||
public IObservable<IReadOnlyList<IssueComment>> GetForRepository(string owner, string name)
|
public IObservable<IssueComment> GetForRepository(string owner, string name)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
return _client.GetForRepository(owner, name).ToObservable();
|
return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(owner, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -60,12 +62,12 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="name">The name of the repository</param>
|
||||||
/// <param name="number">The issue number</param>
|
/// <param name="number">The issue number</param>
|
||||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Issue.</returns>
|
/// <returns>The list of <see cref="IssueComment"/>s for the specified Issue.</returns>
|
||||||
public IObservable<IReadOnlyList<IssueComment>> GetForIssue(string owner, string name, int number)
|
public IObservable<IssueComment> GetForIssue(string owner, string name, int number)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
return _client.GetForIssue(owner, name, number).ToObservable();
|
return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(owner, name, number));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user