Changes in Accept headers as well as names of the functions

This commit is contained in:
Prayank Mathur
2016-03-29 16:19:47 +05:30
parent 2c167bfb70
commit 8ff574ab1c
7 changed files with 31 additions and 30 deletions

View File

@@ -166,7 +166,7 @@ namespace Octokit.Reactive
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
IObservable<Unit> LockIssue(string owner, string name, int number);
IObservable<Issue> Lock(string owner, string name, int number);
/// <summary>
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
@@ -176,6 +176,6 @@ namespace Octokit.Reactive
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
IObservable<Unit> UnlockIssue(string owner, string name, int number);
IObservable<Unit> Unlock(string owner, string name, int number);
}
}

View File

@@ -232,12 +232,12 @@ namespace Octokit.Reactive
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public IObservable<Unit> LockIssue(string owner, string name, int number)
public IObservable<Issue> Lock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.LockIssue(owner, name, number).ToObservable();
return _client.Lock(owner, name, number).ToObservable();
}
/// <summary>
@@ -248,12 +248,12 @@ namespace Octokit.Reactive
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public IObservable<Unit> UnlockIssue(string owner, string name, int number)
public IObservable<Unit> Unlock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.UnlockIssue(owner, name, number).ToObservable();
return _client.Unlock(owner, name, number).ToObservable();
}
}
}

View File

@@ -64,21 +64,20 @@ public class IssuesClientTests : IDisposable
[IntegrationTest]
public async Task CanLockAndUnlockIssue()
{
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.False(issue.Locked);
Assert.Equal(false, issue.Locked);
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.True(issue.Locked);
await _issuesClient.LockIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.Equal(true, issue.Locked);
await _issuesClient.UnlockIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.Equal(false, issue.Locked);
await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.False(issue.Locked);
}
[IntegrationTest]

View File

@@ -78,15 +78,15 @@ public class ObservableIssuesClientTests : IDisposable
var newIssue = new NewIssue("Integration Test Issue");
var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.Equal(false, createResult.Locked);
Assert.False(createResult.Locked);
await _client.LockIssue(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
await _client.Lock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
var lockResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
Assert.Equal(true, lockResult.Locked);
Assert.True(lockResult.Locked);
await _client.UnlockIssue(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
await _client.Unlock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
var unlockIssueResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
Assert.Equal(false, unlockIssueResult.Locked);
Assert.False(unlockIssueResult.Locked);
}
public void Dispose()

View File

@@ -172,7 +172,7 @@ namespace Octokit
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
Task LockIssue(string owner, string name, int number);
Task<Issue> Lock(string owner, string name, int number);
/// <summary>
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
@@ -182,6 +182,6 @@ namespace Octokit
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
Task UnlockIssue(string owner, string name, int number);
Task Unlock(string owner, string name, int number);
}
}

View File

@@ -234,12 +234,12 @@ namespace Octokit
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public Task LockIssue(string owner, string name, int number)
public Task<Issue> Lock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return ApiConnection.Put(ApiUrls.IssueLock(owner, name, number));
return ApiConnection.Put<Issue>(ApiUrls.IssueLock(owner, name, number), AcceptHeaders.IssueLockingUnlockingApiPreview);
}
/// <summary>
@@ -250,12 +250,12 @@ namespace Octokit
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public Task UnlockIssue(string owner, string name, int number)
public Task Unlock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return ApiConnection.Delete(ApiUrls.IssueLock(owner, name, number));
return ApiConnection.Delete(ApiUrls.IssueLock(owner, name, number), AcceptHeaders.IssueLockingUnlockingApiPreview);
}
}
}

View File

@@ -13,5 +13,7 @@
public const string ProtectedBranchesApiPreview = "application/vnd.github.loki-preview+json";
public const string StarCreationTimestamps = "application/vnd.github.v3.star+json";
public const string IssueLockingUnlockingApiPreview = "application/vnd.github.the-key-preview+json";
}
}