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
@@ -4,6 +4,12 @@ using System.Reactive;
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 interface IObservableNotificationsClient
{
/// <summary>
@@ -32,6 +38,14 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IObservable{Notification}"/> of <see cref="Notification"/>.</returns>
IObservable<Notification> GetAllForRepository(string owner, string name);
/// <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>
IObservable<Notification> GetAllForRepository(int repositoryId);
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -42,6 +56,15 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IObservable{Notification}"/> of <see cref="Notification"/>.</returns>
IObservable<Notification> GetAllForRepository(string owner, string name, ApiOptions 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>
IObservable<Notification> GetAllForRepository(int repositoryId, ApiOptions options);
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user.
/// </summary>
@@ -71,6 +94,15 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
IObservable<Notification> GetAllForRepository(string owner, string name, NotificationsRequest request);
/// <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>
IObservable<Notification> GetAllForRepository(int repositoryId, NotificationsRequest request);
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -82,6 +114,16 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
IObservable<Notification> GetAllForRepository(string owner, string name, NotificationsRequest request, ApiOptions 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>
IObservable<Notification> GetAllForRepository(int repositoryId, NotificationsRequest request, ApiOptions options);
/// <summary>
/// Marks all notifications as read.
/// </summary>
@@ -106,6 +148,14 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Unit> MarkAsReadForRepository(string owner, string name);
/// <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>
IObservable<Unit> MarkAsReadForRepository(int repositoryId);
/// <summary>
/// Marks the notifications for a given repository as read.
/// </summary>
@@ -116,6 +166,15 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Unit> MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsReadRequest);
/// <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>
IObservable<Unit> MarkAsReadForRepository(int repositoryId, MarkAsReadRequest markAsReadRequest);
/// <summary>
/// Retrives a single <see cref="Notification"/> by Id.
/// </summary>
@@ -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>
+53
View File
@@ -57,6 +57,14 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
Task<IReadOnlyList<Notification>> GetAllForRepository(string owner, string name);
/// <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="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
Task<IReadOnlyList<Notification>> GetAllForRepository(int repositoryId);
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -67,6 +75,15 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
Task<IReadOnlyList<Notification>> GetAllForRepository(string owner, string name, ApiOptions 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="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
Task<IReadOnlyList<Notification>> GetAllForRepository(int repositoryId, ApiOptions options);
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -77,6 +94,15 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
Task<IReadOnlyList<Notification>> GetAllForRepository(string owner, string name, NotificationsRequest request);
/// <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>
Task<IReadOnlyList<Notification>> GetAllForRepository(int repositoryId, NotificationsRequest request);
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -88,6 +114,16 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
Task<IReadOnlyList<Notification>> GetAllForRepository(string owner, string name, NotificationsRequest request, ApiOptions 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>
Task<IReadOnlyList<Notification>> GetAllForRepository(int repositoryId, NotificationsRequest request, ApiOptions options);
/// <summary>
/// Marks all notifications as read.
/// </summary>
@@ -112,6 +148,14 @@ namespace Octokit
/// <returns></returns>
Task MarkAsReadForRepository(string owner, string name);
/// <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>
Task MarkAsReadForRepository(int repositoryId);
/// <summary>
/// Marks the notifications for a given repository as read.
/// </summary>
@@ -122,6 +166,15 @@ namespace Octokit
/// <returns></returns>
Task MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsReadRequest);
/// <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>
Task MarkAsReadForRepository(int repositoryId, MarkAsReadRequest markAsReadRequest);
/// <summary>
/// Retrives a single <see cref="Notification"/> by Id.
/// </summary>
+81 -1
View File
@@ -85,6 +85,17 @@ namespace Octokit
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="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
public Task<IReadOnlyList<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>
@@ -102,6 +113,20 @@ namespace Octokit
return ApiConnection.GetAll<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="IReadOnlyPagedCollection{Notification}"/> of <see cref="Notification"/>.</returns>
public Task<IReadOnlyList<Notification>> GetAllForRepository(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Notification>(ApiUrls.Notifications(repositoryId), options);
}
/// <summary>
/// Retrieves all of the <see cref="Notification"/>s for the current user specific to the specified repository.
/// </summary>
@@ -119,6 +144,20 @@ namespace Octokit
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 Task<IReadOnlyList<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>
@@ -138,6 +177,22 @@ namespace Octokit
return ApiConnection.GetAll<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 Task<IReadOnlyList<Notification>> GetAllForRepository(int repositoryId, NotificationsRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Notification>(ApiUrls.Notifications(repositoryId), request.ToParametersDictionary(), options);
}
/// <summary>
/// Marks all notifications as read.
/// </summary>
@@ -176,6 +231,17 @@ namespace Octokit
return ApiConnection.Put(ApiUrls.Notifications(owner, name));
}
/// <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 Task MarkAsReadForRepository(int repositoryId)
{
return ApiConnection.Put(ApiUrls.Notifications(repositoryId));
}
/// <summary>
/// Marks the notifications for a given repository as read.
/// </summary>
@@ -188,11 +254,25 @@ namespace Octokit
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(markAsReadRequest, "markAsRead");
Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");
return ApiConnection.Put<object>(ApiUrls.Notifications(owner, name), markAsReadRequest);
}
/// <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 Task MarkAsReadForRepository(int repositoryId, MarkAsReadRequest markAsReadRequest)
{
Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");
return ApiConnection.Put<object>(ApiUrls.Notifications(repositoryId), markAsReadRequest);
}
/// <summary>
/// Retrives a single <see cref="Notification"/> by Id.
/// </summary>