mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 20:30:41 +00:00
Merge remote-tracking branch 'upstream/master' into dotnetcore
# Conflicts: # .travis.yml # Octokit.sln # appveyor.yml
This commit is contained in:
@@ -26,24 +26,15 @@ namespace Octokit.Tests.Integration.Clients
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssue()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
Assert.Empty(timelineEventInfos);
|
||||
|
||||
var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate() { State = ItemState.Closed });
|
||||
Assert.NotNull(closed);
|
||||
|
||||
timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event);
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(0, timelineEventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssueWithApiOptions()
|
||||
{
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1115);
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(1, timelineEventInfos.Count);
|
||||
|
||||
@@ -54,11 +45,47 @@ namespace Octokit.Tests.Integration.Clients
|
||||
StartPage = 1
|
||||
};
|
||||
|
||||
timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1115, pageOptions);
|
||||
timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForRecentIssues()
|
||||
{
|
||||
// Make sure we can deserialize the event timeline for recent closed PRs and open Issues in a heavy activity repository (microsoft/vscode)
|
||||
|
||||
// Search request
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var search = new SearchIssuesRequest
|
||||
{
|
||||
PerPage = 20,
|
||||
Page = 1
|
||||
};
|
||||
search.Repos.Add("microsoft", "vscode");
|
||||
|
||||
// 20 most recent closed PRs
|
||||
search.Type = IssueTypeQualifier.PullRequest;
|
||||
search.State = ItemState.Closed;
|
||||
var pullRequestResults = await github.Search.SearchIssues(search);
|
||||
foreach (var pullRequest in pullRequestResults.Items)
|
||||
{
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("microsoft", "vscode", pullRequest.Number);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
}
|
||||
|
||||
// 20 most recent open Issues
|
||||
search.Type = IssueTypeQualifier.Issue;
|
||||
search.State = ItemState.Open;
|
||||
var issueResults = await github.Search.SearchIssues(search);
|
||||
foreach (var issue in issueResults.Items)
|
||||
{
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("microsoft", "vscode", issue.Number);
|
||||
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
}
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanDeserializeRenameEvent()
|
||||
{
|
||||
|
||||
@@ -340,7 +340,7 @@ public class RepositoriesClientTests
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
|
||||
var update = new RepositoryUpdate { Name = updatedName };
|
||||
var update = new RepositoryUpdate(updatedName);
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -354,7 +354,7 @@ public class RepositoriesClientTests
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
|
||||
var update = new RepositoryUpdate { Name = updatedName };
|
||||
var update = new RepositoryUpdate(updatedName);
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
@@ -367,7 +367,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, Description = "Updated description" };
|
||||
var update = new RepositoryUpdate(repoName) { Description = "Updated description" };
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -380,7 +380,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, Description = "Updated description" };
|
||||
var update = new RepositoryUpdate(repoName) { Description = "Updated description" };
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
@@ -393,7 +393,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, Homepage = "http://aUrl.to/nowhere" };
|
||||
var update = new RepositoryUpdate(repoName) { Homepage = "http://aUrl.to/nowhere" };
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -406,7 +406,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, Homepage = "http://aUrl.to/nowhere" };
|
||||
var update = new RepositoryUpdate(repoName) { Homepage = "http://aUrl.to/nowhere" };
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
@@ -426,7 +426,7 @@ public class RepositoriesClientTests
|
||||
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, Private = true };
|
||||
var update = new RepositoryUpdate(repoName) { Private = true };
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -446,7 +446,7 @@ public class RepositoriesClientTests
|
||||
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, Private = true };
|
||||
var update = new RepositoryUpdate(repoName) { Private = true };
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
@@ -459,7 +459,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, HasDownloads = false };
|
||||
var update = new RepositoryUpdate(repoName) { HasDownloads = false };
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -472,7 +472,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, HasDownloads = false };
|
||||
var update = new RepositoryUpdate(repoName) { HasDownloads = false };
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
@@ -485,7 +485,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, HasIssues = false };
|
||||
var update = new RepositoryUpdate(repoName) { HasIssues = false };
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -498,7 +498,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, HasIssues = false };
|
||||
var update = new RepositoryUpdate(repoName) { HasIssues = false };
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
@@ -511,7 +511,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, HasWiki = false };
|
||||
var update = new RepositoryUpdate(repoName) { HasWiki = false };
|
||||
|
||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||
|
||||
@@ -524,7 +524,7 @@ public class RepositoriesClientTests
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
var update = new RepositoryUpdate { Name = repoName, HasWiki = false };
|
||||
var update = new RepositoryUpdate(repoName) { HasWiki = false };
|
||||
|
||||
_repository = await github.Repository.Edit(_repository.Id, update);
|
||||
|
||||
|
||||
@@ -24,28 +24,16 @@ namespace Octokit.Tests.Integration.Reactive
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssue()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var observable = _client.Issue.Create(_context.Repository.Id, newIssue);
|
||||
var issue = await observable;
|
||||
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
var timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.Empty(timelineEventInfos);
|
||||
|
||||
observable = _client.Issue.Update(_context.Repository.Id, issue.Number, new IssueUpdate { State = ItemState.Closed });
|
||||
var closed = await observable;
|
||||
Assert.NotNull(closed);
|
||||
|
||||
observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(0, timelineEventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssueWithApiOptions()
|
||||
{
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1115);
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
var timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(1, timelineEventInfos.Count);
|
||||
@@ -56,7 +44,7 @@ namespace Octokit.Tests.Integration.Reactive
|
||||
PageCount = 1,
|
||||
StartPage = 1
|
||||
};
|
||||
observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1115, pageOptions);
|
||||
observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions);
|
||||
timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
|
||||
@@ -227,6 +227,30 @@ namespace Octokit.Tests.Clients
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Add("owner", "test", ""));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Add(1, ""));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SurfacesAuthorizationException()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepoCollaboratorsClient(connection);
|
||||
|
||||
connection.Put(Arg.Any<Uri>()).Returns(x => { throw new AuthorizationException(); });
|
||||
|
||||
await Assert.ThrowsAsync<AuthorizationException>(() => client.Add("owner", "test", "user1"));
|
||||
await Assert.ThrowsAsync<AuthorizationException>(() => client.Add(1, "user1"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SurfacesAuthorizationExceptionWhenSpecifyingCollaboratorRequest()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepoCollaboratorsClient(connection);
|
||||
|
||||
connection.Connection.Put<object>(Arg.Any<Uri>(), Arg.Any<object>()).ThrowsAsync(new AuthorizationException());
|
||||
|
||||
await Assert.ThrowsAsync<AuthorizationException>(() => client.Add("owner", "test", "user1", new CollaboratorRequest(Permission.Pull)));
|
||||
await Assert.ThrowsAsync<AuthorizationException>(() => client.Add(1, "user1", new CollaboratorRequest(Permission.Pull)));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheInviteMethod
|
||||
|
||||
@@ -1040,7 +1040,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
||||
var update = new RepositoryUpdate();
|
||||
var update = new RepositoryUpdate("anyreponame");
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit(null, "repo", update));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit("owner", null, update));
|
||||
|
||||
@@ -21,9 +21,8 @@ namespace Octokit.Tests.Models
|
||||
"\"has_wiki\":true," +
|
||||
"\"has_downloads\":true}";
|
||||
|
||||
var update = new RepositoryUpdate
|
||||
var update = new RepositoryUpdate("Hello-World")
|
||||
{
|
||||
Name = "Hello-World",
|
||||
Description = "This is your first repository",
|
||||
Homepage = "https://github.com",
|
||||
Private = true,
|
||||
|
||||
@@ -888,7 +888,7 @@ namespace Octokit.Tests.Reactive
|
||||
{
|
||||
var github = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(github);
|
||||
var update = new RepositoryUpdate();
|
||||
var update = new RepositoryUpdate("anyreponame");
|
||||
|
||||
client.Edit("owner", "repo", update);
|
||||
|
||||
@@ -900,7 +900,7 @@ namespace Octokit.Tests.Reactive
|
||||
{
|
||||
var github = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(github);
|
||||
var update = new RepositoryUpdate();
|
||||
var update = new RepositoryUpdate("anyreponame");
|
||||
|
||||
client.Edit(1, update);
|
||||
|
||||
@@ -911,7 +911,7 @@ namespace Octokit.Tests.Reactive
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
|
||||
var update = new RepositoryUpdate();
|
||||
var update = new RepositoryUpdate("anyreponame");
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", update));
|
||||
Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, update));
|
||||
|
||||
@@ -173,11 +173,11 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, "user");
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
var response = await Connection.Put<object>(ApiUrls.RepoCollaborator(owner, name, user), permission).ConfigureAwait(false);
|
||||
return response.HttpResponse.IsTrue();
|
||||
}
|
||||
catch
|
||||
catch (NotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace Octokit
|
||||
var response = await Connection.Put<object>(ApiUrls.RepoCollaborator(repositoryId, user), permission).ConfigureAwait(false);
|
||||
return response.HttpResponse.IsTrue();
|
||||
}
|
||||
catch
|
||||
catch (NotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,19 +72,19 @@ namespace Octokit
|
||||
Justification = "Ruby don't care. Ruby don't play that.")]
|
||||
public static string ToRubyCase(this string propertyName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(propertyName, "s");
|
||||
Ensure.ArgumentNotNullOrEmptyString(propertyName, "propertyName");
|
||||
return string.Join("_", propertyName.SplitUpperCase()).ToLowerInvariant();
|
||||
}
|
||||
|
||||
public static string FromRubyCase(this string propertyName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(propertyName, "s");
|
||||
Ensure.ArgumentNotNullOrEmptyString(propertyName, "propertyName");
|
||||
return string.Join("", propertyName.Split('_')).ToCapitalizedInvariant();
|
||||
}
|
||||
|
||||
public static string ToCapitalizedInvariant(this string value)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(value, "s");
|
||||
Ensure.ArgumentNotNullOrEmptyString(value, "value");
|
||||
return string.Concat(value[0].ToString().ToUpperInvariant(), value.Substring(1));
|
||||
}
|
||||
static IEnumerable<string> SplitUpperCase(this string source)
|
||||
|
||||
@@ -12,10 +12,6 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class RepositoryUpdate
|
||||
{
|
||||
[Obsolete("Please use the ctor RepositoryUpdate(string name) as Name is a required field")]
|
||||
public RepositoryUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an object that describes an update to a repository on GitHub.
|
||||
|
||||
@@ -204,6 +204,21 @@ namespace Octokit
|
||||
/// url of the reference's source.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Crossreferenced")]
|
||||
Crossreferenced
|
||||
Crossreferenced,
|
||||
|
||||
/// <summary>
|
||||
/// The issue was reveiewed.
|
||||
/// </summary>
|
||||
Reviewed,
|
||||
|
||||
/// <summary>
|
||||
/// A line comment was made.
|
||||
/// </summary>
|
||||
LineCommented,
|
||||
|
||||
/// <summary>
|
||||
/// A commit comment was made.
|
||||
/// </summary>
|
||||
CommitCommented
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Octokit
|
||||
Number = number;
|
||||
}
|
||||
|
||||
public PullRequest(long id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList<User> assignees, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked)
|
||||
public PullRequest(long id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList<User> assignees, bool? mergeable, User mergedBy, string mergeCommitSha, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked)
|
||||
{
|
||||
Id = id;
|
||||
Url = url;
|
||||
@@ -39,6 +39,7 @@ namespace Octokit
|
||||
Assignees = assignees;
|
||||
Mergeable = mergeable;
|
||||
MergedBy = mergedBy;
|
||||
MergeCommitSha = mergeCommitSha;
|
||||
Comments = comments;
|
||||
Commits = commits;
|
||||
Additions = additions;
|
||||
@@ -171,6 +172,15 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public User MergedBy { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of this field changes depending on the state of the pull request.
|
||||
/// Not Merged - the hash of the test commit used to determine mergability.
|
||||
/// Merged with merge commit - the hash of said merge commit.
|
||||
/// Merged via squashing - the hash of the squashed commit added to the base branch.
|
||||
/// Merged via rebase - the hash of the commit that the base branch was updated to.
|
||||
/// </summary>
|
||||
public string MergeCommitSha { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total number of comments contained in the pull request.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using Octokit.Helpers;
|
||||
using Octokit.Internal;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
@@ -40,21 +38,14 @@ namespace Octokit
|
||||
public RepositoryTrafficClone() { }
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "It's a property from the api.")]
|
||||
public RepositoryTrafficClone(long timestamp, int count, int uniques)
|
||||
public RepositoryTrafficClone(DateTimeOffset timestamp, int count, int uniques)
|
||||
{
|
||||
TimestampAsUtcEpochSeconds = timestamp;
|
||||
Timestamp = timestamp;
|
||||
Count = count;
|
||||
Uniques = uniques;
|
||||
}
|
||||
|
||||
[Parameter(Key = "ignoreThisField")]
|
||||
public DateTimeOffset Timestamp
|
||||
{
|
||||
get { return TimestampAsUtcEpochSeconds.FromUnixTime(); }
|
||||
}
|
||||
|
||||
[Parameter(Key = "timestamp")]
|
||||
public long TimestampAsUtcEpochSeconds { get; protected set; }
|
||||
public DateTimeOffset Timestamp { get; protected set; }
|
||||
|
||||
public int Count { get; protected set; }
|
||||
|
||||
|
||||
@@ -40,21 +40,14 @@ namespace Octokit
|
||||
public RepositoryTrafficView() { }
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "It's a property from the api.")]
|
||||
public RepositoryTrafficView(long timestamp, int count, int uniques)
|
||||
public RepositoryTrafficView(DateTimeOffset timestamp, int count, int uniques)
|
||||
{
|
||||
TimestampAsUtcEpochSeconds = timestamp;
|
||||
Timestamp = timestamp;
|
||||
Count = count;
|
||||
Uniques = uniques;
|
||||
}
|
||||
|
||||
[Parameter(Key = "ignoreThisField")]
|
||||
public DateTimeOffset Timestamp
|
||||
{
|
||||
get { return TimestampAsUtcEpochSeconds.FromUnixTime(); }
|
||||
}
|
||||
|
||||
[Parameter(Key = "timestamp")]
|
||||
public long TimestampAsUtcEpochSeconds { get; protected set; }
|
||||
public DateTimeOffset Timestamp { get; protected set; }
|
||||
|
||||
public int Count { get; protected set; }
|
||||
|
||||
|
||||
+6
-6
@@ -5,7 +5,7 @@
|
||||
To retrieve all releases for a repository:
|
||||
|
||||
```
|
||||
var releases = client.Release.GetAll("octokit", "octokit.net");
|
||||
var releases = client.Repository.Release.GetAll("octokit", "octokit.net");
|
||||
var latest = releases[0];
|
||||
Console.WriteLine(
|
||||
"The latest release is tagged at {0} and is named {1}",
|
||||
@@ -24,7 +24,7 @@ newRelease.Body = "**This** is some *Markdown*";
|
||||
newRelease.Draft = true;
|
||||
newRelease.Prerelease = false;
|
||||
|
||||
var result = await client.Release.Create("octokit", "octokit.net", newRelease);
|
||||
var result = await client.Repository.Release.Create("octokit", "octokit.net", newRelease);
|
||||
Console.WriteLine("Created release id {0}", release.Id);
|
||||
```
|
||||
|
||||
@@ -35,12 +35,12 @@ Note that the `Draft` flag is used to indicate when a release should be publishe
|
||||
Once the release is ready for the public, you can apply an update to the release:
|
||||
|
||||
```
|
||||
var release = client.Release.Get("octokit", "octokit.net", 1);
|
||||
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
|
||||
var updateRelease = release.ToUpdate();
|
||||
updateRelease.Draft = false;
|
||||
updateRelease.Name = "Version 1.0";
|
||||
updateRelease.TargetCommitish = "0edef870ecd885cc6506f1e3f08341e8b87370f2" // can also be a ref
|
||||
var result = await client.Release.Edit("octokit", "octokit.net", 1, updateRelease);
|
||||
var result = await client.Repository.Release.Edit("octokit", "octokit.net", 1, updateRelease);
|
||||
```
|
||||
|
||||
### Upload Assets
|
||||
@@ -55,8 +55,8 @@ var assetUpload = new ReleaseAssetUpload()
|
||||
ContentType = "application/zip",
|
||||
RawData = archiveContents
|
||||
};
|
||||
var release = client.Release.Get("octokit", "octokit.net", 1);
|
||||
var asset = await client.Release.UploadAsset(release, assetUpload);
|
||||
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
|
||||
var asset = await client.Repository.Release.UploadAsset(release, assetUpload);
|
||||
```
|
||||
|
||||
**TODO:** are there any known limits documented to upload assets?
|
||||
|
||||
Reference in New Issue
Block a user