-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new types for webhook commit payload (#1844)
Co-authored-by: Itai Bar-Haim <[email protected]>
- Loading branch information
Showing
3 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Octokit/Models/Response/ActivityPayloads/PushWebhookCommit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace Octokit | ||
{ | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class PushWebhookCommit | ||
{ | ||
public string Id { get; protected set; } | ||
|
||
public string TreeId { get; protected set; } | ||
|
||
public bool Distinct { get; protected set; } | ||
|
||
public string Message { get; protected set; } | ||
|
||
public DateTimeOffset Timestamp { get; protected set; } | ||
|
||
public Uri Url { get; protected set; } | ||
|
||
public Committer Author { get; protected set; } | ||
|
||
public Committer Committer { get; protected set; } | ||
|
||
public IReadOnlyList<string> Added { get; protected set; } | ||
|
||
public IReadOnlyList<string> Removed { get; protected set; } | ||
|
||
public IReadOnlyList<string> Modified { get; protected set; } | ||
|
||
internal string DebuggerDisplay | ||
{ | ||
get | ||
{ | ||
return string.Format(CultureInfo.InvariantCulture, "Sha: {0}", Id); | ||
} | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
Octokit/Models/Response/ActivityPayloads/PushWebhookCommitter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace Octokit | ||
{ | ||
/// <summary> | ||
/// Represents the author or committer to a Git commit. This is the information stored in Git and should not be | ||
/// confused with GitHub account information. | ||
/// </summary> | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class PushWebhookCommitter | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="PushWebhookCommitter"/> class. | ||
/// </summary> | ||
public PushWebhookCommitter() { } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="PushWebhookCommitter"/> class. | ||
/// </summary> | ||
/// <param name="name">The full name of the author or committer.</param> | ||
/// <param name="email">The email.</param> | ||
/// <param name="username">The username associated with the account.</param> | ||
public PushWebhookCommitter(string name, string email, string username) | ||
{ | ||
Name = name; | ||
Email = email; | ||
Username = username; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the name of the author or committer. | ||
/// </summary> | ||
/// <value> | ||
/// The name. | ||
/// </value> | ||
public string Name { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the email of the author or committer. | ||
/// </summary> | ||
/// <value> | ||
/// The email. | ||
/// </value> | ||
public string Email { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the GitHub username associated with the commit | ||
/// </summary> | ||
/// <value> | ||
/// The username. | ||
/// </value> | ||
public string Username { get; protected set; } | ||
|
||
internal string DebuggerDisplay | ||
{ | ||
get { return string.Format(CultureInfo.InvariantCulture, "Name: {0} Email: {1} Username: {2}", Name, Email, Username); } | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Octokit/Models/Response/ActivityPayloads/PushWebhookPayload.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
|
||
namespace Octokit | ||
{ | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class PushWebhookPayload : ActivityPayload | ||
{ | ||
public string Head { get; protected set; } | ||
public string Before { get; protected set; } | ||
public string After { get; protected set; } | ||
public string Ref { get; protected set; } | ||
public string BaseRef { get; protected set; } | ||
public bool Created { get; protected set; } | ||
public bool Deleted { get; protected set; } | ||
public bool Forced { get; protected set; } | ||
public string Compare { get; protected set; } | ||
public int Size { get; protected set; } | ||
public IReadOnlyList<PushWebhookCommit> Commits { get; protected set; } | ||
public PushWebhookCommit HeadCommit { get; protected set; } | ||
} | ||
} |