diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
index 9808297f..d1b46a93 100644
--- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
+++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
@@ -74,5 +74,15 @@ namespace Octokit
/// A instance describing a pull request merge
///
IObservable Merge(string owner, string name, int number, MergePullRequest mergePullRequest);
+
+ ///
+ /// Gets the pull request merge status.
+ ///
+ /// http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
+ /// The owner of the repository
+ /// The name of the repository
+ /// The pull request number
+ ///
+ IObservable Merged(string owner, string name, int number);
}
}
diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
index cce9e34d..3ce61a60 100644
--- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
+++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
@@ -1,6 +1,7 @@
using System;
using System.Reactive;
using System.Reactive.Threading.Tasks;
+using System.Threading.Tasks;
using Octokit.Reactive.Internal;
namespace Octokit.Reactive.Clients
@@ -120,5 +121,21 @@ namespace Octokit.Reactive.Clients
return _client.Merge(owner, name, number, mergePullRequest).ToObservable();
}
+
+ ///
+ /// Merges a pull request.
+ ///
+ /// http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
+ /// The owner of the repository
+ /// The name of the repository
+ /// The pull request number
+ ///
+ public IObservable Merged(string owner, string name, int number)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return _client.Merged(owner, name, number).ToObservable();
+ }
}
}
\ No newline at end of file
diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj
index 2f21b5e6..2b831190 100644
--- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj
@@ -122,6 +122,8 @@
+
+
diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
index cd6ab187..d229d309 100644
--- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
@@ -131,6 +131,8 @@
+
+
diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
index 0f441e35..d98a3979 100644
--- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
@@ -126,6 +126,8 @@
+
+
diff --git a/Octokit.Tests/Clients/PullRequestsClientTests.cs b/Octokit.Tests/Clients/PullRequestsClientTests.cs
index 5f589808..73bf4e72 100644
--- a/Octokit.Tests/Clients/PullRequestsClientTests.cs
+++ b/Octokit.Tests/Clients/PullRequestsClientTests.cs
@@ -145,7 +145,7 @@ namespace Octokit.Tests.Clients
client.Merge("fake", "repo", 42, mergePullRequest);
- connection.Received().Put(Arg.Is(u => u.ToString() == "repos/fake/repo/pulls/42"),
+ connection.Received().Put(Arg.Is(u => u.ToString() == "repos/fake/repo/pulls/42/merge"),
mergePullRequest);
}
@@ -164,6 +164,32 @@ namespace Octokit.Tests.Clients
}
}
+ public class TheMergedMethod
+ {
+ [Fact]
+ public void PutsToCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new PullRequestsClient(connection);
+
+ client.Merged("fake", "repo", 42);
+
+ connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/pulls/42/merge"), null);
+ }
+
+ [Fact]
+ public async Task EnsuresArgumentsNotNull()
+ {
+ var connection = Substitute.For();
+ var client = new PullRequestsClient(connection);
+
+ AssertEx.Throws(async () => await
+ client.Merge(null, "name", 42, new MergePullRequest("message")));
+ AssertEx.Throws(async () => await
+ client.Merge("owner", null, 42, new MergePullRequest("message")));
+ }
+ }
+
public class TheCtor
{
[Fact]
diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs
index c1b088b7..b3fd2d9d 100644
--- a/Octokit/Clients/IPullRequestsClient.cs
+++ b/Octokit/Clients/IPullRequestsClient.cs
@@ -72,5 +72,15 @@ namespace Octokit
/// A instance describing a pull request merge
///
Task Merge(string owner, string name, int number, MergePullRequest mergePullRequest);
+
+ ///
+ /// Gets the pull request merge status.
+ ///
+ /// http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
+ /// The owner of the repository
+ /// The name of the repository
+ /// The pull request number
+ ///
+ Task Merged(string owner, string name, int number);
}
}
diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs
index e379cbba..ee092ec3 100644
--- a/Octokit/Clients/PullRequestsClient.cs
+++ b/Octokit/Clients/PullRequestsClient.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Net;
using System.Threading.Tasks;
namespace Octokit
@@ -111,7 +112,23 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(mergePullRequest, "mergePullRequest");
- return ApiConnection.Put(ApiUrls.PullRequest(owner, name, number), mergePullRequest);
+ return ApiConnection.Put(ApiUrls.MergePullRequest(owner, name, number), mergePullRequest);
+ }
+
+ ///
+ /// Gets the pull request merge status.
+ ///
+ /// http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
+ /// The owner of the repository
+ /// The name of the repository
+ /// The pull request number
+ ///
+ public Task Merged(string owner, string name, int number)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return ApiConnection.Get(ApiUrls.MergePullRequest(owner, name, number));
}
}
}
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index 0fbc9321..d96f96df 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -564,6 +564,40 @@ namespace Octokit
{
return "gists/{0}/comments".FormatUri(gistId);
}
+
+ ///
+ /// Returns the that returns the specified pull request.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// /// The pull request number
+ ///
+ public static Uri PullRequest(string owner, string name, int number)
+ {
+ return "repos/{0}/{1}/pulls/{2}".FormatUri(owner, name, number);
+ }
+
+ ///
+ /// Returns the that lists the pull requests for a repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ ///
+ public static Uri PullRequests(string owner, string name)
+ {
+ return "repos/{0}/{1}/pulls".FormatUri(owner, name);
+ }
+
+ ///
+ /// Returns the that returns the pull request merge state.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// /// The pull request number
+ public static Uri MergePullRequest(string owner, string name, int number)
+ {
+ return "repos/{0}/{1}/pulls/{2}/merge".FormatUri(owner, name, number);
+ }
///
/// Returns the for a spesific comment for the specified commit.
@@ -895,28 +929,5 @@ namespace Octokit
{
return "users/{0}/following/{1}".FormatUri(login, following);
}
-
- ///
- /// Returns the that lists the pull requests for a repository.
- ///
- /// The owner of the repository
- /// The name of the repository
- ///
- public static Uri PullRequests(string owner, string name)
- {
- return "repos/{0}/{1}/pulls".FormatUri(owner, name);
- }
-
- ///
- /// Returns the that returns the specified pull request.
- ///
- /// The owner of the repository
- /// The name of the repository
- /// /// The pull request number
- ///
- public static Uri PullRequest(string owner, string name, int number)
- {
- return "repos/{0}/{1}/pulls/{2}".FormatUri(owner, name, number);
- }
}
}
diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj
index 6fb14223..639e1911 100644
--- a/Octokit/Octokit-Mono.csproj
+++ b/Octokit/Octokit-Mono.csproj
@@ -102,7 +102,6 @@
-
@@ -263,11 +262,6 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj
index 89fa5bfb..22590993 100644
--- a/Octokit/Octokit-MonoAndroid.csproj
+++ b/Octokit/Octokit-MonoAndroid.csproj
@@ -272,11 +272,7 @@
-
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj
index 23aa80e3..93634dea 100644
--- a/Octokit/Octokit-Monotouch.csproj
+++ b/Octokit/Octokit-Monotouch.csproj
@@ -267,11 +267,7 @@
-
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj
index c2469a5d..077443e0 100644
--- a/Octokit/Octokit-netcore45.csproj
+++ b/Octokit/Octokit-netcore45.csproj
@@ -260,11 +260,6 @@
-
-
-
-
-
diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj
index dfe288c5..5f04f444 100644
--- a/Octokit/Octokit.csproj
+++ b/Octokit/Octokit.csproj
@@ -156,7 +156,6 @@
-