Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repositoryId overloads to methods on I(Observable)MilestonesClient #1392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions Octokit.Reactive/Clients/IObservableMilestonesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Issue Milestones API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/issues/milestones/">Issue Milestones API documentation</a> for more information.
/// </remarks>
public interface IObservableMilestonesClient
{
/// <summary>
Expand All @@ -16,6 +22,17 @@ public interface IObservableMilestonesClient
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Milestone> Get(string owner, string name, int number);

/// <summary>
/// Gets a single Milestone by number.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#get-a-single-milestone
/// </remarks>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Milestone> Get(int repositoryId, int number);

/// <summary>
/// Gets all open milestones for the repository.
Expand All @@ -27,6 +44,16 @@ public interface IObservableMilestonesClient
/// <param name="name">The name of the repository</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name);

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId);

/// <summary>
/// Gets all open milestones for the repository.
Expand All @@ -40,6 +67,17 @@ public interface IObservableMilestonesClient
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name, ApiOptions options);

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId, ApiOptions options);

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
Expand All @@ -52,6 +90,17 @@ public interface IObservableMilestonesClient
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name, MilestoneRequest request);

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request);

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
Expand All @@ -65,6 +114,18 @@ public interface IObservableMilestonesClient
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name, MilestoneRequest request, ApiOptions options);

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request, ApiOptions options);

/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
Expand All @@ -76,6 +137,16 @@ public interface IObservableMilestonesClient
/// <returns></returns>
IObservable<Milestone> Create(string owner, string name, NewMilestone newMilestone);

/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
/// <returns></returns>
IObservable<Milestone> Create(int repositoryId, NewMilestone newMilestone);

/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
Expand All @@ -89,6 +160,18 @@ public interface IObservableMilestonesClient
/// <returns></returns>
IObservable<Milestone> Update(string owner, string name, int number, MilestoneUpdate milestoneUpdate);

/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The Milestone number</param>
/// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
/// </param>
/// <returns></returns>
IObservable<Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate);

/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
Expand All @@ -99,5 +182,15 @@ public interface IObservableMilestonesClient
/// <param name="number">The milestone number</param>
/// <returns></returns>
IObservable<Unit> Delete(string owner, string name, int number);

/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#delete-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The milestone number</param>
/// <returns></returns>
IObservable<Unit> Delete(int repositoryId, int number);
}
}
129 changes: 128 additions & 1 deletion Octokit.Reactive/Clients/ObservableMilestonesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Issue Milestones API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/issues/milestones/">Issue Milestones API documentation</a> for more information.
/// </remarks>
public class ObservableMilestonesClient : IObservableMilestonesClient
{
readonly IMilestonesClient _client;
Expand Down Expand Up @@ -33,6 +39,18 @@ public IObservable<Milestone> Get(string owner, string name, int number)
return _client.Get(owner, name, number).ToObservable();
}

/// <summary>
/// Gets a single Milestone by number.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#get-a-single-milestone
/// </remarks>
/// <returns></returns>
public IObservable<Milestone> Get(int repositoryId, int number)
{
return _client.Get(repositoryId, number).ToObservable();
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
Expand All @@ -50,6 +68,19 @@ public IObservable<Milestone> GetAllForRepository(string owner, string name)
return GetAllForRepository(owner, name, ApiOptions.None);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId)
{
return GetAllForRepository(repositoryId, ApiOptions.None);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
Expand All @@ -69,6 +100,22 @@ public IObservable<Milestone> GetAllForRepository(string owner, string name, Api
return _connection.GetAndFlattenAllPages<Milestone>(ApiUrls.Milestones(owner, name), options);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Milestone>(ApiUrls.Milestones(repositoryId), options);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
Expand All @@ -88,6 +135,22 @@ public IObservable<Milestone> GetAllForRepository(string owner, string name, Mil
return GetAllForRepository(owner, name, request, ApiOptions.None);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request)
{
Ensure.ArgumentNotNull(request, "request");

return GetAllForRepository(repositoryId, request, ApiOptions.None);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
Expand All @@ -110,6 +173,25 @@ public IObservable<Milestone> GetAllForRepository(string owner, string name, Mil
request.ToParametersDictionary(), options);
}

/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Milestone>(ApiUrls.Milestones(repositoryId),
request.ToParametersDictionary(), options);
}

/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
Expand All @@ -128,6 +210,21 @@ public IObservable<Milestone> Create(string owner, string name, NewMilestone new
return _client.Create(owner, name, newMilestone).ToObservable();
}

/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
/// <returns></returns>
public IObservable<Milestone> Create(int repositoryId, NewMilestone newMilestone)
{
Ensure.ArgumentNotNull(newMilestone, "newMilestone");

return _client.Create(repositoryId, newMilestone).ToObservable();
}

/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
Expand All @@ -148,6 +245,23 @@ public IObservable<Milestone> Update(string owner, string name, int number, Mile
return _client.Update(owner, name, number, milestoneUpdate).ToObservable();
}

/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The Milestone number</param>
/// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
/// </param>
/// <returns></returns>
public IObservable<Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate)
{
Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");

return _client.Update(repositoryId, number, milestoneUpdate).ToObservable();
}

/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
Expand All @@ -164,5 +278,18 @@ public IObservable<Unit> Delete(string owner, string name, int number)

return _client.Delete(owner, name, number).ToObservable();
}

/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#delete-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The milestone number</param>
/// <returns></returns>
public IObservable<Unit> Delete(int repositoryId, int number)
{
return _client.Delete(repositoryId, number).ToObservable();
}
}
}
}
Loading