added new overloads

This commit is contained in:
aedampir@gmail.com
2016-06-16 14:35:00 +07:00
parent 4d8c07eee6
commit 537c18e043
4 changed files with 279 additions and 1 deletions
@@ -5,6 +5,12 @@ using Octokit.Reactive.Internal;
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Activity Notifications API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/activity/notifications/">Activity Notifications API documentation</a> for more information.
/// </remarks>
public class ObservableNotificationsClient : IObservableNotificationsClient
{
readonly IConnection _connection;
@@ -56,6 +62,17 @@ namespace Octokit.Reactive
return GetAllForRepository(owner, name, ApiOptions.None);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository.</param>
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <returns>A <see cref="IObservable{Notification}"/> of <see cref="Notification"/>.</returns>
public IObservable<Notification> GetAllForRepository(int repositoryId)
{
return GetAllForRepository(repositoryId, ApiOptions.None);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -73,6 +90,20 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Notification>(ApiUrls.Notifications(owner, name), options);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository.</param>
/// <param name="options">Options for changing the API response</param>
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <returns>A <see cref="IObservable{Notification}"/> of <see cref="Notification"/>.</returns>
public IObservable<Notification> GetAllForRepository(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<Notification>(ApiUrls.Notifications(repositoryId), options);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user.
/// </summary>
@@ -118,6 +149,20 @@ namespace Octokit.Reactive
return GetAllForRepository(owner, name, request, ApiOptions.None);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository.</param>
/// <param name="request">Specifies the parameters to filter notifications by</param>
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
public IObservable<Notification> GetAllForRepository(int repositoryId, NotificationsRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return GetAllForRepository(repositoryId, request, ApiOptions.None);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -137,6 +182,22 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Notification>(ApiUrls.Notifications(owner, name), request.ToParametersDictionary(), options);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository.</param>
/// <param name="request">Specifies the parameters to filter notifications by</param>
/// <param name="options">Options for changing the API response</param>
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
public IObservable<Notification> GetAllForRepository(int repositoryId, NotificationsRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<Notification>(ApiUrls.Notifications(repositoryId), request.ToParametersDictionary(), options);
}
/// <summary>
/// Marks all notifications as read.
/// </summary>
@@ -175,6 +236,17 @@ namespace Octokit.Reactive
return _notificationsClient.MarkAsReadForRepository(owner, name).ToObservable();
}
/// <summary>
/// Marks the notifications for a given repository as read.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
/// <returns></returns>
public IObservable<Unit> MarkAsReadForRepository(int repositoryId)
{
return _notificationsClient.MarkAsReadForRepository(repositoryId).ToObservable();
}
/// <summary>
/// Marks the notifications for a given repository as read.
/// </summary>
@@ -192,6 +264,20 @@ namespace Octokit.Reactive
return _notificationsClient.MarkAsReadForRepository(owner, name, markAsReadRequest).ToObservable();
}
/// <summary>
/// Marks the notifications for a given repository as read.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
/// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
/// <returns></returns>
public IObservable<Unit> MarkAsReadForRepository(int repositoryId, MarkAsReadRequest markAsReadRequest)
{
Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");
return _notificationsClient.MarkAsReadForRepository(repositoryId, markAsReadRequest).ToObservable();
}
/// <summary>
/// Retrives a single <see cref="Notification"/> by Id.
/// </summary>