Merge remote-tracking branch 'upstream/master' into enterprise-adminstats

This commit is contained in:
Ryan Gribble
2016-01-16 14:01:48 +10:00
51 changed files with 453 additions and 183 deletions

View File

@@ -117,8 +117,19 @@ namespace Octokit.Reactive
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
[Obsolete("Use Status instead")]
IObservableCommitStatusClient CommitStatus { get; }
/// <summary>
/// A client for GitHub's Commit Status API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/statuses/">Commit Status API documentation</a> for more
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
IObservableCommitStatusClient Status { get; }
/// <summary>
/// Client for GitHub's Repository Deployments API
/// </summary>
@@ -302,8 +313,25 @@ namespace Octokit.Reactive
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[System.Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
IObservableRepositoryCommitsClient Commits { get; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
IObservableRepositoryCommitsClient Commit { get; }
/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
IObservableReleasesClient Release { get; }
/// <summary>
/// Client for managing pull requests.
/// </summary>

View File

@@ -11,7 +11,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(client, "client");
_client = client.GitDatabase.Blob;
_client = client.Git.Blob;
}
/// <summary>

View File

@@ -13,7 +13,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(client, "client");
_client = client.Repository.CommitStatus;
_client = client.Repository.Status;
_connection = client.Connection;
}

View File

@@ -10,7 +10,7 @@ namespace Octokit.Reactive
public ObservableCommitsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client.GitDatabase.Commit;
_client = client.Git.Commit;
}
/// <summary>

View File

@@ -14,7 +14,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(client, "client");
_reference = client.GitDatabase.Reference;
_reference = client.Git.Reference;
_connection = client.Connection;
}

View File

@@ -14,7 +14,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(client, "client");
_client = client.Release;
_client = client.Repository.Release;
_connection = client.Connection;
}

View File

@@ -19,7 +19,7 @@ namespace Octokit.Reactive
_client = client.Repository;
_connection = client.Connection;
CommitStatus = new ObservableCommitStatusClient(client);
Status = new ObservableCommitStatusClient(client);
Hooks = new ObservableRepositoryHooksClient(client);
Forks = new ObservableRepositoryForksClient(client);
#pragma warning disable CS0618 // Type or member is obsolete
@@ -33,7 +33,11 @@ namespace Octokit.Reactive
RepositoryComments = new ObservableRepositoryCommentsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Comment = new ObservableRepositoryCommentsClient(client);
#pragma warning disable CS0618 // Type or member is obsolete
Commits = new ObservableRepositoryCommitsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new ObservableRepositoryCommitsClient(client);
Release = new ObservableReleasesClient(client);
DeployKeys = new ObservableRepositoryDeployKeysClient(client);
Content = new ObservableRepositoryContentsClient(client);
Merging = new ObservableMergingClient(client);
@@ -192,7 +196,18 @@ namespace Octokit.Reactive
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
public IObservableCommitStatusClient CommitStatus { get; private set; }
[Obsolete("Use Status instead")]
public IObservableCommitStatusClient CommitStatus { get { return Status; }}
/// <summary>
/// A client for GitHub's Commit Status API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/statuses/">Commit Status API documentation</a> for more
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
public IObservableCommitStatusClient Status { get; private set; }
/// <summary>
/// Client for GitHub's Repository Deployments API
@@ -418,7 +433,7 @@ namespace Octokit.Reactive
/// <returns></returns>
public IObservable<CompareResult> Compare(string owner, string name, string @base, string head)
{
return _client.Commits.Compare(owner, name, @base, head).ToObservable();
return _client.Commit.Compare(owner, name, @base, head).ToObservable();
}
/// <summary>
@@ -444,8 +459,25 @@ namespace Octokit.Reactive
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
public IObservableRepositoryCommitsClient Commits { get; private set; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
public IObservableRepositoryCommitsClient Commit { get; private set; }
/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
public IObservableReleasesClient Release { get; private set; }
/// <summary>
/// Client for managing pull requests.
/// </summary>

View File

@@ -14,7 +14,7 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNull(client, "client");
_connection = client.Connection;
_commit = client.Repository.Commits;
_commit = client.Repository.Commit;
}
/// <summary>

View File

@@ -11,7 +11,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(client, "client");
_client = client.GitDatabase.Tag;
_client = client.Git.Tag;
}
/// <summary>

View File

@@ -11,7 +11,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(client, "client");
_client = client.GitDatabase.Tree;
_client = client.Git.Tree;
}
/// <summary>

View File

@@ -1,4 +1,6 @@
namespace Octokit.Reactive
using System;
namespace Octokit.Reactive
{
public interface IObservableGitHubClient : IApiInfoProvider
{
@@ -13,11 +15,14 @@
IObservablePullRequestsClient PullRequest { get; }
IObservableRepositoriesClient Repository { get; }
IObservableGistsClient Gist { get; }
[Obsolete("Use Repository.Release instead")]
IObservableReleasesClient Release { get; }
IObservableSshKeysClient SshKey { get; }
IObservableUsersClient User { get; }
[System.Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")]
IObservableNotificationsClient Notification { get; }
IObservableGitDatabaseClient Git { get; }
[Obsolete("Use Git instead")]
IObservableGitDatabaseClient GitDatabase { get; }
IObservableSearchClient Search { get; }
IObservableEnterpriseClient Enterprise { get; }

View File

@@ -42,8 +42,7 @@ namespace Octokit.Reactive
Repository = new ObservableRepositoriesClient(gitHubClient);
SshKey = new ObservableSshKeysClient(gitHubClient);
User = new ObservableUsersClient(gitHubClient);
Release = new ObservableReleasesClient(gitHubClient);
GitDatabase = new ObservableGitDatabaseClient(gitHubClient);
Git = new ObservableGitDatabaseClient(gitHubClient);
Gist = new ObservableGistsClient(gitHubClient);
Search = new ObservableSearchClient(gitHubClient);
Enterprise = new ObservableEnterpriseClient(gitHubClient);
@@ -63,11 +62,14 @@ namespace Octokit.Reactive
public IObservablePullRequestsClient PullRequest { get; private set; }
public IObservableRepositoriesClient Repository { get; private set; }
public IObservableGistsClient Gist { get; private set; }
public IObservableReleasesClient Release { get; private set; }
[Obsolete("Use Repository.Release instead")]
public IObservableReleasesClient Release { get { return Repository.Release; } }
public IObservableSshKeysClient SshKey { get; private set; }
public IObservableUsersClient User { get; private set; }
public IObservableNotificationsClient Notification { get; private set; }
public IObservableGitDatabaseClient GitDatabase { get; private set; }
[Obsolete("Use Git instead")]
public IObservableGitDatabaseClient GitDatabase { get { return Git; } }
public IObservableGitDatabaseClient Git { get; private set; }
public IObservableSearchClient Search { get; private set; }
public IObservableEnterpriseClient Enterprise { get; private set; }

View File

@@ -14,7 +14,7 @@ public class BlobClientTests : IDisposable
public BlobClientTests()
{
var github = Helper.GetAuthenticatedClient();
_fixture = github.GitDatabase.Blob;
_fixture = github.Git.Blob;
_context = github.CreateRepositoryContext("public-repo").Result;
}

View File

@@ -17,7 +17,7 @@ public class CommitStatusClientTests
// to go through the rigamarole of creating it all. But ideally, that's exactly what we'd do.
var github = Helper.GetAuthenticatedClient();
var statuses = await github.Repository.CommitStatus.GetAll(
var statuses = await github.Repository.Status.GetAll(
"rails",
"rails",
"94b857899506612956bb542e28e292308accb908");
@@ -33,7 +33,7 @@ public class CommitStatusClientTests
public async Task CanRetrieveCombinedStatus()
{
var github = Helper.GetAuthenticatedClient();
var status = await github.Repository.CommitStatus.GetCombined(
var status = await github.Repository.Status.GetCombined(
"libgit2",
"libgit2sharp",
"f54529997b6ad841be524654d9e9074ab8e7d41d");
@@ -69,7 +69,7 @@ public class CommitStatusClientTests
Description = "this is a test status"
};
var result = await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
var result = await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
Assert.Equal(CommitState.Pending, result.State);
}
@@ -85,9 +85,9 @@ public class CommitStatusClientTests
Description = "this is a test status"
};
await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
var statuses = await _github.Repository.CommitStatus.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
Assert.Equal(1, statuses.Count);
Assert.Equal(CommitState.Pending, statuses[0].State);
@@ -104,13 +104,13 @@ public class CommitStatusClientTests
Description = "this is a test status"
};
await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
status.State = CommitState.Success;
await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
var statuses = await _github.Repository.CommitStatus.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
Assert.Equal(2, statuses.Count);
Assert.Equal(CommitState.Success, statuses[0].State);
@@ -127,9 +127,9 @@ public class CommitStatusClientTests
Description = "this is a test status"
};
await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
var statuses = await _github.Repository.CommitStatus.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
Assert.Equal(1, statuses.Count);
Assert.Equal("default", statuses[0].Context);
@@ -147,13 +147,13 @@ public class CommitStatusClientTests
Context = "System A"
};
await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
status.Context = "System B";
await _github.Repository.CommitStatus.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
await _github.Repository.Status.Create(_context.RepositoryOwner, _context.RepositoryName, commit.Sha, status);
var statuses = await _github.Repository.CommitStatus.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
Assert.Equal(2, statuses.Count);
Assert.Equal("System B", statuses[0].Context);
@@ -167,7 +167,7 @@ public class CommitStatusClientTests
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = await client.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var blobResult = await client.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -178,11 +178,11 @@ public class CommitStatusClientTests
Sha = blobResult.Sha
});
var treeResult = await client.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree);
var treeResult = await client.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree);
var newCommit = new NewCommit("test-commit", treeResult.Sha);
return await client.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
return await client.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
}
public void Dispose()

View File

@@ -13,7 +13,7 @@ public class CommitsClientTests
public async Task CanCreateAndRetrieveCommit()
{
var github = Helper.GetAuthenticatedClient();
var fixture = github.GitDatabase.Commit;
var fixture = github.Git.Commit;
using (var context = await github.CreateRepositoryContext("public-repo"))
{
@@ -24,7 +24,7 @@ public class CommitsClientTests
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = await github.GitDatabase.Blob.Create(owner, context.Repository.Name, blob);
var blobResult = await github.Git.Blob.Create(owner, context.Repository.Name, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -35,7 +35,7 @@ public class CommitsClientTests
Sha = blobResult.Sha
});
var treeResult = await github.GitDatabase.Tree.Create(owner, context.Repository.Name, newTree);
var treeResult = await github.Git.Tree.Create(owner, context.Repository.Name, newTree);
var newCommit = new NewCommit("test-commit", treeResult.Sha);

View File

@@ -24,7 +24,7 @@ public class DeploymentStatusClientTests : IDisposable
Encoding = EncodingType.Utf8
};
var blobResult = github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob).Result;
var blobResult = github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -35,10 +35,10 @@ public class DeploymentStatusClientTests : IDisposable
Sha = blobResult.Sha
});
var treeResult = github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result;
var treeResult = github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
var commit = github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result;
var commit = github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result;
var newDeployment = new NewDeployment(commit.Sha) { AutoMerge = false };
_deployment = _deploymentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployment).Result;

View File

@@ -24,7 +24,7 @@ public class DeploymentsClientTests : IDisposable
Encoding = EncodingType.Utf8
};
var blobResult = github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob).Result;
var blobResult = github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -35,9 +35,9 @@ public class DeploymentsClientTests : IDisposable
Sha = blobResult.Sha
});
var treeResult = github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result;
var treeResult = github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
_commit = github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result;
_commit = github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result;
}
[IntegrationTest]

View File

@@ -22,6 +22,22 @@ public class IssuesClientTests : IDisposable
_context = github.CreateRepositoryContext(new NewRepository(repoName)).Result;
}
[IntegrationTest]
public async Task CanDeserializeIssue()
{
const string title = "a test issue";
const string description = "A new unassigned issue";
var newIssue = new NewIssue(title) { Body = description };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.NotEqual(0, issue.Id);
Assert.Equal(false, issue.Locked);
Assert.Equal(title, retrieved.Title);
Assert.Equal(description, retrieved.Body);
}
[IntegrationTest]
public async Task CanCreateRetrieveAndCloseIssue()
{

View File

@@ -9,7 +9,7 @@ using Octokit.Tests.Integration.Helpers;
public class IssuesEventsClientTests : IDisposable
{
private readonly IIssuesEventsClient _issuesEventsClientClient;
private readonly IIssuesEventsClient _issuesEventsClient;
private readonly IIssuesClient _issuesClient;
private readonly RepositoryContext _context;
@@ -17,7 +17,7 @@ public class IssuesEventsClientTests : IDisposable
{
var github = Helper.GetAuthenticatedClient();
_issuesEventsClientClient = github.Issue.Events;
_issuesEventsClient = github.Issue.Events;
_issuesClient = github.Issue;
var repoName = Helper.MakeNameWithTimestamp("public-repo");
@@ -30,13 +30,13 @@ public class IssuesEventsClientTests : IDisposable
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var issueEventInfo = await _issuesEventsClientClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
var issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Empty(issueEventInfo);
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
Assert.NotNull(closed);
issueEventInfo = await _issuesEventsClientClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(1, issueEventInfo.Count);
Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event);
@@ -67,7 +67,7 @@ public class IssuesEventsClientTests : IDisposable
.Result;
Assert.NotNull(closed2);
var issueEvents = await _issuesEventsClientClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(3, issueEvents.Count);
Assert.Equal(2, issueEvents.Count(issueEvent => issueEvent.Issue.Body == "Everything's coming up Millhouse"));
@@ -81,10 +81,10 @@ public class IssuesEventsClientTests : IDisposable
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
Assert.NotNull(closed);
var issueEvents = await _issuesEventsClientClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
int issueEventId = issueEvents[0].Id;
var issueEventLookupById = await _issuesEventsClientClient.Get(_context.RepositoryOwner, _context.RepositoryName, issueEventId);
var issueEventLookupById = await _issuesEventsClient.Get(_context.RepositoryOwner, _context.RepositoryName, issueEventId);
Assert.Equal(issueEventId, issueEventLookupById.Id);
Assert.Equal(issueEvents[0].Event, issueEventLookupById.Event);
@@ -98,6 +98,17 @@ public class IssuesEventsClientTests : IDisposable
Assert.Equal(EventInfoState.Unsubscribed, issue.Event);
}
[IntegrationTest]
public async Task CanDeserializeMergedEvent()
{
var issueEvent = await _issuesEventsClient.Get("octokit", "octokit.net", 490490630);
Assert.NotNull(issueEvent);
Assert.Equal(EventInfoState.Merged, issueEvent.Event);
Assert.Equal("0bb8747a0ad1a9efff201ea017a0a6a4f69b797e", issueEvent.CommitId);
Assert.Equal(new Uri("https://api.github.com/repos/octokit/octokit.net/commits/0bb8747a0ad1a9efff201ea017a0a6a4f69b797e"), issueEvent.CommitUrl);
}
public void Dispose()
{
_context.Dispose();

View File

@@ -40,21 +40,21 @@ public class MergingClientTests : IDisposable
async Task CreateTheWorld()
{
var master = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
// create new commit for master branch
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World! I want to be overwritten by featurebranch!" } });
var newMaster = await CreateCommit("baseline for merge", newMasterTree.Sha, master.Object.Sha);
// update master
await _github.GitDatabase.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var featureBranchCommit = await CreateCommit("this is the commit to merge", featureBranchTree.Sha, newMaster.Sha);
// create branch
await _github.GitDatabase.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
}
async Task<TreeResponse> CreateTree(IEnumerable<KeyValuePair<string, string>> treeContents)
@@ -68,7 +68,7 @@ public class MergingClientTests : IDisposable
Content = c.Value,
Encoding = EncodingType.Utf8
};
var baselineBlobResult = await _github.GitDatabase.Blob.Create(Helper.UserName, _context.RepositoryName, baselineBlob);
var baselineBlobResult = await _github.Git.Blob.Create(Helper.UserName, _context.RepositoryName, baselineBlob);
collection.Add(new NewTreeItem
{
@@ -85,13 +85,13 @@ public class MergingClientTests : IDisposable
newTree.Tree.Add(item);
}
return await _github.GitDatabase.Tree.Create(Helper.UserName, _context.RepositoryName, newTree);
return await _github.Git.Tree.Create(Helper.UserName, _context.RepositoryName, newTree);
}
async Task<Commit> CreateCommit(string message, string sha, string parent)
{
var newCommit = new NewCommit(message, sha, parent);
return await _github.GitDatabase.Commit.Create(Helper.UserName, _context.RepositoryName, newCommit);
return await _github.Git.Commit.Create(Helper.UserName, _context.RepositoryName, newCommit);
}
public void Dispose()

View File

@@ -235,7 +235,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
// Creating a branch
var newBranch = new NewReference(branchRef, createdCommitInMaster.Sha);
await _github.GitDatabase.Reference.Create(Helper.UserName, repoName, newBranch);
await _github.Git.Reference.Create(Helper.UserName, repoName, newBranch);
// Creating a commit in the branch
@@ -264,7 +264,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
Encoding = EncodingType.Utf8
};
var createdBlob = await _github.GitDatabase.Blob.Create(Helper.UserName, repoName, blob);
var createdBlob = await _github.Git.Blob.Create(Helper.UserName, repoName, blob);
// Creating a tree
var newTree = new NewTree();
@@ -276,15 +276,15 @@ public class PullRequestReviewCommentsClientTests : IDisposable
Sha = createdBlob.Sha,
});
var createdTree = await _github.GitDatabase.Tree.Create(Helper.UserName, repoName, newTree);
var createdTree = await _github.Git.Tree.Create(Helper.UserName, repoName, newTree);
var treeSha = createdTree.Sha;
// Creating a commit
var parent = await _github.GitDatabase.Reference.Get(Helper.UserName, repoName, reference);
var parent = await _github.Git.Reference.Get(Helper.UserName, repoName, reference);
var commit = new NewCommit(commitMessage, treeSha, parent.Object.Sha);
var createdCommit = await _github.GitDatabase.Commit.Create(Helper.UserName, repoName, commit);
await _github.GitDatabase.Reference.Update(Helper.UserName, repoName, reference, new ReferenceUpdate(createdCommit.Sha));
var createdCommit = await _github.Git.Commit.Create(Helper.UserName, repoName, commit);
await _github.Git.Reference.Update(Helper.UserName, repoName, reference, new ReferenceUpdate(createdCommit.Sha));
return createdCommit;
}

View File

@@ -244,10 +244,10 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var master = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World, we meet again!" } });
var masterCommit = await CreateCommit("Commit in master", newMasterTree.Sha, master.Object.Sha);
await _github.GitDatabase.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(masterCommit.Sha));
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(masterCommit.Sha));
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
@@ -275,7 +275,7 @@ public class PullRequestsClientTests : IDisposable
var merge = new MergePullRequest { CommitMessage = "thing the thing" };
var result = await _fixture.Merge(Helper.UserName, _context.RepositoryName, pullRequest.Number, merge);
var master = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
Assert.Equal(result.Sha, master.Object.Sha);
}
@@ -306,11 +306,11 @@ public class PullRequestsClientTests : IDisposable
const string commitMessage = "Another commit in branch";
var branch = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/" + branchName);
var branch = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/" + branchName);
var newTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newCommit = await CreateCommit(commitMessage, newTree.Sha, branch.Object.Sha);
await _github.GitDatabase.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/" + branchName, new ReferenceUpdate(newCommit.Sha));
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/" + branchName, new ReferenceUpdate(newCommit.Sha));
await _repositoryCommentsClient.Create(Helper.UserName, _context.RepositoryName, newCommit.Sha, new NewCommitComment("I am a nice comment") { Path = "README.md", Position = 1 });
@@ -352,26 +352,26 @@ public class PullRequestsClientTests : IDisposable
async Task CreateTheWorld()
{
var master = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
// create new commit for master branch
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await CreateCommit("baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// update master
await _github.GitDatabase.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var featureBranchCommit = await CreateCommit("this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
// create branch
await _github.GitDatabase.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
var otherFeatureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something else" } });
var otherFeatureBranchCommit = await CreateCommit("this is the other commit to merge into the other pull request", otherFeatureBranchTree.Sha, newMaster.Sha);
await _github.GitDatabase.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-other-branch", otherFeatureBranchCommit.Sha));
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-other-branch", otherFeatureBranchCommit.Sha));
}
async Task<TreeResponse> CreateTree(IEnumerable<KeyValuePair<string, string>> treeContents)
@@ -385,7 +385,7 @@ public class PullRequestsClientTests : IDisposable
Content = c.Value,
Encoding = EncodingType.Utf8
};
var baselineBlobResult = await _github.GitDatabase.Blob.Create(Helper.UserName, _context.RepositoryName, baselineBlob);
var baselineBlobResult = await _github.Git.Blob.Create(Helper.UserName, _context.RepositoryName, baselineBlob);
collection.Add(new NewTreeItem
{
@@ -402,13 +402,13 @@ public class PullRequestsClientTests : IDisposable
newTree.Tree.Add(item);
}
return await _github.GitDatabase.Tree.Create(Helper.UserName, _context.RepositoryName, newTree);
return await _github.Git.Tree.Create(Helper.UserName, _context.RepositoryName, newTree);
}
async Task<Commit> CreateCommit(string message, string sha, string parent)
{
var newCommit = new NewCommit(message, sha, parent);
return await _github.GitDatabase.Commit.Create(Helper.UserName, _context.RepositoryName, newCommit);
return await _github.Git.Commit.Create(Helper.UserName, _context.RepositoryName, newCommit);
}
public void Dispose()

View File

@@ -17,7 +17,7 @@ public class ReferencesClientTests : IDisposable
{
_github = Helper.GetAuthenticatedClient();
_fixture = _github.GitDatabase.Reference;
_fixture = _github.Git.Reference;
_context = _github.CreateRepositoryContext("public-repo").Result;
}
@@ -77,7 +77,7 @@ public class ReferencesClientTests : IDisposable
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = await _github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var blobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -88,11 +88,11 @@ public class ReferencesClientTests : IDisposable
Sha = blobResult.Sha
});
var treeResult = await _github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree);
var treeResult = await _github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree);
var newCommit = new NewCommit("This is a new commit", treeResult.Sha);
var commitResult = await _github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
var commitResult = await _github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
var newReference = new NewReference("heads/develop", commitResult.Sha);
var result = await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, newReference);
@@ -108,13 +108,13 @@ public class ReferencesClientTests : IDisposable
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var firstBlobResult = await _github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, firstBlob);
var firstBlobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, firstBlob);
var secondBlob = new NewBlob
{
Content = "This is a test!",
Encoding = EncodingType.Utf8
};
var secondBlobResult = await _github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, secondBlob);
var secondBlobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, secondBlob);
var firstTree = new NewTree();
firstTree.Tree.Add(new NewTreeItem
@@ -125,9 +125,9 @@ public class ReferencesClientTests : IDisposable
Sha = firstBlobResult.Sha
});
var firstTreeResult = await _github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, firstTree);
var firstTreeResult = await _github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, firstTree);
var firstCommit = new NewCommit("This is a new commit", firstTreeResult.Sha);
var firstCommitResult = await _github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, firstCommit);
var firstCommitResult = await _github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, firstCommit);
var newReference = new NewReference("heads/develop", firstCommitResult.Sha);
await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, newReference);
@@ -141,10 +141,10 @@ public class ReferencesClientTests : IDisposable
Sha = secondBlobResult.Sha
});
var secondTreeResult = await _github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, secondTree);
var secondTreeResult = await _github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, secondTree);
var secondCommit = new NewCommit("This is a new commit", secondTreeResult.Sha, firstCommitResult.Sha);
var secondCommitResult = await _github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, secondCommit);
var secondCommitResult = await _github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, secondCommit);
var referenceUpdate = new ReferenceUpdate(secondCommitResult.Sha);
@@ -161,7 +161,7 @@ public class ReferencesClientTests : IDisposable
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = await _github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var blobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -172,11 +172,11 @@ public class ReferencesClientTests : IDisposable
Sha = blobResult.Sha
});
var treeResult = await _github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree);
var treeResult = await _github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree);
var newCommit = new NewCommit("This is a new commit", treeResult.Sha);
var commitResult = await _github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
var commitResult = await _github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
var newReference = new NewReference("heads/develop", commitResult.Sha);

View File

@@ -20,7 +20,7 @@ public class ReleasesClientTests
public TheGetReleasesMethod()
{
var github = Helper.GetAuthenticatedClient();
_releaseClient = github.Release;
_releaseClient = github.Repository.Release;
_context = github.CreateRepositoryContext("public-repo").Result;
}
@@ -84,7 +84,7 @@ public class ReleasesClientTests
public TheEditMethod()
{
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Release;
_releaseClient = _github.Repository.Release;
_context = _github.CreateRepositoryContext("public-repo").Result;
}
@@ -143,7 +143,7 @@ public class ReleasesClientTests
public TheUploadAssetMethod()
{
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Release;
_releaseClient = _github.Repository.Release;
_context = _github.CreateRepositoryContext("public-repo").Result;
}

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
using Octokit.Tests.Integration.Helpers;
public class RepositoryCollaboratorClientTests
{
public class TheGetAllMethod
{
[IntegrationTest]
public async Task ReturnsAllCollaborators()
{
var github = Helper.GetAuthenticatedClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await github.CreateRepositoryContext(new NewRepository(repoName)))
{
var fixture = github.Repository.Collaborator;
// add a collaborator
await fixture.Add(context.RepositoryOwner, context.RepositoryName, "m-zuber-octokit-integration-tests");
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName);
Assert.NotNull(collaborators);
Assert.Equal(2, collaborators.Count);
}
}
}
public class TheIsCollaboratorMethod
{
[IntegrationTest]
public async Task ReturnsTrueIfUserIsCollaborator()
{
var github = Helper.GetAuthenticatedClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await github.CreateRepositoryContext(new NewRepository(repoName)))
{
var fixture = github.Repository.Collaborator;
// add a collaborator
fixture.Add(context.RepositoryOwner, context.RepositoryName, "m-zuber-octokit-integration-tests");
var isCollab = await fixture.IsCollaborator(context.RepositoryOwner, context.RepositoryName, "m-zuber-octokit-integration-tests");
Assert.True(isCollab);
}
}
}
}

View File

@@ -17,7 +17,7 @@ public class RepositoryCommitsClientTests
{
var client = Helper.GetAuthenticatedClient();
_fixture = client.Repository.Commits;
_fixture = client.Repository.Commit;
}
[IntegrationTest]
@@ -99,7 +99,7 @@ public class RepositoryCommitsClientTests
{
_github = Helper.GetAuthenticatedClient();
_fixture = _github.Repository.Commits;
_fixture = _github.Repository.Commit;
_context = _github.CreateRepositoryContext("source-repo").Result;
}
@@ -148,8 +148,8 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var master = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var branch = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/my-branch");
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var branch = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/my-branch");
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, master.Object.Sha, branch.Object.Sha);
@@ -160,21 +160,21 @@ public class RepositoryCommitsClientTests
async Task CreateTheWorld()
{
var master = await _github.GitDatabase.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
// create new commit for master branch
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await CreateCommit("baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// update master
await _github.GitDatabase.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var newFeature = await CreateCommit("this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
// create branch
await _github.GitDatabase.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", newFeature.Sha));
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", newFeature.Sha));
}
async Task<TreeResponse> CreateTree(IDictionary<string, string> treeContents)
@@ -188,7 +188,7 @@ public class RepositoryCommitsClientTests
Content = c.Value,
Encoding = EncodingType.Utf8
};
var baselineBlobResult = await _github.GitDatabase.Blob.Create(Helper.UserName, _context.RepositoryName, baselineBlob);
var baselineBlobResult = await _github.Git.Blob.Create(Helper.UserName, _context.RepositoryName, baselineBlob);
collection.Add(new NewTreeItem
{
@@ -205,13 +205,13 @@ public class RepositoryCommitsClientTests
newTree.Tree.Add(item);
}
return await _github.GitDatabase.Tree.Create(Helper.UserName, _context.RepositoryName, newTree);
return await _github.Git.Tree.Create(Helper.UserName, _context.RepositoryName, newTree);
}
async Task<Commit> CreateCommit(string message, string sha, string parent)
{
var newCommit = new NewCommit(message, sha, parent);
return await _github.GitDatabase.Commit.Create(Helper.UserName, _context.RepositoryName, newCommit);
return await _github.Git.Commit.Create(Helper.UserName, _context.RepositoryName, newCommit);
}
public void Dispose()

View File

@@ -13,7 +13,7 @@ namespace Octokit.Tests.Integration.Clients
public StatisticsClientTests()
{
_client = Helper.GetAuthenticatedClient();
_fixture = _client.GitDatabase.Commit;
_fixture = _client.Git.Commit;
}
[IntegrationTest]
@@ -115,7 +115,7 @@ namespace Octokit.Tests.Integration.Clients
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = await _client.GitDatabase.Blob.Create(owner, repository, blob);
var blobResult = await _client.Git.Blob.Create(owner, repository, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -126,7 +126,7 @@ namespace Octokit.Tests.Integration.Clients
Sha = blobResult.Sha
});
var treeResult = await _client.GitDatabase.Tree.Create(owner, repository, newTree);
var treeResult = await _client.Git.Tree.Create(owner, repository, newTree);
var newCommit = new NewCommit("test-commit", treeResult.Sha);

View File

@@ -15,7 +15,7 @@ public class TreeClientTests : IDisposable
{
_github = Helper.GetAuthenticatedClient();
_fixture = _github.GitDatabase.Tree;
_fixture = _github.Git.Tree;
_context = _github.CreateRepositoryContext("public-repo").Result;
}
@@ -29,7 +29,7 @@ public class TreeClientTests : IDisposable
Encoding = EncodingType.Utf8
};
var createdBlob = await _github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var createdBlob = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
@@ -63,7 +63,7 @@ public class TreeClientTests : IDisposable
Encoding = EncodingType.Utf8
};
var blobResult = await _github.GitDatabase.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var blobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob);
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem

View File

@@ -16,7 +16,7 @@ namespace Octokit.Tests.Integration.Helpers
Content = c.Value,
Encoding = EncodingType.Utf8
};
var baselineBlobResult = await client.GitDatabase.Blob.Create(repository.Owner.Login, repository.Name, baselineBlob);
var baselineBlobResult = await client.Git.Blob.Create(repository.Owner.Login, repository.Name, baselineBlob);
collection.Add(new NewTreeItem
{
@@ -33,32 +33,32 @@ namespace Octokit.Tests.Integration.Helpers
newTree.Tree.Add(item);
}
return await client.GitDatabase.Tree.Create(repository.Owner.Login, repository.Name, newTree);
return await client.Git.Tree.Create(repository.Owner.Login, repository.Name, newTree);
}
public static async Task<Commit> CreateCommit(this IGitHubClient client, Repository repository, string message, string sha, string parent)
{
var newCommit = new NewCommit(message, sha, parent);
return await client.GitDatabase.Commit.Create(repository.Owner.Login, repository.Name, newCommit);
return await client.Git.Commit.Create(repository.Owner.Login, repository.Name, newCommit);
}
public static async Task<Reference> CreateTheWorld(this IGitHubClient client, Repository repository)
{
var master = await client.GitDatabase.Reference.Get(repository.Owner.Login, repository.Name, "heads/master");
var master = await client.Git.Reference.Get(repository.Owner.Login, repository.Name, "heads/master");
// create new commit for master branch
var newMasterTree = await client.CreateTree(repository, new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await client.CreateCommit(repository, "baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// update master
await client.GitDatabase.Reference.Update(repository.Owner.Login, repository.Name, "heads/master", new ReferenceUpdate(newMaster.Sha));
await client.Git.Reference.Update(repository.Owner.Login, repository.Name, "heads/master", new ReferenceUpdate(newMaster.Sha));
// create new commit for feature branch
var featureBranchTree = await client.CreateTree(repository, new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var featureBranchCommit = await client.CreateCommit(repository, "this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
// create branch
return await client.GitDatabase.Reference.Create(repository.Owner.Login, repository.Name, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
return await client.Git.Reference.Create(repository.Owner.Login, repository.Name, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
}
}
}

View File

@@ -131,6 +131,7 @@
<Compile Include="Reactive\ObservableUserEmailsClientTests.cs" />
<Compile Include="Reactive\ObservableTeamsClientTests.cs" />
<Compile Include="RedirectTests.cs" />
<Compile Include="Clients\RepositoryCollaboratorClientTests.cs" />
<Compile Include="SelfTests.cs" />
</ItemGroup>
<ItemGroup>

View File

@@ -360,18 +360,18 @@ namespace Octokit.Tests.Clients
{
"payload", new
{
action = "assigned",
action = "created",
issue = new
{
number = 1337
},
assignee = new
{
id = 1337
},
label = new
{
name = "bug"
number = 1337,
assignee = new
{
id = 1337
},
labels = new[]
{
new { name = "bug"}
}
}
}
}
@@ -382,10 +382,10 @@ namespace Octokit.Tests.Clients
Assert.Equal(1, activities.Count);
var payload = activities.FirstOrDefault().Payload as IssueEventPayload;
Assert.Equal("assigned", payload.Action);
Assert.Equal("created", payload.Action);
Assert.Equal(1337, payload.Issue.Number);
Assert.Equal(1337, payload.Assignee.Id);
Assert.Equal("bug", payload.Label.Name);
Assert.Equal(1337, payload.Issue.Assignee.Id);
Assert.Equal("bug", payload.Issue.Labels.First().Name);
}
[Fact]

View File

@@ -21,7 +21,7 @@ namespace Octokit.Tests.Reactive
client.Get("fake", "repo", "123456ABCD");
gitHubClient.GitDatabase.Blob.Received().Get("fake", "repo", "123456ABCD");
gitHubClient.Git.Blob.Received().Get("fake", "repo", "123456ABCD");
}
[Fact]
@@ -49,7 +49,7 @@ namespace Octokit.Tests.Reactive
client.Create("fake", "repo", newBlob);
gitHubClient.GitDatabase.Blob.Received().Create("fake", "repo", newBlob);
gitHubClient.Git.Blob.Received().Create("fake", "repo", newBlob);
}
[Fact]

View File

@@ -44,7 +44,7 @@ namespace Octokit.Tests.Reactive
client.Get("owner", "name", "reference");
gitHubClient.GitDatabase.Commit.Received(1).Get("owner", "name", "reference");
gitHubClient.Git.Commit.Received(1).Get("owner", "name", "reference");
}
}
@@ -72,7 +72,7 @@ namespace Octokit.Tests.Reactive
client.Create("owner", "name", newCommit);
gitHubClient.GitDatabase.Commit.Received().Create("owner", "name", newCommit);
gitHubClient.Git.Commit.Received().Create("owner", "name", newCommit);
}
}
}

View File

@@ -52,7 +52,7 @@ namespace Octokit.Tests.Reactive
client.Get("fake", "repo", 1);
gitHubClient.Release.Received(1).Get("fake", "repo", 1);
gitHubClient.Repository.Release.Received(1).Get("fake", "repo", 1);
}
[Fact]
@@ -78,7 +78,7 @@ namespace Octokit.Tests.Reactive
releasesClient.Create("fake", "repo", data);
gitHubClient.Release.Received(1).Create("fake", "repo", data);
gitHubClient.Repository.Release.Received(1).Create("fake", "repo", data);
}
[Fact]
@@ -105,7 +105,7 @@ namespace Octokit.Tests.Reactive
releasesClient.Edit("fake", "repo", 1, data);
gitHubClient.Release.Received(1).Edit("fake", "repo", 1, data);
gitHubClient.Repository.Release.Received(1).Edit("fake", "repo", 1, data);
}
[Fact]
@@ -132,7 +132,7 @@ namespace Octokit.Tests.Reactive
client.Delete("fake", "repo", 1);
gitHubClient.Release.Received(1).Delete("fake", "repo", 1);
gitHubClient.Repository.Release.Received(1).Delete("fake", "repo", 1);
}
[Fact]
@@ -186,7 +186,7 @@ namespace Octokit.Tests.Reactive
releasesClient.UploadAsset(release, upload);
gitHubClient.Release.Received(1).UploadAsset(release, upload);
gitHubClient.Repository.Release.Received(1).UploadAsset(release, upload);
}
[Fact]
@@ -212,7 +212,7 @@ namespace Octokit.Tests.Reactive
client.GetAsset("fake", "repo", 1);
gitHubClient.Release.Received(1).GetAsset("fake", "repo", 1);
gitHubClient.Repository.Release.Received(1).GetAsset("fake", "repo", 1);
}
[Fact]
@@ -238,7 +238,7 @@ namespace Octokit.Tests.Reactive
client.EditAsset("fake", "repo", 1, data);
gitHubClient.Release.Received(1).EditAsset("fake", "repo", 1, data);
gitHubClient.Repository.Release.Received(1).EditAsset("fake", "repo", 1, data);
}
[Fact]

View File

@@ -246,12 +246,12 @@ namespace Octokit.Tests.Reactive
{
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
Assert.Throws<ArgumentNullException>(() => client.Commits.Get(null, "repo", "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commits.Get("owner", null, "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commits.Get("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commits.Get("", "repo", "reference"));
Assert.Throws<ArgumentException>(() => client.Commits.Get("owner", "", "reference"));
Assert.Throws<ArgumentException>(() => client.Commits.Get("owner", "repo", ""));
Assert.Throws<ArgumentNullException>(() => client.Commit.Get(null, "repo", "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commit.Get("owner", null, "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commit.Get("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commit.Get("", "repo", "reference"));
Assert.Throws<ArgumentException>(() => client.Commit.Get("owner", "", "reference"));
Assert.Throws<ArgumentException>(() => client.Commit.Get("owner", "repo", ""));
}
[Fact]
@@ -260,9 +260,9 @@ namespace Octokit.Tests.Reactive
var github = Substitute.For<IGitHubClient>();
var client = new ObservableRepositoriesClient(github);
client.Commits.Get("owner", "repo", "reference");
client.Commit.Get("owner", "repo", "reference");
github.Repository.Commits.Received(1).Get("owner", "repo", "reference");
github.Repository.Commit.Received(1).Get("owner", "repo", "reference");
}
}
@@ -273,11 +273,11 @@ namespace Octokit.Tests.Reactive
{
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
Assert.Throws<ArgumentNullException>(() => client.Commits.GetAll(null, "repo"));
Assert.Throws<ArgumentNullException>(() => client.Commits.GetAll("owner", null));
Assert.Throws<ArgumentNullException>(() => client.Commits.GetAll("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commits.GetAll("", "repo"));
Assert.Throws<ArgumentException>(() => client.Commits.GetAll("owner", ""));
Assert.Throws<ArgumentNullException>(() => client.Commit.GetAll(null, "repo"));
Assert.Throws<ArgumentNullException>(() => client.Commit.GetAll("owner", null));
Assert.Throws<ArgumentNullException>(() => client.Commit.GetAll("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commit.GetAll("", "repo"));
Assert.Throws<ArgumentException>(() => client.Commit.GetAll("owner", ""));
}
[Fact]
@@ -287,7 +287,7 @@ namespace Octokit.Tests.Reactive
var client = new ObservableRepositoriesClient(github);
var expected = new Uri("repos/owner/repo/commits", UriKind.Relative);
client.Commits.GetAll("owner", "repo");
client.Commit.GetAll("owner", "repo");
github.Connection.Received(1).Get<List<GitHubCommit>>(expected, Arg.Any<IDictionary<string, string>>(), null);
}

View File

@@ -21,7 +21,7 @@ namespace Octokit.Tests
client.Get("fake", "repo", "123456ABCD");
gitHubClient.GitDatabase.Tree.Received().Get("fake", "repo", "123456ABCD");
gitHubClient.Git.Tree.Received().Get("fake", "repo", "123456ABCD");
}
[Fact]
@@ -48,7 +48,7 @@ namespace Octokit.Tests
client.GetRecursive("fake", "repo", "123456ABCD");
gitHubClient.GitDatabase.Tree.Received().GetRecursive("fake", "repo", "123456ABCD");
gitHubClient.Git.Tree.Received().GetRecursive("fake", "repo", "123456ABCD");
}
[Fact]
@@ -76,7 +76,7 @@ namespace Octokit.Tests
client.Create("fake", "repo", newTree);
gitHubClient.GitDatabase.Tree.Received().Create("fake", "repo", newTree);
gitHubClient.Git.Tree.Received().Create("fake", "repo", newTree);
}
[Fact]

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using System;
#if NET_45
using System.Collections.Generic;
#endif
@@ -194,8 +195,19 @@ namespace Octokit
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
[Obsolete("Use Status instead")]
ICommitStatusClient CommitStatus { get; }
/// <summary>
/// A client for GitHub's Commit Status API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/statuses/">Commit Status API documentation</a> for more
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
ICommitStatusClient Status { get; }
/// <summary>
/// A client for GitHub's Repository Hooks API.
/// </summary>
@@ -247,8 +259,25 @@ namespace Octokit
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[System.Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
IRepositoryCommitsClient Commits { get; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
IRepositoryCommitsClient Commit { get; }
/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
IReleasesClient Release { get; }
/// <summary>
/// Client for GitHub's Repository Merging API
/// </summary>

View File

@@ -208,10 +208,9 @@ namespace Octokit
}
/// <summary>
/// Creates an issue for the specified repository. Any user with pull access to a repository can create an
/// issue.
/// Updates an issue for the specified repository. Issue owners and users with push access can edit an issue.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/#create-an-issue</remarks>
/// <remarks>https://developer.github.com/v3/issues/#edit-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>

View File

@@ -109,10 +109,9 @@ namespace Octokit
/// <returns>A list of licenses available on the site</returns>
public async Task<IReadOnlyList<LicenseMetadata>> GetAllLicenses()
{
const string previewAcceptsHeader = "application/vnd.github.drax-preview+json";
var endpoint = new Uri("licenses", UriKind.Relative);
var response = await _connection.Get<LicenseMetadata[]>(endpoint, null, previewAcceptsHeader)
var response = await _connection.Get<LicenseMetadata[]>(endpoint, null, AcceptHeaders.LicensesApiPreview)
.ConfigureAwait(false);
return new ReadOnlyCollection<LicenseMetadata>(response.Body);
}
@@ -124,10 +123,9 @@ namespace Octokit
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
public async Task<License> GetLicense(string key)
{
const string previewAcceptsHeader = "application/vnd.github.drax-preview+json";
var endpoint = new Uri("licenses/" + Uri.EscapeUriString(key), UriKind.Relative);
var response = await _connection.Get<License>(endpoint, null, previewAcceptsHeader)
var response = await _connection.Get<License>(endpoint, null, AcceptHeaders.LicensesApiPreview)
.ConfigureAwait(false);
return response.Body;
}

View File

@@ -37,7 +37,7 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(name, "repository");
var endpoint = ApiUrls.Releases(owner, name);
return ApiConnection.GetAll<Release>(endpoint, null, "application/vnd.github.v3");
return ApiConnection.GetAll<Release>(endpoint, null, AcceptHeaders.StableVersion);
}
/// <summary>
@@ -78,7 +78,7 @@ namespace Octokit
Ensure.ArgumentNotNull(data, "data");
var endpoint = ApiUrls.Releases(owner, name);
return ApiConnection.Post<Release>(endpoint, data, "application/vnd.github.v3");
return ApiConnection.Post<Release>(endpoint, data, AcceptHeaders.StableVersion);
}
/// <summary>
@@ -140,7 +140,7 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(name, "name");
var endpoint = ApiUrls.ReleaseAssets(owner, name, id);
return ApiConnection.GetAll<ReleaseAsset>(endpoint, null, "application/vnd.github.v3");
return ApiConnection.GetAll<ReleaseAsset>(endpoint, null, AcceptHeaders.StableVersion);
}
/// <summary>
@@ -165,7 +165,7 @@ namespace Octokit
return ApiConnection.Post<ReleaseAsset>(
endpoint,
data.RawData,
"application/vnd.github.v3",
AcceptHeaders.StableVersion,
data.ContentType,
data.Timeout.GetValueOrDefault());
}
@@ -173,7 +173,7 @@ namespace Octokit
return ApiConnection.Post<ReleaseAsset>(
endpoint,
data.RawData,
"application/vnd.github.v3",
AcceptHeaders.StableVersion,
data.ContentType);
}

View File

@@ -22,7 +22,7 @@ namespace Octokit
/// <param name="apiConnection">An API connection</param>
public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection)
{
CommitStatus = new CommitStatusClient(apiConnection);
Status = new CommitStatusClient(apiConnection);
Hooks = new RepositoryHooksClient(apiConnection);
Forks = new RepositoryForksClient(apiConnection);
#pragma warning disable CS0618 // Type or member is obsolete
@@ -36,7 +36,11 @@ namespace Octokit
RepositoryComments = new RepositoryCommentsClient(apiConnection);
#pragma warning restore CS0618 // Type or member is obsolete
Comment = new RepositoryCommentsClient(apiConnection);
#pragma warning disable CS0618 // Type or member is obsolete
Commits = new RepositoryCommitsClient(apiConnection);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new RepositoryCommitsClient(apiConnection);
Release = new ReleasesClient(apiConnection);
DeployKeys = new RepositoryDeployKeysClient(apiConnection);
Merging = new MergingClient(apiConnection);
Content = new RepositoryContentsClient(apiConnection);
@@ -312,7 +316,18 @@ namespace Octokit
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
public ICommitStatusClient CommitStatus { get; private set; }
[Obsolete("Use Status instead")]
public ICommitStatusClient CommitStatus { get { return Status; } }
/// <summary>
/// A client for GitHub's Commit Status API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/statuses/">Commit Status API documentation</a> for more
/// details. Also check out the <a href="https://github.com/blog/1227-commit-status-api">blog post</a>
/// that announced this feature.
/// </remarks>
public ICommitStatusClient Status { get; private set; }
/// <summary>
/// A client for GitHub's Repository Hooks API.
@@ -365,8 +380,25 @@ namespace Octokit
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
public IRepositoryCommitsClient Commits { get; private set; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
public IRepositoryCommitsClient Commit { get; private set; }
/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
public IReleasesClient Release { get; private set; }
/// <summary>
/// Client for GitHub's Repository Merging API
/// </summary>

View File

@@ -92,10 +92,9 @@ namespace Octokit
PullRequest = new PullRequestsClient(apiConnection);
Repository = new RepositoriesClient(apiConnection);
Gist = new GistsClient(apiConnection);
Release = new ReleasesClient(apiConnection);
User = new UsersClient(apiConnection);
SshKey = new SshKeysClient(apiConnection);
GitDatabase = new GitDatabaseClient(apiConnection);
Git = new GitDatabaseClient(apiConnection);
Search = new SearchClient(apiConnection);
Deployment = new DeploymentsClient(apiConnection);
Enterprise = new EnterpriseClient(apiConnection);
@@ -216,14 +215,17 @@ namespace Octokit
/// </remarks>
public IGistsClient Gist { get; private set; }
// TODO: this should be under Repositories to align with the API docs
/// <summary>
/// Access GitHub's Releases API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
public IReleasesClient Release { get; private set; }
[Obsolete("Use Repository.Release instead")]
public IReleasesClient Release
{
get { return Repository.Release; }
}
// TODO: this should be under Users to align with the API docs
// TODO: this should be named PublicKeys to align with the API docs
@@ -258,7 +260,16 @@ namespace Octokit
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
/// </remarks>
public IGitDatabaseClient GitDatabase { get; private set; }
[Obsolete("Use Git instead")]
public IGitDatabaseClient GitDatabase { get { return Git; } }
/// <summary>
/// Access GitHub's Git Data API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
/// </remarks>
public IGitDatabaseClient Git { get; private set; }
/// <summary>
/// Access GitHub's Search API.

View File

@@ -2,6 +2,14 @@
{
public static class AcceptHeaders
{
public const string StableVersion = "application/vnd.github.v3";
public const string StableVersionHtml = "application/vnd.github.html";
public const string RedirectsPreviewThenStableVersionJson = "application/vnd.github.quicksilver-preview+json; charset=utf-8, application/vnd.github.v3+json; charset=utf-8";
public const string LicensesApiPreview = "application/vnd.github.drax-preview+json";
public const string ProtectedBranchesApiPreview = "application/vnd.github.loki-preview+json";
}
}

View File

@@ -519,7 +519,7 @@ namespace Octokit
async Task<IApiResponse<string>> GetHtml(IRequest request)
{
request.Headers.Add("Accept", "application/vnd.github.html");
request.Headers.Add("Accept", AcceptHeaders.StableVersionHtml);
var response = await RunRequest(request, CancellationToken.None);
return new ApiResponse<string>(response, response.Body as string);
}

View File

@@ -11,8 +11,6 @@ namespace Octokit.Internal
/// </summary>
public class JsonHttpPipeline
{
private const string v3ApiVersion = "application/vnd.github.quicksilver-preview+json; charset=utf-8, application/vnd.github.v3+json; charset=utf-8";
readonly IJsonSerializer _serializer;
public JsonHttpPipeline() : this(new SimpleJsonSerializer())
@@ -32,7 +30,7 @@ namespace Octokit.Internal
if (!request.Headers.ContainsKey("Accept"))
{
request.Headers["Accept"] = v3ApiVersion;
request.Headers["Accept"] = AcceptHeaders.RedirectsPreviewThenStableVersionJson;
}
if (request.Method == HttpMethod.Get || request.Body == null) return;

View File

@@ -1,6 +1,8 @@
namespace Octokit
using System;
namespace Octokit
{
/// <summary>
/// <summary>
/// A Client for the GitHub API v3. You can read more about the api here: http://developer.github.com.
/// </summary>
public interface IGitHubClient : IApiInfoProvider
@@ -89,6 +91,7 @@
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
/// </remarks>
[Obsolete("Use Repository.Release instead")]
IReleasesClient Release { get; }
// TODO: this should be under Users to align with the API docs
@@ -125,8 +128,17 @@
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
/// </remarks>
[Obsolete("Use Git instead")]
IGitDatabaseClient GitDatabase { get; }
/// <summary>
/// Access GitHub's Git Data API.
/// </summary>
/// <remarks>
/// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
/// </remarks>
IGitDatabaseClient Git { get; }
/// <summary>
/// Access GitHub's Search API.
/// </summary>

View File

@@ -7,7 +7,5 @@ namespace Octokit
{
public string Action { get; protected set; }
public Issue Issue { get; protected set; }
public User Assignee { get; protected set; }
public Label Label { get; protected set; }
}
}

View File

@@ -10,8 +10,9 @@ namespace Octokit
{
public Issue() { }
public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, ItemState state, string title, string body, User user, IReadOnlyList<Label> labels, User assignee, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt)
public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, ItemState state, string title, string body, User user, IReadOnlyList<Label> labels, User assignee, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt, int id, bool locked)
{
Id = id;
Url = url;
HtmlUrl = htmlUrl;
CommentsUrl = commentsUrl;
@@ -29,8 +30,14 @@ namespace Octokit
ClosedAt = closedAt;
CreatedAt = createdAt;
UpdatedAt = updatedAt;
Locked = locked;
}
/// <summary>
/// The Id for this issue
/// </summary>
public int Id { get; protected set; }
/// <summary>
/// The URL for this issue.
/// </summary>
@@ -113,6 +120,11 @@ namespace Octokit
/// </summary>
public DateTimeOffset? UpdatedAt { get; protected set; }
/// <summary>
/// If the issue is locked or not
/// </summary>
public bool Locked { get; protected set; }
internal string DebuggerDisplay
{
get

View File

@@ -9,7 +9,7 @@ namespace Octokit
{
public IssueEvent() { }
public IssueEvent(int id, Uri url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt, Issue issue)
public IssueEvent(int id, Uri url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt, Issue issue, Uri commitUrl)
{
Id = id;
Url = url;
@@ -20,6 +20,7 @@ namespace Octokit
CommitId = commitId;
CreatedAt = createdAt;
Issue = issue;
CommitUrl = commitUrl;
}
/// <summary>
@@ -57,6 +58,11 @@ namespace Octokit
/// </summary>
public string CommitId { get; protected set; }
/// <summary>
/// The commit URL of a commit that referenced this issue.
/// </summary>
public Uri CommitUrl { get; protected set; }
/// <summary>
/// Date the event occurred for the issue/pull request.
/// </summary>

View File

@@ -75,8 +75,9 @@ var issues = await client.Issue.GetForRepository("octokit", "octokit.net", shoul
At a minimum, you need to specify the title:
```
var client = new GitHubClient(....); // More on GitHubClient can be found in "Getting Started"
var createIssue = new NewIssue("this thing doesn't work");
var issue = await _issuesClient.Create("octokit", "octokit.net", createIssue);
var issue = await client.Issue.Create("octokit", "octokit.net", createIssue);
```
`Create` returns a `Task<Issue>` which represents the created issue.

View File

@@ -1 +1,16 @@
# Working with Issue Labels
# Working with Issue Labels
Labels are appended using the method `NewIssue.Labels.Add(x)`.
Example:
var myNewIssue = new NewIssue("Issue with dropdown menu");
myNewIssue.Labels.Add("bug");
The default labels that come with every repository are:
- bug
- duplicate
- enhancement
- help wanted
- invalid
- question
- wontfix