Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add GraphQL Node ID's to response models #1806

Merged
merged 22 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c65de95
add node_id to Deployments payloads (Deployment and DeploymentStatus …
ryangribble Jun 5, 2018
bee23f3
add node_id to gist responses
ryangribble Jun 5, 2018
79011f8
add node_id to Git Blob
ryangribble Jun 5, 2018
c70ba80
add node_id to Git Commit response
ryangribble Jun 5, 2018
da564f0
add node_id to GitReference response
ryangribble Jun 5, 2018
05bf5ff
add node_id to everything that inherits GitReference
ryangribble Jun 5, 2018
a1b7a31
add node_id to Issue
ryangribble Jun 8, 2018
73317c3
add node_id to IssueComment/IssueEvent
ryangribble Jun 9, 2018
d799ffb
add node_id to Label
ryangribble Jun 9, 2018
9827a47
add node_id to Milestone
ryangribble Jun 9, 2018
1db226d
add node_id to Project/ProjectCard/ProjectColumn
ryangribble Jun 9, 2018
29ebaf5
add node_id to Reaction
ryangribble Jun 9, 2018
3787dbf
add node_id to Release/ReleaseAsset
ryangribble Jun 9, 2018
870c341
add node_id to Team
ryangribble Jun 9, 2018
59c770b
add node_id to Repository.RepositoryContributor/RepositoryInvitation/…
ryangribble Jun 11, 2018
9171625
add node_id to Commit related responses
ryangribble Jun 11, 2018
3a89871
Add node_id to PullRequest related responses
ryangribble Jun 11, 2018
9ceb398
Add node_id to any response models it was found to be missing, based …
ryangribble Jun 11, 2018
d87ab0e
remove unused test variable that was using a response ctor
ryangribble Jun 11, 2018
d091bbb
fix tests that need to handle node_id now
ryangribble Jun 12, 2018
67fc133
Committer is a request object as well as response, so make nodeId opt…
ryangribble Jun 25, 2018
423c201
fix test
ryangribble Jun 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Octokit.Tests/Models/MigrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,6 @@ public class MigrationTests
]
}";

private static readonly Migration migration = new Migration(
id: 79,
guid: "0b989ba4-242f-11e5-81e1-c7b6966d2516",
state: Migration.MigrationState.Exported,
lockRepositories: true,
excludeAttachments: false,
url: "https://api.github.com/orgs/octo-org/migrations/79",
createdAt: "2015-07-06T15:33:38-07:00",
updatedAt: "2015-07-06T15:33:38-07:00",
repositories: new List<Repository>
{
new Repository(1296269)
});

[Fact]
public void CanBeDeserialized()
{
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ public class TheCommitsMethod
[Fact]
public async Task FetchesAllCommitsForPullRequest()
{
var commit = new PullRequestCommit(null, null, null, null, null, Enumerable.Empty<GitReference>(), null, null);
var commit = new PullRequestCommit("123ABC", null, null, null, null, null, Enumerable.Empty<GitReference>(), null, null);
var expectedUrl = "repos/fake/repo/pulls/42/commits";
var gitHubClient = Substitute.For<IGitHubClient>();
var connection = Substitute.For<IConnection>();
Expand All @@ -653,7 +653,7 @@ public async Task FetchesAllCommitsForPullRequest()
[Fact]
public async Task FetchesAllCommitsForPullRequestWithRepositoryId()
{
var commit = new PullRequestCommit(null, null, null, null, null, Enumerable.Empty<GitReference>(), null, null);
var commit = new PullRequestCommit("123ABC", null, null, null, null, null, Enumerable.Empty<GitReference>(), null, null);
var expectedUrl = "repositories/1/pulls/42/commits";
var gitHubClient = Substitute.For<IGitHubClient>();
var connection = Substitute.For<IConnection>();
Expand Down
20 changes: 20 additions & 0 deletions Octokit/Models/Common/Committer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ public Committer(string name, string email, DateTimeOffset date)
Date = date;
}

/// <summary>
/// Initializes a new instance of the <see cref="Committer"/> class.
/// </summary>
/// <param name="nodeId">The GraphQL Node Id</param>
/// <param name="name">The full name of the author or committer.</param>
/// <param name="email">The email.</param>
/// <param name="date">The date.</param>
public Committer(string nodeId, string name, string email, DateTimeOffset date)
{
NodeId = nodeId;
Name = name;
Email = email;
Date = date;
}

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// Gets the name of the author or committer.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public abstract class Account
{
protected Account() { }

protected Account(string avatarUrl, string bio, string blog, int collaborators, string company, DateTimeOffset createdAt, int diskUsage, string email, int followers, int following, bool? hireable, string htmlUrl, int totalPrivateRepos, int id, string location, string login, string name, int ownedPrivateRepos, Plan plan, int privateGists, int publicGists, int publicRepos, AccountType type, string url)
protected Account(string avatarUrl, string bio, string blog, int collaborators, string company, DateTimeOffset createdAt, int diskUsage, string email, int followers, int following, bool? hireable, string htmlUrl, int totalPrivateRepos, int id, string location, string login, string name, string nodeId, int ownedPrivateRepos, Plan plan, int privateGists, int publicGists, int publicRepos, AccountType type, string url)
{
AvatarUrl = avatarUrl;
Bio = bio;
Expand All @@ -28,6 +28,7 @@ protected Account(string avatarUrl, string bio, string blog, int collaborators,
Location = location;
Login = login;
Name = name;
NodeId = nodeId;
OwnedPrivateRepos = ownedPrivateRepos;
Plan = plan;
PrivateGists = privateGists;
Expand Down Expand Up @@ -103,6 +104,11 @@ protected Account(string avatarUrl, string bio, string blog, int collaborators,
/// </summary>
public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The account's geographic location.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/Author.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ public class Author
{
public Author() { }

public Author(string login, int id, string avatarUrl, string url, string htmlUrl, string followersUrl, string followingUrl, string gistsUrl, string type, string starredUrl, string subscriptionsUrl, string organizationsUrl, string reposUrl, string eventsUrl, string receivedEventsUrl, bool siteAdmin)
public Author(string login, int id, string nodeId, string avatarUrl, string url, string htmlUrl, string followersUrl, string followingUrl, string gistsUrl, string type, string starredUrl, string subscriptionsUrl, string organizationsUrl, string reposUrl, string eventsUrl, string receivedEventsUrl, bool siteAdmin)
{
Login = login;
Id = id;
NodeId = nodeId;
AvatarUrl = avatarUrl;
Url = url;
HtmlUrl = htmlUrl;
Expand All @@ -33,6 +34,11 @@ public Author(string login, int id, string avatarUrl, string url, string htmlUrl

public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

public string AvatarUrl { get; protected set; }

public string Url { get; protected set; }
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ public class Blob
{
public Blob() { }

public Blob(string content, EncodingType encoding, string sha, int size)
public Blob(string nodeId, string content, EncodingType encoding, string sha, int size)
{
NodeId = nodeId;
Content = content;
Encoding = encoding;
Sha = sha;
Size = size;
}

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The content of the blob.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Octokit/Models/Response/Commit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class Commit : GitReference
{
public Commit() { }

public Commit(string url, string label, string @ref, string sha, User user, Repository repository, string message, Committer author, Committer committer, GitReference tree, IEnumerable<GitReference> parents, int commentCount, Verification verification)
: base(url, label, @ref, sha, user, repository)
public Commit(string nodeId, string url, string label, string @ref, string sha, User user, Repository repository, string message, Committer author, Committer committer, GitReference tree, IEnumerable<GitReference> parents, int commentCount, Verification verification)
: base(nodeId, url, label, @ref, sha, user, repository)
{
Ensure.ArgumentNotNull(parents, nameof(parents));

Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/CommitComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public class CommitComment
{
public CommitComment() { }

public CommitComment(int id, string url, string htmlUrl, string body, string path, int position, int? line, string commitId, User user, DateTimeOffset createdAt, DateTimeOffset? updatedAt, ReactionSummary reactions)
public CommitComment(int id, string nodeId, string url, string htmlUrl, string body, string path, int position, int? line, string commitId, User user, DateTimeOffset createdAt, DateTimeOffset? updatedAt, ReactionSummary reactions)
{
Id = id;
NodeId = nodeId;
Url = url;
HtmlUrl = htmlUrl;
Body = body;
Expand All @@ -30,6 +31,11 @@ public CommitComment(int id, string url, string htmlUrl, string body, string pat
/// </summary>
public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The URL for this repository comment.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/CommitStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class CommitStatus
{
public CommitStatus() { }

public CommitStatus(DateTimeOffset createdAt, DateTimeOffset updatedAt, CommitState state, string targetUrl, string description, string context, long id, string url, User creator)
public CommitStatus(DateTimeOffset createdAt, DateTimeOffset updatedAt, CommitState state, string targetUrl, string description, string context, long id, string nodeId, string url, User creator)
{
CreatedAt = createdAt;
UpdatedAt = updatedAt;
Expand All @@ -19,6 +19,7 @@ public CommitStatus(DateTimeOffset createdAt, DateTimeOffset updatedAt, CommitSt
Description = description;
Context = context;
Id = id;
NodeId = nodeId;
Url = url;
Creator = creator;
}
Expand Down Expand Up @@ -59,6 +60,11 @@ public CommitStatus(DateTimeOffset createdAt, DateTimeOffset updatedAt, CommitSt
/// </summary>
public long Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The URL of the status.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/Deployment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ public class Deployment
{
public Deployment() { }

public Deployment(int id, string sha, string url, User creator, IReadOnlyDictionary<string, string> payload, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description, string statusesUrl, bool transientEnvironment, bool productionEnvironment)
public Deployment(int id, string nodeId, string sha, string url, User creator, IReadOnlyDictionary<string, string> payload, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description, string statusesUrl, bool transientEnvironment, bool productionEnvironment)
{
Id = id;
NodeId = nodeId;
Sha = sha;
Url = url;
Creator = creator;
Expand All @@ -33,6 +34,11 @@ public Deployment(int id, string sha, string url, User creator, IReadOnlyDiction
/// </summary>
public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
///
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/DeploymentStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public class DeploymentStatus
{
public DeploymentStatus() { }

public DeploymentStatus(int id, string url, DeploymentState state, User creator, IReadOnlyDictionary<string, string> payload, string targetUrl, string logUrl, string environmentUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description)
public DeploymentStatus(int id, string nodeId, string url, DeploymentState state, User creator, IReadOnlyDictionary<string, string> payload, string targetUrl, string logUrl, string environmentUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description)
{
Id = id;
NodeId = nodeId;
Url = url;
State = state;
Creator = creator;
Expand All @@ -31,6 +32,11 @@ public DeploymentStatus(int id, string url, DeploymentState state, User creator,
/// </summary>
public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The API URL for this deployment status.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/EventInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public class EventInfo
{
public EventInfo() { }

public EventInfo(int id, string url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt)
public EventInfo(int id, string nodeId, string url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt)
{
Id = id;
NodeId = nodeId;
Url = url;
Actor = actor;
Assignee = assignee;
Expand All @@ -28,6 +29,11 @@ public EventInfo(int id, string url, User actor, User assignee, Label label, Eve
/// </summary>
public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The URL for this event.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/Gist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ public class Gist
{
public Gist() { }

public Gist(string url, string id, string description, bool @public, User owner, IReadOnlyDictionary<string, GistFile> files, int comments, string commentsUrl, string htmlUrl, string gitPullUrl, string gitPushUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, IReadOnlyList<GistFork> forks, IReadOnlyList<GistHistory> history)
public Gist(string url, string id, string nodeId, string description, bool @public, User owner, IReadOnlyDictionary<string, GistFile> files, int comments, string commentsUrl, string htmlUrl, string gitPullUrl, string gitPushUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, IReadOnlyList<GistFork> forks, IReadOnlyList<GistHistory> history)
{
Url = url;
Id = id;
NodeId = nodeId;
Description = description;
Public = @public;
Owner = owner;
Expand Down Expand Up @@ -42,6 +43,11 @@ public Gist(string url, string id, string description, bool @public, User owner,
/// </remarks>
public string Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// A description of the <see cref="Gist"/>.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/GistComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public class GistComment
{
public GistComment() { }

public GistComment(int id, string url, string body, User user, DateTimeOffset createdAt, DateTimeOffset? updatedAt)
public GistComment(int id, string nodeId, string url, string body, User user, DateTimeOffset createdAt, DateTimeOffset? updatedAt)
{
Id = id;
NodeId = nodeId;
Url = url;
Body = body;
User = user;
Expand All @@ -24,6 +25,11 @@ public GistComment(int id, string url, string body, User user, DateTimeOffset cr
/// </summary>
public int Id { get; protected set; }

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The URL for this gist comment.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/GistFork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ public class GistFork
{
public GistFork() { }

public GistFork(User user, string url, DateTimeOffset createdAt)
public GistFork(string nodeId, User user, string url, DateTimeOffset createdAt)
{
NodeId = nodeId;
User = user;
Url = url;
CreatedAt = createdAt;
}

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The <see cref="User"/> that created this <see cref="GistFork"/>
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Octokit/Models/Response/GitHubCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class GitHubCommit : GitReference
{
public GitHubCommit() { }

public GitHubCommit(string url, string label, string @ref, string sha, User user, Repository repository, Author author, string commentsUrl, Commit commit, Author committer, string htmlUrl, GitHubCommitStats stats, IReadOnlyList<GitReference> parents, IReadOnlyList<GitHubCommitFile> files)
: base(url, label, @ref, sha, user, repository)
public GitHubCommit(string nodeId, string url, string label, string @ref, string sha, User user, Repository repository, Author author, string commentsUrl, Commit commit, Author committer, string htmlUrl, GitHubCommitStats stats, IReadOnlyList<GitReference> parents, IReadOnlyList<GitHubCommitFile> files)
: base(nodeId, url, label, @ref, sha, user, repository)
{
Author = author;
CommentsUrl = commentsUrl;
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/GitReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ public class GitReference
{
public GitReference() { }

public GitReference(string url, string label, string @ref, string sha, User user, Repository repository)
public GitReference(string nodeId, string url, string label, string @ref, string sha, User user, Repository repository)
{
NodeId = nodeId;
Url = url;
Label = label;
Ref = @ref;
Expand All @@ -19,6 +20,11 @@ public GitReference(string url, string label, string @ref, string sha, User user
Repository = repository;
}

/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; protected set; }

/// <summary>
/// The URL associated with this reference.
/// </summary>
Expand Down
Loading